diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-07-09 18:07:00 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-07-09 18:07:00 +0200 |
commit | 2ec98f567888501df0140c858af5f5ea10216a6f (patch) | |
tree | 656e0a3d0bba600bf79ab98c85bfec24ddcb2115 /drivers/gpio/gpio-max732x.c | |
parent | Merge tag 'i3c/for-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/i3c/... (diff) | |
parent | Revert "gpio: tegra: Clean-up debugfs initialisation" (diff) | |
download | linux-2ec98f567888501df0140c858af5f5ea10216a6f.tar.xz linux-2ec98f567888501df0140c858af5f5ea10216a6f.zip |
Merge tag 'gpio-v5.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio
Pull GPIO updates from Linus Walleij:
"This is the big slew of GPIO changes for the v5.3 kernel cycle. This
is mostly incremental work this time.
Three important things:
- The FMC subsystem is deleted through my tree. This happens through
GPIO as its demise was discussed in relation to a patch decoupling
its GPIO implementation from the standard way of handling GPIO. As
it turns out, that is not the only subsystem it reimplements and
the authors think it is better do scratch it and start over using
the proper kernel subsystems than try to polish the rust shiny. See
the commit (ACKed by the maintainers) for details.
- Arnd made a small devres patch that was ACKed by Greg and goes into
the device core.
- SPDX header change colissions may happen, because at times I've
seen that quite a lot changed during the -rc:s in regards to SPDX.
(It is good stuff, tglx has me convinced, and it is worth the
occasional pain.)
Apart from this is is nothing controversial or problematic.
Summary:
Core:
- When a gpio_chip request GPIOs from itself, it can now fully
control the line characteristics, both machine and consumer flags.
This makes a lot of sense, but took some time before I figured out
that this is how it has to work.
- Several smallish documentation fixes.
New drivers:
- The PCA953x driver now supports the TI TCA9539.
- The DaVinci driver now supports the K3 AM654 SoCs.
Driver improvements:
- Major overhaul and hardening of the OMAP driver by Russell King.
- Starting to move some drivers to the new API passing irq_chip along
with the gpio_chip when adding the gpio_chip instead of adding it
separately.
Unrelated:
- Delete the FMC subsystem"
* tag 'gpio-v5.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (87 commits)
Revert "gpio: tegra: Clean-up debugfs initialisation"
gpiolib: Use spinlock_t instead of struct spinlock
gpio: stp-xway: allow compile-testing
gpio: stp-xway: get rid of the #include <lantiq_soc.h> dependency
gpio: stp-xway: improve module clock error handling
gpio: stp-xway: simplify error handling in xway_stp_probe()
gpiolib: Clarify use of non-sleeping functions
gpiolib: Fix references to gpiod_[gs]et_*value_cansleep() variants
gpiolib: Document new gpio_chip.init_valid_mask field
Documentation: gpio: Fix reference to gpiod_get_array()
gpio: pl061: drop duplicate printing of device name
gpio: altera: Pass irqchip when adding gpiochip
gpio: siox: Use devm_ managed gpiochip
gpio: siox: Add struct device *dev helper variable
gpio: siox: Pass irqchip when adding gpiochip
drivers: gpio: amd-fch: make resource struct const
devres: allow const resource arguments
gpio: ath79: Pass irqchip when adding gpiochip
gpio: tegra: Clean-up debugfs initialisation
gpio: siox: Switch to IRQ_TYPE_NONE
...
Diffstat (limited to 'drivers/gpio/gpio-max732x.c')
-rw-r--r-- | drivers/gpio/gpio-max732x.c | 45 |
1 files changed, 16 insertions, 29 deletions
diff --git a/drivers/gpio/gpio-max732x.c b/drivers/gpio/gpio-max732x.c index 5e4102e7b1f9..5fb0bcf31142 100644 --- a/drivers/gpio/gpio-max732x.c +++ b/drivers/gpio/gpio-max732x.c @@ -649,12 +649,12 @@ static int max732x_probe(struct i2c_client *client, case 0x60: chip->client_group_a = client; if (nr_port > 8) { - c = i2c_new_dummy(client->adapter, addr_b); - if (!c) { + c = devm_i2c_new_dummy_device(&client->dev, + client->adapter, addr_b); + if (IS_ERR(c)) { dev_err(&client->dev, "Failed to allocate I2C device\n"); - ret = -ENODEV; - goto out_failed; + return PTR_ERR(c); } chip->client_group_b = chip->client_dummy = c; } @@ -662,12 +662,12 @@ static int max732x_probe(struct i2c_client *client, case 0x50: chip->client_group_b = client; if (nr_port > 8) { - c = i2c_new_dummy(client->adapter, addr_a); - if (!c) { + c = devm_i2c_new_dummy_device(&client->dev, + client->adapter, addr_a); + if (IS_ERR(c)) { dev_err(&client->dev, "Failed to allocate I2C device\n"); - ret = -ENODEV; - goto out_failed; + return PTR_ERR(c); } chip->client_group_a = chip->client_dummy = c; } @@ -675,37 +675,33 @@ static int max732x_probe(struct i2c_client *client, default: dev_err(&client->dev, "invalid I2C address specified %02x\n", client->addr); - ret = -EINVAL; - goto out_failed; + return -EINVAL; } if (nr_port > 8 && !chip->client_dummy) { dev_err(&client->dev, "Failed to allocate second group I2C device\n"); - ret = -ENODEV; - goto out_failed; + return -ENODEV; } mutex_init(&chip->lock); ret = max732x_readb(chip, is_group_a(chip, 0), &chip->reg_out[0]); if (ret) - goto out_failed; + return ret; if (nr_port > 8) { ret = max732x_readb(chip, is_group_a(chip, 8), &chip->reg_out[1]); if (ret) - goto out_failed; + return ret; } - ret = gpiochip_add_data(&chip->gpio_chip, chip); + ret = devm_gpiochip_add_data(&client->dev, &chip->gpio_chip, chip); if (ret) - goto out_failed; + return ret; ret = max732x_irq_setup(chip, id); - if (ret) { - gpiochip_remove(&chip->gpio_chip); - goto out_failed; - } + if (ret) + return ret; if (pdata && pdata->setup) { ret = pdata->setup(client, chip->gpio_chip.base, @@ -716,10 +712,6 @@ static int max732x_probe(struct i2c_client *client, i2c_set_clientdata(client, chip); return 0; - -out_failed: - i2c_unregister_device(chip->client_dummy); - return ret; } static int max732x_remove(struct i2c_client *client) @@ -739,11 +731,6 @@ static int max732x_remove(struct i2c_client *client) } } - gpiochip_remove(&chip->gpio_chip); - - /* unregister any dummy i2c_client */ - i2c_unregister_device(chip->client_dummy); - return 0; } |