Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1678361 > unrolled thread
| Started by | Chris Packham <chris.packham@alliedtelesis.co.nz> |
|---|---|
| First post | 2017-06-30 03:00 +0200 |
| Last post | 2017-06-30 03:00 +0200 |
| Articles | 1 — 1 participant |
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 2/6] i2c: pca-platform: correctly set algo_data.reset_chip Chris Packham <chris.packham@alliedtelesis.co.nz> - 2017-06-30 03:00 +0200
| From | Chris Packham <chris.packham@alliedtelesis.co.nz> |
|---|---|
| Date | 2017-06-30 03:00 +0200 |
| Subject | [PATCH 2/6] i2c: pca-platform: correctly set algo_data.reset_chip |
| Message-ID | <tXSrT-6F8-9@gated-at.bofh.it> |
When device tree support was added the setting of algo_data.reset_chip
was moved. There were two problems with this. The first being that
i2c_pca_pf_resetchip was only used if platform data was provided. The
second that it was unconditionally overridden with
i2c_pca_pf_dummyreset. Ensure that however the reset gpio is defined the
correct reset_chip function is used.
Fixes: commit 4cc7229daa46 ("i2c: pca-platform: switch to struct gpio_desc")
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
drivers/i2c/busses/i2c-pca-platform.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/busses/i2c-pca-platform.c b/drivers/i2c/busses/i2c-pca-platform.c
index 395eca0cbb1f..daccef6865e8 100644
--- a/drivers/i2c/busses/i2c-pca-platform.c
+++ b/drivers/i2c/busses/i2c-pca-platform.c
@@ -184,7 +184,6 @@ static int i2c_pca_pf_probe(struct platform_device *pdev)
if (ret == 0) {
i2c->gpio = gpio_to_desc(platform_data->gpio);
gpiod_direction_output(i2c->gpio, 0);
- i2c->algo_data.reset_chip = i2c_pca_pf_resetchip;
} else {
dev_warn(&pdev->dev, "Registering gpio failed!\n");
i2c->gpio = NULL;
@@ -205,7 +204,10 @@ static int i2c_pca_pf_probe(struct platform_device *pdev)
i2c->algo_data.data = i2c;
i2c->algo_data.wait_for_completion = i2c_pca_pf_waitforcompletion;
- i2c->algo_data.reset_chip = i2c_pca_pf_dummyreset;
+ if (i2c->gpio)
+ i2c->algo_data.reset_chip = i2c_pca_pf_resetchip;
+ else
+ i2c->algo_data.reset_chip = i2c_pca_pf_dummyreset;
switch (res->flags & IORESOURCE_MEM_TYPE_MASK) {
case IORESOURCE_MEM_32BIT:
--
2.13.0
Back to top | Article view | linux.kernel
csiph-web