linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] firmware: google: Fix minor bugs
@ 2019-11-15 13:48 patrick.rudolph
  2019-11-15 13:48 ` [PATCH 1/3] firmware: google: Release devices before unregistering the bus patrick.rudolph
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: patrick.rudolph @ 2019-11-15 13:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: coreboot, patrick.rudolph, Allison Randal, Alexios Zavras,
	Greg Kroah-Hartman, Thomas Gleixner, Arthur Heymans

From: Patrick Rudolph <patrick.rudolph@9elements.com>

This patch series fixes 3 independent bugs in the google firmware
drivers.

Patch 1-2 do proper cleanup at kernel module unloading.

Patch 3 adds a check if the optional GSMI SMM handler is actually
present in the firmware and responses to the driver.

Arthur Heymans (2):
  firmware: google: Unregister driver_info on failure and exit in gsmi
  firmware: google: Probe for a GSMI handler in firmware

Patrick Rudolph (1):
  firmware: google: Release devices before unregistering the bus

 drivers/firmware/google/coreboot_table.c |  6 ++++++
 drivers/firmware/google/gsmi.c           | 24 ++++++++++++++++++++++++
 2 files changed, 30 insertions(+)

-- 
2.21.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/3] firmware: google: Release devices before unregistering the bus
  2019-11-15 13:48 [PATCH 0/3] firmware: google: Fix minor bugs patrick.rudolph
@ 2019-11-15 13:48 ` patrick.rudolph
  2019-11-15 20:28   ` kbuild test robot
  2019-11-16 13:38   ` Greg Kroah-Hartman
  2019-11-15 13:48 ` [PATCH 2/3] firmware: google: Unregister driver_info on failure and exit in gsmi patrick.rudolph
  2019-11-15 13:48 ` [PATCH 3/3] firmware: google: Probe for a GSMI handler in firmware patrick.rudolph
  2 siblings, 2 replies; 11+ messages in thread
From: patrick.rudolph @ 2019-11-15 13:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: coreboot, patrick.rudolph, Allison Randal, Greg Kroah-Hartman,
	Thomas Gleixner, Alexios Zavras, Arthur Heymans

From: Patrick Rudolph <patrick.rudolph@9elements.com>

Fix a bug where the kernel module can't be loaded after it has been
unloaded as the devices are still present and conflicting with the
to be created coreboot devices.

Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
---
 drivers/firmware/google/coreboot_table.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/firmware/google/coreboot_table.c b/drivers/firmware/google/coreboot_table.c
index 8d132e4f008a..88c6545bebf4 100644
--- a/drivers/firmware/google/coreboot_table.c
+++ b/drivers/firmware/google/coreboot_table.c
@@ -163,8 +163,14 @@ static int coreboot_table_probe(struct platform_device *pdev)
 	return ret;
 }
 
+static int __cb_dev_unregister(struct device *dev, void *dummy)
+{
+	device_unregister(dev);
+}
+
 static int coreboot_table_remove(struct platform_device *pdev)
 {
+	bus_for_each_dev(&coreboot_bus_type, NULL, NULL, __cb_dev_unregister);
 	bus_unregister(&coreboot_bus_type);
 	return 0;
 }
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/3] firmware: google: Unregister driver_info on failure and exit in gsmi
  2019-11-15 13:48 [PATCH 0/3] firmware: google: Fix minor bugs patrick.rudolph
  2019-11-15 13:48 ` [PATCH 1/3] firmware: google: Release devices before unregistering the bus patrick.rudolph
@ 2019-11-15 13:48 ` patrick.rudolph
  2019-11-16 13:39   ` Greg Kroah-Hartman
  2019-11-16 13:40   ` Greg Kroah-Hartman
  2019-11-15 13:48 ` [PATCH 3/3] firmware: google: Probe for a GSMI handler in firmware patrick.rudolph
  2 siblings, 2 replies; 11+ messages in thread
From: patrick.rudolph @ 2019-11-15 13:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: coreboot, patrick.rudolph, Arthur Heymans, Allison Randal,
	Thomas Gleixner, Alexios Zavras, Greg Kroah-Hartman

From: Arthur Heymans <arthur@aheymans.xyz>

Fix a bug where the kernel module couldn't be loaded after unloading,
as the platform driver wasn't released on exit.

Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
---
 drivers/firmware/google/gsmi.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/firmware/google/gsmi.c b/drivers/firmware/google/gsmi.c
index edaa4e5d84ad..974c769b75cf 100644
--- a/drivers/firmware/google/gsmi.c
+++ b/drivers/firmware/google/gsmi.c
@@ -1016,6 +1016,9 @@ static __init int gsmi_init(void)
 	dma_pool_destroy(gsmi_dev.dma_pool);
 	platform_device_unregister(gsmi_dev.pdev);
 	pr_info("gsmi: failed to load: %d\n", ret);
+#ifdef CONFIG_PM
+	platform_driver_unregister(&gsmi_driver_info);
+#endif
 	return ret;
 }
 
@@ -1037,6 +1040,9 @@ static void __exit gsmi_exit(void)
 	gsmi_buf_free(gsmi_dev.name_buf);
 	dma_pool_destroy(gsmi_dev.dma_pool);
 	platform_device_unregister(gsmi_dev.pdev);
+#ifdef CONFIG_PM
+	platform_driver_unregister(&gsmi_driver_info);
+#endif
 }
 
 module_init(gsmi_init);
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/3] firmware: google: Probe for a GSMI handler in firmware
  2019-11-15 13:48 [PATCH 0/3] firmware: google: Fix minor bugs patrick.rudolph
  2019-11-15 13:48 ` [PATCH 1/3] firmware: google: Release devices before unregistering the bus patrick.rudolph
  2019-11-15 13:48 ` [PATCH 2/3] firmware: google: Unregister driver_info on failure and exit in gsmi patrick.rudolph
@ 2019-11-15 13:48 ` patrick.rudolph
  2 siblings, 0 replies; 11+ messages in thread
