From: Guenter Roeck <linux@roeck-us.net>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Jean Delvare <khali@linux-fr.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
lm-sensors@lm-sensors.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 0/9] Introduce hwmon_device_register_with_groups and
Date: Mon, 02 Sep 2013 12:25:35 -0700 [thread overview]
Message-ID: <5224E62F.1050400@roeck-us.net> (raw)
In-Reply-To: <1378003742-18685-1-git-send-email-linux@roeck-us.net>
On 08/31/2013 07:48 PM, Guenter Roeck wrote:
> This patch series introduces new hwmon API functions
> hwmon_device_register_with_groups() and devm_hwmon_device_register_with_groups().
>
> hwmon_device_register_with_groups() lets callers register hwmon devices
> as well as associated sysfs attributes with a single call. This simplifies
> hwmon device registration and avoids potential race conditions seen
> if sysfs attributes are created after the initial hwmon device was
> registered.
>
> devm_hwmon_device_register_with_groups() is the managed version of the same
> function.
>
Jean, any comments on this patch series ?
If you are ok with it, I would like to push the new API (patches 1 and 7 of the series)
into 3.12, and keep the rest for 3.13.
Thanks,
Guenter
> The rationale for the new API is that sysfs attributes should be created
> synchronously with device creation to avoid race conditions, as outlined in
> http://www.linuxfoundation.org/news-media/blogs/browse/2013/06/how-create-sysfs-file-correctly.
>
> The first patch of the series introduces hwmon_device_register_with_groups().
>
> Patches 2 to 6 convert some hwmon drivers to use the new API to show and
> test its use. Only the ds1621 and nct6775 patches have been tested at this time;
> the others are informational to show the potential of the new functions.
>
> Patch 7 introduces devm_hwmon_device_register_with_groups() and
> the matching function devm_hwmon_device_unregister(). Patch 8 and 9
> convert the nct6775 and ds1621 drivers drivers to use this function.
>
> hwmon attributes
>
> The old hwmon API attaches hwmon attributes to the parent device, not to the
> hwmon device itself. With the new API, hwmon attributes are attached to the
> hwmon device itself.
>
> Handling the 'name' attribute for hwmon drivers
>
> Since sysfs attributes are no longer attached to the parent device, the
> mandatory 'name' attribute has to be created explicitly. For some drivers,
> this was already the case. I2c drivers, however, create the 'name' attribute
> in the i2c core, and it was used by the hwmon driver.
>
> To simplify name attribute handling, the value of the 'name' attribute is
> passed as parameter to hwmon_device_register_with_groups(). The hwmon core
> creates and manages the attribute. If a NULL pointer is passed instead of
> a name, the attribute is not created.
>
> Unfortunately, since we need a variable to store the pointer to 'name',
> it was necessary to create an internal 'struct hwmon_device'. For this
> reason, device_create(), or rather device_create_with_groups() can no
> longer be used to create the actual device. device_register() is used
> instead, and the device data structures are managed locally.
> [ If there is a better solution for this problem, I am listening. ]
>
> The series is based on my hwmon-next branch and should apply to the top of
> linux-next.
>
> ---------
>
> v2: Rename API functions
> device_create_groups -> device_create_with_groups
> hwmon_device_register_groups -> hwmon_device_register_with_groups
> Additional parameter 'void *drvdata' for hwmon_device_register_groups.
> Additional parameter 'name' for hwmon_device_register_groups.
> Introduce devm_hwmon_device_register_with_groups().
> Various fixes in hwmon driver conversions.
>
>
next prev parent reply other threads:[~2013-09-02 19:25 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-01 2:48 [PATCH v2 0/9] Introduce hwmon_device_register_with_groups and Guenter Roeck
2013-09-01 2:48 ` [PATCH v2 1/9] hwmon: Introduce hwmon_device_register_with_groups Guenter Roeck
2013-09-01 16:24 ` Greg Kroah-Hartman
2013-09-01 17:55 ` Guenter Roeck
2013-09-01 18:01 ` Greg Kroah-Hartman
2013-09-01 2:48 ` [PATCH v2 2/9] hwmon: (ds1621) Convert to use hwmon_device_register_with_groups Guenter Roeck
2013-09-01 2:48 ` [PATCH v2 3/9] hwmon: (gpio-fan) " Guenter Roeck
2013-09-01 2:48 ` [PATCH v2 4/9] hwmon: (ltc4245) " Guenter Roeck
2013-09-01 2:48 ` [PATCH v2 5/9] hwmon: (pmbus) " Guenter Roeck
2013-09-01 2:48 ` [PATCH v2 6/9] hwmon: (nct6775) " Guenter Roeck
2013-09-01 2:49 ` [PATCH v2 7/9] hwmon: Provide managed hwmon registration Guenter Roeck
2013-09-01 2:49 ` [PATCH v2 8/9] hwmon: (nct6775) Convert to use devm_hwmon_device_register_with_groups Guenter Roeck
2013-09-01 2:49 ` [PATCH v2 9/9] hwmon: (ds1621) " Guenter Roeck
2013-09-02 19:25 ` Guenter Roeck [this message]
2013-09-03 15:27 ` [PATCH v2 0/9] Introduce hwmon_device_register_with_groups and Guenter Roeck
2013-09-14 18:31 ` Jean Delvare
2013-09-14 19:16 ` Guenter Roeck
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=5224E62F.1050400@roeck-us.net \
--to=linux@roeck-us.net \
--cc=gregkh@linuxfoundation.org \
--cc=khali@linux-fr.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lm-sensors@lm-sensors.org \
/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