mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Aurelio Colosimo <aurelio.colosimo@gmail.com>
To: Thierry Reding <thierry.reding@gmail.com>,
	Randy Dunlap <rdunlap@infradead.org>
Cc: linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-doc@vger.kernel.org,
	Aurelio Colosimo <aurelio@aureliocolosimo.it>
Subject: [PATCH 1/2] pwm: new field name added to pwm_device
Date: Tue,  5 Aug 2014 17:12:17 +0200	[thread overview]
Message-ID: <1407251538-17566-2-git-send-email-aurelio@aureliocolosimo.it> (raw)
In-Reply-To: <1407251538-17566-1-git-send-email-aurelio@aureliocolosimo.it>

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(-)

diff --git a/drivers/pwm/sysfs.c b/drivers/pwm/sysfs.c
index 4bd0c63..c1d6064 100644
--- a/drivers/pwm/sysfs.c
+++ b/drivers/pwm/sysfs.c
@@ -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) {
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index e90628c..9bacf35 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -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 */
-- 
1.9.1


  reply	other threads:[~2014-08-05 15:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-05 15:12 [PATCH 0/2] pwm: some improvements to sysfs interface Aurelio Colosimo
2014-08-05 15:12 ` Aurelio Colosimo [this message]
2014-08-05 15:12 ` [PATCH 2/2] pwm: new fields, max and resolution, added to sysfs Aurelio Colosimo

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=1407251538-17566-2-git-send-email-aurelio@aureliocolosimo.it \
    --to=aurelio.colosimo@gmail.com \
    --cc=aurelio@aureliocolosimo.it \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=rdunlap@infradead.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

all inboxes | Powered by JetHome®