All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] irqchip: make non-modular code explicitly non-modular
@ 2015-10-11 23:05 Paul Gortmaker
  2015-10-11 23:05 ` [PATCH 1/2] drivers/irqchip: make irq-renesas-intc-irqpin.c " Paul Gortmaker
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Paul Gortmaker @ 2015-10-11 23:05 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: linux-kernel, Paul Gortmaker, Jason Cooper, Magnus Damm, Marc Zyngier

In a previous merge window, we made changes to allow better
delineation between modular and non-modular code in commit
0fd972a7d91d6e15393c449492a04d94c0b89351 ("module: relocate module_init
from init.h to module.h").  This allows us to now ensure module code
looks modular and non-modular code does not accidentally look modular
just to avoid suffering build breakage.

Here we target code that is, by nature of their Makefile and/or
Kconfig settings, only available to be built-in, but implicitly
presenting itself as being possibly modular by way of using modular
headers, macros, and functions.

The goal here is to remove that illusion of modularity from these
files, but in a way that leaves the actual runtime unchanged.
In doing so, we remove code that has never been tested and adds
no value to the tree.  And we continue the process of expecting a
level of consistency between the Kconfig/Makefile of code and the
code in use itself.

Fortuntately the irqchip subsystem has just two instances.  For
comparison there are over 300 instances tree wide, resulting in a
possible net removal of on the order of 5000 lines of unused code.

Build tested on the latest linux-next, on ARM.

Paul.
--

Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Magnus Damm <damm+renesas@opensource.se>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>

Paul Gortmaker (2):
  drivers/irqchip: make irq-renesas-intc-irqpin.c explicitly non-modular
  drivers/irqchip: make irq-renesas-irqc.c explicitly non-modular

 drivers/irqchip/irq-renesas-intc-irqpin.c | 24 +-----------------------
 drivers/irqchip/irq-renesas-irqc.c        | 30 +-----------------------------
 2 files changed, 2 insertions(+), 52 deletions(-)

-- 
2.6.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] drivers/irqchip: make irq-renesas-intc-irqpin.c explicitly non-modular
  2015-10-11 23:05 [PATCH 0/2] irqchip: make non-modular code explicitly non-modular Paul Gortmaker
@ 2015-10-11 23:05 ` Paul Gortmaker
  2015-10-11 23:05 ` [PATCH 2/2] drivers/irqchip: make irq-renesas-irqc.c " Paul Gortmaker
  2015-10-12  7:04 ` [PATCH 0/2] irqchip: make non-modular code " Geert Uytterhoeven
  2 siblings, 0 replies; 5+ messages in thread
From: Paul Gortmaker @ 2015-10-11 23:05 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: linux-kernel, Paul Gortmaker, Magnus Damm, Jason Cooper, Marc Zyngier

The Kconfig currently controlling compilation of this code is:

drivers/irqchip/Kconfig:config RENESAS_INTC_IRQPIN
drivers/irqchip/Kconfig:        bool

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

While at it, since this is core infrastructural code for the platform,
lets prohibit any unbind actions that would have called the .remove
function, if anyone was unwise enough to try that.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

We don't replace module.h with init.h since the file already has that.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Magnus Damm <damm+renesas@opensource.se>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/irqchip/irq-renesas-intc-irqpin.c | 24 +-----------------------
 1 file changed, 1 insertion(+), 23 deletions(-)

diff --git a/drivers/irqchip/irq-renesas-intc-irqpin.c b/drivers/irqchip/irq-renesas-intc-irqpin.c
index c325806561be..2fc5d425c5a0 100644
--- a/drivers/irqchip/irq-renesas-intc-irqpin.c
+++ b/drivers/irqchip/irq-renesas-intc-irqpin.c
@@ -29,7 +29,6 @@
 #include <linux/irqdomain.h>
 #include <linux/err.h>
 #include <linux/slab.h>
-#include <linux/module.h>
 #include <linux/of_device.h>
 #include <linux/platform_data/irq-renesas-intc-irqpin.h>
 #include <linux/pm_runtime.h>
@@ -373,7 +372,6 @@ static const struct of_device_id intc_irqpin_dt_ids[] = {
 	  .data = &intc_irqpin_irlm_r8a777x },
 	{},
 };
-MODULE_DEVICE_TABLE(of, intc_irqpin_dt_ids);
 
 static int intc_irqpin_probe(struct platform_device *pdev)
 {
@@ -589,21 +587,11 @@ err0:
 	return ret;
 }
 
-static int intc_irqpin_remove(struct platform_device *pdev)
-{
-	struct intc_irqpin_priv *p = platform_get_drvdata(pdev);
-
-	irq_domain_remove(p->irq_domain);
-	pm_runtime_put(&pdev->dev);
-	pm_runtime_disable(&pdev->dev);
-	return 0;
-}
-
 static struct platform_driver intc_irqpin_device_driver = {
 	.probe		= intc_irqpin_probe,
-	.remove		= intc_irqpin_remove,
 	.driver		= {
 		.name	= "renesas_intc_irqpin",
+		.suppress_bind_attrs = true,
 		.of_match_table = intc_irqpin_dt_ids,
 	}
 };
