@@ -260,14 +260,14 @@ static int _aggregate_choices(struct device *dev, void *data)
260
260
261
261
/**
262
262
* platform_profile_choices_show - Show the available profile choices for legacy sysfs interface
263
- * @dev : The device
263
+ * @kobj : The kobject
264
264
* @attr: The attribute
265
265
* @buf: The buffer to write to
266
266
*
267
267
* Return: The number of bytes written
268
268
*/
269
- static ssize_t platform_profile_choices_show (struct device * dev ,
270
- struct device_attribute * attr ,
269
+ static ssize_t platform_profile_choices_show (struct kobject * kobj ,
270
+ struct kobj_attribute * attr ,
271
271
char * buf )
272
272
{
273
273
unsigned long aggregate [BITS_TO_LONGS (PLATFORM_PROFILE_LAST )];
@@ -333,14 +333,14 @@ static int _store_and_notify(struct device *dev, void *data)
333
333
334
334
/**
335
335
* platform_profile_show - Show the current profile for legacy sysfs interface
336
- * @dev : The device
336
+ * @kobj : The kobject
337
337
* @attr: The attribute
338
338
* @buf: The buffer to write to
339
339
*
340
340
* Return: The number of bytes written
341
341
*/
342
- static ssize_t platform_profile_show (struct device * dev ,
343
- struct device_attribute * attr ,
342
+ static ssize_t platform_profile_show (struct kobject * kobj ,
343
+ struct kobj_attribute * attr ,
344
344
char * buf )
345
345
{
346
346
enum platform_profile_option profile = PLATFORM_PROFILE_LAST ;
@@ -362,15 +362,15 @@ static ssize_t platform_profile_show(struct device *dev,
362
362
363
363
/**
364
364
* platform_profile_store - Set the profile for legacy sysfs interface
365
- * @dev : The device
365
+ * @kobj : The kobject
366
366
* @attr: The attribute
367
367
* @buf: The buffer to read from
368
368
* @count: The number of bytes to read
369
369
*
370
370
* Return: The number of bytes read
371
371
*/
372
- static ssize_t platform_profile_store (struct device * dev ,
373
- struct device_attribute * attr ,
372
+ static ssize_t platform_profile_store (struct kobject * kobj ,
373
+ struct kobj_attribute * attr ,
374
374
const char * buf , size_t count )
375
375
{
376
376
unsigned long choices [BITS_TO_LONGS (PLATFORM_PROFILE_LAST )];
@@ -401,12 +401,12 @@ static ssize_t platform_profile_store(struct device *dev,
401
401
return count ;
402
402
}
403
403
404
- static DEVICE_ATTR_RO (platform_profile_choices );
405
- static DEVICE_ATTR_RW (platform_profile );
404
+ static struct kobj_attribute attr_platform_profile_choices = __ATTR_RO (platform_profile_choices );
405
+ static struct kobj_attribute attr_platform_profile = __ATTR_RW (platform_profile );
406
406
407
407
static struct attribute * platform_profile_attrs [] = {
408
- & dev_attr_platform_profile_choices .attr ,
409
- & dev_attr_platform_profile .attr ,
408
+ & attr_platform_profile_choices .attr ,
409
+ & attr_platform_profile .attr ,
410
410
NULL
411
411
};
412
412
@@ -575,24 +575,23 @@ EXPORT_SYMBOL_GPL(platform_profile_register);
575
575
/**
576
576
* platform_profile_remove - Unregisters a platform profile class device
577
577
* @dev: Class device
578
- *
579
- * Return: 0
580
578
*/
581
- int platform_profile_remove (struct device * dev )
579
+ void platform_profile_remove (struct device * dev )
582
580
{
583
- struct platform_profile_handler * pprof = to_pprof_handler (dev );
584
- int id ;
581
+ struct platform_profile_handler * pprof ;
582
+
583
+ if (IS_ERR_OR_NULL (dev ))
584
+ return ;
585
+
586
+ pprof = to_pprof_handler (dev );
587
+
585
588
guard (mutex )(& profile_lock );
586
589
587
- id = pprof -> minor ;
590
+ ida_free ( & platform_profile_ida , pprof -> minor ) ;
588
591
device_unregister (& pprof -> dev );
589
- ida_free (& platform_profile_ida , id );
590
592
591
593
sysfs_notify (acpi_kobj , NULL , "platform_profile" );
592
-
593
594
sysfs_update_group (acpi_kobj , & platform_profile_group );
594
-
595
- return 0 ;
596
595
}
597
596
EXPORT_SYMBOL_GPL (platform_profile_remove );
598
597
0 commit comments