public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] remove warning from drivers/net/hp100.c (240-test12-pre7)
@ 2000-12-08 20:19 Rasmus Andersen
  2000-12-09  9:19 ` Pavel Machek
  0 siblings, 1 reply; 6+ messages in thread
From: Rasmus Andersen @ 2000-12-08 20:19 UTC (permalink / raw)
  To: perex; +Cc: linux-kernel

Hi.

The following patch removes a 'defined but not used' warning from drivers/
new/hp100.c when compiling without CONFIG_PCI (240t12p3). It should apply
cleanly.


--- linux-240-t12-pre3-clean/drivers/net/hp100.c	Sat Nov  4 23:27:07 2000
+++ linux/drivers/net/hp100.c	Sat Dec  2 16:07:27 2000
@@ -265,12 +265,14 @@
 
 #define HP100_EISA_IDS_SIZE	(sizeof(hp100_eisa_ids)/sizeof(struct hp100_eisa_id))
 
+#ifdef CONFIG_PCI
 static struct hp100_pci_id hp100_pci_ids[] = {
   { PCI_VENDOR_ID_HP, 		PCI_DEVICE_ID_HP_J2585A },
   { PCI_VENDOR_ID_HP,		PCI_DEVICE_ID_HP_J2585B },
   { PCI_VENDOR_ID_COMPEX,	PCI_DEVICE_ID_COMPEX_ENET100VG4 },
   { PCI_VENDOR_ID_COMPEX2,	PCI_DEVICE_ID_COMPEX2_100VG }
 };
+#endif
 
 #define HP100_PCI_IDS_SIZE	(sizeof(hp100_pci_ids)/sizeof(struct hp100_pci_id))
 

-- 
Regards,
        Rasmus(rasmus@jaquet.dk)

We're going to turn this team around 360 degrees.
-Jason Kidd, upon his drafting to the Dallas Mavericks
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

* Re: [PATCH] remove warning from drivers/net/hp100.c (240-test12-pre7)
  2000-12-08 20:19 [PATCH] remove warning from drivers/net/hp100.c (240-test12-pre7) Rasmus Andersen
@ 2000-12-09  9:19 ` Pavel Machek
  2000-12-09 22:37   ` Peter Samuelson
  0 siblings, 1 reply; 6+ messages in thread
From: Pavel Machek @ 2000-12-09  9:19 UTC (permalink / raw)
  To: Rasmus Andersen, perex; +Cc: linux-kernel

Hi!

> The following patch removes a 'defined but not used' warning from drivers/
> new/hp100.c when compiling without CONFIG_PCI (240t12p3). It should apply
> cleanly.

I'd say that warning is more acceptable than #ifdef... In cases where
warnings can be eliminating without ifdefs, that's okay, but this...

								Pavel

> --- linux-240-t12-pre3-clean/drivers/net/hp100.c	Sat Nov  4 23:27:07 2000
> +++ linux/drivers/net/hp100.c	Sat Dec  2 16:07:27 2000
> @@ -265,12 +265,14 @@
>  
>  #define HP100_EISA_IDS_SIZE	(sizeof(hp100_eisa_ids)/sizeof(struct hp100_eisa_id))
>  
> +#ifdef CONFIG_PCI
>  static struct hp100_pci_id hp100_pci_ids[] = {
>    { PCI_VENDOR_ID_HP, 		PCI_DEVICE_ID_HP_J2585A },
>    { PCI_VENDOR_ID_HP,		PCI_DEVICE_ID_HP_J2585B },
>    { PCI_VENDOR_ID_COMPEX,	PCI_DEVICE_ID_COMPEX_ENET100VG4 },
>    { PCI_VENDOR_ID_COMPEX2,	PCI_DEVICE_ID_COMPEX2_100VG }
>  };
> +#endif
>  
>  #define HP100_PCI_IDS_SIZE	(sizeof(hp100_pci_ids)/sizeof(struct hp100_pci_id))


-- 
I'm pavel@ucw.cz. "In my country we have almost anarchy and I don't care."
Panos Katsaloulis describing me w.r.t. patents at discuss@linmodems.org
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

* Re: [PATCH] remove warning from drivers/net/hp100.c (240-test12-pre7)
  2000-12-09  9:19 ` Pavel Machek
@ 2000-12-09 22:37   ` Peter Samuelson
  2000-12-11 20:32     ` Rasmus Andersen
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Samuelson @ 2000-12-09 22:37 UTC (permalink / raw)
  To: Pavel Machek; +Cc: Rasmus Andersen, perex, linux-kernel


[Pavel Machek]
> I'd say that warning is more acceptable than #ifdef... In cases where
> warnings can be eliminating without ifdefs, that's okay, but this...

In this case it is dead weight in the object file -- and for machines
that can least afford it (CONFIG_PCI=n is mostly for the low end,
right?).

Peter
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

