@@ -146,7 +146,7 @@ DECLARE_FAN_TARGET_RPM_SENSOR_DEV_ATTR(1);
146
146
DECLARE_FAN_TARGET_RPM_SENSOR_DEV_ATTR (2 );
147
147
DECLARE_FAN_TARGET_RPM_SENSOR_DEV_ATTR (3 );
148
148
149
- static struct attribute * as4625_fan_attributes [] = {
149
+ static struct attribute * as4625_fan_attrs [] = {
150
150
/* fan related attributes */
151
151
DECLARE_FAN_FAULT_ATTR (1 ),
152
152
DECLARE_FAN_FAULT_ATTR (2 ),
@@ -166,6 +166,8 @@ static struct attribute *as4625_fan_attributes[] = {
166
166
NULL
167
167
};
168
168
169
+ ATTRIBUTE_GROUPS (as4625_fan );
170
+
169
171
#define FAN_DUTY_CYCLE_REG_MASK 0x0F
170
172
#define FAN_MAX_DUTY_CYCLE 100
171
173
#define FAN_REG_VAL_TO_SPEED_RPM_STEP 150
@@ -292,10 +294,6 @@ static ssize_t fan_show_value(struct device *dev, struct device_attribute *da,
292
294
return ret ;
293
295
}
294
296
295
- static const struct attribute_group as4625_fan_group = {
296
- .attrs = as4625_fan_attributes ,
297
- };
298
-
299
297
static struct as4625_fan_data * as4625_fan_update_device (struct device * dev )
300
298
{
301
299
if (time_after (jiffies , data -> last_updated + HZ + HZ / 2 ) ||
@@ -332,30 +330,19 @@ static int as4625_fan_probe(struct platform_device *pdev)
332
330
{
333
331
int status ;
334
332
335
- data -> hwmon_dev = hwmon_device_register_with_info (& pdev -> dev ,
336
- DRVNAME , NULL , NULL , NULL );
333
+ data -> hwmon_dev = devm_hwmon_device_register_with_groups (& pdev -> dev ,
334
+ DRVNAME , data , as4625_fan_groups );
337
335
if (IS_ERR (data -> hwmon_dev )) {
338
336
status = PTR_ERR (data -> hwmon_dev );
339
337
return status ;
340
338
}
341
339
342
- /* Register sysfs hooks */
343
- status = sysfs_create_group (& data -> hwmon_dev -> kobj , & as4625_fan_group );
344
- if (status )
345
- goto exit_remove ;
346
-
347
340
dev_info (& pdev -> dev , "device created\n" );
348
341
return 0 ;
349
-
350
- exit_remove :
351
- hwmon_device_unregister (data -> hwmon_dev );
352
- return status ;
353
342
}
354
343
355
344
static int as4625_fan_remove (struct platform_device * pdev )
356
345
{
357
- sysfs_remove_group (& data -> hwmon_dev -> kobj , & as4625_fan_group );
358
- hwmon_device_unregister (data -> hwmon_dev );
359
346
return 0 ;
360
347
}
361
348
0 commit comments