* [PATCH] Input: cyapa - switch to using devm_device_add_group
@ 2019-07-13 8:48 Dmitry Torokhov
0 siblings, 0 replies; only message in thread
From: Dmitry Torokhov @ 2019-07-13 8:48 UTC (permalink / raw)
To: linux-input; +Cc: linux-kernel
Instead of installing custom devm cleanup action to remove attribute
groups on failure, let's use the dedicated devm API.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/input/mouse/cyapa.c | 16 +---------------
1 file changed, 1 insertion(+), 15 deletions(-)
diff --git a/drivers/input/mouse/cyapa.c b/drivers/input/mouse/cyapa.c
index dfd3873513e4..c675f156948b 100644
--- a/drivers/input/mouse/cyapa.c
+++ b/drivers/input/mouse/cyapa.c
@@ -1238,13 +1238,6 @@ static const struct attribute_group cyapa_sysfs_group = {
.attrs = cyapa_sysfs_entries,
};
-static void cyapa_remove_sysfs_group(void *data)
-{
- struct cyapa *cyapa = data;
-
- sysfs_remove_group(&cyapa->client->dev.kobj, &cyapa_sysfs_group);
-}
-
static void cyapa_disable_regulator(void *data)
{
struct cyapa *cyapa = data;
@@ -1312,19 +1305,12 @@ static int cyapa_probe(struct i2c_client *client,
return error;
}
- error = sysfs_create_group(&dev->kobj, &cyapa_sysfs_group);
+ error = devm_device_add_group(dev, &cyapa_sysfs_group);
if (error) {
dev_err(dev, "failed to create sysfs entries: %d\n", error);
return error;
}
- error = devm_add_action(dev, cyapa_remove_sysfs_group, cyapa);
- if (error) {
- cyapa_remove_sysfs_group(cyapa);
- dev_err(dev, "failed to add sysfs cleanup action: %d\n", error);
- return error;
- }
-
error = cyapa_prepare_wakeup_controls(cyapa);
if (error) {
dev_err(dev, "failed to prepare wakeup controls: %d\n", error);
--
2.22.0.510.g264f2c817a-goog
--
Dmitry
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2019-07-13 8:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-13 8:48 [PATCH] Input: cyapa - switch to using devm_device_add_group Dmitry Torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).