From 96f7ef90cc373f805a38f2a3e96a8b1948706954 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Fri, 22 Jan 2016 15:27:22 +0100 Subject: [PATCH] dell-smbios: implement new function for finding DMI table 0xDA tokens MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Ultimately, the da_tokens table should not be exported from dell-smbios. Currently, in some cases, dell-laptop accesses that table's members directly, so implement a new function, dell_smbios_find_token(), which returns a pointer to an entry inside the da_tokens table with the given token ID (or NULL if it is not found). Signed-off-by: Michał Kępień Reviewed-by: Pali Rohár Signed-off-by: Darren Hart --- drivers/platform/x86/dell-smbios.c | 13 +++++++++++++ drivers/platform/x86/dell-smbios.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/drivers/platform/x86/dell-smbios.c b/drivers/platform/x86/dell-smbios.c index 2577cf6aff0f..6a27e4c85a24 100644 --- a/drivers/platform/x86/dell-smbios.c +++ b/drivers/platform/x86/dell-smbios.c @@ -77,6 +77,19 @@ void dell_smbios_send_request(int class, int select) } EXPORT_SYMBOL_GPL(dell_smbios_send_request); +struct calling_interface_token *dell_smbios_find_token(int tokenid) +{ + int i; + + for (i = 0; i < da_num_tokens; i++) { + if (da_tokens[i].tokenID == tokenid) + return &da_tokens[i]; + } + + return NULL; +} +EXPORT_SYMBOL_GPL(dell_smbios_find_token); + int find_token_id(int tokenid) { int i; diff --git a/drivers/platform/x86/dell-smbios.h b/drivers/platform/x86/dell-smbios.h index af653ff29b68..6f6dbe8b05d4 100644 --- a/drivers/platform/x86/dell-smbios.h +++ b/drivers/platform/x86/dell-smbios.h @@ -42,6 +42,8 @@ void dell_smbios_clear_buffer(void); void dell_smbios_release_buffer(void); void dell_smbios_send_request(int class, int select); +struct calling_interface_token *dell_smbios_find_token(int tokenid); + int find_token_id(int tokenid); int find_token_location(int tokenid); #endif -- 2.20.1