@@ -613,13 +601,3 @@ static int __init intc_irqpin_init(void)
 	return platform_driver_register(&intc_irqpin_device_driver);
 }
 postcore_initcall(intc_irqpin_init);
-
-static void __exit intc_irqpin_exit(void)
-{
-	platform_driver_unregister(&intc_irqpin_device_driver);
-}
-module_exit(intc_irqpin_exit);
-
-MODULE_AUTHOR("Magnus Damm");
-MODULE_DESCRIPTION("Renesas INTC External IRQ Pin Driver");
-MODULE_LICENSE("GPL v2");
-- 
2.6.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] drivers/irqchip: make irq-renesas-irqc.c explicitly non-modular
  2015-10-11 23:05 [PATCH 0/2] irqchip: make non-modular code explicitly non-modular Paul Gortmaker
  2015-10-11 23:05 ` [PATCH 1/2] drivers/irqchip: make irq-renesas-intc-irqpin.c " Paul Gortmaker
@ 2015-10-11 23:05 ` Paul Gortmaker
  2015-10-12  7:04 ` [PATCH 0/2] irqchip: make non-modular code " Geert Uytterhoeven
  2 siblings, 0 replies; 5+ messages in thread
From: Paul Gortmaker @ 2015-10-11 23:05 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: linux-kernel, Paul Gortmaker, Magnus Damm, Jason Cooper, Marc Zyngier

The Kconfig currently controlling compilation of this code is:

drivers/irqchip/Kconfig:config RENESAS_IRQC
drivers/irqchip/Kconfig:        bool

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

While at it, since this is core infrastructural code for the platform,
lets prohibit any unbind actions that would have called the .remove
function, if anyone was unwise enough to try that.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

We don't replace module.h with init.h since the file already has that.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Magnus Damm <damm+renesas@opensource.se>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/irqchip/irq-renesas-irqc.c | 30 +-----------------------------
 1 file changed, 1 insertion(+), 29 deletions(-)

diff --git a/drivers/irqchip/irq-renesas-irqc.c b/drivers/irqchip/irq-renesas-irqc.c
index 52304b139aa4..a05b1012fce7 100644
--- a/drivers/irqchip/irq-renesas-irqc.c
+++ b/drivers/irqchip/irq-renesas-irqc.c
@@ -28,7 +28,6 @@
 #include <linux/irqdomain.h>
 #include <linux/err.h>
 #include <linux/slab.h>
-#include <linux/module.h>
 #include <linux/pm_runtime.h>
 
 #define IRQC_IRQ_MAX	32	/* maximum 32 interrupts per driver instance */
@@ -260,33 +259,16 @@ err0:
 	return ret;
 }
 
-static int irqc_remove(struct platform_device *pdev)
-{
-	struct irqc_priv *p = platform_get_drvdata(pdev);
-	int k;
-
-	for (k = 0; k < p->number_of_irqs; k++)
-		free_irq(p->irq[k].requested_irq, &p->irq[k]);
-
-	irq_domain_remove(p->irq_domain);
-	iounmap(p->iomem);
-	pm_runtime_put(&pdev->dev);
-	pm_runtime_disable(&pdev->dev);
-	kfree(p);
-	return 0;
-}
-
 static const struct of_device_id irqc_dt_ids[] = {
 	{ .compatible = "renesas,irqc", },
 	{},
 };
-MODULE_DEVICE_TABLE(of, irqc_dt_ids);
 
 static struct platform_driver irqc_device_driver = {
 	.probe		= irqc_probe,
-	.remove		= irqc_remove,
 	.driver		= {
 		.name	= "renesas_irqc",
+		.suppress_bind_attrs = true,
 		.of_match_table	= irqc_dt_ids,
 	}
 };
@@ -296,13 +278,3 @@ static int __init irqc_init(void)
 	return platform_driver_register(&irqc_device_driver);
 }
 postcore_initcall(irqc_init);
-
-static void __exit irqc_exit(void)
-{
-	platform_driver_unregister(&irqc_device_driver);
-}
-module_exit(irqc_exit);
-
-MODULE_AUTHOR("Magnus Damm");
-MODULE_DESCRIPTION("Renesas IRQC Driver");
-MODULE_LICENSE("GPL v2");
-- 
2.6.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] irqchip: make non-modular code explicitly non-modular
  2015-10-11 23:05 [PATCH 0/2] irqchip: make non-modular code explicitly non-modular Paul Gortmaker
  2015-10-11 23:05 ` [PATCH 1/2] drivers/irqchip: make irq-renesas-intc-irqpin.c " Paul Gortmaker
  2015-10-11 23:05 ` [PATCH 2/2] drivers/irqchip: make irq-renesas-irqc.c " Paul Gortmaker
@ 2015-10-12  7:04 ` Geert Uytterhoeven
  2015-10-14  2:26   ` Paul Gortmaker
  2 siblings, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2015-10-12  7:04 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: Thomas Gleixner, linux-kernel, Jason Cooper, Magnus Damm, Marc Zyngier

Hi Paul,

On Mon, Oct 12, 2015 at 1:05 AM, Paul Gortmaker
<paul.gortmaker@windriver.com> wrote:
> In a previous merge window, we made changes to allow better
> delineation between modular and non-modular code in commit
> 0fd972a7d91d6e15393c449492a04d94c0b89351 ("module: relocate module_init
> from init.h to module.h").  This allows us to now ensure module code
> looks modular and non-modular code does not accidentally look modular
> just to avoid suffering build breakage.
>
> Here we target code that is, by nature of their Makefile and/or
> Kconfig settings, only available to be built-in, but implicitly
> presenting itself as being possibly modular by way of using modular
> headers, macros, and functions.
>
> The goal here is to remove that illusion of modularity from these
> files, but in a way that leaves the actual runtime unchanged.
> In doing so, we remove code that has never been tested and adds
> no value to the tree.  And we continue the process of expecting a
> level of consistency between the Kconfig/Makefile of code and the
> code in use itself.
>
> Fortuntately the irqchip subsystem has just two instances.  For
> comparison there are over 300 instances tree wide, resulting in a
> possible net removal of on the order of 5000 lines of unused code.
>
> Build tested on the latest linux-next, on ARM.
>
> Paul.
> --
>
> Cc: Jason Cooper <jason@lakedaemon.net>
> Cc: Magnus Damm <damm+renesas@opensource.se>
> Cc: Marc Zyngier <marc.zyngier@arm.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
>
> Paul Gortmaker (2):
>   drivers/irqchip: make irq-renesas-intc-irqpin.c explicitly non-modular
>   drivers/irqchip: make irq-renesas-irqc.c explicitly non-modular
>
>  drivers/irqchip/irq-renesas-intc-irqpin.c | 24 +-----------------------
>  drivers/irqchip/irq-renesas-irqc.c        | 30 +-----------------------------
>  2 files changed, 2 insertions(+), 52 deletions(-)

Both of these are "external interrupt controllers", meaning that on some boards
they are used to handle only interrupts from external devices (e.g. Ethernet),
which is optional.

Hence IMHO the bool should be changed to tristate instead.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] irqchip: make non-modular code explicitly non-modular
  2015-10-12  7:04 ` [PATCH 0/2] irqchip: make non-modular code " Geert Uytterhoeven
