@@ -289,14 +289,14 @@ static int _remove_hidden_choices(struct device *dev, void *arg)
289
289
290
290
/**
291
291
* platform_profile_choices_show - Show the available profile choices for legacy sysfs interface
292
- * @dev : The device
292
+ * @kobj : The kobject
293
293
* @attr: The attribute
294
294
* @buf: The buffer to write to
295
295
*
296
296
* Return: The number of bytes written
297
297
*/
298
- static ssize_t platform_profile_choices_show (struct device * dev ,
299
- struct device_attribute * attr ,
298
+ static ssize_t platform_profile_choices_show (struct kobject * kobj ,
299
+ struct kobj_attribute * attr ,
300
300
char * buf )
301
301
{
302
302
struct aggregate_choices_data data = {
@@ -371,14 +371,14 @@ static int _store_and_notify(struct device *dev, void *data)
371
371
372
372
/**
373
373
* platform_profile_show - Show the current profile for legacy sysfs interface
374
- * @dev : The device
374
+ * @kobj : The kobject
375
375
* @attr: The attribute
376
376
* @buf: The buffer to write to
377
377
*
378
378
* Return: The number of bytes written
379
379
*/
380
- static ssize_t platform_profile_show (struct device * dev ,
381
- struct device_attribute * attr ,
380
+ static ssize_t platform_profile_show (struct kobject * kobj ,
381
+ struct kobj_attribute * attr ,
382
382
char * buf )
383
383
{
384
384
enum platform_profile_option profile = PLATFORM_PROFILE_LAST ;
@@ -400,15 +400,15 @@ static ssize_t platform_profile_show(struct device *dev,
400
400
401
401
/**
402
402
* platform_profile_store - Set the profile for legacy sysfs interface
403
- * @dev : The device
403
+ * @kobj : The kobject
404
404
* @attr: The attribute
405
405
* @buf: The buffer to read from
406
406
* @count: The number of bytes to read
407
407
*
408
408
* Return: The number of bytes read
409
409
*/
410
- static ssize_t platform_profile_store (struct device * dev ,
411
- struct device_attribute * attr ,
410
+ static ssize_t platform_profile_store (struct kobject * kobj ,
411
+ struct kobj_attribute * attr ,
412
412
const char * buf , size_t count )
413
413
{
414
414
struct aggregate_choices_data data = {
@@ -442,12 +442,12 @@ static ssize_t platform_profile_store(struct device *dev,
442
442
return count ;
443
443
}
444
444
445
- static DEVICE_ATTR_RO (platform_profile_choices );
446
- static DEVICE_ATTR_RW (platform_profile );
445
+ static struct kobj_attribute attr_platform_profile_choices = __ATTR_RO (platform_profile_choices );
446
+ static struct kobj_attribute attr_platform_profile = __ATTR_RW (platform_profile );
447
447
448
448
static struct attribute * platform_profile_attrs [] = {
449
- & dev_attr_platform_profile_choices .attr ,
450
- & dev_attr_platform_profile .attr ,
449
+ & attr_platform_profile_choices .attr ,
450
+ & attr_platform_profile .attr ,
451
451
NULL
452
452
};
453
453
@@ -627,24 +627,23 @@ EXPORT_SYMBOL_GPL(platform_profile_register);
627
627
/**
628
628
* platform_profile_remove - Unregisters a platform profile class device
629
629
* @dev: Class device
630
- *
631
- * Return: 0
632
630
*/
633
- int platform_profile_remove (struct device * dev )
631
+ void platform_profile_remove (struct device * dev )
634
632
{
635
- struct platform_profile_handler * pprof = to_pprof_handler (dev );
636
- int id ;
633
+ struct platform_profile_handler * pprof ;
634
+
635
+ if (IS_ERR_OR_NULL (dev ))
636
+ return ;
637
+
638
+ pprof = to_pprof_handler (dev );
639
+
637
640
guard (mutex )(& profile_lock );
638
641
639
- id = pprof -> minor ;
642
+ ida_free ( & platform_profile_ida , pprof -> minor ) ;
640
643
device_unregister (& pprof -> dev );
641
- ida_free (& platform_profile_ida , id );
642
644
643
645
sysfs_notify (acpi_kobj , NULL , "platform_profile" );
644
-
645
646
sysfs_update_group (acpi_kobj , & platform_profile_group );
646
-
647
- return 0 ;
648
647
}
649
648
EXPORT_SYMBOL_GPL (platform_profile_remove );
650
649
0 commit comments