* Re: [PATCH] remove warning from drivers/net/hp100.c (240-test12-pre7)
  2000-12-09 22:37   ` Peter Samuelson
@ 2000-12-11 20:32     ` Rasmus Andersen
  2000-12-12  0:09       ` Peter Samuelson
  0 siblings, 1 reply; 6+ messages in thread
From: Rasmus Andersen @ 2000-12-11 20:32 UTC (permalink / raw)
  To: Peter Samuelson; +Cc: Pavel Machek, perex, linux-kernel

On Sat, Dec 09, 2000 at 04:37:40PM -0600, Peter Samuelson wrote:
> 
> [Pavel Machek]
> > I'd say that warning is more acceptable than #ifdef... In cases where
> > warnings can be eliminating without ifdefs, that's okay, but this...
> 
> In this case it is dead weight in the object file -- and for machines
> that can least afford it (CONFIG_PCI=n is mostly for the low end,
> right?).

How about this patch? It moves the offending struct to the __init function
where it is used and inside an existing #ifdef CONFIG_PCI. This would be
up to the maintainer but since this is the only place the struct is used
I think it is acceptable to move it from the top of the file.

Comments?


--- linux-240-t12-pre8-clean/drivers/net/hp100.c	Sat Nov  4 23:27:07 2000
+++ linux/drivers/net/hp100.c	Mon Dec 11 21:23:12 2000
@@ -265,13 +265,6 @@
 
 #define HP100_EISA_IDS_SIZE	(sizeof(hp100_eisa_ids)/sizeof(struct hp100_eisa_id))
 
-static struct hp100_pci_id hp100_pci_ids[] = {
-  { PCI_VENDOR_ID_HP, 		PCI_DEVICE_ID_HP_J2585A },
-  { PCI_VENDOR_ID_HP,		PCI_DEVICE_ID_HP_J2585B },
-  { PCI_VENDOR_ID_COMPEX,	PCI_DEVICE_ID_COMPEX_ENET100VG4 },
-  { PCI_VENDOR_ID_COMPEX2,	PCI_DEVICE_ID_COMPEX2_100VG }
-};
-
 #define HP100_PCI_IDS_SIZE	(sizeof(hp100_pci_ids)/sizeof(struct hp100_pci_id))
 
 static int hp100_rx_ratio = HP100_DEFAULT_RX_RATIO;
@@ -335,6 +328,13 @@
   int ioaddr = 0;
 #ifdef CONFIG_PCI
   int pci_start_index = 0;
+
+  static struct hp100_pci_id hp100_pci_ids[] = {
+	  { PCI_VENDOR_ID_HP, 		PCI_DEVICE_ID_HP_J2585A },
+	  { PCI_VENDOR_ID_HP,		PCI_DEVICE_ID_HP_J2585B },
+	  { PCI_VENDOR_ID_COMPEX,	PCI_DEVICE_ID_COMPEX_ENET100VG4 },
+	  { PCI_VENDOR_ID_COMPEX2,	PCI_DEVICE_ID_COMPEX2_100VG }
+  };
 #endif
 
 #ifdef HP100_DEBUG_B

-- 
Regards,
        Rasmus(rasmus@jaquet.dk)

It's a recession when your neighbour loses his job; it's a depression 
when you lose yours. -- Harry S. Truman 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

* Re: [PATCH] remove warning from drivers/net/hp100.c (240-test12-pre7)
  2000-12-11 20:32     ` Rasmus Andersen
@ 2000-12-12  0:09       ` Peter Samuelson
  2000-12-12 13:49         ` Rasmus Andersen
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Samuelson @ 2000-12-12  0:09 UTC (permalink / raw)
  To: Rasmus Andersen; +Cc: Pavel Machek, perex, linux-kernel


[Rasmus Andersen]
> How about this patch? It moves the offending struct to the __init
> function where it is used and inside an existing #ifdef CONFIG_PCI.

Hmmmm, if you're messing around with the pci device table, why not just
convert it to use new-style PCI init?  This is fairly easy to do (I did
one driver myself, and that *proves* it's easy).  The main points:

 1) convert the device table to a 'struct pci_device_id' and reference
    this struct with a call to MODULE_DEVICE_TABLE(my_struct)
 2) create a 'struct pci_driver' function table, rearranging the driver
    housekeeping functions to fit this table
 3) convert your PCI probe loop inn your init function to use
    pci_module_init(my_pci_driver_struct), which does the looping for
    you

Thanks to Adam Richter's hard work, there are lots of examples of
drivers that have already been converted to this scheme.  I don't
remember if Adam purposely skipped hp100.c or if it was an oversight.

Peter
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

* Re: [PATCH] remove warning from drivers/net/hp100.c (240-test12-pre7)
  2000-12-12  0:09       ` Peter Samuelson
@ 2000-12-12 13:49         ` Rasmus Andersen
  0 siblings, 0 replies; 6+ messages in thread
From: Rasmus Andersen @ 2000-12-12 13:49 UTC (permalink / raw)
  To: Peter Samuelson; +Cc: Pavel Machek, perex, linux-kernel

On Mon, Dec 11, 2000 at 06:09:31PM -0600, Peter Samuelson wrote:
> 
> [Rasmus Andersen]
> > How about this patch? It moves the offending struct to the __init
> > function where it is used and inside an existing #ifdef CONFIG_PCI.
> 
> Hmmmm, if you're messing around with the pci device table, why not just
> convert it to use new-style PCI init?  This is fairly easy to do (I did
> one driver myself, and that *proves* it's easy).  The main points:

I was looking into that regarding another driver anyway, so I'll try
my hand at that. Expect some b0rken patches soon :)

Regards,
  Rasmus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

end of thread, other threads:[~2000-12-12 14:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-12-08 20:19 [PATCH] remove warning from drivers/net/hp100.c (240-test12-pre7) Rasmus Andersen
2000-12-09  9:19 ` Pavel Machek
2000-12-09 22:37   ` Peter Samuelson
2000-12-11 20:32     ` Rasmus Andersen
2000-12-12  0:09       ` Peter Samuelson
2000-12-12 13:49         ` Rasmus Andersen

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