2023-03-02 22:11:51

by Nick Alcock

[permalink] [raw]
Subject: [PATCH 05/17] drivers: bus: simple-pm-bus: 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 <[email protected]>
Suggested-by: Luis Chamberlain <[email protected]>
Cc: Luis Chamberlain <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: Hitomi Hasegawa <[email protected]>
---
drivers/bus/simple-pm-bus.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/bus/simple-pm-bus.c b/drivers/bus/simple-pm-bus.c
index 6b8d6257ed8a4..32e6e960f1676 100644
--- a/drivers/bus/simple-pm-bus.c
+++ b/drivers/bus/simple-pm-bus.c
@@ -92,4 +92,3 @@ module_platform_driver(simple_pm_bus_driver);

MODULE_DESCRIPTION("Simple Power-Managed Bus Driver");
MODULE_AUTHOR("Geert Uytterhoeven <[email protected]>");
-MODULE_LICENSE("GPL v2");
--
2.39.1.268.g9de2f9a303



2023-03-03 07:52:49

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH 05/17] drivers: bus: simple-pm-bus: remove MODULE_LICENSE in non-modules

Hi Nick,

On Thu, Mar 2, 2023 at 11:25 PM Nick Alcock <[email protected]> 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.
>
> Signed-off-by: Nick Alcock <[email protected]>
> Suggested-by: Luis Chamberlain <[email protected]>

Thanks for your patch!

> --- a/drivers/bus/simple-pm-bus.c
> +++ b/drivers/bus/simple-pm-bus.c
> @@ -92,4 +92,3 @@ module_platform_driver(simple_pm_bus_driver);
>
> MODULE_DESCRIPTION("Simple Power-Managed Bus Driver");
> MODULE_AUTHOR("Geert Uytterhoeven <[email protected]>");
> -MODULE_LICENSE("GPL v2");

Please do not remove this line as long as the file has no SPDX-License
tag.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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

2023-03-03 18:32:28

by Nick Alcock

[permalink] [raw]
Subject: Re: [PATCH 05/17] drivers: bus: simple-pm-bus: remove MODULE_LICENSE in non-modules

On 3 Mar 2023, Geert Uytterhoeven told this:

> On Thu, Mar 2, 2023 at 11:25 PM Nick Alcock <[email protected]> wrote:
>> --- a/drivers/bus/simple-pm-bus.c
>> +++ b/drivers/bus/simple-pm-bus.c
>> @@ -92,4 +92,3 @@ module_platform_driver(simple_pm_bus_driver);
>>
>> MODULE_DESCRIPTION("Simple Power-Managed Bus Driver");
>> MODULE_AUTHOR("Geert Uytterhoeven <[email protected]>");
>> -MODULE_LICENSE("GPL v2");
>
> Please do not remove this line as long as the file has no SPDX-License
> tag.

I'll augment this patch with an SPDX addition, if you think that's OK,
which it sounds like you do. (MODULE_LICENSE has side effects these days
which a SPDX header does not, and those side effects are wrong for
things that cannot be modules.)

2023-03-03 18:45:26

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH 05/17] drivers: bus: simple-pm-bus: remove MODULE_LICENSE in non-modules

Hi Nick,

On Fri, Mar 3, 2023 at 7:32 PM Nick Alcock <[email protected]> wrote:
> On 3 Mar 2023, Geert Uytterhoeven told this:
> > On Thu, Mar 2, 2023 at 11:25 PM Nick Alcock <[email protected]> wrote:
> >> --- a/drivers/bus/simple-pm-bus.c
> >> +++ b/drivers/bus/simple-pm-bus.c
> >> @@ -92,4 +92,3 @@ module_platform_driver(simple_pm_bus_driver);
> >>
> >> MODULE_DESCRIPTION("Simple Power-Managed Bus Driver");
> >> MODULE_AUTHOR("Geert Uytterhoeven <[email protected]>");
> >> -MODULE_LICENSE("GPL v2");
> >
> > Please do not remove this line as long as the file has no SPDX-License
> > tag.
>
> I'll augment this patch with an SPDX addition, if you think that's OK,
> which it sounds like you do. (MODULE_LICENSE has side effects these days
> which a SPDX header does not, and those side effects are wrong for
> things that cannot be modules.)

Yeah, simple-pm-bus should not be a module.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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

2023-03-20 11:03:44

by Nick Alcock

[permalink] [raw]
Subject: Re: [PATCH 05/17] drivers: bus: simple-pm-bus: remove MODULE_LICENSE in non-modules

On 3 Mar 2023, Geert Uytterhoeven told this:

>> --- a/drivers/bus/simple-pm-bus.c
>> +++ b/drivers/bus/simple-pm-bus.c
>> @@ -92,4 +92,3 @@ module_platform_driver(simple_pm_bus_driver);
>>
>> MODULE_DESCRIPTION("Simple Power-Managed Bus Driver");
>> MODULE_AUTHOR("Geert Uytterhoeven <[email protected]>");
>> -MODULE_LICENSE("GPL v2");
>
> Please do not remove this line as long as the file has no SPDX-License
> tag.

OK, in the next (final?) round this patch will have what I think is the
right SPDX:

diff --git a/drivers/bus/simple-pm-bus.c b/drivers/bus/simple-pm-bus.c
index 7afe1947e1c08..4da77ca7b75aa 100644
--- a/drivers/bus/simple-pm-bus.c
+++ b/drivers/bus/simple-pm-bus.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Simple Power-Managed Bus Driver
*
@@ -138,4 +139,3 @@ module_platform_driver(simple_pm_bus_driver);

MODULE_DESCRIPTION("Simple Power-Managed Bus Driver");
MODULE_AUTHOR("Geert Uytterhoeven <[email protected]>");
-MODULE_LICENSE("GPL v2");
--
2.39.1.268.g9de2f9a303