Skip to content

Commit 6b867c4

Browse files
committed
Merge tag 'gpio-fixes-for-v6.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux
Pull gpio fixes from Bartosz Golaszewski: "Apart from the gpio-exar fix which addresses an older issue, they all fix regressions from this release cycle: - fix missing GPIO chip labels in gpio-zevio and gpio-altera - for the latter: also set GPIO base to -1 to use dynamic range allocation - fix value setting with external pull-up/down resistor in gpio-exar - use the recommended IDA interfaces in gpio-mpsse" * tag 'gpio-fixes-for-v6.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: gpio: mpsse: Remove usage of the deprecated ida_simple_xx() API gpio: exar: set value when external pull-up or pull-down is present gpio: altera: Add missed base and label initialisations gpio: zevio: Add missed label initialisation
2 parents 2a50b1e + f57c084 commit 6b867c4

File tree

4 files changed

+19
-6
lines changed

4 files changed

+19
-6
lines changed

drivers/gpio/gpio-altera.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,11 @@ static int altera_gpio_probe(struct platform_device *pdev)
261261
altera_gc->gc.set = altera_gpio_set;
262262
altera_gc->gc.owner = THIS_MODULE;
263263
altera_gc->gc.parent = &pdev->dev;
264+
altera_gc->gc.base = -1;
265+
266+
altera_gc->gc.label = devm_kasprintf(dev, GFP_KERNEL, "%pfw", dev_fwnode(dev));
267+
if (!altera_gc->gc.label)
268+
return -ENOMEM;
264269

265270
altera_gc->regs = devm_platform_ioremap_resource(pdev, 0);
266271
if (IS_ERR(altera_gc->regs))

drivers/gpio/gpio-exar.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,13 @@ static void exar_set_value(struct gpio_chip *chip, unsigned int offset,
9999
struct exar_gpio_chip *exar_gpio = gpiochip_get_data(chip);
100100
unsigned int addr = exar_offset_to_lvl_addr(exar_gpio, offset);
101101
unsigned int bit = exar_offset_to_bit(exar_gpio, offset);
102+
unsigned int bit_value = value ? BIT(bit) : 0;
102103

103-
if (value)
104-
regmap_set_bits(exar_gpio->regmap, addr, BIT(bit));
105-
else
106-
regmap_clear_bits(exar_gpio->regmap, addr, BIT(bit));
104+
/*
105+
* regmap_write_bits() forces value to be written when an external
106+
* pull up/down might otherwise indicate value was already set.
107+
*/
108+
regmap_write_bits(exar_gpio->regmap, addr, BIT(bit), bit_value);
107109
}
108110

109111
static int exar_direction_output(struct gpio_chip *chip, unsigned int offset,

drivers/gpio/gpio-mpsse.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ static void gpio_mpsse_ida_remove(void *data)
403403
{
404404
struct mpsse_priv *priv = data;
405405

406-
ida_simple_remove(&gpio_mpsse_ida, priv->id);
406+
ida_free(&gpio_mpsse_ida, priv->id);
407407
}
408408

409409
static int gpio_mpsse_probe(struct usb_interface *interface,
@@ -422,7 +422,7 @@ static int gpio_mpsse_probe(struct usb_interface *interface,
422422
priv->intf = interface;
423423
priv->intf_id = interface->cur_altsetting->desc.bInterfaceNumber;
424424

425-
priv->id = ida_simple_get(&gpio_mpsse_ida, 0, 0, GFP_KERNEL);
425+
priv->id = ida_alloc(&gpio_mpsse_ida, GFP_KERNEL);
426426
if (priv->id < 0)
427427
return priv->id;
428428

drivers/gpio/gpio-zevio.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <linux/io.h>
1212
#include <linux/mod_devicetable.h>
1313
#include <linux/platform_device.h>
14+
#include <linux/property.h>
1415
#include <linux/slab.h>
1516
#include <linux/spinlock.h>
1617

@@ -169,6 +170,7 @@ static const struct gpio_chip zevio_gpio_chip = {
169170
/* Initialization */
170171
static int zevio_gpio_probe(struct platform_device *pdev)
171172
{
173+
struct device *dev = &pdev->dev;
172174
struct zevio_gpio *controller;
173175
int status, i;
174176

@@ -180,6 +182,10 @@ static int zevio_gpio_probe(struct platform_device *pdev)
180182
controller->chip = zevio_gpio_chip;
181183
controller->chip.parent = &pdev->dev;
182184

185+
controller->chip.label = devm_kasprintf(dev, GFP_KERNEL, "%pfw", dev_fwnode(dev));
186+
if (!controller->chip.label)
187+
return -ENOMEM;
188+
183189
controller->regs = devm_platform_ioremap_resource(pdev, 0);
184190
if (IS_ERR(controller->regs))
185191
return dev_err_probe(&pdev->dev, PTR_ERR(controller->regs),

0 commit comments

Comments
 (0)