* [patch 1/1] MFD: SM501 build fixes when CONFIG_MFD_SM501_GPIO unset.
[not found] <20080702083428.963530966@fluff.org>
@ 2008-07-02 8:34 ` Ben Dooks
2008-07-02 8:38 ` Li Zefan
0 siblings, 1 reply; 3+ messages in thread
From: Ben Dooks @ 2008-07-02 8:34 UTC (permalink / raw)
Cc: akpm, lizf, linux-kernel, lethal, Ben Dooks
[-- Attachment #1: simtec/simtec-drivers-mfd-sm501-gpiofix.patch --]
[-- Type: text/plain, Size: 2692 bytes --]
Fix the build problems if CONFIG_MFD_SM501_GPIO is not set,
which is generally when there is no gpiolib support available
as currently happens on x86 when building PCI SM501.
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Index: linux-2.6.26-rc8-quilt3/drivers/mfd/sm501.c
===================================================================
--- linux-2.6.26-rc8-quilt3.orig/drivers/mfd/sm501.c 2008-07-02 09:24:46.000000000 +0100
+++ linux-2.6.26-rc8-quilt3/drivers/mfd/sm501.c 2008-07-02 09:27:11.000000000 +0100
@@ -19,7 +19,6 @@
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/pci.h>
-#include <linux/gpio.h>
#include <linux/i2c-gpio.h>
#include <linux/sm501.h>
@@ -35,6 +34,9 @@ struct sm501_device {
struct sm501_gpio;
+#ifdef CONFIG_MFD_SM501_GPIO
+#include <linux/gpio.h>
+
struct sm501_gpio_chip {
struct gpio_chip gpio;
struct sm501_gpio *ourgpio; /* to get back to parent. */
@@ -50,6 +52,11 @@ struct sm501_gpio {
void __iomem *regs;
struct resource *regs_res;
};
+#else
+struct sm501_gpio {
+ /* no gpio support, empty definition for sm501_devdata. */
+};
+#endif
struct sm501_devdata {
spinlock_t reg_lock;
@@ -1082,6 +1089,9 @@ static void sm501_gpio_remove(struct sm5
struct sm501_gpio *gpio = &sm->gpio;
int ret;
+ if (!sm->gpio.registered)
+ return;
+
ret = gpiochip_remove(&gpio->low.gpio);
if (ret)
dev_err(sm->dev, "cannot remove low chip, cannot tidy up\n");
@@ -1100,6 +1110,11 @@ static inline int sm501_gpio_pin2nr(stru
struct sm501_gpio *gpio = &sm->gpio;
return pin + (pin < 32) ? gpio->low.gpio.base : gpio->high.gpio.base;
}
+
+static inline int sm501_gpio_isregistered(struct sm501_devdata *sm)
+{
+ return sm->gpio.registered;
+}
#else
static inline int sm501_register_gpio(struct sm501_devdata *sm)
{
@@ -1114,6 +1129,11 @@ static inline int sm501_gpio_pin2nr(stru
{
return -1;
}
+
+static inline int sm501_gpio_isregistered(struct sm501_devdata *sm)
+{
+ return 0;
+}
#endif
static int sm501_register_gpio_i2c_instance(struct sm501_devdata *sm,
@@ -1330,8 +1350,8 @@ static int sm501_init_dev(struct sm501_d
}
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");
+ if (!sm501_gpio_isregistered(sm))
+ dev_err(sm->dev, "no gpio available for i2c gpio.\n");
else
sm501_register_gpio_i2c(sm, pdata);
}
@@ -1643,8 +1663,7 @@ static void sm501_dev_remove(struct sm50
device_remove_file(sm->dev, &dev_attr_dbg_regs);
- if (sm->gpio.registered)
- sm501_gpio_remove(sm);
+ sm501_gpio_remove(sm);
}
static void sm501_pci_remove(struct pci_dev *dev)
--
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch 1/1] MFD: SM501 build fixes when CONFIG_MFD_SM501_GPIO unset.
2008-07-02 8:34 ` [patch 1/1] MFD: SM501 build fixes when CONFIG_MFD_SM501_GPIO unset Ben Dooks
@ 2008-07-02 8:38 ` Li Zefan
2008-07-02 8:54 ` Ben Dooks
0 siblings, 1 reply; 3+ messages in thread
From: Li Zefan @ 2008-07-02 8:38 UTC (permalink / raw)
To: Ben Dooks; +Cc: akpm, linux-kernel, lethal
> Fix the build problems if CONFIG_MFD_SM501_GPIO is not set,
> which is generally when there is no gpiolib support available
> as currently happens on x86 when building PCI SM501.
>
> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Tested-by: Li Zefan <lizf@cn.fujitsu.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch 1/1] MFD: SM501 build fixes when CONFIG_MFD_SM501_GPIO unset.
2008-07-02 8:38 ` Li Zefan
@ 2008-07-02 8:54 ` Ben Dooks
0 siblings, 0 replies; 3+ messages in thread
From: Ben Dooks @ 2008-07-02 8:54 UTC (permalink / raw)
To: Li Zefan; +Cc: Ben Dooks, akpm, linux-kernel, lethal
On Wed, Jul 02, 2008 at 04:38:53PM +0800, Li Zefan wrote:
> > Fix the build problems if CONFIG_MFD_SM501_GPIO is not set,
> > which is generally when there is no gpiolib support available
> > as currently happens on x86 when building PCI SM501.
> >
> > Signed-off-by: Ben Dooks <ben-linux@fluff.org>
>
> Tested-by: Li Zefan <lizf@cn.fujitsu.com>
thanks.
--
Ben
Q: What's a light-year?
A: One-third less calories than a regular year.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-07-02 9:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20080702083428.963530966@fluff.org>
2008-07-02 8:34 ` [patch 1/1] MFD: SM501 build fixes when CONFIG_MFD_SM501_GPIO unset Ben Dooks
2008-07-02 8:38 ` Li Zefan
2008-07-02 8:54 ` Ben Dooks
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox