Re: [PATCH -mm] char, moxa: Make isabrds variable global.

From: Rakib Mullick
Date: Sat Nov 07 2009 - 00:08:50 EST


On 11/3/09, Rakib Mullick <rakib.mullick@xxxxxxxxx> 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@xxxxxxxxx>
----

--- 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",
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/