Re: [PATCH]dgrs - Fixes Warnings when CONFIG_ISA and CONFIG_PCI are not enabled

From: Ashutosh Naik
Date: Wed Nov 02 2005 - 08:15:49 EST


On 11/2/05, Richard Knutsson <ricknu-0@xxxxxxxxxxxxxx> wrote:
> Ashutosh Naik wrote:
>
> >This patch fixes compiler warnings when CONFIG_ISA and CONFIG_PCI are
> >not enabled in the dgrc network driver.
> >
> >Signed-off-by: Ashutosh Naik <ashutosh.naik@xxxxxxxxx>
> >
> >--
> >diff -Naurp linux-2.6.14/drivers/net/dgrs.c
> >linux-2.6.14-git1/drivers/net/dgrs.c---
> >linux-2.6.14/drivers/net/dgrs.c 2005-10-28 05:32:08.000000000
> >+0530
> >+++ linux-2.6.14-git1/drivers/net/dgrs.c 2005-11-01
> >10:30:03.000000000 +0530
> >@@ -1549,8 +1549,12 @@ MODULE_PARM_DESC(nicmode, "Digi RightSwi
> > static int __init dgrs_init_module (void) {
> > int i;
> >- int eisacount = 0, pcicount = 0;
> >-
> >+#ifdef CONFIG_EISA
> >+ int eisacount = 0;
> >+#endif
> >+#ifdef CONFIG_PCI
> >+ int pcicount = 0;
> >+#endif
> > /*
> > * Command line variable overrides
> > * debug=NNN
> >-
> >
> >
> Since eisacount and pcicount is doing the same task (and they are only
> used in sequence) and to preventing more #ifdef in the source-code, why
> not use the same variable? It will give an warning if both of them is
> not defined, but is that an issue? If so,
> #if !defined CONFIG_EISA && !defined CONFIG_PCI
> could encapsulate the variable to prevent that.
>
> Posted 26'th of October and now also checked against 2.6.14-git1.
>
> Signed-off-by: Richard Knutsson <ricknu-0@xxxxxxxxxxxxxx>
>
> ---
>
> diff -uNr a/drivers/net/dgrs.c b/drivers/net/dgrs.c
> --- a/drivers/net/dgrs.c 2005-08-29 01:41:01.000000000 +0200
> +++ b/drivers/net/dgrs.c 2005-10-26 15:53:43.000000000 +0200
> @@ -1549,7 +1549,7 @@
> static int __init dgrs_init_module (void)
> {
> int i;
> - int eisacount = 0, pcicount = 0;
> + int count;
>
> /*
> * Command line variable overrides
> @@ -1591,14 +1591,14 @@
> * Find and configure all the cards
> */
> #ifdef CONFIG_EISA
> - eisacount = eisa_driver_register(&dgrs_eisa_driver);
> - if (eisacount < 0)
> - return eisacount;
> + count = eisa_driver_register(&dgrs_eisa_driver);
> + if (count < 0)
> + return count;
> #endif
> #ifdef CONFIG_PCI
> - pcicount = pci_register_driver(&dgrs_pci_driver);
> - if (pcicount)
> - return pcicount;
> + count = pci_register_driver(&dgrs_pci_driver);
> + if (count)
> + return count;
> #endif
> return 0;
> }

Well, both of them do the same stuff, but one of these patches needs
to be committed.

Cheers
Ashutosh
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html