diff mbox series

[18/27] kbuild, mfd: remove MODULE_LICENSE in non-modules

Message ID 20230222121453.91915-19-nick.alcock@oracle.com (mailing list archive)
State New, archived
Headers show
Series [01/27] kbuild, power: reset: keystone-reset: remove MODULE_LICENSE in non-modules | expand

Commit Message

Nick Alcock Feb. 22, 2023, 12:14 p.m. UTC
Since commit 8b41fc4454e ("kbuild: create modules.builtin without
Makefile.modbuiltin or tristate.conf"), MODULE_LICENSE declarations
are used to identify modules. As a consequence, uses of the macro
in non-modules will cause modprobe to misidentify their containing
object file as a module when it is not (false positives), and modprobe
might succeed rather than failing with a suitable error message.

So remove it in the files in this commit, none of which can be built as
modules.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Suggested-by: Luis Chamberlain <mcgrof@kernel.org>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: linux-modules@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: Hitomi Hasegawa <hasegawa-hitomi@fujitsu.com>
Cc: Support Opensource <support.opensource@diasemi.com>
Cc: Lee Jones <lee@kernel.org>
---
 drivers/mfd/da903x.c      | 1 -
 drivers/mfd/da9052-core.c | 1 -
 drivers/mfd/da9052-i2c.c  | 1 -
 drivers/mfd/da9052-spi.c  | 1 -
 drivers/mfd/da9055-core.c | 1 -
 drivers/mfd/da9055-i2c.c  | 1 -
 6 files changed, 6 deletions(-)

Comments

DLG Adam Ward Feb. 22, 2023, 10:38 p.m. UTC | #1
On 22/02/2023 12:15, Nick Alcock wrote:
>Since commit 8b41fc4454e ("kbuild: create modules.builtin without Makefile.modbuiltin or tristate.conf"), MODULE_LICENSE declarations are used to identify modules. As a consequence, uses of the macro in non-modules will cause modprobe to misidentify their containing object file as a module when it is not (false positives), and modprobe might succeed rather than failing with a suitable error message.
>
>So remove it in the files in this commit, none of which can be built as modules.

Makes sense - but if you need to do a V2, would you mind removing the erroneous claim on DA9055 at the same time?
https://elixir.bootlin.com/linux/latest/source/drivers/mfd/Kconfig#L364 
Strangely, seems it was always there, yet always bool...

Reviewed-by: Adam Ward <DLG-Adam.Ward.opensource@dm.renesas.com>
Lee Jones Feb. 23, 2023, 1:48 p.m. UTC | #2
On Wed, 22 Feb 2023, DLG Adam Ward wrote:

> On 22/02/2023 12:15, Nick Alcock wrote:
> >Since commit 8b41fc4454e ("kbuild: create modules.builtin without Makefile.modbuiltin or tristate.conf"), MODULE_LICENSE declarations are used to identify modules. As a consequence, uses of the macro in non-modules will cause modprobe to misidentify their containing object file as a module when it is not (false positives), and modprobe might succeed rather than failing with a suitable error message.
> >
> >So remove it in the files in this commit, none of which can be built as modules.
> 
> Makes sense - but if you need to do a V2, would you mind removing the erroneous claim on DA9055 at the same time?

Could you do this anyway please.  While you're at it, please remove the
'kbuild' reference from the subject line, thanks.

> https://elixir.bootlin.com/linux/latest/source/drivers/mfd/Kconfig#L364 
> Strangely, seems it was always there, yet always bool...
> 
> Reviewed-by: Adam Ward <DLG-Adam.Ward.opensource@dm.renesas.com>
 
 Thanks Adam.
Nick Alcock Feb. 23, 2023, 7:24 p.m. UTC | #3
On 23 Feb 2023, Lee Jones stated:

> On Wed, 22 Feb 2023, DLG Adam Ward wrote:
>
>> On 22/02/2023 12:15, Nick Alcock wrote:
>> >Since commit 8b41fc4454e ("kbuild: create modules.builtin without Makefile.modbuiltin or tristate.conf"), MODULE_LICENSE declarations are used to identify modules. As a consequence, uses of the macro in non-modules will cause modprobe to misidentify their containing object file as a module when it is not (false positives), and modprobe might succeed rather than failing with a suitable error message.
>> >
>> >So remove it in the files in this commit, none of which can be built as modules.
>> 
>> Makes sense - but if you need to do a V2, would you mind removing the erroneous claim on DA9055 at the same time?

I don't know what this means. There are two references to DA9055 in this
patch, both in context (not in modified lines), one in
drivers/mfd/da9055-core.c, the other in rivers/mfd/da9055-i2c.c. To me
these both seem likely to be DA9055-related. Are you saying that one of
them isn't?

> Could you do this anyway please.  While you're at it, please remove the
> 'kbuild' reference from the subject line, thanks.

I was going to say that it seems to be in active use, but I just checked
and a total of zero files touched by this series have ever used 'kbuild'
in their log prefixes anywhere. So... dropped, series-wide. (By the
overdesigned approach of using a kbuild: prefix if and only if at least
one file in the files touched in that commit has used that prefix
somewhere in its history.)
DLG Adam Ward Feb. 24, 2023, 3:03 p.m. UTC | #4
On 23/02/2023 19:25, Nick Alcock wrote:

>> Makes sense - but if you need to do a V2, would you mind removing the erroneous claim on DA9055 at the same time?

>I don't know what this means. There are two references to DA9055 in this patch, both in context (not in modified lines), one in drivers/mfd/da9055-core.c, the other in rivers/mfd/da9055-i2c.c. To me these both seem likely to be DA9055-related. Are you saying that one of them isn't?

The comment was followed by this link - https://elixir.bootlin.com/linux/latest/source/drivers/mfd/Kconfig#L36
This files talks about the driver being a module, but, as you correctly point out, it is not.
And never has been.
So it is worth removing.
Nick Alcock Feb. 27, 2023, 1:15 p.m. UTC | #5
On 24 Feb 2023, DLG Adam Ward told this:

> On 23/02/2023 19:25, Nick Alcock wrote:
>
>>> Makes sense - but if you need to do a V2, would you mind removing the erroneous claim on DA9055 at the same time?
>
>>I don't know what this means. There are two references to DA9055 in this patch, both in context (not in modified lines), one in drivers/mfd/da9055-core.c, the other in rivers/mfd/da9055-i2c.c. To me these both seem likely to be DA9055-related. Are you saying that one of them isn't?
>
> The comment was followed by this link - https://elixir.bootlin.com/linux/latest/source/drivers/mfd/Kconfig#L36
> This files talks about the driver being a module, but, as you correctly point out, it is not.
> And never has been.
> So it is worth removing.

Ah! I never even thought of auditing the Kconfigs for erroneous
statements of modularity: that's a much harder-to-automate job.

I'm not planning to do this in general any time soon (because I'd have
to soup up Kconfig parsers and maybe write my own just for this), but
here's a reroll of this one patch that drops the erroneous Kconfig help
text:

