Skip to content

Commit

Permalink
dell-laptop: use dell_smbios_find_token() instead of find_token_id()
Browse files Browse the repository at this point in the history
Replace all uses of find_token_id() with dell_smbios_find_token() to
avoid directly accessing the da_tokens table.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
  • Loading branch information
Michał Kępień authored and Darren Hart committed Mar 23, 2016
1 parent 96f7ef9 commit 63c4029
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions drivers/platform/x86/dell-laptop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1326,19 +1326,19 @@ static int kbd_set_state_safe(struct kbd_state *state, struct kbd_state *old)
static int kbd_set_token_bit(u8 bit)
{
struct calling_interface_buffer *buffer;
int id;
struct calling_interface_token *token;
int ret;

if (bit >= ARRAY_SIZE(kbd_tokens))
return -EINVAL;

id = find_token_id(kbd_tokens[bit]);
if (id == -1)
token = dell_smbios_find_token(kbd_tokens[bit]);
if (!token)
return -EINVAL;

buffer = dell_smbios_get_buffer();
buffer->input[0] = da_tokens[id].location;
buffer->input[1] = da_tokens[id].value;
buffer->input[0] = token->location;
buffer->input[1] = token->value;
dell_smbios_send_request(1, 0);
ret = buffer->output[0];
dell_smbios_release_buffer();
Expand All @@ -1349,19 +1349,19 @@ static int kbd_set_token_bit(u8 bit)
static int kbd_get_token_bit(u8 bit)
{
struct calling_interface_buffer *buffer;
int id;
struct calling_interface_token *token;
int ret;
int val;

if (bit >= ARRAY_SIZE(kbd_tokens))
return -EINVAL;

id = find_token_id(kbd_tokens[bit]);
if (id == -1)
token = dell_smbios_find_token(kbd_tokens[bit]);
if (!token)
return -EINVAL;

buffer = dell_smbios_get_buffer();
buffer->input[0] = da_tokens[id].location;
buffer->input[0] = token->location;
dell_smbios_send_request(0, 0);
ret = buffer->output[0];
val = buffer->output[1];
Expand All @@ -1370,7 +1370,7 @@ static int kbd_get_token_bit(u8 bit)
if (ret)
return dell_smi_error(ret);

return (val == da_tokens[id].value);
return (val == token->value);
}

static int kbd_get_first_active_token_bit(void)
Expand Down Expand Up @@ -1472,7 +1472,7 @@ static inline void kbd_init_tokens(void)
int i;

for (i = 0; i < ARRAY_SIZE(kbd_tokens); ++i)
if (find_token_id(kbd_tokens[i]) != -1)
if (dell_smbios_find_token(kbd_tokens[i]))
kbd_token_bits |= BIT(i);
}

Expand Down

0 comments on commit 63c4029

Please sign in to comment.