From: patrick.rudolph @ 2019-11-15 13:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: coreboot, patrick.rudolph, Arthur Heymans, Greg Kroah-Hartman,
	Thomas Gleixner, Allison Randal, Alexios Zavras

From: Arthur Heymans <arthur@aheymans.xyz>

Currently this driver is loaded if the DMI string matches coreboot
and has a proper smi_command in the ACPI FADT table, but a GSMI handler in
SMM is an optional feature in coreboot.

So probe for a SMM GSMI handler before initializing the driver.
If the smihandler leaves the calling argument in %eax in the SMM save state
untouched that generally means the is no handler for GSMI.

Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
---
 drivers/firmware/google/gsmi.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/firmware/google/gsmi.c b/drivers/firmware/google/gsmi.c
index 974c769b75cf..a3eaa9f41125 100644
--- a/drivers/firmware/google/gsmi.c
+++ b/drivers/firmware/google/gsmi.c
@@ -746,6 +746,7 @@ MODULE_DEVICE_TABLE(dmi, gsmi_dmi_table);
 static __init int gsmi_system_valid(void)
 {
 	u32 hash;
+	u16 cmd, result;
 
 	if (!dmi_check_system(gsmi_dmi_table))
 		return -ENODEV;
@@ -780,6 +781,23 @@ static __init int gsmi_system_valid(void)
 		return -ENODEV;
 	}
 