-- >8 --

From 06d491176513f9fcd699871cb6815534068b664a Mon Sep 17 00:00:00 2001
From: Nick Alcock <nick.alcock@oracle.com>
Date: Thu, 23 Feb 2023 19:10:03 +0000
Subject: [PATCH v2 18/27] mfd: remove MODULE_LICENSE in non-modules

Since commit 8b41fc4454e ("kbuild: create modules.builtin without
Makefile.modbuiltin or tristate.conf"), MODULE_LICENSE declarations
are used to identify modules. As a consequence, uses of the macro
in non-modules will cause modprobe to misidentify their containing
object file as a module when it is not (false positives), and modprobe
might succeed rather than failing with a suitable error message.

So remove it in the files in this commit, none of which can be built as
modules.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Suggested-by: Luis Chamberlain <mcgrof@kernel.org>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: linux-modules@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: Hitomi Hasegawa <hasegawa-hitomi@fujitsu.com>
Cc: Support Opensource <support.opensource@diasemi.com>
Cc: Lee Jones <lee@kernel.org>
---
 drivers/mfd/Kconfig       | 3 ---
 drivers/mfd/da903x.c      | 1 -
 drivers/mfd/da9052-core.c | 1 -
 drivers/mfd/da9052-i2c.c  | 1 -
 drivers/mfd/da9052-spi.c  | 1 -
 drivers/mfd/da9055-core.c | 1 -
 drivers/mfd/da9055-i2c.c  | 1 -
 7 files changed, 9 deletions(-)

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 30db49f318668..751d38b30bb1f 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -361,9 +361,6 @@ config MFD_DA9055
 	  Additional drivers must be enabled in order to use the functionality
 	  of the device.
 
-	  This driver can be built as a module. If built as a module it will be
-	  called "da9055"
-
 config MFD_DA9062
 	tristate "Dialog Semiconductor DA9062/61 PMIC Support"
 	select MFD_CORE
diff --git a/drivers/mfd/da903x.c b/drivers/mfd/da903x.c
index 44a25d642ce94..6570b33a5a77b 100644
--- a/drivers/mfd/da903x.c
+++ b/drivers/mfd/da903x.c
@@ -563,4 +563,3 @@ module_exit(da903x_exit);
 MODULE_DESCRIPTION("PMIC Driver for Dialog Semiconductor DA9034");
 MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>");
 MODULE_AUTHOR("Mike Rapoport <mike@compulab.co.il>");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/mfd/da9052-core.c b/drivers/mfd/da9052-core.c
index 8b42d2f7024f5..150448cd2eb08 100644
--- a/drivers/mfd/da9052-core.c
+++ b/drivers/mfd/da9052-core.c
@@ -653,4 +653,3 @@ void da9052_device_exit(struct da9052 *da9052)
 
 MODULE_AUTHOR("David Dajun Chen <dchen@diasemi.com>");
 MODULE_DESCRIPTION("DA9052 MFD Core");
-MODULE_LICENSE("GPL");
diff --git a/drivers/mfd/da9052-i2c.c b/drivers/mfd/da9052-i2c.c
index ecb8077cdaaf9..03db7a2ccf7a0 100644
--- a/drivers/mfd/da9052-i2c.c
+++ b/drivers/mfd/da9052-i2c.c
@@ -209,4 +209,3 @@ module_exit(da9052_i2c_exit);
 
 MODULE_AUTHOR("David Dajun Chen <dchen@diasemi.com>");
 MODULE_DESCRIPTION("I2C driver for Dialog DA9052 PMIC");
-MODULE_LICENSE("GPL");
diff --git a/drivers/mfd/da9052-spi.c b/drivers/mfd/da9052-spi.c
index b79a57b45c1e8..be5f2b34e18ae 100644
--- a/drivers/mfd/da9052-spi.c
+++ b/drivers/mfd/da9052-spi.c
@@ -102,4 +102,3 @@ module_exit(da9052_spi_exit);
 
 MODULE_AUTHOR("David Dajun Chen <dchen@diasemi.com>");
 MODULE_DESCRIPTION("SPI driver for Dialog DA9052 PMIC");
-MODULE_LICENSE("GPL");
diff --git a/drivers/mfd/da9055-core.c b/drivers/mfd/da9055-core.c
index c3bcbd8905c6c..768302e05baa1 100644
--- a/drivers/mfd/da9055-core.c
+++ b/drivers/mfd/da9055-core.c
@@ -398,5 +398,4 @@ void da9055_device_exit(struct da9055 *da9055)
 }
 
 MODULE_DESCRIPTION("Core support for the DA9055 PMIC");
