@@ -198,7 +198,7 @@ struct acpi_video_device {
struct acpi_device *dev;
struct acpi_video_device_brightness *brightness;
struct backlight_device *backlight;
- struct thermal_cooling_device *cdev;
+ struct thermal_cooling_device *cooling_dev;
struct output_device *output_dev;
};
@@ -387,47 +387,51 @@ static struct output_properties acpi_output_properties = {
/* thermal cooling device callbacks */
-static int video_get_max_state(struct thermal_cooling_device *cdev, unsigned
- long *state)
+static int video_get_max_state(struct thermal_cooling_device *cooling_dev,
+ unsigned long *state)
{
- struct acpi_device *device = cdev->devdata;
+ struct acpi_device *device = cooling_dev->devdata;
struct acpi_video_device *video = acpi_driver_data(device);
*state = video->brightness->count - 3;
return 0;
}
-static int video_get_cur_state(struct thermal_cooling_device *cdev, unsigned
- long *state)
+static int video_get_cur_state(struct thermal_cooling_device *cooling_dev,
+ unsigned long *state)
{
- struct acpi_device *device = cdev->devdata;
+ struct acpi_device *device = cooling_dev->devdata;
struct acpi_video_device *video = acpi_driver_data(device);
+ struct acpi_video_device_brightness *brightness = video->brightness;
unsigned long long level;
int offset;
if (acpi_video_device_lcd_get_level_current(video, &level))
return -EINVAL;
- for (offset = 2; offset < video->brightness->count; offset++)
- if (level == video->brightness->levels[offset]) {
- *state = video->brightness->count - offset - 1;
+
+ for (offset = 2; offset < brightness->count; offset++)
+ if (level == brightness->levels[offset]) {
+ *state = brightness->count - offset - 1;
return 0;
}
return -EINVAL;
}
-static int
-video_set_cur_state(struct thermal_cooling_device *cdev, unsigned long state)
+static int video_set_cur_state(struct thermal_cooling_device *cooling_dev,
+ unsigned long state)
{
- struct acpi_device *device = cdev->devdata;
+ struct acpi_device *device = cooling_dev->devdata;
struct acpi_video_device *video = acpi_driver_data(device);
+ struct acpi_video_device_brightness *brightness = video->brightness;
int level;
- if ( state >= video->brightness->count - 2)
+ if (state >= brightness->count - 2)
return -EINVAL;
- state = video->brightness->count - state;
- level = video->brightness->levels[state -1];
+ state = brightness->count - state;
+ level = brightness->levels[state - 1];
+
return acpi_video_device_lcd_set_level(video, level);
}
@@ -990,9 +994,10 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
if (result)
printk(KERN_ERR PREFIX "Create sysfs link\n");
- device->cdev = thermal_cooling_device_register("LCD",
- device->dev, &video_cooling_ops);
- if (IS_ERR(device->cdev)) {
+ device->cooling_dev =
+ thermal_cooling_device_register("LCD", device->dev,
+ &video_cooling_ops);
+ if (IS_ERR(device->cooling_dev)) {
/*
* Set cdev to NULL so we don't crash trying to
* free it.
@@ -1001,22 +1006,22 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
* device registration failed?
* -- dtor
*/
- device->cdev = NULL;
+ device->cooling_dev = NULL;
return;
}
dev_info(&device->dev->dev, "registered as cooling_device%d\n",
- device->cdev->id);
+ device->cooling_dev->id);
+
result = sysfs_create_link(&device->dev->dev.kobj,
- &device->cdev->device.kobj,
+ &device->cooling_dev->device.kobj,
"thermal_cooling");
if (result)
printk(KERN_ERR PREFIX "Create sysfs link\n");
- result = sysfs_create_link(&device->cdev->device.kobj,
+ result = sysfs_create_link(&device->cooling_dev->device.kobj,
&device->dev->dev.kobj, "device");
if (result)
printk(KERN_ERR PREFIX "Create sysfs link\n");
-
}
if (acpi_video_display_switch_support()) {
@@ -2020,13 +2025,13 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
backlight_device_unregister(device->backlight);
}
- if (device->cdev) {
+ if (device->cooling_dev) {
sysfs_remove_link(&device->dev->dev.kobj,
"thermal_cooling");
- sysfs_remove_link(&device->cdev->device.kobj,
+ sysfs_remove_link(&device->cooling_dev->device.kobj,
"device");
- thermal_cooling_device_unregister(device->cdev);
- device->cdev = NULL;
+ thermal_cooling_device_unregister(device->cooling_dev);
+ device->cooling_dev = NULL;
}
video_output_unregister(device->output_dev);
Cdev name is normally used for ether class devices or character devices so rename member to avoid confusion for casual reader of the code. Signed-off-by: Dmitry Torokhov <dtor@mail.ru> --- drivers/acpi/video.c | 61 +++++++++++++++++++++++++++----------------------- 1 files changed, 33 insertions(+), 28 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html