Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1174861 > unrolled thread

[GIT PULL] Introduce builtin_platform_driver for non modules

Started byPaul Gortmaker <paul.gortmaker@windriver.com>
First post2015-07-01 03:20 +0200
Last post2015-07-01 03:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [GIT PULL] Introduce builtin_platform_driver for non modules Paul Gortmaker <paul.gortmaker@windriver.com> - 2015-07-01 03:20 +0200
    Re: [GIT PULL] Introduce builtin_platform_driver for non modules Greg KH <gregkh@linuxfoundation.org> - 2015-07-01 03:30 +0200

#1174861 — [GIT PULL] Introduce builtin_platform_driver for non modules

FromPaul Gortmaker <paul.gortmaker@windriver.com>
Date2015-07-01 03:20 +0200
Subject[GIT PULL] Introduce builtin_platform_driver for non modules
Message-ID<pHeQW-2p3-11@gated-at.bofh.it>
We see an increasing number of non-modular drivers using
modular_driver() type register functions.  There are several
downsides to letting this continue unchecked:

1) The code can appear modular to a reader of the code, and they
   won't know if the code really is modular without checking the
   Makefile and Kconfig to see if compilation is governed by a
   bool or tristate.
2) Coders of drivers may be tempted to code up an __exit function
   that is never used, just in order to satisfy the required three
   args of the modular registration function.
3) Non-modular code ends up including the <module.h> which increases
   CPP overhead that they don't need.
4) It hinders us from performing better separation of the module
   init code and the generic init code.

So here we introduce similar macros for builtin drivers.  Then we 
convert builtin drivers (controlled by a bool Kconfig) by making the
following type of mapping:

  module_platform_driver()       --->  builtin_platform_driver()
  module_platform_driver_probe() --->  builtin_platform_driver_probe().

The set of drivers that are converted here are just the ones that
showed up as relying on an implicit include of <module.h> during
a pending header cleanup.  So we convert them here vs. adding
an include of <module.h> to non-modular code to avoid compile fails.
Additonal conversions can be done asynchronously at any time.

Once again, an unused module_exit function that is removed here appears
in the diffstat as an outlier wrt. all the other changes.

Original posting:
   "Introduce builtin_driver and use it for non-modular code"
   https://lkml.kernel.org/r/1431287385-1526-1-git-send-email-paul.gortmaker@windriver.com

Thanks,
Paul.
---

The following changes since commit 0f57d86787d8b1076ea8f9cbdddda2a46d534a27:

  Linux 4.1-rc8 (2015-06-14 15:51:10 -1000)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux.git tags/module-builtin_driver-v4.1-rc8

for you to fetch changes up to 77459a0feca4ae8757a905fd1791f039479e8e1e:

  drivers/clk: convert sunxi/clk-mod0.c to use builtin_platform_driver (2015-06-16 14:12:39 -0400)

----------------------------------------------------------------
Replace module_platform_driver with builtin_platform driver in non modules.

----------------------------------------------------------------
Paul Gortmaker (8):
      platform_device: better support builtin boilerplate avoidance
      drivers/platform: Convert non-modular pdev_bus to use builtin_platform_driver
      drivers/cpuidle: Convert non-modular drivers to use builtin_platform_driver
      drivers/cpufreq: Convert non-modular s5pv210-cpufreq.c to use builtin_platform_driver
      drivers/soc: Convert non-modular tegra/pmc to use builtin_platform_driver
      drivers/soc: Convert non-modular soc-realview to use builtin_platform_driver
      drivers/power: Convert non-modular syscon-reboot to use builtin_platform_driver
      drivers/clk: convert sunxi/clk-mod0.c to use builtin_platform_driver

 drivers/clk/sunxi/clk-mod0.c         |  2 +-
 drivers/cpufreq/s5pv210-cpufreq.c    |  2 +-
 drivers/cpuidle/cpuidle-at91.c       |  3 +--
 drivers/cpuidle/cpuidle-calxeda.c    |  3 +--
 drivers/cpuidle/cpuidle-zynq.c       |  3 +--
 drivers/platform/goldfish/pdev_bus.c | 12 +-----------
 drivers/power/reset/syscon-reboot.c  |  2 +-
 drivers/soc/tegra/pmc.c              |  2 +-
 drivers/soc/versatile/soc-realview.c |  2 +-
 include/linux/device.h               | 22 ++++++++++++++++++++++
 include/linux/platform_device.h      | 23 +++++++++++++++++++++++
 11 files changed, 54 insertions(+), 22 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1174864

FromGreg KH <gregkh@linuxfoundation.org>
Date2015-07-01 03:30 +0200
Message-ID<pHf0B-2A9-3@gated-at.bofh.it>
In reply to#1174861
On Tue, Jun 30, 2015 at 09:19:09PM -0400, Paul Gortmaker wrote:
> We see an increasing number of non-modular drivers using
> modular_driver() type register functions.  There are several
> downsides to letting this continue unchecked:
> 
> 1) The code can appear modular to a reader of the code, and they
>    won't know if the code really is modular without checking the
>    Makefile and Kconfig to see if compilation is governed by a
>    bool or tristate.
> 2) Coders of drivers may be tempted to code up an __exit function
>    that is never used, just in order to satisfy the required three
>    args of the modular registration function.
> 3) Non-modular code ends up including the <module.h> which increases
>    CPP overhead that they don't need.
> 4) It hinders us from performing better separation of the module
>    init code and the generic init code.
> 
> So here we introduce similar macros for builtin drivers.  Then we 
> convert builtin drivers (controlled by a bool Kconfig) by making the
> following type of mapping:
> 
>   module_platform_driver()       --->  builtin_platform_driver()
>   module_platform_driver_probe() --->  builtin_platform_driver_probe().
> 
> The set of drivers that are converted here are just the ones that
> showed up as relying on an implicit include of <module.h> during
> a pending header cleanup.  So we convert them here vs. adding
> an include of <module.h> to non-modular code to avoid compile fails.
> Additonal conversions can be done asynchronously at any time.
> 
> Once again, an unused module_exit function that is removed here appears
> in the diffstat as an outlier wrt. all the other changes.
> 
> Original posting:
>    "Introduce builtin_driver and use it for non-modular code"
>    https://lkml.kernel.org/r/1431287385-1526-1-git-send-email-paul.gortmaker@windriver.com
> 
> Thanks,
> Paul.
> ---
> 
> The following changes since commit 0f57d86787d8b1076ea8f9cbdddda2a46d534a27:
> 
>   Linux 4.1-rc8 (2015-06-14 15:51:10 -1000)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux.git tags/module-builtin_driver-v4.1-rc8
> 
> for you to fetch changes up to 77459a0feca4ae8757a905fd1791f039479e8e1e:
> 
>   drivers/clk: convert sunxi/clk-mod0.c to use builtin_platform_driver (2015-06-16 14:12:39 -0400)

Was this ever in linux-next?  I saw you post this once, don't recall any
real discussion about it.  Ideally some subsystem people would ack it...

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web