-MODULE_LICENSE("GPL");
 MODULE_AUTHOR("David Dajun Chen <dchen@diasemi.com>");
diff --git a/drivers/mfd/da9055-i2c.c b/drivers/mfd/da9055-i2c.c
index 702abff506a1a..537fd5de3e6d4 100644
--- a/drivers/mfd/da9055-i2c.c
+++ b/drivers/mfd/da9055-i2c.c
@@ -97,4 +97,3 @@ module_exit(da9055_i2c_exit);
 
 MODULE_AUTHOR("David Dajun Chen <dchen@diasemi.com>");
 MODULE_DESCRIPTION("I2C driver for Dialog DA9055 PMIC");
-MODULE_LICENSE("GPL");
Lee Jones March 1, 2023, 9:04 a.m. UTC | #6
On Mon, 27 Feb 2023, Nick Alcock wrote:

> On 24 Feb 2023, DLG Adam Ward told this:
> 
> > On 23/02/2023 19:25, Nick Alcock wrote:
> >
> >>> Makes sense - but if you need to do a V2, would you mind removing the erroneous claim on DA9055 at the same time?
> >
> >>I don't know what this means. There are two references to DA9055 in this patch, both in context (not in modified lines), one in drivers/mfd/da9055-core.c, the other in rivers/mfd/da9055-i2c.c. To me these both seem likely to be DA9055-related. Are you saying that one of them isn't?
> >
> > The comment was followed by this link - https://elixir.bootlin.com/linux/latest/source/drivers/mfd/Kconfig#L36
> > This files talks about the driver being a module, but, as you correctly point out, it is not.
> > And never has been.
> > So it is worth removing.
> 
> Ah! I never even thought of auditing the Kconfigs for erroneous
> statements of modularity: that's a much harder-to-automate job.
> 
> I'm not planning to do this in general any time soon (because I'd have
> to soup up Kconfig parsers and maybe write my own just for this), but
> here's a reroll of this one patch that drops the erroneous Kconfig help
> text:
> 
> -- >8 --

Can you submit this as an orthogonal v2 please?
 
> From 06d491176513f9fcd699871cb6815534068b664a Mon Sep 17 00:00:00 2001
> From: Nick Alcock <nick.alcock@oracle.com>
> Date: Thu, 23 Feb 2023 19:10:03 +0000
> Subject: [PATCH v2 18/27] mfd: remove MODULE_LICENSE in non-modules
> 
> Since commit 8b41fc4454e ("kbuild: create modules.builtin without
> Makefile.modbuiltin or tristate.conf"), MODULE_LICENSE declarations
> are used to identify modules. As a consequence, uses of the macro
> in non-modules will cause modprobe to misidentify their containing
> object file as a module when it is not (false positives), and modprobe
> might succeed rather than failing with a suitable error message.
> 
> So remove it in the files in this commit, none of which can be built as
> modules.
> 
> Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
> Suggested-by: Luis Chamberlain <mcgrof@kernel.org>
> Cc: Luis Chamberlain <mcgrof@kernel.org>
> Cc: linux-modules@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: Hitomi Hasegawa <hasegawa-hitomi@fujitsu.com>
> Cc: Support Opensource <support.opensource@diasemi.com>
> Cc: Lee Jones <lee@kernel.org>
> ---
>  drivers/mfd/Kconfig       | 3 ---
>  drivers/mfd/da903x.c      | 1 -
>  drivers/mfd/da9052-core.c | 1 -
>  drivers/mfd/da9052-i2c.c  | 1 -
>  drivers/mfd/da9052-spi.c  | 1 -
>  drivers/mfd/da9055-core.c | 1 -
>  drivers/mfd/da9055-i2c.c  | 1 -
>  7 files changed, 9 deletions(-)
> 
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 30db49f318668..751d38b30bb1f 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -361,9 +361,6 @@ config MFD_DA9055
>  	  Additional drivers must be enabled in order to use the functionality
>  	  of the device.
>  
> -	  This driver can be built as a module. If built as a module it will be
> -	  called "da9055"
> -
>  config MFD_DA9062
>  	tristate "Dialog Semiconductor DA9062/61 PMIC Support"
>  	select MFD_CORE
> diff --git a/drivers/mfd/da903x.c b/drivers/mfd/da903x.c
> index 44a25d642ce94..6570b33a5a77b 100644
> --- a/drivers/mfd/da903x.c
> +++ b/drivers/mfd/da903x.c
> @@ -563,4 +563,3 @@ module_exit(da903x_exit);
>  MODULE_DESCRIPTION("PMIC Driver for Dialog Semiconductor DA9034");
>  MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>");
>  MODULE_AUTHOR("Mike Rapoport <mike@compulab.co.il>");
> -MODULE_LICENSE("GPL v2");
> diff --git a/drivers/mfd/da9052-core.c b/drivers/mfd/da9052-core.c
> index 8b42d2f7024f5..150448cd2eb08 100644
> --- a/drivers/mfd/da9052-core.c
> +++ b/drivers/mfd/da9052-core.c
> @@ -653,4 +653,3 @@ void da9052_device_exit(struct da9052 *da9052)
>  
>  MODULE_AUTHOR("David Dajun Chen <dchen@diasemi.com>");
>  MODULE_DESCRIPTION("DA9052 MFD Core");
> -MODULE_LICENSE("GPL");
> diff --git a/drivers/mfd/da9052-i2c.c b/drivers/mfd/da9052-i2c.c
> index ecb8077cdaaf9..03db7a2ccf7a0 100644
> --- a/drivers/mfd/da9052-i2c.c
> +++ b/drivers/mfd/da9052-i2c.c
> @@ -209,4 +209,3 @@ module_exit(da9052_i2c_exit);
>  
>  MODULE_AUTHOR("David Dajun Chen <dchen@diasemi.com>");
>  MODULE_DESCRIPTION("I2C driver for Dialog DA9052 PMIC");
> -MODULE_LICENSE("GPL");
> diff --git a/drivers/mfd/da9052-spi.c b/drivers/mfd/da9052-spi.c
> index b79a57b45c1e8..be5f2b34e18ae 100644
> --- a/drivers/mfd/da9052-spi.c
> +++ b/drivers/mfd/da9052-spi.c
> @@ -102,4 +102,3 @@ module_exit(da9052_spi_exit);
>  
>  MODULE_AUTHOR("David Dajun Chen <dchen@diasemi.com>");
>  MODULE_DESCRIPTION("SPI driver for Dialog DA9052 PMIC");
> -MODULE_LICENSE("GPL");
> diff --git a/drivers/mfd/da9055-core.c b/drivers/mfd/da9055-core.c
> index c3bcbd8905c6c..768302e05baa1 100644
> --- a/drivers/mfd/da9055-core.c
> +++ b/drivers/mfd/da9055-core.c
> @@ -398,5 +398,4 @@ void da9055_device_exit(struct da9055 *da9055)
>  }
>  
>  MODULE_DESCRIPTION("Core support for the DA9055 PMIC");
> -MODULE_LICENSE("GPL");
>  MODULE_AUTHOR("David Dajun Chen <dchen@diasemi.com>");
> diff --git a/drivers/mfd/da9055-i2c.c b/drivers/mfd/da9055-i2c.c
> index 702abff506a1a..537fd5de3e6d4 100644
> --- a/drivers/mfd/da9055-i2c.c
> +++ b/drivers/mfd/da9055-i2c.c
> @@ -97,4 +97,3 @@ module_exit(da9055_i2c_exit);
>  
>  MODULE_AUTHOR("David Dajun Chen <dchen@diasemi.com>");
>  MODULE_DESCRIPTION("I2C driver for Dialog DA9055 PMIC");
> -MODULE_LICENSE("GPL");
> -- 
> 2.39.1.268.g9de2f9a303
diff mbox series

