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] [day] [month] [year] [list]
Message-ID: <ADE657CA350FB648AAC2C43247A983F0021DA67E418A@AUSP01VMBX24.collaborationhost.net>
Date:	Thu, 30 May 2013 16:20:53 -0500
From:	H Hartley Sweeten <hartleys@...ionengravers.com>
To:	Linux Kernel <linux-kernel@...r.kernel.org>
CC:	"linux-pwm@...r.kernel.org" <linux-pwm@...r.kernel.org>,
	"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
	"thierry.reding@...il.com" <thierry.reding@...il.com>,
	"poeschel@...onage.de" <poeschel@...onage.de>,
	"Ryan Mallon (rmallon@...il.com)" <rmallon@...il.com>,
	"rob@...dley.net" <rob@...dley.net>
Subject: RE: [PATCH v2] pwm: add sysfs interface

On Thursday, May 30, 2013 12:30 PM, H Hartley Sweeten wrote:
> Add a simple sysfs interface to the generic PWM framework.
>
>   /sys/class/pwm/
>   `-- pwmchipN/          for each PWM chip
>       |-- export         (w/o) ask the kernel to export a PWM channel
>       |-- npwn           (r/o) number of PWM channels in this PWM chip
>       |-- pwmX/          for each exported PWM channel (per PWM chip)
>       |   |-- duty_ns    (r/w) duty cycle (in nanoseconds)
>       |   |-- enable     (r/w) enable/disable PWM
>       |   |-- period_ns  (r/w) period (in nanoseconds)
>       |   `-- polarity   (r/w) polarity of PWM
>       `-- unexport       (w/o) return a PWM channel to the kernel
>
> Signed-off-by: H Hartley Sweeten <hsweeten@...ionengravers.com>
> Cc: Thierry Reding <thierry.reding@...il.com>
> Cc: Lars Poeschel <poeschel@...onage.de>
> Cc: Ryan Mallon <rmallon@...i.com>
> Cc: Rob Landley <rob@...dley.net>
> ---
> v2: * add API documentation and update Documentation/pwm.txt
>     * fix some issues pointed out by Ryan Mallon
>     * add the pwm attributes to dev.groups so they are created
>       when the device is registered for the exported PWM.
>
>  Documentation/ABI/testing/sysfs-class-pwm |  80 +++++++
>  Documentation/pwm.txt                     |  39 ++++
>  drivers/pwm/Kconfig                       |  12 +
>  drivers/pwm/Makefile                      |   1 +
>  drivers/pwm/core.c                        |  25 ++-
>  drivers/pwm/pwm-sysfs.c                   | 350 ++++++++++++++++++++++++++++++
>  include/linux/pwm.h                       |  28 +++
>  7 files changed, 533 insertions(+), 2 deletions(-)
>  create mode 100644 Documentation/ABI/testing/sysfs-class-pwm
>  create mode 100644 drivers/pwm/pwm-sysfs.c

<snip>

> diff --git a/drivers/pwm/pwm-sysfs.c b/drivers/pwm/pwm-sysfs.c

<snip>

> +void pwmchip_sysfs_export(struct pwm_chip *chip)
> +{
> +	/*
> +	 * If device_create() fails the pwm_chip is still usable by
> +	 * the kernel its just not exported.
> +	 */
> +	chip->dev = device_create(&pwm_class, chip->dev, MKDEV(0, 0), chip,
> +				  "pwmchip%d", chip->base);
> +}

I just realized this will not work.

chip->dev is initialized by the PWM driver before calling pwmchip_add().

I'll post a v3 shortly.

Regards,
Hartley

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