Modified: trunk/drivers/gpio/Kconfig (9039 => 9040)
--- trunk/drivers/gpio/Kconfig 2010-08-02 19:27:55 UTC (rev 9039)
+++ trunk/drivers/gpio/Kconfig 2010-08-03 11:58:23 UTC (rev 9040)
@@ -235,6 +235,13 @@
To compile this driver as a module, choose M here: the module will be
called adp5588-gpio.
+config GPIO_ADP5588_IRQ
+ bool "Interrupt controller support for ADP5588"
+ depends on GPIO_ADP5588=y
+ help
+ Say yes here to enable the adp5588 to be used as an interrupt
+ controller. It requires the driver to be built in the kernel.
+
comment "PCI GPIO expanders:"
config GPIO_CS5535
Modified: trunk/drivers/gpio/adp5588-gpio.c (9039 => 9040)
--- trunk/drivers/gpio/adp5588-gpio.c 2010-08-02 19:27:55 UTC (rev 9039)
+++ trunk/drivers/gpio/adp5588-gpio.c 2010-08-03 11:58:23 UTC (rev 9040)
@@ -69,16 +69,6 @@
return ret;
}
-static int adp5588_gpio_read_intstat(struct i2c_client *client, u8 *buf)
-{
- int ret = i2c_smbus_read_i2c_block_data(client, GPIO_INT_STAT1, 3, buf);
-
- if (ret < 0)
- dev_err(&client->dev, "Read INT_STAT Error\n");
-
- return ret;
-}
-
static int adp5588_gpio_write(struct i2c_client *client, u8 reg, u8 val)
{
int ret = i2c_smbus_write_byte_data(client, reg, val);
@@ -164,6 +154,7 @@
return ret;
}
+#ifdef CONFIG_GPIO_ADP5588_IRQ
static int adp5588_gpio_to_irq(struct gpio_chip *chip, unsigned off)
{
struct adp5588_gpio *dev =
@@ -248,6 +239,16 @@
.set_type = adp5588_irq_set_type,
};
+static int adp5588_gpio_read_intstat(struct i2c_client *client, u8 *buf)
+{
+ int ret = i2c_smbus_read_i2c_block_data(client, GPIO_INT_STAT1, 3, buf);
+
+ if (ret < 0)
+ dev_err(&client->dev, "Read INT_STAT Error\n");
+
+ return ret;
+}
+
static irqreturn_t adp5588_irq_handler(int irq, void *devid)
{
struct adp5588_gpio *dev = devid;
@@ -327,7 +328,26 @@
dev->irq_base = 0;
return ret;
}
+static void adp5588_irq_teardown(struct adp5588_gpio *dev)
+{
+ if (dev->irq_base)
+ free_irq(dev->client->irq, dev);
+}
+#else
+static int adp5588_irq_setup(struct adp5588_gpio *dev)
+{
+ struct i2c_client *client = dev->client;
+ dev_warn(&client->dev, "interrupt support not compiled in\n");
+
+ return 0;
+}
+
+static void adp5588_irq_teardown(struct adp5588_gpio *dev)
+{
+}
+#endif /* CONFIG_GPIO_ADP5588_IRQ */
+
static int __devinit adp5588_gpio_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
@@ -415,8 +435,7 @@
return 0;
err_irq:
- if (dev->irq_base)
- free_irq(dev->client->irq, dev);
+ adp5588_irq_teardown(dev);
err:
kfree(dev);
return ret;