@@ -198,7 +198,12 @@ static int pwm_export_child(struct device *parent, struct pwm_device *pwm)
export->child.parent = parent;
export->child.devt = MKDEV(0, 0);
export->child.groups = pwm_groups;
- dev_set_name(&export->child, "pwm%u", pwm->hwpwm);
+
+ if (pwm->name)
+ dev_set_name(&export->child, pwm->name, pwm->hwpwm);
+ else
+ dev_set_name(&export->child, "pwm%u", pwm->hwpwm);
+
ret = device_register(&export->child);
if (ret) {
@@ -86,6 +86,7 @@ struct pwm_device {
unsigned int pwm;
struct pwm_chip *chip;
void *chip_data;
+ const char *name; /* optional static name for pwm device */
unsigned int period; /* in nanoseconds */
unsigned int duty_cycle; /* in nanoseconds */
Since label is used dinamically, I added one more optional field, which statically defines the name of a pwm output, in a similar way as gpio framework does. Signed-off-by: Aurelio Colosimo <aurelio@aureliocolosimo.it> --- drivers/pwm/sysfs.c | 7 ++++++- include/linux/pwm.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-)