Commit c0842db5 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'gpio-fixes-for-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux

Pull gpio fixes from Bartosz Golaszewski:

 - fix initial value handling for output-only pins in gpio-tps68470

 - fix two resource leaks in gpio-mvebu

* tag 'gpio-fixes-for-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
  gpio: mvebu: fix irq domain leak
  gpio: mvebu: Make use of devm_pwmchip_add
  gpio: tps68470: Make tps68470_gpio_output() always set the initial value
parents d192f538 644ee702
Loading
Loading
Loading
Loading
+15 −11
Original line number Diff line number Diff line
@@ -874,7 +874,7 @@ static int mvebu_pwm_probe(struct platform_device *pdev,

	spin_lock_init(&mvpwm->lock);

	return pwmchip_add(&mvpwm->chip);
	return devm_pwmchip_add(dev, &mvpwm->chip);
}

#ifdef CONFIG_DEBUG_FS
@@ -1112,6 +1112,13 @@ static int mvebu_gpio_probe_syscon(struct platform_device *pdev,
	return 0;
}

static void mvebu_gpio_remove_irq_domain(void *data)
{
	struct irq_domain *domain = data;

	irq_domain_remove(domain);
}

static int mvebu_gpio_probe(struct platform_device *pdev)
{
	struct mvebu_gpio_chip *mvchip;
@@ -1243,17 +1250,21 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
	if (!mvchip->domain) {
		dev_err(&pdev->dev, "couldn't allocate irq domain %s (DT).\n",
			mvchip->chip.label);
		err = -ENODEV;
		goto err_pwm;
		return -ENODEV;
	}

	err = devm_add_action_or_reset(&pdev->dev, mvebu_gpio_remove_irq_domain,
				       mvchip->domain);
	if (err)
		return err;

	err = irq_alloc_domain_generic_chips(
	    mvchip->domain, ngpios, 2, np->name, handle_level_irq,
	    IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_LEVEL, 0, 0);
	if (err) {
		dev_err(&pdev->dev, "couldn't allocate irq chips %s (DT).\n",
			mvchip->chip.label);
		goto err_domain;
		return err;
	}

	/*
@@ -1293,13 +1304,6 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
	}

	return 0;

err_domain:
	irq_domain_remove(mvchip->domain);
err_pwm:
	pwmchip_remove(&mvchip->mvpwm->chip);

	return err;
}

static struct platform_driver mvebu_gpio_driver = {
+3 −3
Original line number Diff line number Diff line
@@ -91,13 +91,13 @@ static int tps68470_gpio_output(struct gpio_chip *gc, unsigned int offset,
	struct tps68470_gpio_data *tps68470_gpio = gpiochip_get_data(gc);
	struct regmap *regmap = tps68470_gpio->tps68470_regmap;

	/* Set the initial value */
	tps68470_gpio_set(gc, offset, value);

	/* rest are always outputs */
	if (offset >= TPS68470_N_REGULAR_GPIO)
		return 0;

	/* Set the initial value */
	tps68470_gpio_set(gc, offset, value);

	return regmap_update_bits(regmap, TPS68470_GPIO_CTL_REG_A(offset),
				 TPS68470_GPIO_MODE_MASK,
				 TPS68470_GPIO_MODE_OUT_CMOS);