@ 2015-10-14  2:26   ` Paul Gortmaker
  0 siblings, 0 replies; 5+ messages in thread
From: Paul Gortmaker @ 2015-10-14  2:26 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Thomas Gleixner, linux-kernel, Jason Cooper, Magnus Damm, Marc Zyngier

[Re: [PATCH 0/2] irqchip: make non-modular code explicitly non-modular] On 12/10/2015 (Mon 09:04) Geert Uytterhoeven wrote:

> Hi Paul,
> 
> On Mon, Oct 12, 2015 at 1:05 AM, Paul Gortmaker
> <paul.gortmaker@windriver.com> wrote:

[...]

> > Paul Gortmaker (2):
> >   drivers/irqchip: make irq-renesas-intc-irqpin.c explicitly non-modular
> >   drivers/irqchip: make irq-renesas-irqc.c explicitly non-modular
> >
> >  drivers/irqchip/irq-renesas-intc-irqpin.c | 24 +-----------------------
> >  drivers/irqchip/irq-renesas-irqc.c        | 30 +-----------------------------
> >  2 files changed, 2 insertions(+), 52 deletions(-)
> 
> Both of these are "external interrupt controllers", meaning that on some boards
> they are used to handle only interrupts from external devices (e.g. Ethernet),
> which is optional.
> 
> Hence IMHO the bool should be changed to tristate instead.

So, at the risk of repeating myself -- changing to tristate widens the
scope on build coverage and everything else.  When I did this for a
staging driver, I got caught in symbols that were not exported.  Not
critically complex, but it does show that allowing a new config option
can make things break.  Hence keeping the support matrix the same is
table stakes to allow me to make this tree wide update in a way that
scales.

As the changes I propose do not change the runtime, I think that the
verification of the extension of functionality lies on those who think
moving these drivers from bool to tristate is a genuine value add.

If for no other reason, it at least does keep a bisect honest in showing
where existing functionality broke vs. added functionality brought in
new breakage.

Paul.
--

> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-10-14  2:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-11 23:05 [PATCH 0/2] irqchip: make non-modular code explicitly non-modular Paul Gortmaker
2015-10-11 23:05 ` [PATCH 1/2] drivers/irqchip: make irq-renesas-intc-irqpin.c " Paul Gortmaker
2015-10-11 23:05 ` [PATCH 2/2] drivers/irqchip: make irq-renesas-irqc.c " Paul Gortmaker
2015-10-12  7:04 ` [PATCH 0/2] irqchip: make non-modular code " Geert Uytterhoeven
2015-10-14  2:26   ` Paul Gortmaker

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.