Input: adxl34x - use device core to create driver-specific device attributes
Dmitry Torokhov
maintainerPATCH v2 1/4 Input: adxl34x - use device core to create driver-specific device attributes
Instead of creating driver-specific device attributes with sysfs_create_group() have device core do this by setting up dev_groups pointer in the driver structure.
---
v2: added Nono's ACK
drivers/input/misc/adxl34x-i2c.c | 1 + drivers/input/misc/adxl34x-spi.c | 1 + drivers/input/misc/adxl34x.c | 15 +++++++-------- drivers/input/misc/adxl34x.h | 1 + 4 files changed, 10 insertions(+), 8 deletions(-)
drivers/input/misc/adxl34x-i2c.c +1 -0
@@ -132,6 +132,7 @@ MODULE_DEVICE_TABLE(of, adxl34x_of_id);static struct i2c_driver adxl34x_driver = { .driver = { .name ="adxl34x" , + .dev_groups = adxl34x_groups, .pm =pm_sleep_ptr (&adxl34x_pm), .of_match_table = adxl34x_of_id, },
drivers/input/misc/adxl34x-spi.c +1 -0
@@ -97,6 +97,7 @@ static void adxl34x_spi_remove(struct spi_device *spi)static struct spi_driver adxl34x_driver = { .driver = { .name ="adxl34x" , + .dev_groups = adxl34x_groups, .pm =pm_sleep_ptr (&adxl34x_pm), }, .probe = adxl34x_spi_probe,
drivers/input/misc/adxl34x.c +7 -8
@@ -664,6 +664,12 @@ static const struct attribute_group adxl34x_attr_group = { .attrs = adxl34x_attributes, }; +const struct attribute_group *adxl34x_groups[] = { + &adxl34x_attr_group, +NULL +}; +EXPORT_SYMBOL_GPL (adxl34x_groups); +static int adxl34x_input_open (struct input_dev *input) {struct adxl34x *ac =input_get_drvdata (input);
@@ -823,13 +829,9 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq, goto err_free_mem; } - err =sysfs_create_group (&dev->kobj, &adxl34x_attr_group); -if (err) - goto err_free_irq; - err =input_register_device (input_dev);if (err) - goto err_remove_attr; + goto err_free_irq;AC_WRITE (ac,OFSX , pdata->x_axis_offset); ac->hwcal.x = pdata->x_axis_offset;
@@ -889,8 +891,6 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,return ac; - err_remove_attr: -sysfs_remove_group (&dev->kobj, &adxl34x_attr_group); err_free_irq:free_irq (ac->irq, ac); err_free_mem:
@@ -903,7 +903,6 @@ EXPORT_SYMBOL_GPL(adxl34x_probe);void adxl34x_remove (struct adxl34x *ac) { -sysfs_remove_group (&ac->dev->kobj, &adxl34x_attr_group);free_irq (ac->irq, ac);input_unregister_device (ac->input);dev_dbg (ac->dev,"unregistered accelerometer\n" );
drivers/input/misc/adxl34x.h +1 -0
@@ -26,5 +26,6 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,void adxl34x_remove (struct adxl34x *ac);extern const struct dev_pm_ops adxl34x_pm; +extern const struct attribute_group *adxl34x_groups[];#endif
Signature · 1 line
2.45.2.505.gda0bf45e8d-goog
Dmitry Torokhov
maintainerPATCH v2 2/4 Input: adxl34x - use input_set_capability()
Switch to using input_set_capability() instead of using __set_bit() to make clear what exactly kinds of events (EV_KEY, EV_REL) are being declared.
Also drop redundant calls setting EV_ABS and ABS_X|Y|Z bits as that is taken care by input_set_abs_params().
---
v2: new patch, split out from devm conversion at Nino's request
drivers/input/misc/adxl34x.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-)
drivers/input/misc/adxl34x.c +13 -19
@@ -769,18 +769,12 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,input_set_drvdata (input_dev, ac); -__set_bit (ac->pdata.ev_type, input_dev->evbit); -if (ac->pdata.ev_type ==EV_REL ) { -__set_bit (REL_X , input_dev->relbit); -__set_bit (REL_Y , input_dev->relbit); -__set_bit (REL_Z , input_dev->relbit); +input_set_capability (input_dev,EV_REL ,REL_X ); +input_set_capability (input_dev,EV_REL ,REL_Y ); +input_set_capability (input_dev,EV_REL ,REL_Z ); }else {/* EV_ABS */ -__set_bit (ABS_X , input_dev->absbit); -__set_bit (ABS_Y , input_dev->absbit); -__set_bit (ABS_Z , input_dev->absbit); -if (pdata->data_range &FULL_RES ) range =ADXL_FULLRES_MAX_VAL ;/* Signed 13-bit */ else
@@ -791,18 +785,18 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,input_set_abs_params (input_dev,ABS_Z , -range, range,3 ,3 ); } -__set_bit (EV_KEY , input_dev->evbit); -__set_bit (pdata->ev_code_tap[ADXL_X_AXIS ], input_dev->keybit); -__set_bit (pdata->ev_code_tap[ADXL_Y_AXIS ], input_dev->keybit); -__set_bit (pdata->ev_code_tap[ADXL_Z_AXIS ], input_dev->keybit); +input_set_capability (input_dev,EV_KEY , pdata->ev_code_tap[ADXL_X_AXIS ]); +input_set_capability (input_dev,EV_KEY , pdata->ev_code_tap[ADXL_Y_AXIS ]); +input_set_capability (input_dev,EV_KEY , pdata->ev_code_tap[ADXL_Z_AXIS ]);if (pdata->ev_code_ff) { ac->int_mask =FREE_FALL ; -__set_bit (pdata->ev_code_ff, input_dev->keybit); +input_set_capability (input_dev,EV_KEY , pdata->ev_code_ff); }if (pdata->ev_code_act_inactivity) -__set_bit (pdata->ev_code_act_inactivity, input_dev->keybit); +input_set_capability (input_dev,EV_KEY , + pdata->ev_code_act_inactivity); ac->int_mask |=ACTIVITY |INACTIVITY ;
@@ -874,13 +868,13 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,if (pdata->orientation_enable &ADXL_EN_ORIENTATION_3D )for (i =0 ; i <ARRAY_SIZE (pdata->ev_codes_orient_3d); i++) -__set_bit (pdata->ev_codes_orient_3d[i], - input_dev->keybit); +input_set_capability (input_dev,EV_KEY , + pdata->ev_codes_orient_3d[i]);if (pdata->orientation_enable &ADXL_EN_ORIENTATION_2D )for (i =0 ; i <ARRAY_SIZE (pdata->ev_codes_orient_2d); i++) -__set_bit (pdata->ev_codes_orient_2d[i], - input_dev->keybit); +input_set_capability (input_dev,EV_KEY , + pdata->ev_codes_orient_2d[i]); }else { ac->pdata.orientation_enable =0 ; }
Signature · 1 line
2.45.2.505.gda0bf45e8d-goog
Re: [PATCH v2 2/4] Input: adxl34x - use input_set_capability()
Quoted 9 lines · Dmitry Torokhov
Switch to using
input_set_capability()instead of using__set_bit()to make clear what exactly kinds of events (EV_KEY,EV_REL) are being declared.Also drop redundant calls setting
EV_ABSand ABS_X|Y|Z bits as that is taken care byinput_set_abs_params().Signed-off-by Dmitry Torokhov <[email protected]>---
Quoted 85 lines
v2: new patch, split out from devm conversion at Nino's request
drivers/input/misc/adxl34x.c | 32 +++++++++++++-------------------
1 file changed, 13 insertions(+), 19 deletions(-)drivers/input/misc/adxl34x.c +0
-0@@ -769,18 +769,12 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,
input_set_drvdata(input_dev, ac);drivers/input/misc/adxl34x.c +0
-2-__set_bit (ac->pdata.ev_type, input_dev->evbit); -if (
ac->pdata.ev_type==EV_REL) {drivers/input/misc/adxl34x.c +3
-3-__set_bit (REL_X , input_dev->relbit); -__set_bit (REL_Y , input_dev->relbit); -__set_bit (REL_Z , input_dev->relbit); +input_set_capability (input_dev,EV_REL ,REL_X ); +input_set_capability (input_dev,EV_REL ,REL_Y ); +input_set_capability (input_dev,EV_REL ,REL_Z );} else {
/*EV_ABS*/drivers/input/misc/adxl34x.c +0
-4-__set_bit (ABS_X , input_dev->absbit); -__set_bit (ABS_Y , input_dev->absbit); -__set_bit (ABS_Z , input_dev->absbit); -if (
pdata->data_range&FULL_RES)
range =ADXL_FULLRES_MAX_VAL; /* Signed 13-bit */
elsedrivers/input/misc/adxl34x.c +0
-0@@ -791,18 +785,18 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq, input_set_abs_params(input_dev, ABS_Z, -range, range, 3, 3); }drivers/input/misc/adxl34x.c +1
-4-__set_bit (EV_KEY , input_dev->evbit); -__set_bit (pdata->ev_code_tap[ADXL_X_AXIS ], input_dev->keybit); -__set_bit (pdata->ev_code_tap[ADXL_Y_AXIS ], input_dev->keybit); -__set_bit (pdata->ev_code_tap[ADXL_Z_AXIS ], input_dev->keybit); + input_set_capability(input_dev, EV_KEY, pdata-Quoted 1 line
ev_code_tap[ADXL_X_AXIS]);
drivers/input/misc/adxl34x.c +1
-0+ input_set_capability(input_dev, EV_KEY, pdata-Quoted 1 line
ev_code_tap[ADXL_Y_AXIS]);
drivers/input/misc/adxl34x.c +1
-0+ input_set_capability(input_dev, EV_KEY, pdata-Quoted 1 line
ev_code_tap[ADXL_Z_AXIS]);
if (pdata->ev_code_ff) {
ac->int_mask=FREE_FALL;drivers/input/misc/adxl34x.c +1
-1-__set_bit (pdata->ev_code_ff, input_dev->keybit); +input_set_capability (input_dev,EV_KEY , pdata->ev_code_ff);}
if (pdata->ev_code_act_inactivity)drivers/input/misc/adxl34x.c +2
-1-__set_bit (pdata->ev_code_act_inactivity, input_dev->keybit); +input_set_capability (input_dev,EV_KEY , + pdata->ev_code_act_inactivity);
ac->int_mask|= ACTIVITY | INACTIVITY;drivers/input/misc/adxl34x.c +0
-0@@ -874,13 +868,13 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,
if (pdata->orientation_enable&ADXL_EN_ORIENTATION_3D) for (i = 0; i < ARRAY_SIZE(pdata-Quoted 1 line
ev_codes_orient_3d); i++)drivers/input/misc/adxl34x.c +2
-2-__set_bit (pdata->ev_codes_orient_3d[i], - input_dev->keybit); + input_set_capability(input_dev, EV_KEY, + pdata-Quoted 1 line
ev_codes_orient_3d[i]);
if (pdata->orientation_enable&ADXL_EN_ORIENTATION_2D) for (i = 0; i < ARRAY_SIZE(pdata-Quoted 1 line
ev_codes_orient_2d); i++)drivers/input/misc/adxl34x.c +2
-2-__set_bit (pdata->ev_codes_orient_2d[i], - input_dev->keybit); + input_set_capability(input_dev, EV_KEY, + pdata-Quoted 1 line
ev_codes_orient_2d[i]);
} else {
ac->pdata.orientation_enable= 0;
}
Dmitry Torokhov
maintainerPATCH v2 3/4 Input: adxl34x - switch to using managed resources
In reply to Dmitry TorokhovSwitch the driver to use managed resources to simplify error handling.
---
v2: conversion to using input_set_capability() moved to a separate patch
drivers/input/misc/adxl34x-i2c.c | 8 ----- drivers/input/misc/adxl34x-spi.c | 8 ----- drivers/input/misc/adxl34x.c | 53 ++++++++++---------------------- drivers/input/misc/adxl34x.h | 1 - 4 files changed, 17 insertions(+), 53 deletions(-)
drivers/input/misc/adxl34x-i2c.c +0 -8
@@ -98,13 +98,6 @@ static int adxl34x_i2c_probe(struct i2c_client *client)return 0 ; } -static void adxl34x_i2c_remove (struct i2c_client *client) -{ -struct adxl34x *ac =i2c_get_clientdata (client); - -adxl34x_remove (ac); -} -static const struct i2c_device_id adxl34x_id[] = { {"adxl34x" }, { }
@@ -137,7 +130,6 @@ static struct i2c_driver adxl34x_driver = { .of_match_table = adxl34x_of_id, }, .probe = adxl34x_i2c_probe, - .remove = adxl34x_i2c_remove, .id_table = adxl34x_id, };
drivers/input/misc/adxl34x-spi.c +0 -8
@@ -87,13 +87,6 @@ static int adxl34x_spi_probe(struct spi_device *spi)return 0 ; } -static void adxl34x_spi_remove (struct spi_device *spi) -{ -struct adxl34x *ac =spi_get_drvdata (spi); - -adxl34x_remove (ac); -} -static struct spi_driver adxl34x_driver = { .driver = { .name ="adxl34x" ,
@@ -101,7 +94,6 @@ static struct spi_driver adxl34x_driver = { .pm = pm_sleep_ptr(&adxl34x_pm), }, .probe = adxl34x_spi_probe, - .remove = adxl34x_spi_remove, };module_spi_driver (adxl34x_driver);
drivers/input/misc/adxl34x.c +17 -36
94 lines not on this page · raw message
drivers/input/misc/adxl34x.h +0 -1
@@ -23,7 +23,6 @@ struct adxl34x_bus_ops {struct adxl34x *adxl34x_probe (struct device *dev,int irq,bool fifo_delay_default,const struct adxl34x_bus_ops *bops); -void adxl34x_remove (struct adxl34x *ac);extern const struct dev_pm_ops adxl34x_pm;extern const struct attribute_group *adxl34x_groups[];
Signature · 1 line
2.45.2.505.gda0bf45e8d-goog
Re: [PATCH v2 3/4] Input: adxl34x - switch to using managed resources
Quoted 4 lines · Dmitry Torokhov
Switch the driver to use managed resources to simplify error handling.
Signed-off-by Dmitry Torokhov <[email protected]>---
Dmitry Torokhov
maintainerPATCH v2 4/4 Input: adxl34x- switch to using "guard" notation
In reply to Dmitry TorokhovSwitch to using guard(mutex)() notation to acquire and automatically release mutexes.
---
v2: added Nono's ACK
drivers/input/misc/adxl34x.c | 61 ++++++++++++------------------------ 1 file changed, 20 insertions(+), 41 deletions(-)
drivers/input/misc/adxl34x.c +20 -41
@@ -241,7 +241,8 @@ static void adxl34x_get_triple(struct adxl34x *ac, struct axis_triple *axis) ac->bops->read_block (ac->dev,DATAX0 ,DATAZ1 -DATAX0 +1 , buf); -mutex_lock (&ac->mutex); +guard (mutex)(&ac->mutex); + ac->saved.x = (s16 )le16_to_cpu (buf[0 ]); axis->x = ac->saved.x;
@@ -250,7 +251,6 @@ static void adxl34x_get_triple(struct adxl34x *ac, struct axis_triple *axis) ac->saved.z = (s16 )le16_to_cpu (buf[2 ]); axis->z = ac->saved.z; -mutex_unlock (&ac->mutex); }static void adxl34x_service_ev_fifo (struct adxl34x *ac)
@@ -416,15 +416,13 @@ static int adxl34x_suspend(struct device *dev) {struct adxl34x *ac =dev_get_drvdata (dev); -mutex_lock (&ac->mutex); +guard (mutex)(&ac->mutex);if (!ac->suspended && !ac->disabled && ac->opened)__adxl34x_disable (ac); ac->suspended = true; -mutex_unlock (&ac->mutex); -return 0 ; }
@@ -432,15 +430,13 @@ static int adxl34x_resume(struct device *dev) {struct adxl34x *ac =dev_get_drvdata (dev); -mutex_lock (&ac->mutex); +guard (mutex)(&ac->mutex);if (ac->suspended && !ac->disabled && ac->opened)__adxl34x_enable (ac); ac->suspended = false; -mutex_unlock (&ac->mutex); -return 0 ; }
@@ -464,7 +460,7 @@ static ssize_t adxl34x_disable_store(struct device *dev,if (error)return error; -mutex_lock (&ac->mutex); +guard (mutex)(&ac->mutex);if (!ac->suspended && ac->opened) {if (val) {
@@ -478,8 +474,6 @@ static ssize_t adxl34x_disable_store(struct device *dev, ac->disabled = !!val; -mutex_unlock (&ac->mutex); -return count; }
@@ -489,16 +483,13 @@ static ssize_t adxl34x_calibrate_show(struct device *dev, struct device_attribute *attr, char *buf) { struct adxl34x *ac = dev_get_drvdata(dev); -ssize_t count; -mutex_lock (&ac->mutex); - count =sprintf (buf,"%d,%d,%d\n" , - ac->hwcal.x *4 + ac->swcal.x, - ac->hwcal.y *4 + ac->swcal.y, - ac->hwcal.z *4 + ac->swcal.z); -mutex_unlock (&ac->mutex); +guard (mutex)(&ac->mutex); -return count; +return sprintf (buf,"%d,%d,%d\n" , + ac->hwcal.x *4 + ac->swcal.x, + ac->hwcal.y *4 + ac->swcal.y, + ac->hwcal.z *4 + ac->swcal.z); } static ssize_t adxl34x_calibrate_store(struct device *dev,
@@ -512,7 +503,8 @@ static ssize_t adxl34x_calibrate_store(struct device *dev,* We use HW calibration and handle the remaining bits in SW. (4mg/LSB) */ -mutex_lock (&ac->mutex); +guard (mutex)(&ac->mutex); + ac->hwcal.x -= (ac->saved.x /4 ); ac->swcal.x = ac->saved.x %4 ;
@@ -525,7 +517,6 @@ static ssize_t adxl34x_calibrate_store(struct device *dev,AC_WRITE (ac,OFSX , (s8 ) ac->hwcal.x);AC_WRITE (ac,OFSY , (s8 ) ac->hwcal.y);AC_WRITE (ac,OFSZ , (s8 ) ac->hwcal.z); -mutex_unlock (&ac->mutex);return count; }
@@ -553,15 +544,13 @@ static ssize_t adxl34x_rate_store(struct device *dev,if (error)return error; -mutex_lock (&ac->mutex); +guard (mutex)(&ac->mutex); ac->pdata.data_rate =RATE (val);AC_WRITE (ac,BW_RATE , ac->pdata.data_rate | (ac->pdata.low_power_mode ?LOW_POWER :0 )); -mutex_unlock (&ac->mutex); -return count; }
@@ -588,7 +577,7 @@ static ssize_t adxl34x_autosleep_store(struct device *dev,if (error)return error; -mutex_lock (&ac->mutex); +guard (mutex)(&ac->mutex);if (val) ac->pdata.power_mode |= (PCTL_AUTO_SLEEP |PCTL_LINK );
@@ -598,8 +587,6 @@ static ssize_t adxl34x_autosleep_store(struct device *dev,if (!ac->disabled && !ac->suspended && ac->opened)AC_WRITE (ac,POWER_CTL , ac->pdata.power_mode |PCTL_MEASURE ); -mutex_unlock (&ac->mutex); -return count; }
@@ -610,14 +597,11 @@ static ssize_t adxl34x_position_show(struct device *dev, struct device_attribute *attr, char *buf) { struct adxl34x *ac = dev_get_drvdata(dev); -ssize_t count; -mutex_lock (&ac->mutex); - count =sprintf (buf,"(%d, %d, %d)\n" , - ac->saved.x, ac->saved.y, ac->saved.z); -mutex_unlock (&ac->mutex); +guard (mutex)(&ac->mutex); -return count; +return sprintf (buf,"(%d, %d, %d)\n" , + ac->saved.x, ac->saved.y, ac->saved.z); } static DEVICE_ATTR(position, S_IRUGO, adxl34x_position_show, NULL);
@@ -638,9 +622,8 @@ static ssize_t adxl34x_write_store(struct device *dev,if (error)return error; -mutex_lock (&ac->mutex); +guard (mutex)(&ac->mutex);AC_WRITE (ac, val >>8 , val &0xFF ); -mutex_unlock (&ac->mutex);return count; }
@@ -674,15 +657,13 @@ static int adxl34x_input_open(struct input_dev *input) {struct adxl34x *ac =input_get_drvdata (input); -mutex_lock (&ac->mutex); +guard (mutex)(&ac->mutex);if (!ac->suspended && !ac->disabled)__adxl34x_enable (ac); ac->opened = true; -mutex_unlock (&ac->mutex); -return 0 ; }
@@ -690,14 +671,12 @@ static void adxl34x_input_close(struct input_dev *input) {struct adxl34x *ac =input_get_drvdata (input); -mutex_lock (&ac->mutex); +guard (mutex)(&ac->mutex);if (!ac->suspended && !ac->disabled)__adxl34x_disable (ac); ac->opened = false; - -mutex_unlock (&ac->mutex); } struct adxl34x *adxl34x_probe(struct device *dev, int irq,
Signature · 1 line
2.45.2.505.gda0bf45e8d-goog
Quoted 12 lines
-----Original Message-----
From: Dmitry Torokhov <[email protected]>
Sent: Monday, June 10, 2024 6:43 PM
To: [email protected]; Sa, Nuno <[email protected]>
Cc: Hennerich, Michael <[email protected]>; linux- [email protected]
Subject: [PATCH v2 1/4] Input: adxl34x - use device core to create driver- specific device attributes
Quoted 6 lines
Instead of creating driver-specific device attributes with
sysfs_create_group()have device core do this by setting updev_groupspointer in the driver structure.Reviewed-by Nuno Sa <[email protected]>Signed-off-by Dmitry Torokhov <[email protected]>
Quoted 98 lines
---
v2: added Nono's ACK
drivers/input/misc/adxl34x-i2c.c | 1 + drivers/input/misc/adxl34x-spi.c | 1(quoted diff) +1
-0+ drivers/input/misc/adxl34x.c | 15 +++++++-------- drivers/input/misc/adxl34x.h | 1 + 4 files changed, 10 insertions(+), 8 deletions(-)drivers/input/misc/adxl34x- renamed from drivers/input/misc/adxl34x-i2c.c +0
-0
i2c.c
indexd4014e367c77..7531c7b2d657100644drivers/input/misc/adxl34x-i2c.c +1
-0@@ -132,6 +132,7 @@ MODULE_DEVICE_TABLE(of, adxl34x_of_id); staticstruct i2c_driver adxl34x_driver = { .driver = { .name ="adxl34x" , + .dev_groups = adxl34x_groups, .pm =pm_sleep_ptr (&adxl34x_pm), .of_match_table = adxl34x_of_id, },drivers/input/misc/adxl34x- renamed from drivers/input/misc/adxl34x-spi.c +0
-0
spi.c
indexf1094a8ccdd5..2befcc4df0be100644drivers/input/misc/adxl34x-spi.c +1
-0@@ -97,6 +97,7 @@ static void adxl34x_spi_remove(struct spi_device *spi)static struct spi_driver adxl34x_driver = { .driver = { .name ="adxl34x" , + .dev_groups = adxl34x_groups, .pm =pm_sleep_ptr (&adxl34x_pm), }, .probe = adxl34x_spi_probe,drivers/input/misc/adxl34x.c index renamed from drivers/input/misc/adxl34x.c +0
-0
a3f45e0ee0c7..fbe5a56c19d1100644drivers/input/misc/adxl34x.c +6
-0@@ -664,6 +664,12 @@ static const struct attribute_group adxl34x_attr_group = { .attrs = adxl34x_attributes, }; +const struct attribute_group *adxl34x_groups[] = { + &adxl34x_attr_group, +NULL +}; +EXPORT_SYMBOL_GPL (adxl34x_groups); +static int adxl34x_input_open (struct input_dev *input) { struct adxl34x *ac = input_get_drvdata(input); @@ -823,13 +829,9@@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,
drivers/input/misc/adxl34x.c +1
-7goto err_free_mem; } - err =sysfs_create_group (&dev->kobj, &adxl34x_attr_group); -if (err) - goto err_free_irq; - err =input_register_device (input_dev);if (err) - goto err_remove_attr; + goto err_free_irq;AC_WRITE (ac,OFSX , pdata->x_axis_offset); ac->hwcal.x = pdata->x_axis_offset;@@ -889,8 +891,6 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq, return ac; - err_remove_attr: -sysfs_remove_group (&dev->kobj, &adxl34x_attr_group); err_free_irq:free_irq (ac->irq, ac);
err_free_mem:drivers/input/misc/adxl34x.c +0
-1@@ -903,7 +903,6 @@ EXPORT_SYMBOL_GPL(adxl34x_probe);void adxl34x_remove (struct adxl34x *ac) { -sysfs_remove_group (&ac->dev->kobj, &adxl34x_attr_group);free_irq (ac->irq, ac);input_unregister_device (ac->input); dev_dbg(ac->dev, "unregistered accelerometer\n"); diff --git
a/drivers/input/misc/adxl34x.hb/drivers/input/misc/adxl34x.hindexf9272a2e7a96..67e0ddc5c3eb100644drivers/input/misc/adxl34x.h +1
-1@@ -26,5 +26,6 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq, void adxl34x_remove(struct adxl34x *ac);extern const struct dev_pm_ops adxl34x_pm; +extern const struct attribute_group *adxl34x_groups[];#endif --2.45.2.505.gda0bf45e8d-goog