Fix warning in drivers/ide/pci/triflex.c
Subsystems (2)
PATCH 1/1 Fix warning in drivers/ide/pci/triflex.c
hi all,
this patch fixes this warning:
drivers/ide/pci/triflex.c:49: warning: `triflex_get_info' defined but not used
here is:
drivers/ide/pci/triflex.c +2 -0
@@ -45,6 +45,7 @@static struct pci_dev *triflex_dev; +#ifdef CONFIG_PROC_FS static int triflex_get_info (char *buf,char **addr,off_t offset,int count) {char *p = buf;
@@ -91,6 +92,7 @@ return len > count ? count : len; } +#endif static int triflex_tune_chipset (ide_drive_t *drive,u8 xferspeed) {
drivers/ide/pci/triflex.h +8 -8
@@ -14,8 +14,16 @@static unsigned int __devinit init_chipset_triflex (struct pci_dev *,const char *);static void init_hwif_triflex (ide_hwif_t *); +#ifdef CONFIG_PROC_FS static int triflex_get_info (char *,char **,off_t ,int ); +static ide_pci_host_proc_t triflex_proc__initdata = { + .name ="triflex" , + .set =1 , + .get_info = triflex_get_info, +}; +#endif +static ide_pci_device_t triflex_devices[]__devinitdata = { { .vendor =PCI_VENDOR_ID_COMPAQ ,
@@ -33,14 +41,6 @@ } }; -#ifdef CONFIG_PROC_FS -static ide_pci_host_proc_t triflex_proc__initdata = { - .name ="triflex" , - .set =1 , - .get_info = triflex_get_info, -}; -#endif -static struct pci_device_id triflex_pci_tbl[] = { {PCI_VENDOR_ID_COMPAQ ,PCI_DEVICE_ID_COMPAQ_TRIFLEX_IDE ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,0 },
Signature · 8 lines
Luiz Fernando N. Capitulino <[email protected]> <http://www.telecentros.sp.gov.br> _______________________________________________ Kernel-janitors mailing list [email protected] http://lists.osdl.org/mailman/listinfo/kernel-janitors
Greetings,
Quoted 20 lines · Luiz Fernando Capitulino
hi all,
this patch fixes this warning:
drivers/ide/pci/triflex.c:49: warning: `triflex_get_info' defined but not usedhere is:
diff -X dontdiff -Nru
linux-2.6.2-rc2/drivers/ide/pci/triflex.clinux-2.6.2-rc2~/drivers/ide/pci/triflex.cdrivers/ide/pci/triflex.c +1
-0@@ -45,6 +45,7 @@static struct pci_dev *triflex_dev; +#ifdef CONFIG_PROC_FS static int triflex_get_info (char *buf,char **addr,off_t offset,int count) {char *p = buf;
drivers/ide/pci/triflex.c line 95
Quoted 4 lines
drivers/ide/pci/triflex.c +1
-0@@ -91,6 +92,7 @@ return len > count ? count : len; } +#endif
Do we really need this chunk?
drivers/ide/pci/triflex.h line 18
Quoted 11 lines
drivers/ide/pci/triflex.c +0
-0static int triflex_tune_chipset (ide_drive_t *drive,u8 xferspeed) {diff -X dontdiff -Nru
linux-2.6.2-rc2/drivers/ide/pci/triflex.hlinux-2.6.2-rc2~/drivers/ide/pci/triflex.hdrivers/ide/pci/triflex.h +1
-0@@ -14,8 +14,16 @@static unsigned int __devinit init_chipset_triflex (struct pci_dev *,const char *);static void init_hwif_triflex (ide_hwif_t *); +#ifdef CONFIG_PROC_FS static int triflex_get_info (char *,char **,off_t ,int );
.
.
.
drivers/ide/pci/triflex.h line 19
Quoted 1 line
drivers/ide/pci/triflex.h +1
-0+#endif
Since triflex_get_info is already #ifdef'd out if CONFIG_PROC_FS is not
set, we don't need to put that extra #ifdef on the .c file, since that function will not get used anyway.
IIRC the policy for adding #ifdefs on .c files is when it's really
necessary, and I don't really see the point for this (expect object size and an extra symbol defined, which I don't think it really hurts here).
Cheers,
Felipe
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
PATCH 1/1 Fix warning in drivers/net/pppoe.c when
In reply to Luiz Fernando Capitulinohi,
When !CONFIG_PROC_FS, I'm getting this warning:
drivers/net/pppoe.c: In function `pppoe_init':drivers/net/pppoe.c:1132: warning: label `out_unregister' defined but not used
this patch fixes that and removes a #ifdef/#endif inside a function. I would like to hear comments about it.
drivers/net/pppoe.c +16 -9
@@ -1076,6 +1076,20 @@ .llseek = seq_lseek, .release = seq_release, }; + +static int __init pppoe_proc_init (void ) +{ +struct proc_dir_entry *p =create_proc_entry ("pppoe" ,S_IRUGO , + proc_net); + +if (!p) +return 0 ; + + p->proc_fops = &pppoe_seq_fops; +return 1 ; +} +#else /* CONFIG_PROC_FS */ +static int inline pppoe_proc_init (void ) {return 0 ; }#endif /* CONFIG_PROC_FS */ /* ->ioctl are set at pppox_create */
@@ -1112,18 +1126,11 @@if (err) goto out; -#ifdef CONFIG_PROC_FS -{ -struct proc_dir_entry *p =create_proc_entry ("pppoe" ,S_IRUGO , - proc_net); + err = -ENOMEM ; -if (!p) +if (!(err =pppoe_proc_init ())) goto out_unregister; - p->proc_fops = &pppoe_seq_fops; - err =0 ; -} -#endif /* CONFIG_PROC_FS */ dev_add_pack (&pppoes_ptype);dev_add_pack (&pppoed_ptype);register_netdevice_notifier (&pppoe_notifier);
Signature · 8 lines
Luiz Fernando N. Capitulino <[email protected]> <http://www.telecentros.sp.gov.br> _______________________________________________ Kernel-janitors mailing list [email protected] http://lists.osdl.org/mailman/listinfo/kernel-janitors
Re: [Kernel-janitors] [PATCH] Fix warning in drivers/net/pppoe.c
In reply to Luiz Fernando CapitulinoEm Qui, 2004-01-29 às 17:05, Luiz Fernando Capitulino escreveu:
Review
Quoted 5 lines
(quoted diff) +2
-1+ err = -ENOMEM; - if (!p) + if (!(err = pppoe_proc_init())) goto out_unregister;
I did a study thing in the handling of 'err', I will rediff.
Signature · 9 lines
Luiz Fernando N. Capitulino <[email protected]> <http://www.telecentros.sp.gov.br> _______________________________________________ Kernel-janitors mailing list [email protected] http://lists.osdl.org/mailman/listinfo/kernel-janitors
Re: [Kernel-janitors] [PATCH] Fix warning indrivers/ide/pci/triflex.c
In reply to Luiz Fernando CapitulinoQuoted 10 lines · Luiz Fernando Capitulino
...
Em Seg, 2004-01-26 às 14:06, Felipe W Damasio escreveu:
...Quoted 3 lines
IIRC the policy for adding #ifdefs on .c files is when it's really
necessary, and I don't really see the point for this (expect object size and an extra symbol defined, which I don't think it really hurts here).AFAIK, the _real_ problem is when you have #ifdef/#endif inside
functions. I agree that is better to avoid it in .c files, but is not all the cases that it can be done.
Let's think about something different:CONFIG_PROC_FS=n is _very_ unusual.
It's good that drivers compile and work with CONFIG_PROC_FS=n, and it's also good to remove warnings in code.
But is it really worth uglifying code with #ifdef's to avoid a completely harmless warning in a very unusual configuration?
Quoted 1 line
Luiz Fernando N. Capitulino
cu
Adrian
Signature · 9 lines
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitorsPATCH 1/1 Fix warning in drivers/net/pppoe.c when
In reply to Luiz Fernando CapitulinoHi all,
here is the version 23.7 with Francois tips, actually I'm not testing against (err < 0), because it is not necessary.
drivers/net/pppoe.c +20 -14
@@ -1076,6 +1076,20 @@ .llseek = seq_lseek, .release = seq_release, }; + +static int __init pppoe_proc_init (void ) +{ +struct proc_dir_entry *p; + + p =create_proc_entry ("pppoe" ,S_IRUGO , proc_net); +if (!p) +return -ENOMEM ; + + p->proc_fops = &pppoe_seq_fops; +return 0 ; +} +#else /* CONFIG_PROC_FS */ +static inline int pppoe_proc_init (void ) {return 0 ; }#endif /* CONFIG_PROC_FS */ /* ->ioctl are set at pppox_create */
@@ -1112,26 +1126,18 @@if (err) goto out; -#ifdef CONFIG_PROC_FS -{ -struct proc_dir_entry *p =create_proc_entry ("pppoe" ,S_IRUGO , - proc_net); - err = -ENOMEM ; -if (!p) - goto out_unregister; + + err =pppoe_proc_init (); +if (err) { +unregister_pppox_proto (PX_PROTO_OE ); + goto out; + } - p->proc_fops = &pppoe_seq_fops; - err =0 ; -} -#endif /* CONFIG_PROC_FS */ dev_add_pack (&pppoes_ptype);dev_add_pack (&pppoed_ptype);register_netdevice_notifier (&pppoe_notifier); out:return err; -out_unregister: -unregister_pppox_proto (PX_PROTO_OE ); - goto out; } static void __exit pppoe_exit(void)
Signature · 8 lines
Luiz Fernando N. Capitulino <[email protected]> <http://www.telecentros.sp.gov.br> _______________________________________________ Kernel-janitors mailing list [email protected] http://lists.osdl.org/mailman/listinfo/kernel-janitors