All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michał Kępień" <kernel@kempniu.pl>
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>
Cc: Alex Hung <alex.hung@canonical.com>,
	platform-driver-x86@vger.kernel.org, linux-leds@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 03/14] dell-smbios: rename buffer to dell_smbios_buffer
Date: Tue, 12 Jan 2016 15:02:49 +0100	[thread overview]
Message-ID: <1452607380-20861-4-git-send-email-kernel@kempniu.pl> (raw)
In-Reply-To: <1452607380-20861-1-git-send-email-kernel@kempniu.pl>

As the SMBIOS buffer is exported from the module, it has to be renamed
to something less generic, so add a "dell_smbios_" prefix to the
variable name.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
---
 drivers/platform/x86/dell-laptop.c |  139 ++++++++++++++++++------------------
 drivers/platform/x86/dell-smbios.c |   20 +++---
 drivers/platform/x86/dell-smbios.h |    2 +-
 3 files changed, 81 insertions(+), 80 deletions(-)

diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
index 572bdca..aaef181 100644
--- a/drivers/platform/x86/dell-laptop.c
+++ b/drivers/platform/x86/dell-laptop.c
@@ -419,18 +419,18 @@ static int dell_rfkill_set(void *data, bool blocked)
 	get_buffer();
 
 	dell_send_request(17, 11);
-	ret = buffer->output[0];
-	status = buffer->output[1];
+	ret = dell_smbios_buffer->output[0];
+	status = dell_smbios_buffer->output[1];
 
 	if (ret != 0)
 		goto out;
 
 	clear_buffer();
 
-	buffer->input[0] = 0x2;
+	dell_smbios_buffer->input[0] = 0x2;
 	dell_send_request(17, 11);
-	ret = buffer->output[0];
-	hwswitch = buffer->output[1];
+	ret = dell_smbios_buffer->output[0];
+	hwswitch = dell_smbios_buffer->output[1];
 
 	/* If the hardware switch controls this radio, and the hardware
 	   switch is disabled, always disable the radio */
@@ -440,9 +440,9 @@ static int dell_rfkill_set(void *data, bool blocked)
 
 	clear_buffer();
 
-	buffer->input[0] = (1 | (radio<<8) | (disable << 16));
+	dell_smbios_buffer->input[0] = (1 | (radio << 8) | (disable << 16));
 	dell_send_request(17, 11);
-	ret = buffer->output[0];
+	ret = dell_smbios_buffer->output[0];
 
  out:
 	release_buffer();
