[PATCH v6 4/9] scsi: Always define blogic_pci_tbl structure

Alexey Gladkov posted 9 patches 1 month, 3 weeks ago
There is a newer version of this series
[PATCH v6 4/9] scsi: Always define blogic_pci_tbl structure
Posted by Alexey Gladkov 1 month, 3 weeks ago
The blogic_pci_tbl structure is used by the MODULE_DEVICE_TABLE macro.
There is no longer a need to protect it with the MODULE condition, since
this no longer causes the compiler to warn about an unused variable.

To avoid warnings when -Wunused-const-variable option is used, mark it
as __maybe_unused for such configuration.

Cc: Khalid Aziz <khalid@gonehiking.org>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
Suggested-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Alexey Gladkov <legion@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
---
 drivers/scsi/BusLogic.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
index 1f100270cd38..82597bd96525 100644
--- a/drivers/scsi/BusLogic.c
+++ b/drivers/scsi/BusLogic.c
@@ -3715,7 +3715,6 @@ static void __exit blogic_exit(void)
 
 __setup("BusLogic=", blogic_setup);
 
-#ifdef MODULE
 /*static const struct pci_device_id blogic_pci_tbl[] = {
 	{ PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER,
 	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
@@ -3725,13 +3724,12 @@ __setup("BusLogic=", blogic_setup);
 	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
 	{ }
 };*/
-static const struct pci_device_id blogic_pci_tbl[] = {
+static const struct pci_device_id blogic_pci_tbl[] __maybe_unused = {
 	{PCI_DEVICE(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER)},
 	{PCI_DEVICE(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC)},
 	{PCI_DEVICE(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT)},
 	{0, },
 };
-#endif
 MODULE_DEVICE_TABLE(pci, blogic_pci_tbl);
 
 module_init(blogic_init);
-- 
2.50.1
Re: [PATCH v6 4/9] scsi: Always define blogic_pci_tbl structure
Posted by Martin K. Petersen 1 month, 2 weeks ago
Alexey,

> The blogic_pci_tbl structure is used by the MODULE_DEVICE_TABLE macro.
> There is no longer a need to protect it with the MODULE condition,
> since this no longer causes the compiler to warn about an unused
> variable.
>
> To avoid warnings when -Wunused-const-variable option is used, mark it
> as __maybe_unused for such configuration.

Applied to 6.18/scsi-staging, thanks!

-- 
Martin K. Petersen
Re: [PATCH v6 4/9] scsi: Always define blogic_pci_tbl structure
Posted by Nathan Chancellor 1 month, 2 weeks ago
Hi Martin,

On Mon, Aug 18, 2025 at 10:04:02PM -0400, Martin K. Petersen wrote:
> 
> Alexey,
> 
> > The blogic_pci_tbl structure is used by the MODULE_DEVICE_TABLE macro.
> > There is no longer a need to protect it with the MODULE condition,
> > since this no longer causes the compiler to warn about an unused
> > variable.
> >
> > To avoid warnings when -Wunused-const-variable option is used, mark it
> > as __maybe_unused for such configuration.
> 
> Applied to 6.18/scsi-staging, thanks!

I think I will need this change to apply patch 7 [1] to kbuild-next
without any issues [2]. If there is little risk of conflict, could I
take it with your Ack? Another option would be getting it into 6.17 as a
fix so that I could back merge Linus's tree and apply the series on top.
I am already going to have to do that for the pinctrl change that Linus
W took [3].

[1]: https://lore.kernel.org/22b36a5807d943a84431298c18b41d093e01c371.1755170493.git.legion@kernel.org/
[2]: https://lore.kernel.org/aDWoCU2YrxaCBi42@example.org/
[3]: https://lore.kernel.org/CACRpkdZ9oyJ4aJ5Dcp_Dtv5qoiSo+g5cO7Uf4PmHgv_Z423onQ@mail.gmail.com/

Cheers,
Nathan
Re: [PATCH v6 4/9] scsi: Always define blogic_pci_tbl structure
Posted by Martin K. Petersen 1 month, 2 weeks ago
Hi Nathan!

>> Applied to 6.18/scsi-staging, thanks!
>
> I think I will need this change to apply patch 7 [1] to kbuild-next
> without any issues [2]. If there is little risk of conflict, could I
> take it with your Ack?

Sure, no problem. Dropped the patch from my tree.

Acked-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen
Re: [PATCH v6 4/9] scsi: Always define blogic_pci_tbl structure
Posted by Nathan Chancellor 1 month, 2 weeks ago
On Tue, Aug 19, 2025 at 09:52:10PM -0400, Martin K. Petersen wrote:
> >> Applied to 6.18/scsi-staging, thanks!
> >
> > I think I will need this change to apply patch 7 [1] to kbuild-next
> > without any issues [2]. If there is little risk of conflict, could I
> > take it with your Ack?
> 
> Sure, no problem. Dropped the patch from my tree.
> 
> Acked-by: Martin K. Petersen <martin.petersen@oracle.com>

Thanks a lot!
Re: [PATCH v6 4/9] scsi: Always define blogic_pci_tbl structure
Posted by Alexey Gladkov 1 month, 1 week ago
On Wed, Aug 20, 2025 at 09:11:42AM -0700, Nathan Chancellor wrote:
> On Tue, Aug 19, 2025 at 09:52:10PM -0400, Martin K. Petersen wrote:
> > >> Applied to 6.18/scsi-staging, thanks!
> > >
> > > I think I will need this change to apply patch 7 [1] to kbuild-next
> > > without any issues [2]. If there is little risk of conflict, could I
> > > take it with your Ack?
> > 
> > Sure, no problem. Dropped the patch from my tree.
> > 
> > Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
> 
> Thanks a lot!

Has these patches been added somewhere, I can't find it in kbuild?

-- 
Rgrds, legion
Re: [PATCH v6 4/9] scsi: Always define blogic_pci_tbl structure
Posted by Nathan Chancellor 1 month, 1 week ago
Hi Alexey,

On Mon, Aug 25, 2025 at 12:09:48PM +0200, Alexey Gladkov wrote:
> Has these patches been added somewhere, I can't find it in kbuild?

I plan to apply this to the kbuild tree when [1] becomes available in
mainline so that I can backmerge it and apply the rest of the series on
top to avoid build breakage. As it is on a fixes branch, I would expect
it to be there by -rc4 or -rc5, which still gives us a few weeks for
soak testing in -next. If it is not there by then, I will just apply the
series in whole and we will just end up with the same commit in the tree
twice.

[1]: https://git.kernel.org/linusw/linux-pinctrl/c/bd7c2312128e31d056d30d34d60503de056e15f0

Cheers,
Nathan