Patchworkβ [-mm] char, moxa: Make isabrds variable global.

login
register
about
Submitter Rakib Mullick
Date 2009-11-07 05:08:35
Message ID <b9df5fa10911062108l2334be64ka0777e89c6dbc17f@mail.gmail.com>
Download mbox | patch
Permalink /patch/58290/
State New
Headers show

Comments

Rakib Mullick - 2009-11-07 05:08:35
On 11/3/09, Rakib Mullick <rakib.mullick@gmail.com> wrote:
>  When CONFIG_MODULE=n and CONFIG_PCI=n, then variable
>  isabrds becomes unused variable. So place it outside
>  moxa_init solves this problem.
>
>   We were warned by the following warning:
>
>  drivers/char/moxa.c: In function `moxa_init':
>  drivers/char/moxa.c:1012: warning: unused variable `isabrds'

Hi Andrew, after applying this one, it introduce a new warning:

drivers/char/moxa.c:1010: warning: 'isabrds' defined but not used

And while compiling moxa.c we are also warned by the following warnings:

drivers/char/moxa.c:81: warning: 'moxa_brdname' defined but not used
drivers/char/moxa.c:818: warning: 'moxa_init_board' defined but not used

To fix this warnings we need to properly #ifdef above functions.
So after applying the following patch - moxa.c compiles cleanly.

Would you mind check this out, Andrew?

  Fix compilation warning when CONFIG_PCI=n.

Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
----

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Jiri Slaby - 2009-11-07 10:27:03
On 11/07/2009 06:08 AM, Rakib Mullick wrote:
> On 11/3/09, Rakib Mullick <rakib.mullick@gmail.com> wrote:
>>  When CONFIG_MODULE=n and CONFIG_PCI=n, then variable
>>  isabrds becomes unused variable. So place it outside
>>  moxa_init solves this problem.
>>
>>   We were warned by the following warning:
>>
>>  drivers/char/moxa.c: In function `moxa_init':
>>  drivers/char/moxa.c:1012: warning: unused variable `isabrds'
> 
> Hi Andrew, after applying this one, it introduce a new warning:

Sorry I had no time to look into the first patch. And it makes no sense.
The driver is unusable on !MODULE && !PCI. So better fix is to disallow
whole build on such configurations. Care to fix that?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Patch

--- linus/drivers/char/moxa.c	2009-11-06 17:12:13.000000000 +0600
+++ rakib/drivers/char/moxa.c	2009-11-06 17:47:18.000000000 +0600
@@ -78,6 +78,7 @@  enum {
 	MOXA_BOARD_CP204J,
 };

+#if defined MODULE || defined CONFIG_PCI
 static char *moxa_brdname[] =
 {
 	"C218 Turbo PCI series",
@@ -87,6 +88,9 @@  static char *moxa_brdname[] =
 	"CP-204J series",
 };

+static unsigned int __initdata isabrds;
+#endif
+
 #ifdef CONFIG_PCI
 static struct pci_device_id moxa_pcibrds[] = {
 	{ PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_C218),
@@ -419,6 +423,7 @@  static DEFINE_SPINLOCK(moxa_lock);
  * HW init
  */

+#if defined MODULE || defined CONFIG_PCI
 static int moxa_check_fw_model(struct moxa_board_conf *brd, u8 model)
 {
 	switch (brd->boardType) {
@@ -878,6 +883,7 @@  err_free:
 err:
 	return ret;
 }
+#endif

 static void moxa_board_deinit(struct moxa_board_conf *brd)
 {
@@ -1009,7 +1015,6 @@  static struct pci_driver moxa_pci_driver

 static int __init moxa_init(void)
 {
-	unsigned int isabrds = 0;
 	int retval = 0;

 	printk(KERN_INFO "MOXA Intellio family driver version %s\n",