@@ -457,7 +457,8 @@ static void dell_rfkill_update_sw_state(struct rfkill *rfkill, int radio,
 		/* Has hw-switch, sync sw_state to BIOS */
 		int block = rfkill_blocked(rfkill);
 		clear_buffer();
-		buffer->input[0] = (1 | (radio << 8) | (block << 16));
+		dell_smbios_buffer->input[0] = (1 | (radio << 8)
+						  | (block << 16));
 		dell_send_request(17, 11);
 	} else {
 		/* No hw-switch, sync BIOS state to sw_state */
@@ -482,8 +483,8 @@ static void dell_rfkill_query(struct rfkill *rfkill, void *data)
 	get_buffer();
 
 	dell_send_request(17, 11);
-	ret = buffer->output[0];
-	status = buffer->output[1];
+	ret = dell_smbios_buffer->output[0];
+	status = dell_smbios_buffer->output[1];
 
 	if (ret != 0 || !(status & BIT(0))) {
 		release_buffer();
@@ -492,10 +493,10 @@ static void dell_rfkill_query(struct rfkill *rfkill, void *data)
 
 	clear_buffer();
 
-	buffer->input[0] = 0x2;
+	dell_smbios_buffer->input[0] = 0x2;
 	dell_send_request(17, 11);
-	ret = buffer->output[0];
-	hwswitch = buffer->output[1];
+	ret = dell_smbios_buffer->output[0];
+	hwswitch = dell_smbios_buffer->output[1];
 
 	release_buffer();
 
@@ -522,15 +523,15 @@ static int dell_debugfs_show(struct seq_file *s, void *data)
 	get_buffer();
 
 	dell_send_request(17, 11);
-	ret = buffer->output[0];
-	status = buffer->output[1];
+	ret = dell_smbios_buffer->output[0];
+	status = dell_smbios_buffer->output[1];
 
 	clear_buffer();
 
-	buffer->input[0] = 0x2;
+	dell_smbios_buffer->input[0] = 0x2;
 	dell_send_request(17, 11);
-	hwswitch_ret = buffer->output[0];
-	hwswitch_state = buffer->output[1];
+	hwswitch_ret = dell_smbios_buffer->output[0];
+	hwswitch_state = dell_smbios_buffer->output[1];
 
 	release_buffer();
 
@@ -620,20 +621,20 @@ static void dell_update_rfkill(struct work_struct *ignored)
 	get_buffer();
 
 	dell_send_request(17, 11);
-	ret = buffer->output[0];
-	status = buffer->output[1];
+	ret = dell_smbios_buffer->output[0];
+	status = dell_smbios_buffer->output[1];
 
 	if (ret != 0)
 		goto out;
 
 	clear_buffer();
 
-	buffer->input[0] = 0x2;
+	dell_smbios_buffer->input[0] = 0x2;
 	dell_send_request(17, 11);
-	ret = buffer->output[0];
+	ret = dell_smbios_buffer->output[0];
 
 	if (ret == 0 && (status & BIT(0)))
-		hwswitch = buffer->output[1];
+		hwswitch = dell_smbios_buffer->output[1];
 
 	if (wifi_rfkill) {
 		dell_rfkill_update_hw_state(wifi_rfkill, 1, status, hwswitch);
@@ -711,8 +712,8 @@ static int __init dell_setup_rfkill(void)
 
 	get_buffer();
 	dell_send_request(17, 11);
-	ret = buffer->output[0];
-	status = buffer->output[1];
+	ret = dell_smbios_buffer->output[0];
+	status = dell_smbios_buffer->output[1];
 	release_buffer();
 
 	/* dell wireless info smbios call is not supported */
@@ -874,15 +875,15 @@ static int dell_send_intensity(struct backlight_device *bd)
 		return -ENODEV;
 
 	get_buffer();
-	buffer->input[0] = token;
-	buffer->input[1] = bd->props.brightness;
+	dell_smbios_buffer->input[0] = token;
+	dell_smbios_buffer->input[1] = bd->props.brightness;
 
 	if (power_supply_is_system_supplied() > 0)
 		dell_send_request(1, 2);
 	else
 		dell_send_request(1, 1);
 
-	ret = dell_smi_error(buffer->output[0]);
+	ret = dell_smi_error(dell_smbios_buffer->output[0]);
 
 	release_buffer();
 	return ret;
@@ -898,17 +899,17 @@ static int dell_get_intensity(struct backlight_device *bd)
 		return -ENODEV;
 
 	get_buffer();
-	buffer->input[0] = token;
+	dell_smbios_buffer->input[0] = token;
 
 	if (power_supply_is_system_supplied() > 0)
 		dell_send_request(0, 2);
 	else
 		dell_send_request(0, 1);
 
-	if (buffer->output[0])
-		ret = dell_smi_error(buffer->output[0]);
+	if (dell_smbios_buffer->output[0])
+		ret = dell_smi_error(dell_smbios_buffer->output[0]);
 	else
-		ret = buffer->output[1];
+		ret = dell_smbios_buffer->output[1];
 
 	release_buffer();
 	return ret;
@@ -1159,29 +1160,29 @@ static int kbd_get_info(struct kbd_info *info)
 
 	get_buffer();
 
-	buffer->input[0] = 0x0;
+	dell_smbios_buffer->input[0] = 0x0;
 	dell_send_request(4, 11);
-	ret = buffer->output[0];
+	ret = dell_smbios_buffer->output[0];
 
 	if (ret) {
 		ret = dell_smi_error(ret);
 		goto out;
 	}
 
-	info->modes = buffer->output[1] & 0xFFFF;
-	info->type = (buffer->output[1] >> 24) & 0xFF;
-	info->triggers = buffer->output[2] & 0xFF;
-	units = (buffer->output[2] >> 8) & 0xFF;
-	info->levels = (buffer->output[2] >> 16) & 0xFF;
+	info->modes = dell_smbios_buffer->output[1] & 0xFFFF;
+	info->type = (dell_smbios_buffer->output[1] >> 24) & 0xFF;
+	info->triggers = dell_smbios_buffer->output[2] & 0xFF;
+	units = (dell_smbios_buffer->output[2] >> 8) & 0xFF;
+	info->levels = (dell_smbios_buffer->output[2] >> 16) & 0xFF;
 
 	if (units & BIT(0))
-		info->seconds = (buffer->output[3] >> 0) & 0xFF;
+		info->seconds = (dell_smbios_buffer->output[3] >> 0) & 0xFF;
 	if (units & BIT(1))
-		info->minutes = (buffer->output[3] >> 8) & 0xFF;
+		info->minutes = (dell_smbios_buffer->output[3] >> 8) & 0xFF;
 	if (units & BIT(2))
-		info->hours = (buffer->output[3] >> 16) & 0xFF;
+		info->hours = (dell_smbios_buffer->output[3] >> 16) & 0xFF;
 	if (units & BIT(3))
-		info->days = (buffer->output[3] >> 24) & 0xFF;
+		info->days = (dell_smbios_buffer->output[3] >> 24) & 0xFF;
 
  out:
 	release_buffer();
@@ -1247,25 +1248,25 @@ static int kbd_get_state(struct kbd_state *state)
 
 	get_buffer();
 
-	buffer->input[0] = 0x1;
+	dell_smbios_buffer->input[0] = 0x1;
 	dell_send_request(4, 11);
-	ret = buffer->output[0];
+	ret = dell_smbios_buffer->output[0];
 
 	if (ret) {
 		ret = dell_smi_error(ret);
 		goto out;
 	}
 
-	state->mode_bit = ffs(buffer->output[1] & 0xFFFF);
+	state->mode_bit = ffs(dell_smbios_buffer->output[1] & 0xFFFF);
 	if (state->mode_bit != 0)
 		state->mode_bit--;
 
-	state->triggers = (buffer->output[1] >> 16) & 0xFF;
-	state->timeout_value = (buffer->output[1] >> 24) & 0x3F;
-	state->timeout_unit = (buffer->output[1] >> 30) & 0x3;
-	state->als_setting = buffer->output[2] & 0xFF;
-	state->als_value = (buffer->output[2] >> 8) & 0xFF;
-	state->level = (buffer->output[2] >> 16) & 0xFF;
+	state->triggers = (dell_smbios_buffer->output[1] >> 16) & 0xFF;
+	state->timeout_value = (dell_smbios_buffer->output[1] >> 24) & 0x3F;
+	state->timeout_unit = (dell_smbios_buffer->output[1] >> 30) & 0x3;
+	state->als_setting = dell_smbios_buffer->output[2] & 0xFF;
+	state->als_value = (dell_smbios_buffer->output[2] >> 8) & 0xFF;
+	state->level = (dell_smbios_buffer->output[2] >> 16) & 0xFF;
 
  out:
 	release_buffer();
@@ -1277,15 +1278,15 @@ static int kbd_set_state(struct kbd_state *state)
 	int ret;
 
 	get_buffer();
-	buffer->input[0] = 0x2;
-	buffer->input[1] = BIT(state->mode_bit) & 0xFFFF;
-	buffer->input[1] |= (state->triggers & 0xFF) << 16;
-	buffer->input[1] |= (state->timeout_value & 0x3F) << 24;
-	buffer->input[1] |= (state->timeout_unit & 0x3) << 30;
-	buffer->input[2] = state->als_setting & 0xFF;
-	buffer->input[2] |= (state->level & 0xFF) << 16;
+	dell_smbios_buffer->input[0] = 0x2;
+	dell_smbios_buffer->input[1] = BIT(state->mode_bit) & 0xFFFF;
+	dell_smbios_buffer->input[1] |= (state->triggers & 0xFF) << 16;
+	dell_smbios_buffer->input[1] |= (state->timeout_value & 0x3F) << 24;
+	dell_smbios_buffer->input[1] |= (state->timeout_unit & 0x3) << 30;
+	dell_smbios_buffer->input[2] = state->als_setting & 0xFF;
+	dell_smbios_buffer->input[2] |= (state->level & 0xFF) << 16;
 	dell_send_request(4, 11);
-	ret = buffer->output[0];
+	ret = dell_smbios_buffer->output[0];
 	release_buffer();
 
 	return dell_smi_error(ret);
@@ -1324,10 +1325,10 @@ static int kbd_set_token_bit(u8 bit)
 		return -EINVAL;
 
 	get_buffer();
-	buffer->input[0] = da_tokens[id].location;
-	buffer->input[1] = da_tokens[id].value;
+	dell_smbios_buffer->input[0] = da_tokens[id].location;
+	dell_smbios_buffer->input[1] = da_tokens[id].value;
 	dell_send_request(1, 0);
-	ret = buffer->output[0];
+	ret = dell_smbios_buffer->output[0];
 	release_buffer();
 
 	return dell_smi_error(ret);
@@ -1347,10 +1348,10 @@ static int kbd_get_token_bit(u8 bit)
 		return -EINVAL;
 
 	get_buffer();
-	buffer->input[0] = da_tokens[id].location;
+	dell_smbios_buffer->input[0] = da_tokens[id].location;
 	dell_send_request(0, 0);
-	ret = buffer->output[0];
-	val = buffer->output[1];
+	ret = dell_smbios_buffer->output[0];
+	val = dell_smbios_buffer->output[1];
 	release_buffer();
 
 	if (ret)
@@ -2018,10 +2019,10 @@ static int __init dell_init(void)
 	token = find_token_location(BRIGHTNESS_TOKEN);
 	if (token != -1) {
 		get_buffer();
-		buffer->input[0] = token;
+		dell_smbios_buffer->input[0] = token;
 		dell_send_request(0, 2);
-		if (buffer->output[0] == 0)
-			max_intensity = buffer->output[3];
+		if (dell_smbios_buffer->output[0] == 0)
+			max_intensity = dell_smbios_buffer->output[3];
 		release_buffer();
 	}
 
diff --git a/drivers/platform/x86/dell-smbios.c b/drivers/platform/x86/dell-smbios.c
index 758680f..a3898f9 100644
--- a/drivers/platform/x86/dell-smbios.c
+++ b/drivers/platform/x86/dell-smbios.c
@@ -31,8 +31,8 @@ struct calling_interface_structure {
 } __packed;
 
 static DEFINE_MUTEX(buffer_mutex);
-struct calling_interface_buffer *buffer;
-EXPORT_SYMBOL_GPL(buffer);
+struct calling_interface_buffer *dell_smbios_buffer;
+EXPORT_SYMBOL_GPL(dell_smbios_buffer);
 
 static int da_command_address;
 static int da_command_code;
@@ -42,7 +42,7 @@ EXPORT_SYMBOL_GPL(da_tokens);
 
 void clear_buffer(void)
 {
-	memset(buffer, 0, sizeof(struct calling_interface_buffer));
+	memset(dell_smbios_buffer, 0, sizeof(struct calling_interface_buffer));
 }
 EXPORT_SYMBOL_GPL(clear_buffer);
 
@@ -91,15 +91,15 @@ struct calling_interface_buffer *dell_send_request(int class, int select)
 	command.magic = SMI_CMD_MAGIC;
 	command.command_address = da_command_address;
 	command.command_code = da_command_code;
-	command.ebx = virt_to_phys(buffer);
+	command.ebx = virt_to_phys(dell_smbios_buffer);
 	command.ecx = 0x42534931;
 
-	buffer->class = class;
-	buffer->select = select;
+	dell_smbios_buffer->class = class;
+	dell_smbios_buffer->select = select;
 
 	dcdbas_smi_request(&command);
 
-	return buffer;
+	return dell_smbios_buffer;
 }
 EXPORT_SYMBOL_GPL(dell_send_request);
 
@@ -162,8 +162,8 @@ static int __init dell_smbios_init(void)
 	 * Allocate buffer below 4GB for SMI data--only 32-bit physical addr
 	 * is passed to SMI handler.
 	 */
-	buffer = (void *)__get_free_page(GFP_KERNEL | GFP_DMA32);
-	if (!buffer) {
+	dell_smbios_buffer = (void *)__get_free_page(GFP_KERNEL | GFP_DMA32);
+	if (!dell_smbios_buffer) {
 		ret = -ENOMEM;
 		goto fail_buffer;
 	}
@@ -178,7 +178,7 @@ fail_buffer:
 static void __exit dell_smbios_exit(void)
 {
 	kfree(da_tokens);
-	free_page((unsigned long)buffer);
+	free_page((unsigned long)dell_smbios_buffer);
 }
 
 subsys_initcall(dell_smbios_init);
diff --git a/drivers/platform/x86/dell-smbios.h b/drivers/platform/x86/dell-smbios.h
index 0f58ce8..89c787c 100644
--- a/drivers/platform/x86/dell-smbios.h
+++ b/drivers/platform/x86/dell-smbios.h
@@ -35,7 +35,7 @@ struct calling_interface_token {
 	};
 };
 
-extern struct calling_interface_buffer *buffer;
+extern struct calling_interface_buffer *dell_smbios_buffer;
 extern struct calling_interface_token *da_tokens;
 
 void clear_buffer(void);
-- 
1.7.10.4

  parent reply	other threads:[~2016-01-12 14:02 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-12 14:02 [PATCH 00/14] Common Dell SMBIOS API Michał Kępień
2016-01-12 14:02 ` [PATCH 01/14] dell-laptop: extract SMBIOS-related code to a separate module Michał Kępień
2016-01-16 15:19   ` Pali Rohár
2016-01-18 10:34     ` Michał Kępień
2016-01-20  9:21     ` Michał Kępień
2016-01-21  8:35       ` Pali Rohár
2016-01-21 13:06         ` Michał Kępień
2016-01-21 13:14           ` Pali Rohár
2016-01-21 13:39             ` Michał Kępień
2016-02-08 21:42               ` Darren Hart
2016-02-09  8:33                 ` Pali Rohár
2016-02-09 13:58                   ` Michał Kępień
2016-02-09 16:51                   ` Darren Hart
2016-02-09 19:12                     ` Pali Rohár
2016-02-10 23:03                       ` Darren Hart
2016-01-12 14:02 ` [PATCH 02/14] dell-smbios: don't pass a buffer to dell_send_request() Michał Kępień
2016-01-12 14:02 ` Michał Kępień [this message]
2016-01-12 14:02 ` [PATCH 04/14] dell-smbios: rename clear_buffer() to dell_smbios_clear_buffer() Michał Kępień
2016-01-12 14:02 ` [PATCH 05/14] dell-smbios: rename get_buffer() to dell_smbios_get_buffer() Michał Kępień
2016-01-12 14:02 ` [PATCH 06/14] dell-smbios: rename release_buffer() to dell_smbios_release_buffer() Michał Kępień
2016-01-12 14:02 ` [PATCH 07/14] dell-smbios: rename dell_send_request() to dell_smbios_send_request() Michał Kępień
2016-01-12 14:02 ` [PATCH 08/14] dell-smbios: implement new function for finding DMI table 0xDA tokens Michał Kępień
2016-01-12 14:02 ` [PATCH 09/14] dell-laptop: use dell_smbios_find_token() instead of find_token_id() Michał Kępień
2016-01-12 14:02 ` [PATCH 10/14] dell-laptop: use dell_smbios_find_token() instead of find_token_location() Michał Kępień
2016-01-12 14:02 ` [PATCH 11/14] dell-smbios: remove find_token_{id,location}() Michał Kępień
2016-01-12 14:02 ` [PATCH 12/14] dell-smbios: make da_tokens static Michał Kępień
2016-01-12 14:02 ` [PATCH 13/14] dell-led: use dell_smbios_find_token() for finding mic DMI tokens Michał Kępień
2016-01-21 10:52   ` Jacek Anaszewski
2016-01-21 15:00     ` Michał Kępień
2016-01-21 15:42       ` Jacek Anaszewski
2016-01-12 14:03 ` [PATCH 14/14] dell-led: use dell_smbios_send_request() for SMBIOS requests Michał Kępień
2016-01-14 22:43 ` [PATCH 00/14] Common Dell SMBIOS API Darren Hart

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=1452607380-20861-4-git-send-email-kernel@kempniu.pl \
    --to=kernel@kempniu.pl \
    --cc=alex.hung@canonical.com \
    --cc=dvhart@infradead.org \
    --cc=j.anaszewski@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=mjg59@srcf.ucam.org \
    --cc=pali.rohar@gmail.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rpurdie@rpsys.net \
    /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.