|
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 | const struct platform_profile_ops *ops; |
@@ -90,8 +89,8 @@ static int _notify_class_profile(struct device *dev, void *data) |
90 | 89 | struct platform_profile_handler *handler = to_pprof_handler(dev); |
91 | 90 |
|
92 | 91 | lockdep_assert_held(&profile_lock); |
93 | | - sysfs_notify(&handler->class_dev.kobj, NULL, "profile"); |
94 | | - kobject_uevent(&handler->class_dev.kobj, KOBJ_CHANGE); |
| 92 | + sysfs_notify(&handler->dev.kobj, NULL, "profile"); |
| 93 | + kobject_uevent(&handler->dev.kobj, KOBJ_CHANGE); |
95 | 94 |
|
96 | 95 | return 0; |
97 | 96 | } |
@@ -517,12 +516,12 @@ struct device *platform_profile_register(struct device *dev, const char *name, |
517 | 516 | pprof->name = name; |
518 | 517 | pprof->ops = ops; |
519 | 518 | pprof->minor = minor; |
520 | | - pprof->class_dev.class = &platform_profile_class; |
521 | | - pprof->class_dev.parent = dev; |
522 | | - dev_set_drvdata(&pprof->class_dev, drvdata); |
523 | | - dev_set_name(&pprof->class_dev, "platform-profile-%d", pprof->minor); |
| 519 | + pprof->dev.class = &platform_profile_class; |
| 520 | + pprof->dev.parent = dev; |
| 521 | + dev_set_drvdata(&pprof->dev, drvdata); |
| 522 | + dev_set_name(&pprof->dev, "platform-profile-%d", pprof->minor); |
524 | 523 | /* device_register() takes ownership of pprof/ppdev */ |
525 | | - ppdev = &no_free_ptr(pprof)->class_dev; |
| 524 | + ppdev = &no_free_ptr(pprof)->dev; |
526 | 525 | err = device_register(ppdev); |
527 | 526 | if (err) { |
528 | 527 | put_device(ppdev); |
@@ -554,7 +553,7 @@ int platform_profile_remove(struct device *dev) |
554 | 553 | guard(mutex)(&profile_lock); |
555 | 554 |
|
556 | 555 | id = pprof->minor; |
557 | | - device_unregister(&pprof->class_dev); |
| 556 | + device_unregister(&pprof->dev); |
558 | 557 | ida_free(&platform_profile_ida, id); |
559 | 558 |
|
560 | 559 | sysfs_notify(acpi_kobj, NULL, "platform_profile"); |
|
0 commit comments