Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1230042 > unrolled thread
| Started by | Andy Shevchenko <andriy.shevchenko@linux.intel.com> |
|---|---|
| First post | 2015-09-22 12:20 +0200 |
| Last post | 2015-10-02 14:20 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v1 5/8] gpio: pca953x: store driver_data for future use Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-09-22 12:20 +0200
Re: [PATCH v1 5/8] gpio: pca953x: store driver_data for future use Linus Walleij <linus.walleij@linaro.org> - 2015-10-02 13:00 +0200
Re: [PATCH v1 5/8] gpio: pca953x: store driver_data for future use Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-10-02 14:20 +0200
| From | Andy Shevchenko <andriy.shevchenko@linux.intel.com> |
|---|---|
| Date | 2015-09-22 12:20 +0200 |
| Subject | [PATCH v1 5/8] gpio: pca953x: store driver_data for future use |
| Message-ID | <qbsQ2-2oh-9@gated-at.bofh.it> |
Instead of using id->driver_data directly we copied it to the internal
structure. This will help to adapt driver for ACPI use.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/gpio/gpio-pca953x.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index 50caeb1..242e244 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -42,6 +42,9 @@
#define PCA_INT 0x0100
#define PCA953X_TYPE 0x1000
#define PCA957X_TYPE 0x2000
+#define PCA_TYPE_MASK 0xF000
+
+#define PCA_CHIP_TYPE(x) ((x) & PCA_TYPE_MASK)
static const struct i2c_device_id pca953x_id[] = {
{ "pca9505", 40 | PCA953X_TYPE | PCA_INT, },
@@ -95,6 +98,7 @@ struct pca953x_chip {
struct gpio_chip gpio_chip;
const char *const *names;
int chip_type;
+ unsigned long driver_data;
};
static inline struct pca953x_chip *to_pca(struct gpio_chip *gc)
@@ -517,14 +521,13 @@ static irqreturn_t pca953x_irq_handler(int irq, void *devid)
}
static int pca953x_irq_setup(struct pca953x_chip *chip,
- const struct i2c_device_id *id,
int irq_base)
{
struct i2c_client *client = chip->client;
int ret, i, offset = 0;
if (client->irq && irq_base != -1
- && (id->driver_data & PCA_INT)) {
+ && (chip->driver_data & PCA_INT)) {
switch (chip->chip_type) {
case PCA953X_TYPE:
@@ -581,12 +584,11 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
#else /* CONFIG_GPIO_PCA953X_IRQ */
static int pca953x_irq_setup(struct pca953x_chip *chip,
- const struct i2c_device_id *id,
int irq_base)
{
struct i2c_client *client = chip->client;
- if (irq_base != -1 && (id->driver_data & PCA_INT))
+ if (irq_base != -1 && (chip->driver_data & PCA_INT))
dev_warn(&client->dev, "interrupt support not compiled in\n");
return 0;
@@ -673,14 +675,15 @@ static int pca953x_probe(struct i2c_client *client,
chip->client = client;
- chip->chip_type = id->driver_data & (PCA953X_TYPE | PCA957X_TYPE);
+ chip->driver_data = id->driver_data;
+ chip->chip_type = PCA_CHIP_TYPE(chip->driver_data);
mutex_init(&chip->i2c_lock);
/* initialize cached registers from their original values.
* we can't share this chip with another i2c master.
*/
- pca953x_setup_gpio(chip, id->driver_data & PCA_GPIO_MASK);
+ pca953x_setup_gpio(chip, chip->driver_data & PCA_GPIO_MASK);
if (chip->chip_type == PCA953X_TYPE)
ret = device_pca953x_init(chip, invert);
@@ -693,7 +696,7 @@ static int pca953x_probe(struct i2c_client *client,
if (ret)
return ret;
- ret = pca953x_irq_setup(chip, id, irq_base);
+ ret = pca953x_irq_setup(chip, irq_base);
if (ret)
return ret;
--
2.5.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Linus Walleij <linus.walleij@linaro.org> |
|---|---|
| Date | 2015-10-02 13:00 +0200 |
| Message-ID | <qf6ee-18p-11@gated-at.bofh.it> |
| In reply to | #1230042 |
On Tue, Sep 22, 2015 at 3:10 AM, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > Instead of using id->driver_data directly we copied it to the internal > structure. This will help to adapt driver for ACPI use. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Gregory, Grygorii, Graeme: can I get some help in reviewing these PCA patches for ACPI support? Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Andy Shevchenko <andriy.shevchenko@linux.intel.com> |
|---|---|
| Date | 2015-10-02 14:20 +0200 |
| Message-ID | <qf7tE-351-23@gated-at.bofh.it> |
| In reply to | #1238119 |
On Fri, 2015-10-02 at 03:53 -0700, Linus Walleij wrote: > On Tue, Sep 22, 2015 at 3:10 AM, Andy Shevchenko > <andriy.shevchenko@linux.intel.com> wrote: > > > Instead of using id->driver_data directly we copied it to the > > internal > > structure. This will help to adapt driver for ACPI use. > > > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > Gregory, Grygorii, Graeme: can I get some help in reviewing these > PCA patches for ACPI support? I would like to notice that there is v2 of the series (GPIO patches weren't changed AFAIR). http://www.spinics.net/lists/kernel/msg2087827.html > > Yours, > Linus Walleij -- Andy Shevchenko <andriy.shevchenko@linux.intel.com> Intel Finland Oy -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web