From: Carlos Corbacho <carlos@strangeworlds.co.uk>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Matthew Garrett <mjg@redhat.com>, platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH 09/10] WMI: make use of class device's attributres
Date: Sun, 12 Sep 2010 18:50:23 +0100 [thread overview]
Message-ID: <201009121850.23852.carlos@strangeworlds.co.uk> (raw)
In-Reply-To: <20100826071525.7976.28120.stgit@localhost.localdomain>
On Thursday 26 August 2010 08:15:25 Dmitry Torokhov wrote:
> Instead of adding modalias attribute manually set it up as class's
> device attribute so driver core will create and remove it for us.
>
> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Acked-by: Carlos Corbacho <carlos@strangeworlds.co.uk>
> ---
>
> drivers/platform/x86/wmi.c | 15 +++++++--------
> 1 files changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
> index b4e5bea..781321b 100644
> --- a/drivers/platform/x86/wmi.c
> +++ b/drivers/platform/x86/wmi.c
> @@ -661,7 +661,7 @@ EXPORT_SYMBOL_GPL(wmi_has_guid);
> /*
> * sysfs interface
> */
> -static ssize_t show_modalias(struct device *dev, struct device_attribute
> *attr, +static ssize_t modalias_show(struct device *dev, struct
> device_attribute *attr, char *buf)
> {
> char guid_string[37];
> @@ -675,7 +675,11 @@ static ssize_t show_modalias(struct device *dev,
> struct device_attribute *attr,
>
> return sprintf(buf, "wmi:%s\n", guid_string);
> }
> -static DEVICE_ATTR(modalias, S_IRUGO, show_modalias, NULL);
> +
> +static struct device_attribute wmi_dev_attrs[] = {
> + __ATTR_RO(modalias),
> + __ATTR_NULL
> +};
>
> static int wmi_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
> {
> @@ -708,6 +712,7 @@ static struct class wmi_class = {
> .name = "wmi",
> .dev_release = wmi_dev_free,
> .dev_uevent = wmi_dev_uevent,
> + .dev_attrs = wmi_dev_attrs,
> };
>
> static int wmi_create_devs(void)
> @@ -740,10 +745,6 @@ static int wmi_create_devs(void)
> result = device_register(guid_dev);
> if (result)
> return result;
> -
> - result = device_create_file(guid_dev, &dev_attr_modalias);
> - if (result)
> - return result;
> }
>
> return 0;
> @@ -763,8 +764,6 @@ static void wmi_remove_devs(void)
> guid_dev = wblock->dev;
> gblock = &wblock->gblock;
>
> - device_remove_file(guid_dev, &dev_attr_modalias);
> -
> device_unregister(guid_dev);
> }
> }
>
> --
> To unsubscribe from this list: send the line "unsubscribe
> platform-driver-x86" in the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
E-Mail: carlos@strangeworlds.co.uk
Web: strangeworlds.co.uk
GPG Key ID: 0x23EE722D
next prev parent reply other threads:[~2010-09-12 17:50 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-26 7:14 [PATCH 01/10] WMI: remove EC region handler when _WDG parsing fails Dmitry Torokhov
2010-08-26 7:14 ` [PATCH 02/10] WMI: free wmi blocks when parse_wdg() fails Dmitry Torokhov
2010-09-12 17:19 ` Carlos Corbacho
2010-08-26 7:14 ` [PATCH 03/10] WMI: fix wmi_gtoa() to actully terminate the string Dmitry Torokhov
2010-09-12 17:28 ` Carlos Corbacho
2010-08-26 7:14 ` [PATCH 04/10] WMI: do not leak memory in parse_wdg() Dmitry Torokhov
2010-09-12 17:29 ` Carlos Corbacho
2010-08-26 7:15 ` [PATCH 05/10] WMI: fix potential NULL pointer dereference Dmitry Torokhov
2010-09-12 17:30 ` Carlos Corbacho
2010-08-26 7:15 ` [PATCH 06/10] WMI: simplify handling of returned WMI blocks in parse_wdg() Dmitry Torokhov
2010-09-12 17:39 ` Carlos Corbacho
2010-08-26 7:15 ` [PATCH 07/10] WMI: use separate list head for storing wmi blocks Dmitry Torokhov
2010-09-12 17:40 ` Carlos Corbacho
2010-08-26 7:15 ` [PATCH 08/10] WMI: use pr_err() and friends Dmitry Torokhov
2010-09-12 17:42 ` Carlos Corbacho
2010-08-26 7:15 ` [PATCH 09/10] WMI: make use of class device's attributres Dmitry Torokhov
2010-09-12 17:50 ` Carlos Corbacho [this message]
2010-08-26 7:15 ` [PATCH 10/10] WMI: embed struct device directly into wmi_block Dmitry Torokhov
2010-09-12 7:29 ` [PATCH 01/10] WMI: remove EC region handler when _WDG parsing fails Dmitry Torokhov
2010-09-12 17:14 ` Carlos Corbacho
2010-10-01 17:00 ` Dmitry Torokhov
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=201009121850.23852.carlos@strangeworlds.co.uk \
--to=carlos@strangeworlds.co.uk \
--cc=dmitry.torokhov@gmail.com \
--cc=mjg@redhat.com \
--cc=platform-driver-x86@vger.kernel.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