diff mbox

[v2,07/16] dell-smbios: don't return an SMBIOS buffer from dell_smbios_send_request()

Message ID 1453472848-3118-8-git-send-email-kernel@kempniu.pl (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Michał Kępień Jan. 22, 2016, 2:27 p.m. UTC
An SMBIOS buffer pointer does not need to be returned by
dell_smbios_send_request(), because SMBIOS call results are stored in
the buffer passed as input.

Signed-off-by: Micha? K?pie? <kernel@kempniu.pl>
---
 drivers/platform/x86/dell-smbios.c |    5 +----
 drivers/platform/x86/dell-smbios.h |    3 +--
 2 files changed, 2 insertions(+), 6 deletions(-)

Comments

Darren Hart Feb. 8, 2016, 6:44 p.m. UTC | #1
On Fri, Jan 22, 2016 at 03:27:19PM +0100, Micha? K?pie? wrote:
> An SMBIOS buffer pointer does not need to be returned by
> dell_smbios_send_request(), because SMBIOS call results are stored in
> the buffer passed as input.

This should come before 6/16, update the commit message to reflect the module
exported buffer (not the one passed as input), or possibly just merge this patch
and 6/16 as correcting the use of SMBIOS buffer within the module.
Michał Kępień Feb. 9, 2016, 1:27 p.m. UTC | #2
> > An SMBIOS buffer pointer does not need to be returned by
> > dell_smbios_send_request(), because SMBIOS call results are stored in
> > the buffer passed as input.
> 
> This should come before 6/16, update the commit message to reflect the module
> exported buffer (not the one passed as input), or possibly just merge this patch
> and 6/16 as correcting the use of SMBIOS buffer within the module.

I have only now noticed that I phrased the commit message for this patch
rather unfortunately as it inappropriately conveyed my reasoning.  What
I meant by "the buffer passed as input" was not "the buffer passed as an
argument to dell_smbios_send_request()", but rather "the buffer passed
to the SMI handler".  In other words, there is no reason to return a
buffer from dell_smbios_send_request(), because each caller will simply
find their output in the same buffer they used to provide input (no
matter whether the latter is passed as a function argument or accessed
using a module-wide variable).

Anyway, as even the above explanation is hardly a stellar demonstration
of clarity, I believe your idea of resolving this issue may simply be
the best one, thanks.
Darren Hart Feb. 9, 2016, 4:50 p.m. UTC | #3
On Tue, Feb 09, 2016 at 02:27:36PM +0100, Micha? K?pie? wrote:
> > > An SMBIOS buffer pointer does not need to be returned by
> > > dell_smbios_send_request(), because SMBIOS call results are stored in
> > > the buffer passed as input.
> > 
> > This should come before 6/16, update the commit message to reflect the module
> > exported buffer (not the one passed as input), or possibly just merge this patch
> > and 6/16 as correcting the use of SMBIOS buffer within the module.
> 
> I have only now noticed that I phrased the commit message for this patch
> rather unfortunately as it inappropriately conveyed my reasoning.  What
> I meant by "the buffer passed as input" was not "the buffer passed as an
> argument to dell_smbios_send_request()", but rather "the buffer passed
> to the SMI handler".  In other words, there is no reason to return a
> buffer from dell_smbios_send_request(), because each caller will simply
> find their output in the same buffer they used to provide input (no
> matter whether the latter is passed as a function argument or accessed
> using a module-wide variable).
> 
> Anyway, as even the above explanation is hardly a stellar demonstration
> of clarity, I believe your idea of resolving this issue may simply be
> the best one, thanks.

In my tree, I reworded this as:

    dell-smbios: don't return an SMBIOS buffer from dell_smbios_send_request()

    An SMBIOS buffer pointer does not need to be returned by
    dell_smbios_send_request(), because SMBIOS call results are stored in
    the buffer exported by the module.

Is that acceptable?
Michał Kępień Feb. 9, 2016, 5:34 p.m. UTC | #4
> > > > An SMBIOS buffer pointer does not need to be returned by
> > > > dell_smbios_send_request(), because SMBIOS call results are stored in
> > > > the buffer passed as input.
> In my tree, I reworded this as:
> 
>     dell-smbios: don't return an SMBIOS buffer from dell_smbios_send_request()
> 
>     An SMBIOS buffer pointer does not need to be returned by
>     dell_smbios_send_request(), because SMBIOS call results are stored in
>     the buffer exported by the module.
> 
> Is that acceptable?

Sure, thanks.  I saw the edited commit message in your tree before
sending my previous message and I liked it.
diff mbox

Patch

diff --git a/drivers/platform/x86/dell-smbios.c b/drivers/platform/x86/dell-smbios.c
index d573765..b10c613 100644
--- a/drivers/platform/x86/dell-smbios.c
+++ b/drivers/platform/x86/dell-smbios.c
@@ -59,8 +59,7 @@  void dell_smbios_release_buffer(void)
 }
 EXPORT_SYMBOL_GPL(dell_smbios_release_buffer);
 
-struct calling_interface_buffer *
-dell_smbios_send_request(int class, int select)
+void dell_smbios_send_request(int class, int select)
 {
 	struct smi_cmd command;
 
@@ -74,8 +73,6 @@  dell_smbios_send_request(int class, int select)
 	buffer->select = select;
 
 	dcdbas_smi_request(&command);
-
-	return buffer;
 }
 EXPORT_SYMBOL_GPL(dell_smbios_send_request);
 
diff --git a/drivers/platform/x86/dell-smbios.h b/drivers/platform/x86/dell-smbios.h
index 4220ac1..80b5048 100644
--- a/drivers/platform/x86/dell-smbios.h
+++ b/drivers/platform/x86/dell-smbios.h
@@ -41,8 +41,7 @@  extern struct calling_interface_token *da_tokens;
 void dell_smbios_get_buffer(void);
 void dell_smbios_clear_buffer(void);
 void dell_smbios_release_buffer(void);
-struct calling_interface_buffer *
-dell_smbios_send_request(int class, int select);
+void dell_smbios_send_request(int class, int select);
 
 int find_token_id(int tokenid);
 int find_token_location(int tokenid);