Skip to content

Commit 18068a6

Browse files
committed
gpio: pca953x: Drop unused fields in struct pca953x_platform_data
JIRA: https://issues.redhat.com/browse/RHEL-35606 Conflicts: Due to missing ed5c2f5 ("i2c: Make remove callback return void"), we must still return 0. commit 2f4d3e2 Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Date: Fri Sep 1 16:40:32 2023 +0300 gpio: pca953x: Drop unused fields in struct pca953x_platform_data New code should solely use firmware nodes for the specifics and not any callbacks. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Signed-off-by: Andrew Halaney <ahalaney@redhat.com>
1 parent f19e138 commit 18068a6

File tree

2 files changed

+8
-42
lines changed

2 files changed

+8
-42
lines changed

drivers/gpio/gpio-pca953x.c

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ struct pca953x_chip {
211211

212212
struct i2c_client *client;
213213
struct gpio_chip gpio_chip;
214-
const char *const *names;
215214
unsigned long driver_data;
216215
struct regulator *regulator;
217216

@@ -712,7 +711,6 @@ static void pca953x_setup_gpio(struct pca953x_chip *chip, int gpios)
712711
gc->label = dev_name(&chip->client->dev);
713712
gc->parent = &chip->client->dev;
714713
gc->owner = THIS_MODULE;
715-
gc->names = chip->names;
716714
}
717715

718716
#ifdef CONFIG_GPIO_PCA953X_IRQ
@@ -998,7 +996,7 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
998996
}
999997
#endif
1000998

1001-
static int device_pca95xx_init(struct pca953x_chip *chip, u32 invert)
999+
static int device_pca95xx_init(struct pca953x_chip *chip)
10021000
{
10031001
DECLARE_BITMAP(val, MAX_LINE);
10041002
u8 regaddr;
@@ -1016,24 +1014,21 @@ static int device_pca95xx_init(struct pca953x_chip *chip, u32 invert)
10161014
if (ret)
10171015
goto out;
10181016

1019-
/* set platform specific polarity inversion */
1020-
if (invert)
1021-
bitmap_fill(val, MAX_LINE);
1022-
else
1023-
bitmap_zero(val, MAX_LINE);
1017+
/* clear polarity inversion */
1018+
bitmap_zero(val, MAX_LINE);
10241019

10251020
ret = pca953x_write_regs(chip, chip->regs->invert, val);
10261021
out:
10271022
return ret;
10281023
}
10291024

1030-
static int device_pca957x_init(struct pca953x_chip *chip, u32 invert)
1025+
static int device_pca957x_init(struct pca953x_chip *chip)
10311026
{
10321027
DECLARE_BITMAP(val, MAX_LINE);
10331028
unsigned int i;
10341029
int ret;
10351030

1036-
ret = device_pca95xx_init(chip, invert);
1031+
ret = device_pca95xx_init(chip);
10371032
if (ret)
10381033
goto out;
10391034

@@ -1055,9 +1050,8 @@ static int pca953x_probe(struct i2c_client *client)
10551050
const struct i2c_device_id *i2c_id = i2c_client_get_device_id(client);
10561051
struct pca953x_platform_data *pdata;
10571052
struct pca953x_chip *chip;
1058-
int irq_base = 0;
1053+
int irq_base;
10591054
int ret;
1060-
u32 invert = 0;
10611055
struct regulator *reg;
10621056
const struct regmap_config *regmap_config;
10631057

@@ -1069,8 +1063,6 @@ static int pca953x_probe(struct i2c_client *client)
10691063
if (pdata) {
10701064
irq_base = pdata->irq_base;
10711065
chip->gpio_start = pdata->gpio_base;
1072-
invert = pdata->invert;
1073-
chip->names = pdata->names;
10741066
} else {
10751067
struct gpio_desc *reset_gpio;
10761068

@@ -1170,10 +1162,10 @@ static int pca953x_probe(struct i2c_client *client)
11701162
*/
11711163
if (PCA_CHIP_TYPE(chip->driver_data) == PCA957X_TYPE) {
11721164
chip->regs = &pca957x_regs;
1173-
ret = device_pca957x_init(chip, invert);
1165+
ret = device_pca957x_init(chip);
11741166
} else {
11751167
chip->regs = &pca953x_regs;
1176-
ret = device_pca95xx_init(chip, invert);
1168+
ret = device_pca95xx_init(chip);
11771169
}
11781170
if (ret)
11791171
goto err_exit;
@@ -1186,13 +1178,6 @@ static int pca953x_probe(struct i2c_client *client)
11861178
if (ret)
11871179
goto err_exit;
11881180

1189-
if (pdata && pdata->setup) {
1190-
ret = pdata->setup(client, chip->gpio_chip.base,
1191-
chip->gpio_chip.ngpio, pdata->context);
1192-
if (ret < 0)
1193-
dev_warn(&client->dev, "setup failed, %d\n", ret);
1194-
}
1195-
11961181
return 0;
11971182

11981183
err_exit:
@@ -1202,14 +1187,8 @@ static int pca953x_probe(struct i2c_client *client)
12021187

12031188
static int pca953x_remove(struct i2c_client *client)
12041189
{
1205-
struct pca953x_platform_data *pdata = dev_get_platdata(&client->dev);
12061190
struct pca953x_chip *chip = i2c_get_clientdata(client);
12071191

1208-
if (pdata && pdata->teardown) {
1209-
pdata->teardown(client, chip->gpio_chip.base,
1210-
chip->gpio_chip.ngpio, pdata->context);
1211-
}
1212-
12131192
regulator_disable(chip->regulator);
12141193

12151194
return 0;

include/linux/platform_data/pca953x.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,8 @@ struct pca953x_platform_data {
1111
/* number of the first GPIO */
1212
unsigned gpio_base;
1313

14-
/* initial polarity inversion setting */
15-
u32 invert;
16-
1714
/* interrupt base */
1815
int irq_base;
19-
20-
void *context; /* param to setup/teardown */
21-
22-
int (*setup)(struct i2c_client *client,
23-
unsigned gpio, unsigned ngpio,
24-
void *context);
25-
void (*teardown)(struct i2c_client *client,
26-
unsigned gpio, unsigned ngpio,
27-
void *context);
28-
const char *const *names;
2916
};
3017

3118
#endif /* _LINUX_PCA953X_H */

0 commit comments

Comments
 (0)