+	/* Test the smihandler with a bogus command. If it leaves the
+	 * calling argument in %ax untouched, there is no handler for
+	 * GSMI commands.
+	 */
+	cmd = GSMI_CALLBACK | 0xff << 8;
+	asm volatile (
+		"outb %%al, %%dx\n\t"
+		: "=a" (result)
+		: "0" (cmd),
+		  "d" (acpi_gbl_FADT.smi_command)
+		: "memory", "cc"
+		);
+	if (cmd == result) {
+		pr_info("gsmi: no gsmi handler in firmware\n");
+		return -ENODEV;
+	}
+
 	/* Found */
 	return 0;
 }
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/3] firmware: google: Release devices before unregistering the bus
  2019-11-15 13:48 ` [PATCH 1/3] firmware: google: Release devices before unregistering the bus patrick.rudolph
@ 2019-11-15 20:28   ` kbuild test robot
  2019-11-16 13:38   ` Greg Kroah-Hartman
  1 sibling, 0 replies; 11+ messages in thread
From: kbuild test robot @ 2019-11-15 20:28 UTC (permalink / raw)
  To: patrick.rudolph
  Cc: kbuild-all, linux-kernel, coreboot, patrick.rudolph,
	Allison Randal, Greg Kroah-Hartman, Thomas Gleixner,
	Alexios Zavras, Arthur Heymans

[-- Attachment #1: Type: text/plain, Size: 1684 bytes --]

Hi,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.4-rc7 next-20191115]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/patrick-rudolph-9elements-com/firmware-google-Fix-minor-bugs/20191116-024230
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 96b95eff4a591dbac582c2590d067e356a18aacb
config: mips-allmodconfig (attached as .config)
compiler: mips-linux-gcc (GCC) 7.4.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.4.0 make.cross ARCH=mips 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/firmware/google/coreboot_table.c: In function '__cb_dev_unregister':
>> drivers/firmware/google/coreboot_table.c:169:1: warning: no return statement in function returning non-void [-Wreturn-type]
    }
    ^

vim +169 drivers/firmware/google/coreboot_table.c

   165	
   166	static int __cb_dev_unregister(struct device *dev, void *dummy)
   167	{
   168		device_unregister(dev);
 > 169	}
   170	

---
0-DAY kernel test infrastructure                 Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 62069 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/3] firmware: google: Release devices before unregistering the bus
  2019-11-15 13:48 ` [PATCH 1/3] firmware: google: Release devices before unregistering the bus patrick.rudolph
  2019-11-15 20:28   ` kbuild test robot
@ 2019-11-16 13:38   ` Greg Kroah-Hartman
  2019-11-18  8:12     ` patrick.rudolph
  1 sibling, 1 reply; 11+ messages in thread
From: Greg Kroah-Hartman @ 2019-11-16 13:38 UTC (permalink / raw)
  To: patrick.rudolph
  Cc: linux-kernel, coreboot, Allison Randal, Thomas Gleixner,
	Alexios Zavras, Arthur Heymans

On Fri, Nov 15, 2019 at 02:48:37PM +0100, patrick.rudolph@9elements.com wrote:
> From: Patrick Rudolph <patrick.rudolph@9elements.com>
> 
> Fix a bug where the kernel module can't be loaded after it has been
> unloaded as the devices are still present and conflicting with the
> to be created coreboot devices.
> 
> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
> ---
>  drivers/firmware/google/coreboot_table.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/firmware/google/coreboot_table.c b/drivers/firmware/google/coreboot_table.c
> index 8d132e4f008a..88c6545bebf4 100644
> --- a/drivers/firmware/google/coreboot_table.c
> +++ b/drivers/firmware/google/coreboot_table.c
> @@ -163,8 +163,14 @@ static int coreboot_table_probe(struct platform_device *pdev)
>  	return ret;
>  }
>  
> +static int __cb_dev_unregister(struct device *dev, void *dummy)
> +{
> +	device_unregister(dev);

Did you build this patch???

Did it work when you tested it?  How?

Please fix up,

greg k-h

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/3] firmware: google: Unregister driver_info on failure and exit in gsmi
  2019-11-15 13:48 ` [PATCH 2/3] firmware: google: Unregister driver_info on failure and exit in gsmi patrick.rudolph
@ 2019-11-16 13:39   ` Greg Kroah-Hartman
  2019-11-16 13:40   ` Greg Kroah-Hartman
  1 sibling, 0 replies; 11+ messages in thread
From: Greg Kroah-Hartman @ 2019-11-16 13:39 UTC (permalink / raw)
  To: patrick.rudolph
  Cc: linux-kernel, coreboot, Arthur Heymans, Allison Randal,
	Thomas Gleixner, Alexios Zavras

On Fri, Nov 15, 2019 at 02:48:38PM +0100, patrick.rudolph@9elements.com wrote:
> From: Arthur Heymans <arthur@aheymans.xyz>
> 
> Fix a bug where the kernel module couldn't be loaded after unloading,
> as the platform driver wasn't released on exit.
> 
> Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
> ---

When sending a patch from someone else, you too have to add your s-o-b
so that we can accept it as that shows the progression of the patch (and
you are accepting responsibility for it being correct.)

Please fix up when you resend.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/3] firmware: google: Unregister driver_info on failure and exit in gsmi
  2019-11-15 13:48 ` [PATCH 2/3] firmware: google: Unregister driver_info on failure and exit in gsmi patrick.rudolph
  2019-11-16 13:39   ` Greg Kroah-Hartman
@ 2019-11-16 13:40   ` Greg Kroah-Hartman
  2019-11-18  7:59     ` patrick.rudolph
  1 sibling, 1 reply; 11+ messages in thread
From: Greg Kroah-Hartman @ 2019-11-16 13:40 UTC (permalink / raw)
  To: patrick.rudolph
  Cc: linux-kernel, coreboot, Arthur Heymans, Allison Randal,
	Thomas Gleixner, Alexios Zavras

