All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Len Brown <len.brown@intel.com>
Cc: Zhang Rui <rui.zhang@intel.com>, linux-acpi@vger.kernel.org
Subject: [PATCH 3/4] ACPI: video - rename cdev to cooling_device
Date: Sat, 08 Aug 2009 00:26:31 -0700	[thread overview]
Message-ID: <20090808075642.39D81526EC9@mailhub.coreip.homeip.net> (raw)
In-Reply-To: <20090808072150.2980.3863.stgit@localhost.localdomain>

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(-)

diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 98ade4e..5407e0b 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -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);


  parent reply	other threads:[~2009-08-08  7:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20090808072150.2980.3863.stgit@localhost.localdomain>
2009-08-08  7:26 ` [PATCH 1/4] ACPI: video - fix oops when unloading module Dmitry Torokhov
2009-08-10  1:31   ` Zhang Rui
2009-08-30  2:55     ` Len Brown
2009-08-08  7:26 ` [PATCH 2/4] ACPI: video - fix potential crash when unloading Dmitry Torokhov
2009-08-10  2:11   ` Zhang Rui
2009-08-30  2:59     ` Len Brown
2009-08-08  7:26 ` Dmitry Torokhov [this message]
2009-08-30  3:04   ` [PATCH 3/4] ACPI: video - rename cdev to cooling_device Len Brown
2009-08-08  7:26 ` [PATCH 4/4] ACPI: video - cleanup video device registration Dmitry Torokhov
2009-08-10  2:11   ` Zhang Rui
2009-08-10  5:51     ` Dmitry Torokhov
2009-08-10  6:21       ` Zhang Rui
2009-08-30  3:24   ` Len Brown
2009-09-01  6:30     ` Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090808075642.39D81526EC9@mailhub.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.