Skip to content

Commit 26a4ded

Browse files
nehebBartosz Golaszewski
authored andcommitted
gpio: twl4030: use gpiochip_get_data
We can pass the pointer in probe to gpiochip_add_data instead of using dev_get_drvdata. Signed-off-by: Rosen Penev <rosenp@gmail.com> Link: https://lore.kernel.org/r/20241203233354.184404-1-rosenp@gmail.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
1 parent 40384c8 commit 26a4ded

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/gpio/gpio-twl6040.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
static int twl6040gpo_get(struct gpio_chip *chip, unsigned offset)
2424
{
25-
struct twl6040 *twl6040 = dev_get_drvdata(chip->parent->parent);
25+
struct twl6040 *twl6040 = gpiochip_get_data(chip);
2626
int ret = 0;
2727

2828
ret = twl6040_reg_read(twl6040, TWL6040_REG_GPOCTL);
@@ -46,7 +46,7 @@ static int twl6040gpo_direction_out(struct gpio_chip *chip, unsigned offset,
4646

4747
static void twl6040gpo_set(struct gpio_chip *chip, unsigned offset, int value)
4848
{
49-
struct twl6040 *twl6040 = dev_get_drvdata(chip->parent->parent);
49+
struct twl6040 *twl6040 = gpiochip_get_data(chip);
5050
int ret;
5151
u8 gpoctl;
5252

@@ -91,7 +91,7 @@ static int gpo_twl6040_probe(struct platform_device *pdev)
9191

9292
twl6040gpo_chip.parent = &pdev->dev;
9393

94-
ret = devm_gpiochip_add_data(&pdev->dev, &twl6040gpo_chip, NULL);
94+
ret = devm_gpiochip_add_data(&pdev->dev, &twl6040gpo_chip, twl6040);
9595
if (ret < 0) {
9696
dev_err(&pdev->dev, "could not register gpiochip, %d\n", ret);
9797
twl6040gpo_chip.ngpio = 0;

0 commit comments

Comments
 (0)