From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: patrick.rudolph@9elements.com
Cc: linux-kernel@vger.kernel.org,
Arthur Heymans <arthur@aheymans.xyz>,
Allison Randal <allison@lohutok.net>,
Thomas Gleixner <tglx@linutronix.de>,
Alexios Zavras <alexios.zavras@intel.com>,
furquan@chromium.org
Subject: Re: [PATCH 2/3] firmware: google: Unregister driver_info on failure and exit in gsmi
Date: Mon, 18 Nov 2019 09:13:41 +0100 [thread overview]
Message-ID: <20191118081341.GA133533@kroah.com> (raw)
In-Reply-To: <246585089f8b0730bc4e0ddae2e6a877009e1307.camel@9elements.com>
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
next prev parent reply other threads:[~2019-11-18 8:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2019-11-15 13:48 ` [PATCH 3/3] firmware: google: Probe for a GSMI handler in firmware patrick.rudolph
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191118081341.GA133533@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=alexios.zavras@intel.com \
--cc=allison@lohutok.net \
--cc=arthur@aheymans.xyz \
--cc=furquan@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patrick.rudolph@9elements.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox