Skip to contentSkip to conversation

pwm: Set class for exported channels in sysfs

PATCH Superseded Gottfried Haider 1 participant 2 messages May 1, 2017 – May 15, 2017 PWM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pwm: Set class for exported channels in sysfs

Notifications for devices without bus or class set get dropped by dev_uevent_filter. Adding the class to the exported child matches what the gpio subsystem is doing.

With this change exporting a channel triggers a udev event, which gives userspace a chance to fixup permissions and makes it possible for non-root users to make use of the pwm subsystem.

---
 drivers/pwm/sysfs.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pwm/sysfs.c +1 -0
index a813239..83f2b0b 100644
@@ -263,6 +263,7 @@ static int pwm_export_child(struct device *parent, struct pwm_device *pwm)
 	export->pwm = pwm;
 	mutex_init(&export->lock);
 
+	export->child.class = parent->class;
 	export->child.release = pwm_export_release;
 	export->child.parent = parent;
 	export->child.devt = MKDEV(0, 0);
Signature · 1 line
2.1.4
#1 lore raw

Does anyone have time to review this patch?

I wrote this with the Raspberry Pi in mind, but they want to see this at least acknowledged by upstream before carrying in their downstream tree (which seems quite sensible to me).

Thanks in advance,
Gottfried