On Fri, Nov 15, 2019 at 02:48:38PM +0100, patrick.rudolph@9elements.com wrote:
> From: Arthur Heymans <arthur@aheymans.xyz>
> 
> Fix a bug where the kernel module couldn't be loaded after unloading,
> as the platform driver wasn't released on exit.
> 
> Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
> ---
>  drivers/firmware/google/gsmi.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/firmware/google/gsmi.c b/drivers/firmware/google/gsmi.c
> index edaa4e5d84ad..974c769b75cf 100644
> --- a/drivers/firmware/google/gsmi.c
> +++ b/drivers/firmware/google/gsmi.c
> @@ -1016,6 +1016,9 @@ static __init int gsmi_init(void)
>  	dma_pool_destroy(gsmi_dev.dma_pool);
>  	platform_device_unregister(gsmi_dev.pdev);
>  	pr_info("gsmi: failed to load: %d\n", ret);
> +#ifdef CONFIG_PM
> +	platform_driver_unregister(&gsmi_driver_info);
> +#endif
>  	return ret;
>  }
>  
> @@ -1037,6 +1040,9 @@ static void __exit gsmi_exit(void)
>  	gsmi_buf_free(gsmi_dev.name_buf);
>  	dma_pool_destroy(gsmi_dev.dma_pool);
>  	platform_device_unregister(gsmi_dev.pdev);
> +#ifdef CONFIG_PM
> +	platform_driver_unregister(&gsmi_driver_info);

Why the #ifdef here?  Why does PM change things?

#ifdefs in .c code is really frowned on.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/3] firmware: google: Unregister driver_info on failure and exit in gsmi
  2019-11-16 13:40   ` Greg Kroah-Hartman
@ 2019-11-18  7:59     ` patrick.rudolph
  2019-11-18  8:13       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 11+ messages in thread
From: patrick.rudolph @ 2019-11-18  7:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Arthur Heymans, Allison Randal, Thomas Gleixner,
	Alexios Zavras, furquan

On Sat, 2019-11-16 at 14:40 +0100, Greg Kroah-Hartman wrote:
> On Fri, Nov 15, 2019 at 02:48:38PM +0100, 
> patrick.rudolph@9elements.com wrote:
> > From: Arthur Heymans <arthur@aheymans.xyz>
> > 
> > Fix a bug where the kernel module couldn't be loaded after
> > unloading,
> > as the platform driver wasn't released on exit.
> > 
> > Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
> > ---
> >  drivers/firmware/google/gsmi.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/drivers/firmware/google/gsmi.c
> > b/drivers/firmware/google/gsmi.c
> > index edaa4e5d84ad..974c769b75cf 100644
> > --- a/drivers/firmware/google/gsmi.c
> > +++ b/drivers/firmware/google/gsmi.c
> > @@ -1016,6 +1016,9 @@ static __init int gsmi_init(void)
> >  	dma_pool_destroy(gsmi_dev.dma_pool);
> >  	platform_device_unregister(gsmi_dev.pdev);
> >  	pr_info("gsmi: failed to load: %d\n", ret);
> > +#ifdef CONFIG_PM
> > +	platform_driver_unregister(&gsmi_driver_info);
> > +#endif
> >  	return ret;
> >  }
> >  
> > @@ -1037,6 +1040,9 @@ static void __exit gsmi_exit(void)
> >  	gsmi_buf_free(gsmi_dev.name_buf);
> >  	dma_pool_destroy(gsmi_dev.dma_pool);
> >  	platform_device_unregister(gsmi_dev.pdev);
> > +#ifdef CONFIG_PM
> > +	platform_driver_unregister(&gsmi_driver_info);
> 
> Why the #ifdef here?  Why does PM change things?
> 
The driver is only registered if CONFIG_PM is selected, thus it only
needs to be unregistered if CONFIG_PM is selected.

See 8942b2d5094b0 for reference.

Regards,
Patrick

> #ifdefs in .c code is really frowned on.
> 
> thanks,
> 
> greg k-h


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/3] firmware: google: Release devices before unregistering the bus
  2019-11-16 13:38   ` Greg Kroah-Hartman
@ 2019-11-18  8:12     ` patrick.rudolph
  0 siblings, 0 replies; 11+ messages in thread
From: patrick.rudolph @ 2019-11-18  8:12 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Allison Randal, Thomas Gleixner, Alexios Zavras,
	Arthur Heymans

