mirror of
https://github.com/FEX-Emu/linux.git
synced 2025-01-03 15:52:00 +00:00
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>
This commit is contained in:
parent
8e07514db8
commit
614ef43222
@ -649,7 +649,7 @@ EXPORT_SYMBOL_GPL(wmi_has_guid);
|
|||||||
/*
|
/*
|
||||||
* sysfs interface
|
* 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 *buf)
|
||||||
{
|
{
|
||||||
char guid_string[37];
|
char guid_string[37];
|
||||||
@ -663,7 +663,11 @@ static ssize_t show_modalias(struct device *dev, struct device_attribute *attr,
|
|||||||
|
|
||||||
return sprintf(buf, "wmi:%s\n", guid_string);
|
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)
|
static int wmi_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
|
||||||
{
|
{
|
||||||
@ -696,6 +700,7 @@ static struct class wmi_class = {
|
|||||||
.name = "wmi",
|
.name = "wmi",
|
||||||
.dev_release = wmi_dev_free,
|
.dev_release = wmi_dev_free,
|
||||||
.dev_uevent = wmi_dev_uevent,
|
.dev_uevent = wmi_dev_uevent,
|
||||||
|
.dev_attrs = wmi_dev_attrs,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int wmi_create_devs(void)
|
static int wmi_create_devs(void)
|
||||||
@ -728,10 +733,6 @@ static int wmi_create_devs(void)
|
|||||||
result = device_register(guid_dev);
|
result = device_register(guid_dev);
|
||||||
if (result)
|
if (result)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
result = device_create_file(guid_dev, &dev_attr_modalias);
|
|
||||||
if (result)
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -751,8 +752,6 @@ static void wmi_remove_devs(void)
|
|||||||
guid_dev = wblock->dev;
|
guid_dev = wblock->dev;
|
||||||
gblock = &wblock->gblock;
|
gblock = &wblock->gblock;
|
||||||
|
|
||||||
device_remove_file(guid_dev, &dev_attr_modalias);
|
|
||||||
|
|
||||||
device_unregister(guid_dev);
|
device_unregister(guid_dev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user