Patch

diff --git a/drivers/mfd/da903x.c b/drivers/mfd/da903x.c
index 44a25d642ce9..6570b33a5a77 100644
--- a/drivers/mfd/da903x.c
+++ b/drivers/mfd/da903x.c
@@ -563,4 +563,3 @@  module_exit(da903x_exit);
 MODULE_DESCRIPTION("PMIC Driver for Dialog Semiconductor DA9034");
 MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>");
 MODULE_AUTHOR("Mike Rapoport <mike@compulab.co.il>");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/mfd/da9052-core.c b/drivers/mfd/da9052-core.c
index 8b42d2f7024f..150448cd2eb0 100644
--- a/drivers/mfd/da9052-core.c
+++ b/drivers/mfd/da9052-core.c
@@ -653,4 +653,3 @@  void da9052_device_exit(struct da9052 *da9052)
 
 MODULE_AUTHOR("David Dajun Chen <dchen@diasemi.com>");
 MODULE_DESCRIPTION("DA9052 MFD Core");
-MODULE_LICENSE("GPL");
diff --git a/drivers/mfd/da9052-i2c.c b/drivers/mfd/da9052-i2c.c
index ecb8077cdaaf..03db7a2ccf7a 100644
--- a/drivers/mfd/da9052-i2c.c
+++ b/drivers/mfd/da9052-i2c.c
@@ -209,4 +209,3 @@  module_exit(da9052_i2c_exit);
 
 MODULE_AUTHOR("David Dajun Chen <dchen@diasemi.com>");
 MODULE_DESCRIPTION("I2C driver for Dialog DA9052 PMIC");
-MODULE_LICENSE("GPL");
diff --git a/drivers/mfd/da9052-spi.c b/drivers/mfd/da9052-spi.c
index b79a57b45c1e..be5f2b34e18a 100644
--- a/drivers/mfd/da9052-spi.c
+++ b/drivers/mfd/da9052-spi.c
@@ -102,4 +102,3 @@  module_exit(da9052_spi_exit);
 
 MODULE_AUTHOR("David Dajun Chen <dchen@diasemi.com>");
 MODULE_DESCRIPTION("SPI driver for Dialog DA9052 PMIC");
-MODULE_LICENSE("GPL");
diff --git a/drivers/mfd/da9055-core.c b/drivers/mfd/da9055-core.c
index c3bcbd8905c6..768302e05baa 100644
--- a/drivers/mfd/da9055-core.c
+++ b/drivers/mfd/da9055-core.c
@@ -398,5 +398,4 @@  void da9055_device_exit(struct da9055 *da9055)
 }
 
 MODULE_DESCRIPTION("Core support for the DA9055 PMIC");
-MODULE_LICENSE("GPL");
 MODULE_AUTHOR("David Dajun Chen <dchen@diasemi.com>");
diff --git a/drivers/mfd/da9055-i2c.c b/drivers/mfd/da9055-i2c.c
index 702abff506a1..537fd5de3e6d 100644
--- a/drivers/mfd/da9055-i2c.c
+++ b/drivers/mfd/da9055-i2c.c
@@ -97,4 +97,3 @@  module_exit(da9055_i2c_exit);
 
 MODULE_AUTHOR("David Dajun Chen <dchen@diasemi.com>");
 MODULE_DESCRIPTION("I2C driver for Dialog DA9055 PMIC");
-MODULE_LICENSE("GPL");