aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2010-08-26 03:15:25 -0400
committerMatthew Garrett <mjg@redhat.com>2010-10-21 09:36:48 -0400
commit614ef4322200086447d5e1f79e8876213c94f499 (patch)
tree4e0fc6e06502e57e3f70ad5cbc83570d7338de0d /drivers
parent8e07514db8d037a8454e81cd529a9844c9fa7075 (diff)
WMI: make use of class device's attributres
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> Signed-off-by: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/platform/x86/wmi.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index dd30b2aa7a29..b9a60a0aabfd 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -649,7 +649,7 @@ EXPORT_SYMBOL_GPL(wmi_has_guid);
649/* 649/*
650 * sysfs interface 650 * sysfs interface
651 */ 651 */
652static ssize_t show_modalias(struct device *dev, struct device_attribute *attr, 652static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
653 char *buf) 653 char *buf)
654{ 654{
655 char guid_string[37]; 655 char guid_string[37];
@@ -663,7 +663,11 @@ static ssize_t show_modalias(struct device *dev, struct device_attribute *attr,
663 663
664 return sprintf(buf, "wmi:%s\n", guid_string); 664 return sprintf(buf, "wmi:%s\n", guid_string);
665} 665}
666static DEVICE_ATTR(modalias, S_IRUGO, show_modalias, NULL); 666
667static struct device_attribute wmi_dev_attrs[] = {
668 __ATTR_RO(modalias),
669 __ATTR_NULL
670};
667 671
668static int wmi_dev_uevent(struct device *dev, struct kobj_uevent_env *env) 672static int wmi_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
669{ 673{
@@ -696,6 +700,7 @@ static struct class wmi_class = {
696 .name = "wmi", 700 .name = "wmi",
697 .dev_release = wmi_dev_free, 701 .dev_release = wmi_dev_free,
698 .dev_uevent = wmi_dev_uevent, 702 .dev_uevent = wmi_dev_uevent,
703 .dev_attrs = wmi_dev_attrs,
699}; 704};
700 705
701static int wmi_create_devs(void) 706static int wmi_create_devs(void)
@@ -728,10 +733,6 @@ static int wmi_create_devs(void)
728 result = device_register(guid_dev); 733 result = device_register(guid_dev);
729 if (result) 734 if (result)
730 return result; 735 return result;
731
732 result = device_create_file(guid_dev, &dev_attr_modalias);
733 if (result)
734 return result;
735 } 736 }
736 737
737 return 0; 738 return 0;
@@ -751,8 +752,6 @@ static void wmi_remove_devs(void)
751 guid_dev = wblock->dev; 752 guid_dev = wblock->dev;
752 gblock = &wblock->gblock; 753 gblock = &wblock->gblock;
753 754
754 device_remove_file(guid_dev, &dev_attr_modalias);
755
756 device_unregister(guid_dev); 755 device_unregister(guid_dev);
757 } 756 }
758} 757}