public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] PNP: Export pnp_bus_type for modules
@ 2024-05-27 20:24 Andy Shevchenko
  2024-05-27 22:20 ` Woody Suwalski
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Andy Shevchenko @ 2024-05-27 20:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-acpi, linux-kernel
  Cc: Rafael J. Wysocki, Guanbing Huang, Guanbing Huang,
	Andy Shevchenko, Woody Suwalski

Since we have dev_is_pnp() macro that utilises the address of pnp_bus_type
variable, the users, which can be compiled as modules, will be failed to
build. Export the variable to the modules to prevent build breakage.

Reported-by: Woody Suwalski <terraluna977@gmail.com>
Closes: https://lore.kernel.org/r/cc8a93b2-2504-9754-e26c-5d5c3bd1265c@gmail.com
Fixes: 2a49b45cd0e7 ("PNP: Add dev_is_pnp() macro")
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/pnp/driver.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c
index 0a5d0d8befa8..1394d17bd6f7 100644
--- a/drivers/pnp/driver.c
+++ b/drivers/pnp/driver.c
@@ -265,6 +265,7 @@ const struct bus_type pnp_bus_type = {
 	.pm	 = &pnp_bus_dev_pm_ops,
 	.dev_groups = pnp_dev_groups,
 };
+EXPORT_SYMBOL(pnp_bus_type);
 
 int pnp_register_driver(struct pnp_driver *drv)
 {
-- 
2.45.1


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

* Re: [PATCH v1 1/1] PNP: Export pnp_bus_type for modules
  2024-05-27 20:24 [PATCH v1 1/1] PNP: Export pnp_bus_type for modules Andy Shevchenko
@ 2024-05-27 22:20 ` Woody Suwalski
  2024-05-28  4:58 ` Christoph Hellwig
  2024-05-28  9:42 ` Rafael J. Wysocki
  2 siblings, 0 replies; 9+ messages in thread
From: Woody Suwalski @ 2024-05-27 22:20 UTC (permalink / raw)
  To: Andy Shevchenko, Greg Kroah-Hartman, linux-acpi, linux-kernel
  Cc: Rafael J. Wysocki, Guanbing Huang, Guanbing Huang

Andy Shevchenko wrote:
> Since we have dev_is_pnp() macro that utilises the address of pnp_bus_type
> variable, the users, which can be compiled as modules, will be failed to
> build. Export the variable to the modules to prevent build breakage.
>
> Reported-by: Woody Suwalski <terraluna977@gmail.com>
> Closes: https://lore.kernel.org/r/cc8a93b2-2504-9754-e26c-5d5c3bd1265c@gmail.com
> Fixes: 2a49b45cd0e7 ("PNP: Add dev_is_pnp() macro")
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> ---
>   drivers/pnp/driver.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c
> index 0a5d0d8befa8..1394d17bd6f7 100644
> --- a/drivers/pnp/driver.c
> +++ b/drivers/pnp/driver.c
> @@ -265,6 +265,7 @@ const struct bus_type pnp_bus_type = {
>   	.pm	 = &pnp_bus_dev_pm_ops,
>   	.dev_groups = pnp_dev_groups,
>   };
> +EXPORT_SYMBOL(pnp_bus_type);
>   
>   int pnp_register_driver(struct pnp_driver *drv)
>   {
Confirm the patch works OK.

Tested-by: Woody Suwalski <terraluna977@gmail.com>

Thanks, Woody


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

* Re: [PATCH v1 1/1] PNP: Export pnp_bus_type for modules
  2024-05-27 20:24 [PATCH v1 1/1] PNP: Export pnp_bus_type for modules Andy Shevchenko
  2024-05-27 22:20 ` Woody Suwalski
@ 2024-05-28  4:58 ` Christoph Hellwig
  2024-05-28  7:10   ` Andy Shevchenko
  2024-05-28  7:12   ` Andy Shevchenko
  2024-05-28  9:42 ` Rafael J. Wysocki
  2 siblings, 2 replies; 9+ messages in thread
From: Christoph Hellwig @ 2024-05-28  4:58 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, linux-acpi, linux-kernel, Rafael J. Wysocki,
	Guanbing Huang, Guanbing Huang, Woody Suwalski

On Mon, May 27, 2024 at 11:24:24PM +0300, Andy Shevchenko wrote:
> Since we have dev_is_pnp() macro that utilises the address of pnp_bus_type
> variable, the users, which can be compiled as modules, will be failed to
> build. Export the variable to the modules to prevent build breakage.

NAK.  Please move dev_is_pnp out of line and export it (as
EXPORT_SYMBOL_GPL), please.  bus types should be private unless we have
really good reasons for them not to be private.


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

* Re: [PATCH v1 1/1] PNP: Export pnp_bus_type for modules
  2024-05-28  4:58 ` Christoph Hellwig
@ 2024-05-28  7:10   ` Andy Shevchenko
  2024-05-28  7:12   ` Andy Shevchenko
  1 sibling, 0 replies; 9+ messages in thread
From: Andy Shevchenko @ 2024-05-28  7:10 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Greg Kroah-Hartman, linux-acpi, linux-kernel, Rafael J. Wysocki,
	Guanbing Huang, Guanbing Huang, Woody Suwalski

On Tue, May 28, 2024 at 7:58 AM Christoph Hellwig <hch@infradead.org> wrote:
>
> On Mon, May 27, 2024 at 11:24:24PM +0300, Andy Shevchenko wrote:
> > Since we have dev_is_pnp() macro that utilises the address of pnp_bus_type
> > variable, the users, which can be compiled as modules, will be failed to
> > build. Export the variable to the modules to prevent build breakage.
>
> NAK.  Please move dev_is_pnp out of line and export it (as
> EXPORT_SYMBOL_GPL), please.  bus types should be private unless we have
> really good reasons for them not to be private.

Works for me, I'll redo it in the v2, thank you for the review.

-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v1 1/1] PNP: Export pnp_bus_type for modules
  2024-05-28  4:58 ` Christoph Hellwig
  2024-05-28  7:10   ` Andy Shevchenko
