From patchwork Sat Aug 8 07:26:31 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 40099 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n787QQUv021611 for ; Sat, 8 Aug 2009 07:26:36 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754460AbZHHH0e (ORCPT ); Sat, 8 Aug 2009 03:26:34 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754465AbZHHH0e (ORCPT ); Sat, 8 Aug 2009 03:26:34 -0400 Received: from rv-out-0506.google.com ([209.85.198.239]:39667 "EHLO rv-out-0506.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754460AbZHHH0d (ORCPT ); Sat, 8 Aug 2009 03:26:33 -0400 Received: by rv-out-0506.google.com with SMTP id f6so594921rvb.1 for ; Sat, 08 Aug 2009 00:26:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:subject:to:cc:date :in-reply-to:references:user-agent:mime-version:content-type :content-transfer-encoding:message-id; bh=E3OHfhy7zPFcl/x+tS1OR/IxXp20NiQ2//oLogfDVn4=; b=nR72iqKgTGhJ9n9IsNiO0n7wPLJP/fX+F+zr6I47rcCwTaY5Jp9F5H+LQVK5Ao+D0A z3HwVkLWSU6n+Xwn1yrEsjqJvP3D7hjiTsz5bkwi3YL9pY1zDXQhDJo49VnPN6hRyOlA jXrcNryvJ/zZfEhJi4VfPZnJoCPXhrxOVCDdI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:subject:to:cc:date:in-reply-to:references:user-agent :mime-version:content-type:content-transfer-encoding:message-id; b=PCFaR9EUtHN+yP8qUfkOPf+Qd0wEnDc1o42zTWXKY0syKf6LFQl2lwm8xUs9XnIVTK gV54AXtxMwjIm63vhXeVKzrVX43BQBWf5q0eKnACWvfScIyjabUSAcW++K67cD8DTF7L gd1Xln1mmAHtah9Gt/D27SsOknIEVrfY+wqEw= Received: by 10.140.142.8 with SMTP id p8mr842147rvd.11.1249716395020; Sat, 08 Aug 2009 00:26:35 -0700 (PDT) Received: from mailhub.coreip.homeip.net (c-24-6-153-137.hsd1.ca.comcast.net [24.6.153.137]) by mx.google.com with ESMTPS id b39sm11095300rvf.33.2009.08.08.00.26.33 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 08 Aug 2009 00:26:34 -0700 (PDT) From: Dmitry Torokhov Subject: [PATCH 3/4] ACPI: video - rename cdev to cooling_device To: Len Brown Cc: Zhang Rui , linux-acpi@vger.kernel.org Date: Sat, 08 Aug 2009 00:26:31 -0700 In-Reply-To: <20090808072150.2980.3863.stgit@localhost.localdomain> References: <20090808072150.2980.3863.stgit@localhost.localdomain> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 Message-Id: <20090808075642.39D81526EC9@mailhub.coreip.homeip.net> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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 --- 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 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);