lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue,  5 Aug 2014 17:12:17 +0200
From:	Aurelio Colosimo <aurelio.colosimo@...il.com>
To:	Thierry Reding <thierry.reding@...il.com>,
	Randy Dunlap <rdunlap@...radead.org>
Cc:	linux-pwm@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-doc@...r.kernel.org,
	Aurelio Colosimo <aurelio@...eliocolosimo.it>
Subject: [PATCH 1/2] pwm: new field name added to pwm_device

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@...eliocolosimo.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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