@ 2024-05-28  7:12   ` Andy Shevchenko
  2024-05-28  7:14     ` Christoph Hellwig
  1 sibling, 1 reply; 9+ messages in thread
From: Andy Shevchenko @ 2024-05-28  7:12 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Greg Kroah-Hartman, linux-acpi, linux-kernel, Rafael J. Wysocki,
	Guanbing Huang, Guanbing Huang, Woody Suwalski

On Tue, May 28, 2024 at 7:58 AM Christoph Hellwig <hch@infradead.org> wrote:
>
> On Mon, May 27, 2024 at 11:24:24PM +0300, Andy Shevchenko wrote:
> > Since we have dev_is_pnp() macro that utilises the address of pnp_bus_type
> > variable, the users, which can be compiled as modules, will be failed to
> > build. Export the variable to the modules to prevent build breakage.
>
> NAK.  Please move dev_is_pnp out of line and export it (as
> EXPORT_SYMBOL_GPL), please.  bus types should be private unless we have
> really good reasons for them not to be private.

FWIW, it's not private, it's just not exported to the modules. Are you
suggesting to hide the bus type completely to make it static? If so,
this is out of scope of this fix.

-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v1 1/1] PNP: Export pnp_bus_type for modules
  2024-05-28  7:12   ` Andy Shevchenko
@ 2024-05-28  7:14     ` Christoph Hellwig
  0 siblings, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2024-05-28  7:14 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Christoph Hellwig, Greg Kroah-Hartman, linux-acpi, linux-kernel,
	Rafael J. Wysocki, Guanbing Huang, Guanbing Huang, Woody Suwalski

On Tue, May 28, 2024 at 10:12:31AM +0300, Andy Shevchenko wrote:
> > NAK.  Please move dev_is_pnp out of line and export it (as
> > EXPORT_SYMBOL_GPL), please.  bus types should be private unless we have
> > really good reasons for them not to be private.
> 
> FWIW, it's not private, it's just not exported to the modules. Are you
> suggesting to hide the bus type completely to make it static? If so,
> this is out of scope of this fix.

Not exporting it is the most important bit.  Making it private would
be even better of course.


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

* Re: [PATCH v1 1/1] PNP: Export pnp_bus_type for modules
  2024-05-27 20:24 [PATCH v1 1/1] PNP: Export pnp_bus_type for modules Andy Shevchenko
  2024-05-27 22:20 ` Woody Suwalski
  2024-05-28  4:58 ` Christoph Hellwig
@ 2024-05-28  9:42 ` Rafael J. Wysocki
  2024-05-28  9:52   ` Andy Shevchenko
  2 siblings, 1 reply; 9+ messages in thread
