linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Gortmaker <paul.gortmaker@windriver.com>
To: linux-kernel@vger.kernel.org
Cc: linux-arch@vger.kernel.org,
	Paul Gortmaker <paul.gortmaker@windriver.com>
Subject: [PATCH 29/73] drivers/platform: don't use modular register in non-modular pdev_bus.c
Date: Tue, 21 Jan 2014 16:22:32 -0500	[thread overview]
Message-ID: <1390339396-3479-30-git-send-email-paul.gortmaker@windriver.com> (raw)
In-Reply-To: <1390339396-3479-1-git-send-email-paul.gortmaker@windriver.com>

This driver is configured with a Kconfig option that is
declared as a bool.  Hence it is not possible for the code
to be built as modular.  However the code is currently using
the module_platform_driver() macro for driver registration.

While this currently works, we really don't want to be including
the module.h header in non-modular code, which we'll be forced
to do, pending some upcoming code relocation from init.h into
module.h.  So we fix it now by using the non-modular equivalent.

With some macro detangulation, and a little help from cpp, we can
see that module_platform_driver(goldfish_pdev_bus_driver) gets
roughly translated into:

  static int __init goldfish_pdev_bus_driver_init(void)
  {
        return platform_driver_register(&goldfish_pdev_bus_driver);
  }
  module_init(goldfish_pdev_bus_driver_init);

  static void __exit goldfish_pdev_bus_driver_exit(void)
  {
        platform_driver_unregister(&goldfish_pdev_bus_driver);
  }
  module_exit(goldfish_pdev_bus_driver_exit);

And since we've already established that the code is non-modular,
we can completely drop any code relating to module_exit.  For non
modular code, module_init beomes __initcall.  But direct use of
__initcall is discouraged, vs. one of the priority categorized
subgroups.  As __initcall gets mapped onto device_initcall, our
use of device_initcall directly in this change means that the
runtime impact is zero -- they will remain at level 6 in the
initcall ordering.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/platform/goldfish/pdev_bus.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/platform/goldfish/pdev_bus.c b/drivers/platform/goldfish/pdev_bus.c
index 92cc4cf..e4e999f 100644
--- a/drivers/platform/goldfish/pdev_bus.c
+++ b/drivers/platform/goldfish/pdev_bus.c
@@ -221,20 +221,15 @@ free_resources:
 	return ret;
 }
 
-static int goldfish_pdev_bus_remove(struct platform_device *pdev)
-{
-	iounmap(pdev_bus_base);
-	free_irq(pdev_bus_irq, pdev);
-	release_mem_region(pdev_bus_addr, pdev_bus_len);
-	return 0;
-}
-
 static struct platform_driver goldfish_pdev_bus_driver = {
 	.probe = goldfish_pdev_bus_probe,
-	.remove = goldfish_pdev_bus_remove,
 	.driver = {
 		.name = "goldfish_pdev_bus"
 	}
 };
 
-module_platform_driver(goldfish_pdev_bus_driver);
+static int __init goldfish_pdev_bus_driver_init(void)
+{
+	return platform_driver_register(&goldfish_pdev_bus_driver);
+}
+device_initcall(goldfish_pdev_bus_driver_init);
-- 
1.8.4.1

  parent reply	other threads:[~2014-01-21 21:24 UTC|newest]

Thread overview: 228+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-21 21:22 [PATCH RFC 00/73] tree-wide: clean up some no longer required #include <linux/init.h> Paul Gortmaker
2014-01-21 21:22 ` Paul Gortmaker
2014-01-21 21:22 ` [PATCH 01/73] init: delete the __cpuinit related stubs Paul Gortmaker
2014-01-22  9:46   ` Paul Gortmaker
2014-02-07 22:47   ` Greg Kroah-Hartman
2014-02-07 22:47     ` Greg Kroah-Hartman
2014-01-21 21:22 ` [PATCH 02/73] mm: replace module_init usages with subsys_initcall in nommu.c Paul Gortmaker
2014-01-21 21:22 ` [PATCH 03/73] fs/notify: don't use module_init for non-modular inotify_user code Paul Gortmaker
2014-01-21 21:22 ` [PATCH 04/73] netfilter: don't use module_init/exit in core IPV4 code Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-21 21:22 ` [PATCH 05/73] x86: don't use module_init in non-modular intel_mid_vrtc.c Paul Gortmaker
2014-01-21 21:22 ` [PATCH 06/73] x86: don't use module_init for non-modular core bootflag code Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-21 21:22 ` [PATCH 07/73] x86: replace __init_or_module with __init in non-modular vsmp_64.c Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-21 21:22 ` [PATCH 08/73] drivers/tty/hvc: don't use module_init in non-modular hyp. console code Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-21 21:22 ` [PATCH 09/73] staging: don't use module_init in non-modular ion_dummy_driver.c Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-21 21:22 ` [PATCH 10/73] powerpc: use device_initcall for registering rtc devices Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-21 23:48   ` Geoff Levand
2014-01-22  2:26     ` Paul Gortmaker
2014-01-22  2:26       ` Paul Gortmaker
2014-01-21 21:22 ` [PATCH 11/73] powerpc: book3s KVM can be modular so it should use module.h Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-21 21:22 ` [PATCH 12/73] powerpc: kvm e500/44x is not modular, so don't use module_init Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-21 22:23   ` Paul Gortmaker
2014-01-21 21:22 ` [PATCH 13/73] powerpc: use subsys_initcall for Freescale Local Bus Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-21 21:22 ` [PATCH 14/73] powerpc: don't use module_init for non-modular core hugetlb code Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-21 21:22 ` [PATCH 15/73] powerpc: don't use module_init in non-modular 83xx suspend code Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-21 21:22 ` [PATCH 16/73] arm: include module.h in drivers/bus/omap_l3_smx.c Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-21 21:22 ` [PATCH 17/73] arm: fix implicit module.h use in mach-at91 gpio.h Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-21 21:22 ` [PATCH 18/73] arm: fix implicit #include <linux/init.h> in entry asm Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-21 21:22 ` [PATCH 19/73] arm: mach-s3c64xx mach-crag6410-module.c is not modular Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-23 13:16   ` Charles Keepax
2014-02-15 17:04     ` Kukjin Kim
2014-01-21 21:22 ` [PATCH 20/73] arm: use subsys_initcall in non-modular pl320 IPC code Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-21 21:44   ` Arnd Bergmann
2014-01-21 21:44     ` Arnd Bergmann
2014-01-21 22:19     ` Paul Gortmaker
2014-01-21 21:22 ` [PATCH 21/73] arm: don't use module_init in non-modular mach-vexpress/spc.c code Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-21 21:22 ` [PATCH 22/73] alpha: don't use module_init for non-modular core code Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-22  0:32   ` Richard Henderson
2014-01-22  0:32     ` Richard Henderson
2014-01-21 21:22 ` [PATCH 23/73] sparc: don't use module_init in non-modular pci.c code Paul Gortmaker
2014-01-21 22:35   ` David Miller
2014-01-21 22:35     ` David Miller
2014-01-21 21:22 ` [PATCH 24/73] m68k: don't use module_init in non-modular mvme16x/rtc.c code Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-21 21:22 ` [PATCH 25/73] ia64: don't use module_init for non-modular core kernel/mca.c code Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-21 21:22 ` [PATCH 26/73] ia64: don't use module_init in non-modular sim/simscsi.c code Paul Gortmaker
2014-01-21 21:22 ` [PATCH 27/73] drivers/clk: don't use module_init in clk-nomadik.c which is non-modular Paul Gortmaker
2014-01-31 23:17   ` Mike Turquette
2014-01-31 23:17     ` Mike Turquette
2014-01-21 21:22 ` [PATCH 28/73] cpuidle: don't use modular platform register in non-modular ARM drivers Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-21 21:22 ` Paul Gortmaker [this message]
2014-01-21 21:22 ` [PATCH 30/73] drivers/i2c: busses/i2c-acorn.c is tristate and should use module.h Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-24 17:26   ` Wolfram Sang
2014-01-21 21:22 ` [PATCH 31/73] module: relocate module_init from init.h to module.h Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-22  0:16   ` Rusty Russell
2014-01-22  0:16     ` Rusty Russell
2014-01-22  0:43     ` Randy Dunlap
2014-01-22  1:56     ` Paul Gortmaker
2014-01-21 21:22 ` [PATCH 32/73] logo: emit "#include <linux/init.h> in autogenerated C file Paul Gortmaker
2014-01-21 21:22 ` [PATCH 33/73] arm: delete non-required instances of include <linux/init.h> Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-21 21:22 ` [PATCH 34/73] mips: " Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-21 21:22 ` [PATCH 35/73] sparc: " Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-21 22:35   ` David Miller
2014-01-21 22:35     ` David Miller
2014-01-21 21:22 ` [PATCH 36/73] s390: " Paul Gortmaker
2014-01-21 21:22 ` [PATCH 37/73] alpha: delete non-required instances of <linux/init.h> Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-22  0:32   ` Richard Henderson
2014-01-21 21:22 ` [PATCH 38/73] blackfin: " Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-21 21:22 ` [PATCH 39/73] powerpc: delete another unrequired instance " Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-21 21:22 ` [PATCH 40/73] watchdog: delete non-required instances of include <linux/init.h> Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-02-24 19:52   ` Wim Van Sebroeck
2014-02-24 19:52     ` Wim Van Sebroeck
2014-01-21 21:22 ` [PATCH 41/73] video: " Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-21 21:22 ` [PATCH 42/73] rtc: " Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2015-06-08 19:54   ` [42/73] " Alexandre Belloni
2015-06-08 21:06     ` Paul Gortmaker
2015-06-09  7:49       ` Alexandre Belloni
2015-06-10  1:49         ` Paul Gortmaker
2014-01-21 21:22 ` [PATCH 43/73] scsi: " Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
     [not found] ` <1390339396-3479-1-git-send-email-paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