On Sat, 2019-11-16 at 14:38 +0100, Greg Kroah-Hartman wrote:
> On Fri, Nov 15, 2019 at 02:48:37PM +0100, 
> patrick.rudolph@9elements.com wrote:
> > From: Patrick Rudolph <patrick.rudolph@9elements.com>
> > 
> > Fix a bug where the kernel module can't be loaded after it has been
> > unloaded as the devices are still present and conflicting with the
> > to be created coreboot devices.
> > 
> > Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
> > ---
> >  drivers/firmware/google/coreboot_table.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/drivers/firmware/google/coreboot_table.c
> > b/drivers/firmware/google/coreboot_table.c
> > index 8d132e4f008a..88c6545bebf4 100644
> > --- a/drivers/firmware/google/coreboot_table.c
> > +++ b/drivers/firmware/google/coreboot_table.c
> > @@ -163,8 +163,14 @@ static int coreboot_table_probe(struct
> > platform_device *pdev)
> >  	return ret;
> >  }
> >  
> > +static int __cb_dev_unregister(struct device *dev, void *dummy)
> > +{
> > +	device_unregister(dev);
> 
> Did you build this patch???
> 
> Did it work when you tested it?  How?
> 
It builds without a warning and is working.

It looks like there's no -Werror=return-type in the kernel's Makefile,
which is kind of odd as this is kind of undefined behaviour in C...

Will fix.

> Please fix up,
> 
> greg k-h


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/3] firmware: google: Unregister driver_info on failure and exit in gsmi
  2019-11-18  7:59     ` patrick.rudolph
@ 2019-11-18  8:13       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 11+ messages in thread
From: Greg Kroah-Hartman @ 2019-11-18  8:13 UTC (permalink / raw)
  To: patrick.rudolph
  Cc: linux-kernel, Arthur Heymans, Allison Randal, Thomas Gleixner,
	Alexios Zavras, furquan

On Mon, Nov 18, 2019 at 08:59:32AM +0100, patrick.rudolph@9elements.com wrote:
> On Sat, 2019-11-16 at 14:40 +0100, Greg Kroah-Hartman wrote:
> > On Fri, Nov 15, 2019 at 02:48:38PM +0100, 
> > patrick.rudolph@9elements.com wrote:
> > > From: Arthur Heymans <arthur@aheymans.xyz>
> > > 
> > > Fix a bug where the kernel module couldn't be loaded after
> > > unloading,
> > > as the platform driver wasn't released on exit.
> > > 
> > > Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
> > > ---
> > >  drivers/firmware/google/gsmi.c | 6 ++++++
> > >  1 file changed, 6 insertions(+)
> > > 
> > > diff --git a/drivers/firmware/google/gsmi.c
> > > b/drivers/firmware/google/gsmi.c
> > > index edaa4e5d84ad..974c769b75cf 100644
> > > --- a/drivers/firmware/google/gsmi.c
> > > +++ b/drivers/firmware/google/gsmi.c
> > > @@ -1016,6 +1016,9 @@ static __init int gsmi_init(void)
> > >  	dma_pool_destroy(gsmi_dev.dma_pool);
> > >  	platform_device_unregister(gsmi_dev.pdev);
> > >  	pr_info("gsmi: failed to load: %d\n", ret);
> > > +#ifdef CONFIG_PM
> > > +	platform_driver_unregister(&gsmi_driver_info);
> > > +#endif
> > >  	return ret;
> > >  }
> > >  
> > > @@ -1037,6 +1040,9 @@ static void __exit gsmi_exit(void)
> > >  	gsmi_buf_free(gsmi_dev.name_buf);
> > >  	dma_pool_destroy(gsmi_dev.dma_pool);
> > >  	platform_device_unregister(gsmi_dev.pdev);
> > > +#ifdef CONFIG_PM
> > > +	platform_driver_unregister(&gsmi_driver_info);
> > 
> > Why the #ifdef here?  Why does PM change things?
> > 
> The driver is only registered if CONFIG_PM is selected, thus it only
> needs to be unregistered if CONFIG_PM is selected.
> 
> See 8942b2d5094b0 for reference.

That is a "fun" abuse of the platform driver interface :(

Why not just have this registration of your device for the "normal"
device your driver binds to?  Why create a special platform device
instead?  That means you have double the number of "devices" for your
single real device.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-11-18  8:13 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-15 13:48 [PATCH 0/3] firmware: google: Fix minor bugs patrick.rudolph
2019-11-15 13:48 ` [PATCH 1/3] firmware: google: Release devices before unregistering the bus patrick.rudolph
2019-11-15 20:28   ` kbuild test robot
2019-11-16 13:38   ` Greg Kroah-Hartman
2019-11-18  8:12     ` patrick.rudolph
2019-11-15 13:48 ` [PATCH 2/3] firmware: google: Unregister driver_info on failure and exit in gsmi patrick.rudolph
2019-11-16 13:39   ` Greg Kroah-Hartman
2019-11-16 13:40   ` Greg Kroah-Hartman
2019-11-18  7:59     ` patrick.rudolph
2019-11-18  8:13       ` Greg Kroah-Hartman
2019-11-15 13:48 ` [PATCH 3/3] firmware: google: Probe for a GSMI handler in firmware patrick.rudolph

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).