From: Grant Likely <grant.likely@secretlab.ca> To: Barry Song <21cnbao@gmail.com> Cc: Linus Walleij <linus.walleij@linaro.org>, Linus Walleij <linus.walleij@stericsson.com>, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Lee Jones <lee.jones@linaro.org>, Jonas Aaberg <jonas.aberg@stericsson.com> Subject: Re: [PATCH 02/10] mach-u300: rewrite gpio driver, move to drivers/gpio Date: Fri, 20 May 2011 00:58:20 -0600 [thread overview] Message-ID: <20110520065820.GC21285@ponder.secretlab.ca> (raw) In-Reply-To: <BANLkTim=iwHY2NhWuK6qmhAdez-5AiJDBw@mail.gmail.com> On Thu, May 19, 2011 at 10:05:25PM +0800, Barry Song wrote: > 2011/5/19 Linus Walleij <linus.walleij@linaro.org>: > > On Thu, May 19, 2011 at 2:35 PM, Barry Song <21cnbao@gmail.com> wrote: > >> 2011/5/19 Linus Walleij <linus.walleij@linaro.org>: > >>> On Thu, May 19, 2011 at 1:38 PM, Barry Song <21cnbao@gmail.com> wrote: > >>>> > >>>> looks like the driver can't be a real module, is the module_exit > >>>> suitable? it looks strange module_exit plays together with > >>>> arch_initcall. > >>> > >>> It's a rather common design pattern in the kernel for early > >>> platform drivers. Either the dependencies are resolved by the > >>> different initlevels or they are resolved in probe order with > >>> loadable modules. Module load will call all initlevels in order. > >>> > >>> It is not elegant but it is common. > >> > >> Linus, thanks for your reply. module_exit and related functions are > >> really useless codes. but people have done that before, then we have > >> no way except following. > >> u300_gpio_exit never gets chance to run and when we disassemble > >> vmlinux, u300_gpio_exit() function should be not in the final binary > >> at all, just a symbol name is left. > > > > I know. I can make the Kconfig options tristate if it makes you feel > > better... > what i feel headache is that it is really difficult and unpredicted > for an internal gpio driver to be removable in lots of read products > because gpio is probably the last bottom module other drivers need. > even it can be called in arch/arm/plat(mach). > > i am not sure whether i am thinking right. gpio and pinmux are more > things of bottom level APIs like dma/clock tree but not like device > drivers. but i really think you have sent a great pinmux core > framework. > No, gpio controllers are just another set of devices, albeit really low level devices that lots of other things depend on. The Linux model does and should support loading/unloading of GPIO drivers providing there is nothing using them. So, yes, in a lot of cases unloading them is simply not possible because board support code depends on them at some point in early boot, but that doesn't mean that they should be treated differently than any other drivers. Oh, and just to be clear, there are also use cases where really low level code has to go and poke GPIO devices directly before any of the driver model subsystems are up and running. That is a different use-case and it is not what I'm talking about here. g. > we once thought we could have a plat-common above all > plat-xxx/mach-xxx, and let the plat-common provide the cores of dma, > clk, gpio, pinmux(pinmux core from you), for example, all common API > and abstract level codes like gpio_request can be there, and SoCs just > implement some hardware-related callbacks required by plat-common in > themselves plat-xxx . > > > > > Linus Walleij > >
WARNING: multiple messages have this Message-ID (diff)
From: grant.likely@secretlab.ca (Grant Likely) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 02/10] mach-u300: rewrite gpio driver, move to drivers/gpio Date: Fri, 20 May 2011 00:58:20 -0600 [thread overview] Message-ID: <20110520065820.GC21285@ponder.secretlab.ca> (raw) In-Reply-To: <BANLkTim=iwHY2NhWuK6qmhAdez-5AiJDBw@mail.gmail.com> On Thu, May 19, 2011 at 10:05:25PM +0800, Barry Song wrote: > 2011/5/19 Linus Walleij <linus.walleij@linaro.org>: > > On Thu, May 19, 2011 at 2:35 PM, Barry Song <21cnbao@gmail.com> wrote: > >> 2011/5/19 Linus Walleij <linus.walleij@linaro.org>: > >>> On Thu, May 19, 2011 at 1:38 PM, Barry Song <21cnbao@gmail.com> wrote: > >>>> > >>>> looks like the driver can't be a real module, is the module_exit > >>>> suitable? it looks strange module_exit plays together with > >>>> arch_initcall. > >>> > >>> It's a rather common design pattern in the kernel for early > >>> platform drivers. Either the dependencies are resolved by the > >>> different initlevels or they are resolved in probe order with > >>> loadable modules. Module load will call all initlevels in order. > >>> > >>> It is not elegant but it is common. > >> > >> Linus, thanks for your reply. module_exit and related functions are > >> really useless codes. but people have done that before, then we have > >> no way except following. > >> u300_gpio_exit never gets chance to run and when we disassemble > >> vmlinux, u300_gpio_exit() ?function should be not in the final binary > >> at all, just a symbol name is left. > > > > I know. I can make the Kconfig options tristate if it makes you feel > > better... > what i feel headache is that it is really difficult and unpredicted > for an internal gpio driver to be removable in lots of read products > because gpio is probably the last bottom module other drivers need. > even it can be called in arch/arm/plat(mach). > > i am not sure whether i am thinking right. gpio and pinmux are more > things of bottom level APIs like dma/clock tree but not like device > drivers. but i really think you have sent a great pinmux core > framework. > No, gpio controllers are just another set of devices, albeit really low level devices that lots of other things depend on. The Linux model does and should support loading/unloading of GPIO drivers providing there is nothing using them. So, yes, in a lot of cases unloading them is simply not possible because board support code depends on them at some point in early boot, but that doesn't mean that they should be treated differently than any other drivers. Oh, and just to be clear, there are also use cases where really low level code has to go and poke GPIO devices directly before any of the driver model subsystems are up and running. That is a different use-case and it is not what I'm talking about here. g. > we once thought we could have a plat-common above all > plat-xxx/mach-xxx, and let the plat-common provide the cores of dma, > clk, gpio, pinmux(pinmux core from you), for example, all common API > and abstract level codes like gpio_request can be there, and SoCs just > implement some hardware-related callbacks required by plat-common in > themselves plat-xxx . > > > > > Linus Walleij > >
next prev parent reply other threads:[~2011-05-20 6:58 UTC|newest] Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-04-27 13:13 [PATCH 02/10] mach-u300: rewrite gpio driver, move to drivers/gpio Linus Walleij 2011-04-27 13:13 ` Linus Walleij 2011-04-27 18:23 ` H Hartley Sweeten 2011-04-27 18:23 ` H Hartley Sweeten 2011-04-28 7:07 ` Linus Walleij 2011-04-28 7:07 ` Linus Walleij 2011-04-28 7:10 ` Linus Walleij 2011-04-28 7:10 ` Linus Walleij 2011-04-28 17:41 ` H Hartley Sweeten 2011-04-28 17:41 ` H Hartley Sweeten 2011-05-13 14:51 ` Linus Walleij 2011-05-13 14:51 ` Linus Walleij 2011-05-19 8:56 ` Shawn Guo 2011-05-19 8:56 ` Shawn Guo 2011-05-19 12:21 ` Linus Walleij 2011-05-19 12:21 ` Linus Walleij 2011-05-19 13:56 ` Shawn Guo 2011-05-19 13:56 ` Shawn Guo 2011-05-19 19:11 ` Sascha Hauer 2011-05-19 19:11 ` Sascha Hauer 2011-05-19 19:30 ` Nicolas Pitre 2011-05-19 19:30 ` Nicolas Pitre 2011-05-20 3:18 ` Shawn Guo 2011-05-20 3:18 ` Shawn Guo 2011-05-20 3:43 ` Kyungmin Park 2011-05-20 3:43 ` Kyungmin Park 2011-05-20 3:54 ` Nicolas Pitre 2011-05-20 3:54 ` Nicolas Pitre 2011-05-19 21:18 ` H Hartley Sweeten 2011-05-19 21:18 ` H Hartley Sweeten 2011-05-20 1:50 ` Jamie Iles 2011-05-20 1:50 ` Jamie Iles 2011-05-20 22:07 ` H Hartley Sweeten 2011-05-20 22:07 ` H Hartley Sweeten 2011-05-21 13:03 ` Jamie Iles 2011-05-21 13:03 ` Jamie Iles 2011-05-20 7:01 ` Grant Likely 2011-05-20 7:01 ` Grant Likely 2011-05-20 7:47 ` Linus Walleij 2011-05-20 7:47 ` Linus Walleij 2011-05-19 11:11 ` Barry Song 2011-05-19 11:38 ` Barry Song 2011-05-19 11:38 ` Barry Song 2011-05-19 12:25 ` Linus Walleij 2011-05-19 12:25 ` Linus Walleij 2011-05-19 12:35 ` Barry Song 2011-05-19 12:35 ` Barry Song 2011-05-19 13:17 ` Linus Walleij 2011-05-19 13:17 ` Linus Walleij 2011-05-19 14:05 ` Barry Song 2011-05-19 14:05 ` Barry Song 2011-05-20 6:58 ` Grant Likely [this message] 2011-05-20 6:58 ` Grant Likely 2011-05-20 6:52 ` Grant Likely 2011-05-20 6:52 ` Grant Likely 2011-05-20 7:46 ` Linus Walleij 2011-05-20 7:46 ` Linus Walleij
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=20110520065820.GC21285@ponder.secretlab.ca \ --to=grant.likely@secretlab.ca \ --cc=21cnbao@gmail.com \ --cc=jonas.aberg@stericsson.com \ --cc=lee.jones@linaro.org \ --cc=linus.walleij@linaro.org \ --cc=linus.walleij@stericsson.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.