lkml.org 
[lkml]   [2008]   [Oct]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 5/6] gpio/pca953x: pass gpio_chip pointer to the setup/teardown callbacks
This is needed so that the platform code could register the chip
with the platform internal structures.

While at it, also change gpio_base to the signed type (we'll pass
-1 for the dynamic allocation).

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
drivers/gpio/pca953x.c | 7 +++----
include/linux/i2c/pca953x.h | 8 +++++---
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c
index 9ceeb89..7597e01 100644
--- a/drivers/gpio/pca953x.c
+++ b/drivers/gpio/pca953x.c
@@ -235,8 +235,7 @@ static int __devinit pca953x_probe(struct i2c_client *client,
goto out_failed;

if (pdata->setup) {
- ret = pdata->setup(client, chip->gpio_chip.base,
- chip->gpio_chip.ngpio, pdata->context);
+ ret = pdata->setup(client, &chip->gpio_chip, pdata->context);
if (ret < 0)
dev_warn(&client->dev, "setup failed, %d\n", ret);
}
@@ -256,8 +255,8 @@ static int pca953x_remove(struct i2c_client *client)
int ret = 0;

if (pdata->teardown) {
- ret = pdata->teardown(client, chip->gpio_chip.base,
- chip->gpio_chip.ngpio, pdata->context);
+ ret = pdata->teardown(client, &chip->gpio_chip,
+ pdata->context);
if (ret < 0) {
dev_err(&client->dev, "%s failed, %d\n",
"teardown", ret);
diff --git a/include/linux/i2c/pca953x.h b/include/linux/i2c/pca953x.h
index 3c73612..60d60c0 100644
--- a/include/linux/i2c/pca953x.h
+++ b/include/linux/i2c/pca953x.h
@@ -1,8 +1,10 @@
/* platform data for the PCA9539 16-bit I/O expander driver */

+struct gpio_chip;
+
struct pca953x_platform_data {
/* number of the first GPIO */
- unsigned gpio_base;
+ int gpio_base;

/* initial polarity inversion setting */
uint16_t invert;
@@ -10,9 +12,9 @@ struct pca953x_platform_data {
void *context; /* param to setup/teardown */

int (*setup)(struct i2c_client *client,
- unsigned gpio, unsigned ngpio,
+ struct gpio_chip *chip,
void *context);
int (*teardown)(struct i2c_client *client,
- unsigned gpio, unsigned ngpio,
+ struct gpio_chip *chip,
void *context);
};
--
1.5.6.3


\
 
 \ /
  Last update: 2008-10-28 18:51    [from the cache]
©2003-2011 Jasper Spaans