diff options
author | Chris Packham <chris.packham@alliedtelesis.co.nz> | 2017-06-29 20:54:04 -0400 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2017-07-04 10:02:20 -0400 |
commit | 2ec4d8831b9644a080302ce10868afff8d135fc3 (patch) | |
tree | cdde50fd34ae550c710e279e1efac88f55029ea8 | |
parent | 3a4991a9864cb6b98bb9c7cf47854ffe2a79805a (diff) |
i2c: pca-platform: correctly set algo_data.reset_chip
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>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-rw-r--r-- | drivers/i2c/busses/i2c-pca-platform.c | 6 |
1 files 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) | |||
184 | if (ret == 0) { | 184 | if (ret == 0) { |
185 | i2c->gpio = gpio_to_desc(platform_data->gpio); | 185 | i2c->gpio = gpio_to_desc(platform_data->gpio); |
186 | gpiod_direction_output(i2c->gpio, 0); | 186 | gpiod_direction_output(i2c->gpio, 0); |
187 | i2c->algo_data.reset_chip = i2c_pca_pf_resetchip; | ||
188 | } else { | 187 | } else { |
189 | dev_warn(&pdev->dev, "Registering gpio failed!\n"); | 188 | dev_warn(&pdev->dev, "Registering gpio failed!\n"); |
190 | i2c->gpio = NULL; | 189 | i2c->gpio = NULL; |
@@ -205,7 +204,10 @@ static int i2c_pca_pf_probe(struct platform_device *pdev) | |||
205 | 204 | ||
206 | i2c->algo_data.data = i2c; | 205 | i2c->algo_data.data = i2c; |
207 | i2c->algo_data.wait_for_completion = i2c_pca_pf_waitforcompletion; | 206 | i2c->algo_data.wait_for_completion = i2c_pca_pf_waitforcompletion; |
208 | i2c->algo_data.reset_chip = i2c_pca_pf_dummyreset; | 207 | if (i2c->gpio) |
208 | i2c->algo_data.reset_chip = i2c_pca_pf_resetchip; | ||
209 | else | ||
210 | i2c->algo_data.reset_chip = i2c_pca_pf_dummyreset; | ||
209 | 211 | ||
210 | switch (res->flags & IORESOURCE_MEM_TYPE_MASK) { | 212 | switch (res->flags & IORESOURCE_MEM_TYPE_MASK) { |
211 | case IORESOURCE_MEM_32BIT: | 213 | case IORESOURCE_MEM_32BIT: |