Revert "thermal/drivers/core: Use a char pointer for the cooling device name"
This reverts commit dcf5ffc91c
which is
commit 58483761810087e5ffdf36e84ac1bf26df909097 upstream.
It breaks the Android kernel ABI and is not needed for Android devices,
so it is safe to revert for now. If it is determined that it is needed
in the future, it can be brought back in an abi-preserving way.
Bug: 161946584
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I1554f3e0e4972d5553d62dc7b994303708c617b5
This commit is contained in:
@@ -133,7 +133,7 @@ static int mlxsw_get_cooling_device_idx(struct mlxsw_thermal *thermal,
|
|||||||
/* Allow mlxsw thermal zone binding to an external cooling device */
|
/* Allow mlxsw thermal zone binding to an external cooling device */
|
||||||
for (i = 0; i < ARRAY_SIZE(mlxsw_thermal_external_allowed_cdev); i++) {
|
for (i = 0; i < ARRAY_SIZE(mlxsw_thermal_external_allowed_cdev); i++) {
|
||||||
if (strnstr(cdev->type, mlxsw_thermal_external_allowed_cdev[i],
|
if (strnstr(cdev->type, mlxsw_thermal_external_allowed_cdev[i],
|
||||||
strlen(cdev->type)))
|
sizeof(cdev->type)))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1095,7 +1095,10 @@ __thermal_cooling_device_register(struct device_node *np,
|
|||||||
{
|
{
|
||||||
struct thermal_cooling_device *cdev;
|
struct thermal_cooling_device *cdev;
|
||||||
struct thermal_zone_device *pos = NULL;
|
struct thermal_zone_device *pos = NULL;
|
||||||
int ret;
|
int result;
|
||||||
|
|
||||||
|
if (type && strlen(type) >= THERMAL_NAME_LENGTH)
|
||||||
|
return ERR_PTR(-EINVAL);
|
||||||
|
|
||||||
if (!ops || !ops->get_max_state || !ops->get_cur_state ||
|
if (!ops || !ops->get_max_state || !ops->get_cur_state ||
|
||||||
!ops->set_cur_state)
|
!ops->set_cur_state)
|
||||||
@@ -1105,17 +1108,14 @@ __thermal_cooling_device_register(struct device_node *np,
|
|||||||
if (!cdev)
|
if (!cdev)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
ret = ida_simple_get(&thermal_cdev_ida, 0, 0, GFP_KERNEL);
|
result = ida_simple_get(&thermal_cdev_ida, 0, 0, GFP_KERNEL);
|
||||||
if (ret < 0)
|
if (result < 0) {
|
||||||
goto out_kfree_cdev;
|
kfree(cdev);
|
||||||
cdev->id = ret;
|
return ERR_PTR(result);
|
||||||
|
|
||||||
cdev->type = kstrdup(type ? type : "", GFP_KERNEL);
|
|
||||||
if (!cdev->type) {
|
|
||||||
ret = -ENOMEM;
|
|
||||||
goto out_ida_remove;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cdev->id = result;
|
||||||
|
strlcpy(cdev->type, type ? : "", sizeof(cdev->type));
|
||||||
mutex_init(&cdev->lock);
|
mutex_init(&cdev->lock);
|
||||||
INIT_LIST_HEAD(&cdev->thermal_instances);
|
INIT_LIST_HEAD(&cdev->thermal_instances);
|
||||||
cdev->np = np;
|
cdev->np = np;
|
||||||
@@ -1125,9 +1125,12 @@ __thermal_cooling_device_register(struct device_node *np,
|
|||||||
cdev->devdata = devdata;
|
cdev->devdata = devdata;
|
||||||
thermal_cooling_device_setup_sysfs(cdev);
|
thermal_cooling_device_setup_sysfs(cdev);
|
||||||
dev_set_name(&cdev->device, "cooling_device%d", cdev->id);
|
dev_set_name(&cdev->device, "cooling_device%d", cdev->id);
|
||||||
ret = device_register(&cdev->device);
|
result = device_register(&cdev->device);
|
||||||
if (ret)
|
if (result) {
|
||||||
goto out_kfree_type;
|
ida_simple_remove(&thermal_cdev_ida, cdev->id);
|
||||||
|
put_device(&cdev->device);
|
||||||
|
return ERR_PTR(result);
|
||||||
|
}
|
||||||
|
|
||||||
/* Add 'this' new cdev to the global cdev list */
|
/* Add 'this' new cdev to the global cdev list */
|
||||||
mutex_lock(&thermal_list_lock);
|
mutex_lock(&thermal_list_lock);
|
||||||
@@ -1145,14 +1148,6 @@ __thermal_cooling_device_register(struct device_node *np,
|
|||||||
mutex_unlock(&thermal_list_lock);
|
mutex_unlock(&thermal_list_lock);
|
||||||
|
|
||||||
return cdev;
|
return cdev;
|
||||||
|
|
||||||
out_kfree_type:
|
|
||||||
kfree(cdev->type);
|
|
||||||
put_device(&cdev->device);
|
|
||||||
out_ida_remove:
|
|
||||||
ida_simple_remove(&thermal_cdev_ida, cdev->id);
|
|
||||||
out_kfree_cdev:
|
|
||||||
return ERR_PTR(ret);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1311,7 +1306,6 @@ void thermal_cooling_device_unregister(struct thermal_cooling_device *cdev)
|
|||||||
ida_simple_remove(&thermal_cdev_ida, cdev->id);
|
ida_simple_remove(&thermal_cdev_ida, cdev->id);
|
||||||
device_del(&cdev->device);
|
device_del(&cdev->device);
|
||||||
thermal_cooling_device_destroy_sysfs(cdev);
|
thermal_cooling_device_destroy_sysfs(cdev);
|
||||||
kfree(cdev->type);
|
|
||||||
put_device(&cdev->device);
|
put_device(&cdev->device);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(thermal_cooling_device_unregister);
|
EXPORT_SYMBOL_GPL(thermal_cooling_device_unregister);
|
||||||
|
@@ -96,7 +96,7 @@ struct thermal_cooling_device_ops {
|
|||||||
|
|
||||||
struct thermal_cooling_device {
|
struct thermal_cooling_device {
|
||||||
int id;
|
int id;
|
||||||
char *type;
|
char type[THERMAL_NAME_LENGTH];
|
||||||
struct device device;
|
struct device device;
|
||||||
struct device_node *np;
|
struct device_node *np;
|
||||||
void *devdata;
|
void *devdata;
|
||||||
|
Reference in New Issue
Block a user