|
10 | 10 | #include <linux/platform_profile.h> |
11 | 11 | #include <linux/sysfs.h> |
12 | 12 |
|
13 | | -#define to_pprof_handler(d) (container_of(d, struct platform_profile_handler, class_dev)) |
| 13 | +#define to_pprof_handler(d) (container_of(d, struct platform_profile_handler, dev)) |
14 | 14 |
|
15 | 15 | static DEFINE_MUTEX(profile_lock); |
16 | 16 |
|
17 | 17 | struct platform_profile_handler { |
18 | 18 | const char *name; |
19 | | - struct device *dev; |
20 | | - struct device class_dev; |
| 19 | + struct device dev; |
21 | 20 | int minor; |
22 | 21 | unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)]; |
23 | 22 | unsigned long hidden_choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)]; |
@@ -96,8 +95,8 @@ static int _notify_class_profile(struct device *dev, void *data) |
96 | 95 | struct platform_profile_handler *handler = to_pprof_handler(dev); |
97 | 96 |
|
98 | 97 | lockdep_assert_held(&profile_lock); |
99 | | - sysfs_notify(&handler->class_dev.kobj, NULL, "profile"); |
100 | | - kobject_uevent(&handler->class_dev.kobj, KOBJ_CHANGE); |
| 98 | + sysfs_notify(&handler->dev.kobj, NULL, "profile"); |
| 99 | + kobject_uevent(&handler->dev.kobj, KOBJ_CHANGE); |
101 | 100 |
|
102 | 101 | return 0; |
103 | 102 | } |
@@ -569,12 +568,12 @@ struct device *platform_profile_register(struct device *dev, const char *name, |
569 | 568 | pprof->name = name; |
570 | 569 | pprof->ops = ops; |
571 | 570 | pprof->minor = minor; |
572 | | - pprof->class_dev.class = &platform_profile_class; |
573 | | - pprof->class_dev.parent = dev; |
574 | | - dev_set_drvdata(&pprof->class_dev, drvdata); |
575 | | - dev_set_name(&pprof->class_dev, "platform-profile-%d", pprof->minor); |
| 571 | + pprof->dev.class = &platform_profile_class; |
| 572 | + pprof->dev.parent = dev; |
| 573 | + dev_set_drvdata(&pprof->dev, drvdata); |
| 574 | + dev_set_name(&pprof->dev, "platform-profile-%d", pprof->minor); |
576 | 575 | /* device_register() takes ownership of pprof/ppdev */ |
577 | | - ppdev = &no_free_ptr(pprof)->class_dev; |
| 576 | + ppdev = &no_free_ptr(pprof)->dev; |
578 | 577 | err = device_register(ppdev); |
579 | 578 | if (err) { |
580 | 579 | put_device(ppdev); |
@@ -606,7 +605,7 @@ int platform_profile_remove(struct device *dev) |
606 | 605 | guard(mutex)(&profile_lock); |
607 | 606 |
|
608 | 607 | id = pprof->minor; |
609 | | - device_unregister(&pprof->class_dev); |
| 608 | + device_unregister(&pprof->dev); |
610 | 609 | ida_free(&platform_profile_ida, id); |
611 | 610 |
|
612 | 611 | sysfs_notify(acpi_kobj, NULL, "platform_profile"); |
|
0 commit comments