From: Rafael J. Wysocki @ 2024-05-28  9:42 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, linux-acpi, linux-kernel, Rafael J. Wysocki,
	Guanbing Huang, Guanbing Huang, Woody Suwalski

On Mon, May 27, 2024 at 10:24 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> Since we have dev_is_pnp() macro that utilises the address of pnp_bus_type
> variable, the users, which can be compiled as modules, will be failed to
> build. Export the variable to the modules to prevent build breakage.
>
> Reported-by: Woody Suwalski <terraluna977@gmail.com>
> Closes: https://lore.kernel.org/r/cc8a93b2-2504-9754-e26c-5d5c3bd1265c@gmail.com
> Fixes: 2a49b45cd0e7 ("PNP: Add dev_is_pnp() macro")
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> ---
>  drivers/pnp/driver.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c
> index 0a5d0d8befa8..1394d17bd6f7 100644
> --- a/drivers/pnp/driver.c
> +++ b/drivers/pnp/driver.c
> @@ -265,6 +265,7 @@ const struct bus_type pnp_bus_type = {
>         .pm      = &pnp_bus_dev_pm_ops,
>         .dev_groups = pnp_dev_groups,
>  };
> +EXPORT_SYMBOL(pnp_bus_type);

Why not EXPORT_SYMBOL_GPL()?

>  int pnp_register_driver(struct pnp_driver *drv)
>  {
> --
> 2.45.1
>
>

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

* Re: [PATCH v1 1/1] PNP: Export pnp_bus_type for modules
  2024-05-28  9:42 ` Rafael J. Wysocki
@ 2024-05-28  9:52   ` Andy Shevchenko
  2024-05-28  9:58     ` Rafael J. Wysocki
  0 siblings, 1 reply; 9+ messages in thread
From: Andy Shevchenko @ 2024-05-28  9:52 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Greg Kroah-Hartman, linux-acpi, linux-kernel, Rafael J. Wysocki,
	Guanbing Huang, Guanbing Huang, Woody Suwalski

On Tue, May 28, 2024 at 12:42 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
> On Mon, May 27, 2024 at 10:24 PM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
> >
> > Since we have dev_is_pnp() macro that utilises the address of pnp_bus_type
> > variable, the users, which can be compiled as modules, will be failed to
> > build. Export the variable to the modules to prevent build breakage.

...

> > +EXPORT_SYMBOL(pnp_bus_type);
>
> Why not EXPORT_SYMBOL_GPL()?

To be consistent with the rest, but in any case Christoph suggested
something else, where _GPL is assumed to be.

-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v1 1/1] PNP: Export pnp_bus_type for modules
  2024-05-28  9:52   ` Andy Shevchenko
@ 2024-05-28  9:58     ` Rafael J. Wysocki
  0 siblings, 0 replies; 9+ messages in thread
From: Rafael J. Wysocki @ 2024-05-28  9:58 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Rafael J. Wysocki, Greg Kroah-Hartman, linux-acpi, linux-kernel,
	Rafael J. Wysocki, Guanbing Huang, Guanbing Huang, Woody Suwalski

On Tue, May 28, 2024 at 11:53 AM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> On Tue, May 28, 2024 at 12:42 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
> > On Mon, May 27, 2024 at 10:24 PM Andy Shevchenko
> > <andy.shevchenko@gmail.com> wrote:
> > >
> > > Since we have dev_is_pnp() macro that utilises the address of pnp_bus_type
> > > variable, the users, which can be compiled as modules, will be failed to
> > > build. Export the variable to the modules to prevent build breakage.
>
> ...
>
> > > +EXPORT_SYMBOL(pnp_bus_type);
> >
> > Why not EXPORT_SYMBOL_GPL()?
>
> To be consistent with the rest, but in any case Christoph suggested
> something else, where _GPL is assumed to be.

Yes, that's even better.

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

end of thread, other threads:[~2024-05-28  9:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-27 20:24 [PATCH v1 1/1] PNP: Export pnp_bus_type for modules Andy Shevchenko
2024-05-27 22:20 ` Woody Suwalski
2024-05-28  4:58 ` Christoph Hellwig
2024-05-28  7:10   ` Andy Shevchenko
2024-05-28  7:12   ` Andy Shevchenko
2024-05-28  7:14     ` Christoph Hellwig
2024-05-28  9:42 ` Rafael J. Wysocki
2024-05-28  9:52   ` Andy Shevchenko
2024-05-28  9:58     ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox