Commit a79c6d33 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Wentao Guan
Browse files

gpio: pca953x: Drop unused fields in struct pca953x_platform_data

stable inclusion
from stable-v6.6.76
commit e657dc10c4d4877f7d514019d9f4a3a07b74b778
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IBW08Q

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=e657dc10c4d4877f7d514019d9f4a3a07b74b778



--------------------------------

[ Upstream commit 2f4d3e293392571e02b106c8b431b638bd029276 ]

New code should solely use firmware nodes for the specifics and
not any callbacks.

Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Stable-dep-of: 7cef813a91c4 ("gpio: pca953x: log an error when failing to get the reset GPIO")
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
(cherry picked from commit e657dc10c4d4877f7d514019d9f4a3a07b74b778)
Signed-off-by: default avatarWentao Guan <guanwentao@uniontech.com>
parent 42a2a96c
Loading
Loading
Loading
Loading
+8 −29
Original line number Diff line number Diff line
@@ -211,7 +211,6 @@ struct pca953x_chip {

	struct i2c_client *client;
	struct gpio_chip gpio_chip;
	const char *const *names;
	unsigned long driver_data;
	struct regulator *regulator;

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

#ifdef CONFIG_GPIO_PCA953X_IRQ
@@ -1000,7 +998,7 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
}
#endif

static int device_pca95xx_init(struct pca953x_chip *chip, u32 invert)
static int device_pca95xx_init(struct pca953x_chip *chip)
{
	DECLARE_BITMAP(val, MAX_LINE);
	u8 regaddr;
@@ -1018,10 +1016,7 @@ static int device_pca95xx_init(struct pca953x_chip *chip, u32 invert)
	if (ret)
		goto out;

	/* set platform specific polarity inversion */
	if (invert)
		bitmap_fill(val, MAX_LINE);
	else
	/* clear polarity inversion */
	bitmap_zero(val, MAX_LINE);

	ret = pca953x_write_regs(chip, chip->regs->invert, val);
@@ -1029,13 +1024,13 @@ static int device_pca95xx_init(struct pca953x_chip *chip, u32 invert)
	return ret;
}

static int device_pca957x_init(struct pca953x_chip *chip, u32 invert)
static int device_pca957x_init(struct pca953x_chip *chip)
{
	DECLARE_BITMAP(val, MAX_LINE);
	unsigned int i;
	int ret;

	ret = device_pca95xx_init(chip, invert);
	ret = device_pca95xx_init(chip);
	if (ret)
		goto out;

@@ -1056,9 +1051,8 @@ static int pca953x_probe(struct i2c_client *client)
{
	struct pca953x_platform_data *pdata;
	struct pca953x_chip *chip;
	int irq_base = 0;
	int irq_base;
	int ret;
	u32 invert = 0;
	struct regulator *reg;
	const struct regmap_config *regmap_config;

@@ -1070,8 +1064,6 @@ static int pca953x_probe(struct i2c_client *client)
	if (pdata) {
		irq_base = pdata->irq_base;
		chip->gpio_start = pdata->gpio_base;
		invert = pdata->invert;
		chip->names = pdata->names;
	} else {
		struct gpio_desc *reset_gpio;

@@ -1160,10 +1152,10 @@ static int pca953x_probe(struct i2c_client *client)
	 */
	if (PCA_CHIP_TYPE(chip->driver_data) == PCA957X_TYPE) {
		chip->regs = &pca957x_regs;
		ret = device_pca957x_init(chip, invert);
		ret = device_pca957x_init(chip);
	} else {
		chip->regs = &pca953x_regs;
		ret = device_pca95xx_init(chip, invert);
		ret = device_pca95xx_init(chip);
	}
	if (ret)
		goto err_exit;
@@ -1176,13 +1168,6 @@ static int pca953x_probe(struct i2c_client *client)
	if (ret)
		goto err_exit;

	if (pdata && pdata->setup) {
		ret = pdata->setup(client, chip->gpio_chip.base,
				   chip->gpio_chip.ngpio, pdata->context);
		if (ret < 0)
			dev_warn(&client->dev, "setup failed, %d\n", ret);
	}

	return 0;

err_exit:
@@ -1192,14 +1177,8 @@ static int pca953x_probe(struct i2c_client *client)

static void pca953x_remove(struct i2c_client *client)
{
	struct pca953x_platform_data *pdata = dev_get_platdata(&client->dev);
	struct pca953x_chip *chip = i2c_get_clientdata(client);

	if (pdata && pdata->teardown) {
		pdata->teardown(client, chip->gpio_chip.base,
				chip->gpio_chip.ngpio, pdata->context);
	}

	regulator_disable(chip->regulator);
}

+0 −13
Original line number Diff line number Diff line
@@ -11,21 +11,8 @@ struct pca953x_platform_data {
	/* number of the first GPIO */
	unsigned	gpio_base;

	/* initial polarity inversion setting */
	u32		invert;

	/* interrupt base */
	int		irq_base;

	void		*context;	/* param to setup/teardown */

	int		(*setup)(struct i2c_client *client,
				unsigned gpio, unsigned ngpio,
				void *context);
	void		(*teardown)(struct i2c_client *client,
				unsigned gpio, unsigned ngpio,
				void *context);
	const char	*const *names;
};

#endif /* _LINUX_PCA953X_H */