2014-01-21 21:22   ` [PATCH 44/73] spi: " Paul Gortmaker
2014-01-21 21:22     ` Paul Gortmaker
2014-01-21 21:43     ` Mark Brown
2014-01-21 21:43       ` Mark Brown
2014-01-21 21:22 ` [PATCH 45/73] acpi: " Paul Gortmaker
2014-01-21 23:18   ` Rafael J. Wysocki
2014-01-21 21:22 ` [PATCH 46/73] drivers/power: " Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-21 21:22 ` [PATCH 47/73] drivers/media: " Paul Gortmaker
2014-02-04 19:40   ` Mauro Carvalho Chehab
2014-02-05 15:09     ` Paul Gortmaker
2014-01-21 21:22 ` [PATCH 48/73] drivers/ata: " Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-02-13 21:41   ` Tejun Heo
2014-02-13 21:41     ` Tejun Heo
2014-01-21 21:22 ` [PATCH 49/73] drivers/mtd: " Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-29  0:02   ` Brian Norris
2014-01-29  0:02     ` Brian Norris
2014-01-29 14:34     ` Paul Gortmaker
2014-01-29 14:34       ` Paul Gortmaker
2014-01-21 21:22 ` [PATCH 50/73] drivers/hwmon: " Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-21 21:37   ` Guenter Roeck
2014-01-21 21:37     ` Guenter Roeck
2014-01-21 22:32     ` Paul Gortmaker
2014-01-23 16:38   ` Jean Delvare
2014-01-21 21:22 ` [PATCH 51/73] drivers/i2c: " Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
     [not found]   ` <1390339396-3479-52-git-send-email-paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
2014-01-24 17:09     ` Jean Delvare
2014-01-24 17:09       ` Jean Delvare
2014-01-24 17:26   ` Wolfram Sang
2014-01-24 17:26     ` Wolfram Sang
2014-01-21 21:22 ` [PATCH 52/73] drivers/pinctrl: " Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-23  8:11   ` Linus Walleij
2014-01-21 21:22 ` [PATCH 53/73] drivers/isdn: " Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-21 22:35   ` David Miller
2014-01-21 22:35     ` David Miller
2014-01-21 21:22 ` [PATCH 54/73] drivers/leds: " Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-02-06 19:28   ` Bryan Wu
2014-02-06 19:28     ` Bryan Wu
2014-02-06 19:40     ` Paul Gortmaker
2014-02-06 19:40       ` Paul Gortmaker
2014-02-06 19:46       ` Bryan Wu
2014-01-21 21:22 ` [PATCH 55/73] drivers/pcmcia: " Paul Gortmaker
2014-01-21 21:22   ` Paul Gortmaker
2014-01-21 21:22 ` [PATCH 56/73] drivers/char: " Paul Gortmaker
2014-01-21 21:23 ` [PATCH 57/73] drivers/infiniband: " Paul Gortmaker
2014-01-21 21:23   ` Paul Gortmaker
2014-01-21 21:23 ` [PATCH 58/73] drivers/mfd: " Paul Gortmaker
2014-01-21 21:23   ` Paul Gortmaker
2014-02-10 12:16   ` Lee Jones
2014-01-21 21:23 ` [PATCH 59/73] drivers/gpio: " Paul Gortmaker
2014-01-21 21:23   ` Paul Gortmaker
2014-01-23  8:12   ` Linus Walleij
2014-01-23  8:12     ` Linus Walleij
2014-01-23 22:58     ` Stephen Rothwell
2014-01-24  2:21       ` Paul Gortmaker
2014-01-24  2:21         ` Paul Gortmaker
2014-02-05 13:02         ` Linus Walleij
2014-02-05 15:00           ` Paul Gortmaker
2014-02-05 15:00             ` Paul Gortmaker
2014-02-06  9:33             ` Linus Walleij
2014-02-06  9:33               ` Linus Walleij
2014-01-24  8:44       ` Linus Walleij
2014-01-24  8:44         ` Linus Walleij
2014-01-21 21:23 ` [PATCH 60/73] drivers/bluetooth: " Paul Gortmaker
2014-01-21 21:23   ` Paul Gortmaker
2014-01-21 21:55   ` Marcel Holtmann
2014-01-21 22:30     ` Paul Gortmaker
2014-01-21 21:23 ` [PATCH 61/73] drivers/mmc: " Paul Gortmaker
2014-01-21 21:23   ` Paul Gortmaker
2014-01-21 21:23 ` [PATCH 62/73] drivers/crypto: " Paul Gortmaker
2014-01-21 21:23   ` Paul Gortmaker
2014-01-21 21:23 ` [PATCH 63/73] drivers/platform: " Paul Gortmaker
2014-01-21 21:23 ` [PATCH 64/73] drivers/misc: " Paul Gortmaker
2014-01-21 21:23 ` [PATCH 65/73] drivers/edac: " Paul Gortmaker
2014-01-22 20:02   ` Borislav Petkov
2014-01-21 21:23 ` [PATCH 66/73] drivers/macintosh: " Paul Gortmaker
2014-01-21 21:23 ` [PATCH 67/73] drivers/base: " Paul Gortmaker
2014-01-21 21:23   ` Paul Gortmaker
2014-01-21 21:33   ` Mark Brown
2014-01-21 21:33     ` Mark Brown
2014-01-21 21:42   ` Pavel Machek
2014-01-21 23:18   ` Rafael J. Wysocki
2014-01-21 21:23 ` [PATCH 68/73] drivers/cpufreq: delete non-required instances of <linux/init.h> Paul Gortmaker
2014-01-21 21:23   ` Paul Gortmaker
2014-01-22  4:58   ` Viresh Kumar
2014-01-22  4:58     ` Viresh Kumar
2014-01-22  9:17     ` Paul Gortmaker
2014-01-22  9:17       ` Paul Gortmaker
2014-01-21 21:23 ` [PATCH 69/73] drivers/pci: " Paul Gortmaker
2014-01-21 21:23   ` Paul Gortmaker
2014-04-03 21:55   ` Bjorn Helgaas
2014-04-03 21:55     ` Bjorn Helgaas
2014-01-21 21:23 ` [PATCH 70/73] drivers/dma: " Paul Gortmaker
2014-01-21 21:23   ` Paul Gortmaker
2014-01-21 21:23 ` [PATCH 71/73] drivers/gpu: " Paul Gortmaker
2014-01-21 21:23   ` Paul Gortmaker
2014-01-21 21:23 ` [PATCH 72/73] drivers: delete remaining " Paul Gortmaker
2014-01-21 21:23   ` Paul Gortmaker
2014-02-07 22:45   ` Greg Kroah-Hartman
2014-01-21 21:23 ` [PATCH 73/73] include: remove needless " Paul Gortmaker
2014-01-21 21:23   ` Paul Gortmaker
2014-01-21 21:37   ` Geert Uytterhoeven
2014-01-21 21:44     ` Paul Gortmaker
2014-01-21 21:44       ` Paul Gortmaker
2014-01-22  7:00 ` [PATCH RFC 00/73] tree-wide: clean up some no longer required #include <linux/init.h> Stephen Rothwell
2014-01-22  7:00   ` Stephen Rothwell
2014-01-23  0:38   ` Paul Gortmaker
2014-01-23  0:38     ` Paul Gortmaker
2014-01-28  3:13     ` Benjamin Herrenschmidt
2014-01-28  3:13       ` Benjamin Herrenschmidt
2014-01-28 16:21       ` Paul Gortmaker
2014-01-28 16:21         ` Paul Gortmaker

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=1390339396-3479-30-git-send-email-paul.gortmaker@windriver.com \
    --to=paul.gortmaker@windriver.com \
    --cc=linux-arch@vger.kernel.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: 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).