Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1315026

[PATCH v2 12/16] dell-laptop: use dell_smbios_find_token() instead of find_token_location()

Path csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Michał Kępień <kernel@kempniu.pl>
Newsgroups linux.kernel
Subject [PATCH v2 12/16] dell-laptop: use dell_smbios_find_token() instead of find_token_location()
Date Fri, 22 Jan 2016 15:30:02 +0100
Message-ID <qTKSS-5dr-29@gated-at.bofh.it> (permalink)
References <qTKSR-5dr-7@gated-at.bofh.it>
X-Original-To Darren Hart <dvhart@infradead.org>, Matthew Garrett <mjg59@srcf.ucam.org>, Pali Rohár <pali.rohar@gmail.com>, Richard Purdie <rpurdie@rpsys.net>, Jacek Anaszewski <j.anaszewski@samsung.com>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=kempniu.pl; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=mlMJC/ly6x8MnjLyYt8pIDJQRnthftZWmkLDyICgTxQ=; b=MLh0wzQAK+hTaTkGqAN+fg7bhxqlFQAiOaIj2P3jLU6enl/9xwD3/bfdd68Pu5J7zt P0F4apomhUuVT44Ga2L53R+5quTdEybbNrEc3qxNJakkpCDmV7Ump8Un314Y+raBdmtM uLetjSYRpc66lkW1UKZIUuf0xVTIVfmSBx6HA=
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=mlMJC/ly6x8MnjLyYt8pIDJQRnthftZWmkLDyICgTxQ=; b=Awq1c5bAsDZtEzCbCLZuepPQ731NsCfnXdYf3P7YnSZnhrRMcU08yg4tanwwKYu4ZQ CDyLufen6svcNBtavdsT3SGECydfGEiF8Et2RLC0YcejZv2VZqc6oPo7ps2CZpAqqZP9 Fp3A/cFYJM26hersf88qAdU23w0guliZPDqQqbYaL4FwNPLMcPQcOiew2DsbN8V6bDD4 vJeUfu8V4ruEi3k536J3xK17jCbR288LfDvQnJuBHmym+vuP6MMN+j/1OGS66k97nCVJ hbFXKSzUt74T0kqTNuj1ya9O2C7xAjXilGwN3gFb4a21/bXKm7M1gi1HUbj3T4nN3mxJ UEjg==
X-Gm-Message-State AG10YOTFkDlTkn7ym7IPSdgdlKfG07oaruseS9Jw6xuKKCKhftE1TC+J3AguocKms0mp8Q==
X-Received by 10.25.90.13 with SMTP id o13mr1416643lfb.114.1453472875827; Fri, 22 Jan 2016 06:27:55 -0800 (PST)
X-Mailer git-send-email 1.7.10.4
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 78
Organization linux.* mail to news gateway
X-Original-Cc platform-driver-x86@vger.kernel.org, linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
X-Original-Date Fri, 22 Jan 2016 15:27:24 +0100
X-Original-Message-ID <1453472848-3118-13-git-send-email-kernel@kempniu.pl>
X-Original-References <1453472848-3118-1-git-send-email-kernel@kempniu.pl>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1315026

Show key headers only | View raw


Replace all uses of find_token_location() with dell_smbios_find_token()
to avoid directly accessing the da_tokens table.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
---
 drivers/platform/x86/dell-laptop.c |   24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
index 4d1694d..76064c8 100644
--- a/drivers/platform/x86/dell-laptop.c
+++ b/drivers/platform/x86/dell-laptop.c
@@ -874,15 +874,15 @@ static void dell_cleanup_rfkill(void)
 static int dell_send_intensity(struct backlight_device *bd)
 {
 	struct calling_interface_buffer *buffer;
-	int token;
+	struct calling_interface_token *token;
 	int ret;
 
-	token = find_token_location(BRIGHTNESS_TOKEN);
-	if (token == -1)
+	token = dell_smbios_find_token(BRIGHTNESS_TOKEN);
+	if (!token)
 		return -ENODEV;
 
 	buffer = dell_smbios_get_buffer();
-	buffer->input[0] = token;
+	buffer->input[0] = token->location;
 	buffer->input[1] = bd->props.brightness;
 
 	if (power_supply_is_system_supplied() > 0)
@@ -899,15 +899,15 @@ static int dell_send_intensity(struct backlight_device *bd)
 static int dell_get_intensity(struct backlight_device *bd)
 {
 	struct calling_interface_buffer *buffer;
-	int token;
+	struct calling_interface_token *token;
 	int ret;
 
-	token = find_token_location(BRIGHTNESS_TOKEN);
-	if (token == -1)
+	token = dell_smbios_find_token(BRIGHTNESS_TOKEN);
+	if (!token)
 		return -ENODEV;
 
 	buffer = dell_smbios_get_buffer();
-	buffer->input[0] = token;
+	buffer->input[0] = token->location;
 
 	if (power_supply_is_system_supplied() > 0)
 		dell_smbios_send_request(0, 2);
@@ -1987,8 +1987,8 @@ static void kbd_led_exit(void)
 static int __init dell_init(void)
 {
 	struct calling_interface_buffer *buffer;
+	struct calling_interface_token *token;
 	int max_intensity = 0;
-	int token;
 	int ret;
 
 	if (!dmi_check_system(dell_device_table))
@@ -2030,10 +2030,10 @@ static int __init dell_init(void)
 	if (acpi_video_get_backlight_type() != acpi_backlight_vendor)
 		return 0;
 
-	token = find_token_location(BRIGHTNESS_TOKEN);
-	if (token != -1) {
+	token = dell_smbios_find_token(BRIGHTNESS_TOKEN);
+	if (token) {
 		buffer = dell_smbios_get_buffer();
-		buffer->input[0] = token;
+		buffer->input[0] = token->location;
 		dell_smbios_send_request(0, 2);
 		if (buffer->output[0] == 0)
 			max_intensity = buffer->output[3];
-- 
1.7.10.4

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH v2 12/16] dell-laptop: use dell_smbios_find_token() instead of find_token_location() Michał Kępień <kernel@kempniu.pl> - 2016-01-22 15:30 +0100

csiph-web