Re: [-mmotm] some different buliding failures

From: Andrew Morton
Date: Wed Jul 02 2008 - 04:16:06 EST


On Wed, 02 Jul 2008 14:23:28 +0800 Li Zefan <lizf@xxxxxxxxxxxxxx> wrote:

> drivers/mfd/sm501.c:39: error: field 'gpio' has incomplete type

OK, this monstrosity seems to make it compile:


diff -puN drivers/mfd/sm501.c~sm501-guess-n-giggle-build-fix drivers/mfd/sm501.c
--- a/drivers/mfd/sm501.c~sm501-guess-n-giggle-build-fix
+++ a/drivers/mfd/sm501.c
@@ -19,7 +19,9 @@
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/pci.h>
+#ifdef CONFIG_MFD_SM501_GPIO
#include <linux/gpio.h>
+#endif
#include <linux/i2c-gpio.h>

#include <linux/sm501.h>
@@ -33,6 +35,7 @@ struct sm501_device {
struct platform_device pdev;
};

+#ifdef CONFIG_MFD_SM501_GPIO
struct sm501_gpio;

struct sm501_gpio_chip {
@@ -50,13 +53,15 @@ struct sm501_gpio {
void __iomem *regs;
struct resource *regs_res;
};
+#endif

struct sm501_devdata {
spinlock_t reg_lock;
struct mutex clock_lock;
struct list_head devices;
+#ifdef CONFIG_MFD_SM501_GPIO
struct sm501_gpio gpio;
-
+#endif
struct device *dev;
struct resource *io_res;
struct resource *mem_res;
@@ -1116,6 +1121,7 @@ static inline int sm501_gpio_pin2nr(stru
}
#endif

+#ifdef CONFIG_MFD_SM501_GPIO
static int sm501_register_gpio_i2c_instance(struct sm501_devdata *sm,
struct sm501_platdata_gpio_i2c *iic)
{
@@ -1168,6 +1174,7 @@ static int sm501_register_gpio_i2c(struc

return 0;
}
+#endif

/* sm501_dbg_regs
*
@@ -1329,12 +1336,14 @@ static int sm501_init_dev(struct sm501_d
sm501_register_gpio(sm);
}

+#ifdef CONFIG_MFD_SM501_GPIO
if (pdata->gpio_i2c != NULL && pdata->gpio_i2c_nr > 0) {
if (!sm->gpio.registered)
dev_err(sm->dev, "no gpio registered for i2c gpio.\n");
else
sm501_register_gpio_i2c(sm, pdata);
}
+#endif

ret = sm501_check_clocks(sm);
if (ret) {
@@ -1643,8 +1652,10 @@ static void sm501_dev_remove(struct sm50

device_remove_file(sm->dev, &dev_attr_dbg_regs);

+#ifdef CONFIG_MFD_SM501_GPIO
if (sm->gpio.registered)
sm501_gpio_remove(sm);
+#endif
}

static void sm501_pci_remove(struct pci_dev *dev)
_

--
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/