From: Gottfried Haider <gottfried.haider@gmail.com>
To: Gottfried Haider <gottfried.haider@gmail.com>,
Thierry Reding <thierry.reding@gmail.com>
Cc: hsweeten@visionengravers.com, linux-pwm@vger.kernel.org
Subject: [PATCH] pwm: Set class for exported channels in sysfs
Date: Mon, 1 May 2017 06:59:58 +0000 [thread overview]
Message-ID: <1493621998-4982-1-git-send-email-gottfried.haider@gmail.com> (raw)
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.
Signed-off-by: Gottfried Haider <gottfried.haider@gmail.com>
---
drivers/pwm/sysfs.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/pwm/sysfs.c b/drivers/pwm/sysfs.c
index a813239..83f2b0b 100644
--- a/drivers/pwm/sysfs.c
+++ b/drivers/pwm/sysfs.c
@@ -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);
--
2.1.4
next reply other threads:[~2017-05-01 7:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-01 6:59 Gottfried Haider [this message]
2017-05-15 11:07 ` [PATCH] pwm: Set class for exported channels in sysfs Gottfried Haider
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1493621998-4982-1-git-send-email-gottfried.haider@gmail.com \
--to=gottfried.haider@gmail.com \
--cc=hsweeten@visionengravers.com \
--cc=linux-pwm@vger.kernel.org \
--cc=thierry.reding@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).