linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anson Huang <anson.huang@nxp.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Russell King - ARM Linux <linux@armlinux.org.uk>,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Sascha Hauer <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	Peter Chen <peter.chen@nxp.com>,
	"oleksandr.suvorov@toradex.com" <oleksandr.suvorov@toradex.com>,
	Andreas Kemnade <andreas@kemnade.info>,
	Peng Fan <peng.fan@nxp.com>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Olof Johansson <olof@lixom.net>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Alexandre Torgue <alexandre.torgue@st.com>,
	Patrice Chotard <patrice.chotard@st.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Joel Stanley <joel@jms.id.au>, Lubomir Rintel <lkundrak@v3.sk>,
	Christian Gmeiner <christian.gmeiner@gmail.com>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Leo Li <leoyang.li@nxp.com>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	"michael@walle.cc" <michael@walle.cc>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	dl-linux-imx <linux-imx@nxp.com>
Subject: RE: [PATCH V2 1/4] gpio: mxc: Support module build
Date: Mon, 27 Jul 2020 08:18:56 +0000	[thread overview]
Message-ID: <DB3PR0402MB3916F080E4912B27B18BEADEF5720@DB3PR0402MB3916.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <CAK8P3a13gcF_+dkfxZW0u_YuJ92hY1JukWfzM+e30iM=YUhraQ@mail.gmail.com>

Hi, Arnd


> Subject: Re: [PATCH V2 1/4] gpio: mxc: Support module build
> 
> On Wed, Jul 22, 2020 at 3:50 AM Anson Huang <Anson.Huang@nxp.com>
> wrote:
> >
> > Change config to tristate, add module device table, module author,
> > description and license to support module build for i.MX GPIO driver.
> >
> > As this is a SoC GPIO module, it provides common functions for most of
> > the peripheral devices, such as GPIO pins control, secondary interrupt
> > controller for GPIO pins IRQ etc., without GPIO driver, most of the
> > peripheral devices will NOT work properly, so GPIO module is similar
> > with clock, pinctrl driver that should be loaded ONCE and never
> > unloaded.
> >
> > Since MXC GPIO driver needs to have init function to register syscore
> > ops once, here still use subsys_initcall(), NOT module_platform_driver().
> 
> I'm not following this explanation.
> 
> Why is this driver using syscore_ops rather than
> SIMPLE_DEV_PM_OPS() or similar?

Below is the original patch of using syscore_ops, it has explanation:

commit 1a5287a3dbc34cd0c02c8f64c9131bd23cdfe2bb
Author: Anson Huang <anson.huang@nxp.com>
Date:   Fri Nov 9 04:56:56 2018 +0000

    gpio: mxc: move gpio noirq suspend/resume to syscore phase

    During noirq suspend/resume phase, GPIO irq could arrive
    and its registers like IMR will be changed by irq handle
    process, to make the GPIO registers exactly when it is
    powered ON after resume, move the GPIO noirq suspend/resume
    callback to syscore suspend/resume phase, local irq is
    disabled at this phase so GPIO registers are atomic.

> 
> Why can the driver not unregister the syscore_ops the way it registers them
> when unloading the module?

As per previous discussion, for SoC level GPIO, since it acts as interrupt controller and
most of peripheral devices now depends on GPIO driver for proper function, so it makes
sense to keep SoC level GPIO once loaded and never unload.


> 
> Why do you need subsys_initcall() rather than a device_initcall()?

The subsys_initcal() is done by below commit, the commit log has detail explanation.


commit e188cbf7564fba80e8339b9406e8740f3e495c63
Author: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Date:   Thu Sep 8 04:48:15 2016 +0300

    gpio: mxc: shift gpio_mxc_init() to subsys_initcall level


> 
> If the subsys_initcall() is indeed required here instead of device_initcall(), how
> can it work if the driver is a loadable module?

My understanding is: there are two scenarios, one for built-in case, the other is for loadable module,
the subsys_initcall() is for built-in case according to the upper commit, for loadable
module, the user needs to handle the sequence of modules loaded.

Thanks,
Anson


  reply	other threads:[~2020-07-27  8:19 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-22  1:45 [PATCH V2 1/4] gpio: mxc: Support module build Anson Huang
2020-07-22  1:45 ` [PATCH V2 2/4] arm64: defconfig: Build in CONFIG_GPIO_MXC by default Anson Huang
2020-07-22  1:45 ` [PATCH V2 3/4] ARM: imx_v6_v7_defconfig: " Anson Huang
2020-07-22  1:45 ` [PATCH V2 4/4] ARM: multi_v7_defconfig: " Anson Huang
2020-07-22  8:15 ` [PATCH V2 1/4] gpio: mxc: Support module build Arnd Bergmann
2020-07-27  8:18   ` Anson Huang [this message]
2020-07-27 10:44     ` Arnd Bergmann
2020-07-27 11:21       ` Anson Huang
2020-07-27 11:56         ` Arnd Bergmann
2020-07-27 12:23           ` Anson Huang
2020-07-27 13:41             ` Arnd Bergmann
2020-09-03  1:31               ` Anson Huang
2020-09-12  9:56                 ` Linus Walleij
2020-09-14  2:19                   ` Anson Huang
2020-07-28  8:09           ` Linus Walleij
2020-07-28  7:59       ` Linus Walleij
2020-07-28 11:25         ` Viresh Kumar

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=DB3PR0402MB3916F080E4912B27B18BEADEF5720@DB3PR0402MB3916.eurprd04.prod.outlook.com \
    --to=anson.huang@nxp.com \
    --cc=alexandre.torgue@st.com \
    --cc=andreas@kemnade.info \
    --cc=arnd@arndb.de \
    --cc=bgolaszewski@baylibre.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=christian.gmeiner@gmail.com \
    --cc=festevam@gmail.com \
    --cc=geert+renesas@glider.be \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=joel@jms.id.au \
    --cc=kernel@pengutronix.de \
    --cc=krzk@kernel.org \
    --cc=leoyang.li@nxp.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=lkundrak@v3.sk \
    --cc=m.szyprowski@samsung.com \
    --cc=michael@walle.cc \
    --cc=oleksandr.suvorov@toradex.com \
    --cc=olof@lixom.net \
    --cc=patrice.chotard@st.com \
    --cc=peng.fan@nxp.com \
    --cc=peter.chen@nxp.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=will@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).