From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751267AbdJEB56 (ORCPT ); Wed, 4 Oct 2017 21:57:58 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:48008 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751132AbdJEB55 (ORCPT ); Wed, 4 Oct 2017 21:57:57 -0400 Date: Wed, 4 Oct 2017 18:57:52 -0700 From: Darren Hart To: Mario Limonciello Cc: Andy Shevchenko , LKML , platform-driver-x86@vger.kernel.org, Andy Lutomirski , quasisec@google.com, pali.rohar@gmail.com, rjw@rjwysocki.net, mjg59@google.com, hch@lst.de, Greg KH Subject: Re: [PATCH v4 09/14] platform/x86: dell-smbios: Introduce dispatcher for SMM calls Message-ID: <20171005015752.GD25018@fury> References: <151b8e5bb0be0a9ef88282581d441a4211465ae7.1507156392.git.mario.limonciello@dell.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <151b8e5bb0be0a9ef88282581d441a4211465ae7.1507156392.git.mario.limonciello@dell.com> User-Agent: Mutt/1.8.0 (2017-02-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 04, 2017 at 05:48:35PM -0500, Mario Limonciello wrote: > This splits up the dell-smbios driver into two drivers: > * dell-smbios > * dell-smbios-smm > > dell-smbios can operate with multiple different dispatcher drivers to > perform SMBIOS operations. > > Also modify the interface that dell-laptop and dell-wmi use align to this > model more closely. Rather than a single global buffer being allocated > for all drivers, each driver will allocate and be responsible for it's own > buffer. The pointer will be passed to the calling function and each > dispatcher driver will then internally copy it to the proper location to > perform it's call. > > Signed-off-by: Mario Limonciello > --- > MAINTAINERS | 6 ++ > drivers/platform/x86/Kconfig | 17 ++- > drivers/platform/x86/Makefile | 1 + > drivers/platform/x86/dell-laptop.c | 191 ++++++++++++++++----------------- > drivers/platform/x86/dell-smbios-smm.c | 136 +++++++++++++++++++++++ > drivers/platform/x86/dell-smbios-smm.h | 22 ++++ > drivers/platform/x86/dell-smbios.c | 120 +++++++++++++-------- > drivers/platform/x86/dell-smbios.h | 13 ++- > drivers/platform/x86/dell-wmi.c | 8 +- > 9 files changed, 361 insertions(+), 153 deletions(-) > create mode 100644 drivers/platform/x86/dell-smbios-smm.c > create mode 100644 drivers/platform/x86/dell-smbios-smm.h > ... > +config DELL_SMBIOS_SMM > + tristate "Dell SMBIOS calling interface (SMM implementation)" > + depends on DCDBAS > + default DCDBAS > + select DELL_SMBIOS > + ---help--- > + This provides an implementation for the Dell SMBIOS calling interface > + communicated over ACPI-WMI. Not over ACPI-WMI... over SMM.... right? > diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c > index f42159fd2031..c648bbfcc394 100644 > --- a/drivers/platform/x86/dell-laptop.c > +++ b/drivers/platform/x86/dell-laptop.c > @@ -85,6 +85,7 @@ static struct platform_driver platform_driver = { > } > }; > > +static struct calling_interface_buffer *buffer; > static struct platform_device *platform_device; > static struct backlight_device *dell_backlight_device; > static struct rfkill *wifi_rfkill; > @@ -405,7 +406,6 @@ static const struct dmi_system_id dell_quirks[] __initconst = { > > static int dell_rfkill_set(void *data, bool blocked) > { > - struct calling_interface_buffer *buffer; > int disable = blocked ? 1 : 0; > unsigned long radio = (unsigned long)data; > int hwswitch_bit = (unsigned long)data - 1; > @@ -413,19 +413,21 @@ static int dell_rfkill_set(void *data, bool blocked) > int status; > int ret; > > - buffer = dell_smbios_get_buffer(); > - > - dell_smbios_send_request(17, 11); > + memset(buffer, 0, sizeof(struct calling_interface_buffer)); > + buffer->class = 17; > + buffer->select = 11; Please move these three lines into a function, it's used far far too often to be open coded. The dell_smbios_send_request is a reasonable wrapper which you could just define here as well. This would minimize the change to the driver. -- Darren Hart VMware Open Source Technology Center