2024-04-03 08:24:07

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 30/34] sata: mv: drop unnecessary #ifdef checks

From: Arnd Bergmann <[email protected]>

Building with W=1 shows a warning for an unused variable when CONFIG_PCI
is diabled:

drivers/ata/sata_mv.c:790:35: error: unused variable 'mv_pci_tbl' [-Werror,-Wunused-const-variable]
static const struct pci_device_id mv_pci_tbl[] = {

Move the table into the same block that containsn the pci_driver
definition.

Fixes: 7bb3c5290ca0 ("sata_mv: Remove PCI dependency")
Signed-off-by: Arnd Bergmann <[email protected]>
---
drivers/ata/sata_mv.c | 64 +++++++++++++++++++++----------------------
1 file changed, 32 insertions(+), 32 deletions(-)

diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index e82786c63fbd..697063890f5d 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -787,37 +787,6 @@ static const struct ata_port_info mv_port_info[] = {
},
};

-static const struct pci_device_id mv_pci_tbl[] = {
- { PCI_VDEVICE(MARVELL, 0x5040), chip_504x },
- { PCI_VDEVICE(MARVELL, 0x5041), chip_504x },
- { PCI_VDEVICE(MARVELL, 0x5080), chip_5080 },
- { PCI_VDEVICE(MARVELL, 0x5081), chip_508x },
- /* RocketRAID 1720/174x have different identifiers */
- { PCI_VDEVICE(TTI, 0x1720), chip_6042 },
- { PCI_VDEVICE(TTI, 0x1740), chip_6042 },
- { PCI_VDEVICE(TTI, 0x1742), chip_6042 },
-
- { PCI_VDEVICE(MARVELL, 0x6040), chip_604x },
- { PCI_VDEVICE(MARVELL, 0x6041), chip_604x },
- { PCI_VDEVICE(MARVELL, 0x6042), chip_6042 },
- { PCI_VDEVICE(MARVELL, 0x6080), chip_608x },
- { PCI_VDEVICE(MARVELL, 0x6081), chip_608x },
-
- { PCI_VDEVICE(ADAPTEC2, 0x0241), chip_604x },
-
- /* Adaptec 1430SA */
- { PCI_VDEVICE(ADAPTEC2, 0x0243), chip_7042 },
-
- /* Marvell 7042 support */
- { PCI_VDEVICE(MARVELL, 0x7042), chip_7042 },
-
- /* Highpoint RocketRAID PCIe series */
- { PCI_VDEVICE(TTI, 0x2300), chip_7042 },
- { PCI_VDEVICE(TTI, 0x2310), chip_7042 },
-
- { } /* terminate list */
-};
-
static const struct mv_hw_ops mv5xxx_ops = {
.phy_errata = mv5_phy_errata,
.enable_leds = mv5_enable_leds,
@@ -4303,6 +4272,37 @@ static int mv_pci_init_one(struct pci_dev *pdev,
static int mv_pci_device_resume(struct pci_dev *pdev);
#endif

+static const struct pci_device_id mv_pci_tbl[] = {
+ { PCI_VDEVICE(MARVELL, 0x5040), chip_504x },
+ { PCI_VDEVICE(MARVELL, 0x5041), chip_504x },
+ { PCI_VDEVICE(MARVELL, 0x5080), chip_5080 },
+ { PCI_VDEVICE(MARVELL, 0x5081), chip_508x },
+ /* RocketRAID 1720/174x have different identifiers */
+ { PCI_VDEVICE(TTI, 0x1720), chip_6042 },
+ { PCI_VDEVICE(TTI, 0x1740), chip_6042 },
+ { PCI_VDEVICE(TTI, 0x1742), chip_6042 },
+
+ { PCI_VDEVICE(MARVELL, 0x6040), chip_604x },
+ { PCI_VDEVICE(MARVELL, 0x6041), chip_604x },
+ { PCI_VDEVICE(MARVELL, 0x6042), chip_6042 },
+ { PCI_VDEVICE(MARVELL, 0x6080), chip_608x },
+ { PCI_VDEVICE(MARVELL, 0x6081), chip_608x },
+
+ { PCI_VDEVICE(ADAPTEC2, 0x0241), chip_604x },
+
+ /* Adaptec 1430SA */
+ { PCI_VDEVICE(ADAPTEC2, 0x0243), chip_7042 },
+
+ /* Marvell 7042 support */
+ { PCI_VDEVICE(MARVELL, 0x7042), chip_7042 },
+
+ /* Highpoint RocketRAID PCIe series */
+ { PCI_VDEVICE(TTI, 0x2300), chip_7042 },
+ { PCI_VDEVICE(TTI, 0x2310), chip_7042 },
+
+ { } /* terminate list */
+};
+

static struct pci_driver mv_pci_driver = {
.name = DRV_NAME,
@@ -4315,6 +4315,7 @@ static struct pci_driver mv_pci_driver = {
#endif

};
+MODULE_DEVICE_TABLE(pci, mv_pci_tbl);

/**
* mv_print_info - Dump key info to kernel log for perusal.
@@ -4487,7 +4488,6 @@ static void __exit mv_exit(void)
MODULE_AUTHOR("Brett Russ");
MODULE_DESCRIPTION("SCSI low-level driver for Marvell SATA controllers");
MODULE_LICENSE("GPL v2");
-MODULE_DEVICE_TABLE(pci, mv_pci_tbl);
MODULE_VERSION(DRV_VERSION);
MODULE_ALIAS("platform:" DRV_NAME);

--
2.39.2



2024-04-03 08:34:13

by Damien Le Moal

[permalink] [raw]
Subject: Re: [PATCH 30/34] sata: mv: drop unnecessary #ifdef checks

On 4/3/24 17:06, Arnd Bergmann wrote:
> From: Arnd Bergmann <[email protected]>
>
> Building with W=1 shows a warning for an unused variable when CONFIG_PCI
> is diabled:
>
> drivers/ata/sata_mv.c:790:35: error: unused variable 'mv_pci_tbl' [-Werror,-Wunused-const-variable]
> static const struct pci_device_id mv_pci_tbl[] = {
>
> Move the table into the same block that containsn the pci_driver
> definition.
>
> Fixes: 7bb3c5290ca0 ("sata_mv: Remove PCI dependency")
> Signed-off-by: Arnd Bergmann <[email protected]>

The patch title is also not describing what the patch does.
Are you OK with changing that to:

ata: sata_mv: Fix PCI device ID table declaration warning

?

> ---
> drivers/ata/sata_mv.c | 64 +++++++++++++++++++++----------------------
> 1 file changed, 32 insertions(+), 32 deletions(-)
>
> diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
> index e82786c63fbd..697063890f5d 100644
> --- a/drivers/ata/sata_mv.c
> +++ b/drivers/ata/sata_mv.c
> @@ -787,37 +787,6 @@ static const struct ata_port_info mv_port_info[] = {
> },
> };
>
> -static const struct pci_device_id mv_pci_tbl[] = {
> - { PCI_VDEVICE(MARVELL, 0x5040), chip_504x },
> - { PCI_VDEVICE(MARVELL, 0x5041), chip_504x },
> - { PCI_VDEVICE(MARVELL, 0x5080), chip_5080 },
> - { PCI_VDEVICE(MARVELL, 0x5081), chip_508x },
> - /* RocketRAID 1720/174x have different identifiers */
> - { PCI_VDEVICE(TTI, 0x1720), chip_6042 },
> - { PCI_VDEVICE(TTI, 0x1740), chip_6042 },
> - { PCI_VDEVICE(TTI, 0x1742), chip_6042 },
> -
> - { PCI_VDEVICE(MARVELL, 0x6040), chip_604x },
> - { PCI_VDEVICE(MARVELL, 0x6041), chip_604x },
> - { PCI_VDEVICE(MARVELL, 0x6042), chip_6042 },
> - { PCI_VDEVICE(MARVELL, 0x6080), chip_608x },
> - { PCI_VDEVICE(MARVELL, 0x6081), chip_608x },
> -
> - { PCI_VDEVICE(ADAPTEC2, 0x0241), chip_604x },
> -
> - /* Adaptec 1430SA */
> - { PCI_VDEVICE(ADAPTEC2, 0x0243), chip_7042 },
> -
> - /* Marvell 7042 support */
> - { PCI_VDEVICE(MARVELL, 0x7042), chip_7042 },
> -
> - /* Highpoint RocketRAID PCIe series */
> - { PCI_VDEVICE(TTI, 0x2300), chip_7042 },
> - { PCI_VDEVICE(TTI, 0x2310), chip_7042 },
> -
> - { } /* terminate list */
> -};
> -
> static const struct mv_hw_ops mv5xxx_ops = {
> .phy_errata = mv5_phy_errata,
> .enable_leds = mv5_enable_leds,
> @@ -4303,6 +4272,37 @@ static int mv_pci_init_one(struct pci_dev *pdev,
> static int mv_pci_device_resume(struct pci_dev *pdev);
> #endif
>
> +static const struct pci_device_id mv_pci_tbl[] = {
> + { PCI_VDEVICE(MARVELL, 0x5040), chip_504x },
> + { PCI_VDEVICE(MARVELL, 0x5041), chip_504x },
> + { PCI_VDEVICE(MARVELL, 0x5080), chip_5080 },
> + { PCI_VDEVICE(MARVELL, 0x5081), chip_508x },
> + /* RocketRAID 1720/174x have different identifiers */
> + { PCI_VDEVICE(TTI, 0x1720), chip_6042 },
> + { PCI_VDEVICE(TTI, 0x1740), chip_6042 },
> + { PCI_VDEVICE(TTI, 0x1742), chip_6042 },
> +
> + { PCI_VDEVICE(MARVELL, 0x6040), chip_604x },
> + { PCI_VDEVICE(MARVELL, 0x6041), chip_604x },
> + { PCI_VDEVICE(MARVELL, 0x6042), chip_6042 },
> + { PCI_VDEVICE(MARVELL, 0x6080), chip_608x },
> + { PCI_VDEVICE(MARVELL, 0x6081), chip_608x },
> +
> + { PCI_VDEVICE(ADAPTEC2, 0x0241), chip_604x },
> +
> + /* Adaptec 1430SA */
> + { PCI_VDEVICE(ADAPTEC2, 0x0243), chip_7042 },
> +
> + /* Marvell 7042 support */
> + { PCI_VDEVICE(MARVELL, 0x7042), chip_7042 },
> +
> + /* Highpoint RocketRAID PCIe series */
> + { PCI_VDEVICE(TTI, 0x2300), chip_7042 },
> + { PCI_VDEVICE(TTI, 0x2310), chip_7042 },
> +
> + { } /* terminate list */
> +};
> +
>
> static struct pci_driver mv_pci_driver = {
> .name = DRV_NAME,
> @@ -4315,6 +4315,7 @@ static struct pci_driver mv_pci_driver = {
> #endif
>
> };
> +MODULE_DEVICE_TABLE(pci, mv_pci_tbl);
>
> /**
> * mv_print_info - Dump key info to kernel log for perusal.
> @@ -4487,7 +4488,6 @@ static void __exit mv_exit(void)
> MODULE_AUTHOR("Brett Russ");
> MODULE_DESCRIPTION("SCSI low-level driver for Marvell SATA controllers");
> MODULE_LICENSE("GPL v2");
> -MODULE_DEVICE_TABLE(pci, mv_pci_tbl);
> MODULE_VERSION(DRV_VERSION);
> MODULE_ALIAS("platform:" DRV_NAME);
>

--
Damien Le Moal
Western Digital Research


2024-04-03 08:34:16

by Damien Le Moal

[permalink] [raw]
Subject: Re: [PATCH 30/34] sata: mv: drop unnecessary #ifdef checks

On 4/3/24 17:06, Arnd Bergmann wrote:
> From: Arnd Bergmann <[email protected]>
>
> Building with W=1 shows a warning for an unused variable when CONFIG_PCI
> is diabled:

s/diabled/disabled

> drivers/ata/sata_mv.c:790:35: error: unused variable 'mv_pci_tbl' [-Werror,-Wunused-const-variable]
> static const struct pci_device_id mv_pci_tbl[] = {
>
> Move the table into the same block that containsn the pci_driver
> definition.

s/containsn/contains

But no need to resend, I will fix that when applying.

Thanks !

>
> Fixes: 7bb3c5290ca0 ("sata_mv: Remove PCI dependency")
> Signed-off-by: Arnd Bergmann <[email protected]>
> ---
> drivers/ata/sata_mv.c | 64 +++++++++++++++++++++----------------------
> 1 file changed, 32 insertions(+), 32 deletions(-)
>
> diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
> index e82786c63fbd..697063890f5d 100644
> --- a/drivers/ata/sata_mv.c
> +++ b/drivers/ata/sata_mv.c
> @@ -787,37 +787,6 @@ static const struct ata_port_info mv_port_info[] = {
> },
> };
>
> -static const struct pci_device_id mv_pci_tbl[] = {
> - { PCI_VDEVICE(MARVELL, 0x5040), chip_504x },
> - { PCI_VDEVICE(MARVELL, 0x5041), chip_504x },
> - { PCI_VDEVICE(MARVELL, 0x5080), chip_5080 },
> - { PCI_VDEVICE(MARVELL, 0x5081), chip_508x },
> - /* RocketRAID 1720/174x have different identifiers */
> - { PCI_VDEVICE(TTI, 0x1720), chip_6042 },
> - { PCI_VDEVICE(TTI, 0x1740), chip_6042 },
> - { PCI_VDEVICE(TTI, 0x1742), chip_6042 },
> -
> - { PCI_VDEVICE(MARVELL, 0x6040), chip_604x },
> - { PCI_VDEVICE(MARVELL, 0x6041), chip_604x },
> - { PCI_VDEVICE(MARVELL, 0x6042), chip_6042 },
> - { PCI_VDEVICE(MARVELL, 0x6080), chip_608x },
> - { PCI_VDEVICE(MARVELL, 0x6081), chip_608x },
> -
> - { PCI_VDEVICE(ADAPTEC2, 0x0241), chip_604x },
> -
> - /* Adaptec 1430SA */
> - { PCI_VDEVICE(ADAPTEC2, 0x0243), chip_7042 },
> -
> - /* Marvell 7042 support */
> - { PCI_VDEVICE(MARVELL, 0x7042), chip_7042 },
> -
> - /* Highpoint RocketRAID PCIe series */
> - { PCI_VDEVICE(TTI, 0x2300), chip_7042 },
> - { PCI_VDEVICE(TTI, 0x2310), chip_7042 },
> -
> - { } /* terminate list */
> -};
> -
> static const struct mv_hw_ops mv5xxx_ops = {
> .phy_errata = mv5_phy_errata,
> .enable_leds = mv5_enable_leds,
> @@ -4303,6 +4272,37 @@ static int mv_pci_init_one(struct pci_dev *pdev,
> static int mv_pci_device_resume(struct pci_dev *pdev);
> #endif
>
> +static const struct pci_device_id mv_pci_tbl[] = {
> + { PCI_VDEVICE(MARVELL, 0x5040), chip_504x },
> + { PCI_VDEVICE(MARVELL, 0x5041), chip_504x },
> + { PCI_VDEVICE(MARVELL, 0x5080), chip_5080 },
> + { PCI_VDEVICE(MARVELL, 0x5081), chip_508x },
> + /* RocketRAID 1720/174x have different identifiers */
> + { PCI_VDEVICE(TTI, 0x1720), chip_6042 },
> + { PCI_VDEVICE(TTI, 0x1740), chip_6042 },
> + { PCI_VDEVICE(TTI, 0x1742), chip_6042 },
> +
> + { PCI_VDEVICE(MARVELL, 0x6040), chip_604x },
> + { PCI_VDEVICE(MARVELL, 0x6041), chip_604x },
> + { PCI_VDEVICE(MARVELL, 0x6042), chip_6042 },
> + { PCI_VDEVICE(MARVELL, 0x6080), chip_608x },
> + { PCI_VDEVICE(MARVELL, 0x6081), chip_608x },
> +
> + { PCI_VDEVICE(ADAPTEC2, 0x0241), chip_604x },
> +
> + /* Adaptec 1430SA */
> + { PCI_VDEVICE(ADAPTEC2, 0x0243), chip_7042 },
> +
> + /* Marvell 7042 support */
> + { PCI_VDEVICE(MARVELL, 0x7042), chip_7042 },
> +
> + /* Highpoint RocketRAID PCIe series */
> + { PCI_VDEVICE(TTI, 0x2300), chip_7042 },
> + { PCI_VDEVICE(TTI, 0x2310), chip_7042 },
> +
> + { } /* terminate list */
> +};
> +
>
> static struct pci_driver mv_pci_driver = {
> .name = DRV_NAME,
> @@ -4315,6 +4315,7 @@ static struct pci_driver mv_pci_driver = {
> #endif
>
> };
> +MODULE_DEVICE_TABLE(pci, mv_pci_tbl);
>
> /**
> * mv_print_info - Dump key info to kernel log for perusal.
> @@ -4487,7 +4488,6 @@ static void __exit mv_exit(void)
> MODULE_AUTHOR("Brett Russ");
> MODULE_DESCRIPTION("SCSI low-level driver for Marvell SATA controllers");
> MODULE_LICENSE("GPL v2");
> -MODULE_DEVICE_TABLE(pci, mv_pci_tbl);
> MODULE_VERSION(DRV_VERSION);
> MODULE_ALIAS("platform:" DRV_NAME);
>

--
Damien Le Moal
Western Digital Research


2024-04-03 08:53:25

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 30/34] sata: mv: drop unnecessary #ifdef checks

On Wed, Apr 3, 2024, at 10:32, Damien Le Moal wrote:
> On 4/3/24 17:06, Arnd Bergmann wrote:
>> From: Arnd Bergmann <[email protected]>
>>
>> Building with W=1 shows a warning for an unused variable when CONFIG_PCI
>> is diabled:
>>
>> drivers/ata/sata_mv.c:790:35: error: unused variable 'mv_pci_tbl' [-Werror,-Wunused-const-variable]
>> static const struct pci_device_id mv_pci_tbl[] = {
>>
>> Move the table into the same block that containsn the pci_driver
>> definition.
>>
>> Fixes: 7bb3c5290ca0 ("sata_mv: Remove PCI dependency")
>> Signed-off-by: Arnd Bergmann <[email protected]>
>
> The patch title is also not describing what the patch does.
> Are you OK with changing that to:
>
> ata: sata_mv: Fix PCI device ID table declaration warning
>
> ?

Yes, please do, thanks!

I had first tried to remove all the #ifdef checks and just
rely on dead-code-elimination doing the same when
pci_register_driver() is stubbed out and IS_ENABLED(CONFIG_OF)
checks turn off the rest. Unfortunately, the include/linux/pci.h
interfaces are not all stubbed out here and cause compile-time
failures without CONFIG_PCI, so that didn't work out.

Arnd

2024-04-03 09:19:12

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH 30/34] sata: mv: drop unnecessary #ifdef checks

On Wed, Apr 03, 2024 at 10:06:48AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <[email protected]>
>
> Building with W=1 shows a warning for an unused variable when CONFIG_PCI
> is diabled:
>
> drivers/ata/sata_mv.c:790:35: error: unused variable 'mv_pci_tbl' [-Werror,-Wunused-const-variable]
> static const struct pci_device_id mv_pci_tbl[] = {
>
> Move the table into the same block that containsn the pci_driver
> definition.

..

> + { } /* terminate list */
> +};

> +

Too many blank lines now.

>
> static struct pci_driver mv_pci_driver = {
> .name = DRV_NAME,

--
With Best Regards,
Andy Shevchenko



2024-04-04 03:45:16

by Damien Le Moal

[permalink] [raw]
Subject: Re: [PATCH 30/34] sata: mv: drop unnecessary #ifdef checks

On 4/3/24 17:50, Arnd Bergmann wrote:
> On Wed, Apr 3, 2024, at 10:32, Damien Le Moal wrote:
>> On 4/3/24 17:06, Arnd Bergmann wrote:
>>> From: Arnd Bergmann <[email protected]>
>>>
>>> Building with W=1 shows a warning for an unused variable when CONFIG_PCI
>>> is diabled:
>>>
>>> drivers/ata/sata_mv.c:790:35: error: unused variable 'mv_pci_tbl' [-Werror,-Wunused-const-variable]
>>> static const struct pci_device_id mv_pci_tbl[] = {
>>>
>>> Move the table into the same block that containsn the pci_driver
>>> definition.
>>>
>>> Fixes: 7bb3c5290ca0 ("sata_mv: Remove PCI dependency")
>>> Signed-off-by: Arnd Bergmann <[email protected]>
>>
>> The patch title is also not describing what the patch does.
>> Are you OK with changing that to:
>>
>> ata: sata_mv: Fix PCI device ID table declaration warning
>>
>> ?
>
> Yes, please do, thanks!

Applied to for-6.9-fixes with discussed tweaks and removal of extra blanklines
pointed out by Andy. Thanks !

>
> I had first tried to remove all the #ifdef checks and just
> rely on dead-code-elimination doing the same when
> pci_register_driver() is stubbed out and IS_ENABLED(CONFIG_OF)
> checks turn off the rest. Unfortunately, the include/linux/pci.h
> interfaces are not all stubbed out here and cause compile-time
> failures without CONFIG_PCI, so that didn't work out.
>
> Arnd

--
Damien Le Moal
Western Digital Research