kfree(pos);
}
-static const struct class thermal_class = {
- .name = "thermal",
-};
+static struct class *thermal_class __ro_after_init;
static bool thermal_class_unavailable __ro_after_init = true;
static inline
cdev->np = np;
cdev->ops = ops;
cdev->updated = false;
- cdev->device.class = &thermal_class;
+ cdev->device.class = thermal_class;
cdev->device.release = thermal_cdev_release;
cdev->devdata = devdata;
if (!tz->ops.critical)
tz->ops.critical = thermal_zone_device_critical;
- tz->device.class = &thermal_class;
+ tz->device.class = thermal_class;
tz->device.release = thermal_zone_device_release;
tz->devdata = devdata;
tz->num_trips = num_trips;
static int __init thermal_init(void)
{
+ struct class *tc;
int result;
thermal_debug_init();
if (result)
goto unregister_governors;
- result = class_register(&thermal_class);
- if (result)
+ tc = class_create("thermal");
+ if (IS_ERR(tc)) {
+ result = PTR_ERR(tc);
goto unregister_governors;
+ }
+ thermal_class = tc;
thermal_class_unavailable = false;
return 0;