Commit 4b013353 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman Committed by Hans de Goede

platform/x86: dell-privacy: convert to use dev_groups

The driver core supports the ability to handle the creation and removal
of device-specific sysfs files in a race-free manner.  Take advantage of
that by converting this driver to use this by moving the sysfs
attributes into a group and assigning the dev_groups pointer to it.

Cc: Perry Yuan <Perry.Yuan@dell.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Mark Gross <markgross@kernel.org>
Cc: Dell.Client.Kernel@dell.com
Cc: platform-driver-x86@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20220729115302.2258296-1-gregkh@linuxfoundation.orgReviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent d5a4dfc3
...@@ -174,15 +174,12 @@ static ssize_t dell_privacy_current_state_show(struct device *dev, ...@@ -174,15 +174,12 @@ static ssize_t dell_privacy_current_state_show(struct device *dev,
static DEVICE_ATTR_RO(dell_privacy_supported_type); static DEVICE_ATTR_RO(dell_privacy_supported_type);
static DEVICE_ATTR_RO(dell_privacy_current_state); static DEVICE_ATTR_RO(dell_privacy_current_state);
static struct attribute *privacy_attributes[] = { static struct attribute *privacy_attrs[] = {
&dev_attr_dell_privacy_supported_type.attr, &dev_attr_dell_privacy_supported_type.attr,
&dev_attr_dell_privacy_current_state.attr, &dev_attr_dell_privacy_current_state.attr,
NULL, NULL,
}; };
ATTRIBUTE_GROUPS(privacy);
static const struct attribute_group privacy_attribute_group = {
.attrs = privacy_attributes
};
/* /*
* Describes the Device State class exposed by BIOS which can be consumed by * Describes the Device State class exposed by BIOS which can be consumed by
...@@ -342,10 +339,6 @@ static int dell_privacy_wmi_probe(struct wmi_device *wdev, const void *context) ...@@ -342,10 +339,6 @@ static int dell_privacy_wmi_probe(struct wmi_device *wdev, const void *context)
if (ret) if (ret)
return ret; return ret;
ret = devm_device_add_group(&wdev->dev, &privacy_attribute_group);
if (ret)
return ret;
if (priv->features_present & BIT(DELL_PRIVACY_TYPE_AUDIO)) { if (priv->features_present & BIT(DELL_PRIVACY_TYPE_AUDIO)) {
ret = dell_privacy_leds_setup(&priv->wdev->dev); ret = dell_privacy_leds_setup(&priv->wdev->dev);
if (ret) if (ret)
...@@ -374,6 +367,7 @@ static const struct wmi_device_id dell_wmi_privacy_wmi_id_table[] = { ...@@ -374,6 +367,7 @@ static const struct wmi_device_id dell_wmi_privacy_wmi_id_table[] = {
static struct wmi_driver dell_privacy_wmi_driver = { static struct wmi_driver dell_privacy_wmi_driver = {
.driver = { .driver = {
.name = "dell-privacy", .name = "dell-privacy",
.dev_groups = privacy_groups,
}, },
.probe = dell_privacy_wmi_probe, .probe = dell_privacy_wmi_probe,
.remove = dell_privacy_wmi_remove, .remove = dell_privacy_wmi_remove,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment