Skip to content

Commit

Permalink
platform/x86: ideapad-laptop: use dev_groups to register attribute gr…
Browse files Browse the repository at this point in the history
…oups

Instead of manually adding/removing attribute groups, set
(struct device_driver).dev_groups pointer to have the driver
core do it.

Signed-off-by: Ovidiu Panait <ovidiu.panait.oss@gmail.com>
Link: https://lore.kernel.org/r/20250210155333.1145867-1-ovidiu.panait.oss@gmail.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
  • Loading branch information
Ovidiu Panait authored and Ilpo Järvinen committed Feb 13, 2025
1 parent d026feb commit d497c47
Showing 1 changed file with 2 additions and 21 deletions.
23 changes: 2 additions & 21 deletions drivers/platform/x86/ideapad-laptop.c
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,7 @@ static const struct attribute_group ideapad_attribute_group = {
.is_visible = ideapad_is_visible,
.attrs = ideapad_attributes
};
__ATTRIBUTE_GROUPS(ideapad_attribute);

/*
* DYTC Platform profile
Expand Down Expand Up @@ -1244,21 +1245,6 @@ static void ideapad_unregister_rfkill(struct ideapad_private *priv, int dev)
rfkill_destroy(priv->rfk[dev]);
}

/*
* Platform device
*/
static int ideapad_sysfs_init(struct ideapad_private *priv)
{
return device_add_group(&priv->platform_device->dev,
&ideapad_attribute_group);
}

static void ideapad_sysfs_exit(struct ideapad_private *priv)
{
device_remove_group(&priv->platform_device->dev,
&ideapad_attribute_group);
}

/*
* input device
*/
Expand Down Expand Up @@ -2175,10 +2161,6 @@ static int ideapad_acpi_add(struct platform_device *pdev)

ideapad_check_features(priv);

err = ideapad_sysfs_init(priv);
if (err)
return err;

ideapad_debugfs_init(priv);

err = ideapad_input_init(priv);
Expand Down Expand Up @@ -2265,7 +2247,6 @@ static int ideapad_acpi_add(struct platform_device *pdev)

input_failed:
ideapad_debugfs_exit(priv);
ideapad_sysfs_exit(priv);

return err;
}
Expand Down Expand Up @@ -2293,7 +2274,6 @@ static void ideapad_acpi_remove(struct platform_device *pdev)
ideapad_kbd_bl_exit(priv);
ideapad_input_exit(priv);
ideapad_debugfs_exit(priv);
ideapad_sysfs_exit(priv);
}

#ifdef CONFIG_PM_SLEEP
Expand Down Expand Up @@ -2325,6 +2305,7 @@ static struct platform_driver ideapad_acpi_driver = {
.name = "ideapad_acpi",
.pm = &ideapad_pm,
.acpi_match_table = ACPI_PTR(ideapad_device_ids),
.dev_groups = ideapad_attribute_groups,
},
};

Expand Down

0 comments on commit d497c47

Please sign in to comment.