mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-26 13:44:15 +08:00
gpio fixes for v6.2-rc3
- fix a reference leak in gpio-sifive - fix a potential use of an uninitialized variable in core gpiolib - fix a potential use of an uninitialized variable in gpio-pca953x - make GPIO irqchips immutable in gpio-pmic-eic-sprd, gpio-eic-sprd and gpio-sprd -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEFp3rbAvDxGAT0sefEacuoBRx13IFAmO3EEQACgkQEacuoBRx 13KPmg//Xu6/ng05VYSMtKr/3di1+8RD603+uLu5fCsJTzNHOezKX+Zumkf4eiZ5 9ojvf/TGMWnCfKN5XAJ5YLqkCfAtSxBXMo0WLyZqDHtSGraBuOHdPpidSSkIcIyI BYql+lNtpEvUAG2JT0UjBnTiGgooNIYnmi18gecVzJ+xImP6pUrO41anfvLycOCH EqhpFZhegHm45XrQso6UH8T50QxL9avTnfwygVPR8s3M0pWmtJqogQYNjZasx0pf oRCSJ3eUZXWR69Z7IzRPJzBY88uL3MjcJfD4e8+rotR0/mTR55CdxbhS2i79Vc33 zn80+5aWq1BtyAB+ZJrEd+211q5IVg+pnRQcdKDl86NSvQRVU57lCVpiTgc0DL4e kcktFWCoKEJ56p+ZtJDFnpSddetyEg+1mGPIBC9+MPANzkqggm0eq2o7ymqEEEGI gRe9kzBfN9oOKxtdfIrvttqrTKyifSJsbe6Sb6B+RG9nhJdE6eK6SdpS5m5WHXZW ATFj9c8yBCZzlXuJbviZUGedhCyLKI4z5EzgJj5TayQBuSZTYme/Iz2+++GjHbdD pylT/lSWbyGl1rrZ5YgQPeKN9U9/aknWEu1KHgx7iL9v8ulIRd3lVAqfFfwyf6Lt WPPHhlMznTQ/Wf6EhYb1U/yaCyAyWTxTh/KR6BMqp4FyKlQ9n/k= =vy5/ -----END PGP SIGNATURE----- Merge tag 'gpio-fixes-for-v6.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux Pull gpio fixes from Bartosz Golaszewski: "A reference leak fix, two fixes for using uninitialized variables and more drivers converted to using immutable irqchips: - fix a reference leak in gpio-sifive - fix a potential use of an uninitialized variable in core gpiolib - fix a potential use of an uninitialized variable in gpio-pca953x - make GPIO irqchips immutable in gpio-pmic-eic-sprd, gpio-eic-sprd and gpio-sprd" * tag 'gpio-fixes-for-v6.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: gpio: sifive: Fix refcount leak in sifive_gpio_probe gpio: sprd: Make the irqchip immutable gpio: pmic-eic-sprd: Make the irqchip immutable gpio: eic-sprd: Make the irqchip immutable gpio: pca953x: avoid to use uninitialized value pinctrl gpiolib: Fix using uninitialized lookup-flags on ACPI platforms
This commit is contained in:
commit
aa01a18392
@ -91,7 +91,6 @@ enum sprd_eic_type {
|
||||
|
||||
struct sprd_eic {
|
||||
struct gpio_chip chip;
|
||||
struct irq_chip intc;
|
||||
void __iomem *base[SPRD_EIC_MAX_BANK];
|
||||
enum sprd_eic_type type;
|
||||
spinlock_t lock;
|
||||
@ -255,6 +254,8 @@ static void sprd_eic_irq_mask(struct irq_data *data)
|
||||
default:
|
||||
dev_err(chip->parent, "Unsupported EIC type.\n");
|
||||
}
|
||||
|
||||
gpiochip_disable_irq(chip, offset);
|
||||
}
|
||||
|
||||
static void sprd_eic_irq_unmask(struct irq_data *data)
|
||||
@ -263,6 +264,8 @@ static void sprd_eic_irq_unmask(struct irq_data *data)
|
||||
struct sprd_eic *sprd_eic = gpiochip_get_data(chip);
|
||||
u32 offset = irqd_to_hwirq(data);
|
||||
|
||||
gpiochip_enable_irq(chip, offset);
|
||||
|
||||
switch (sprd_eic->type) {
|
||||
case SPRD_EIC_DEBOUNCE:
|
||||
sprd_eic_update(chip, offset, SPRD_EIC_DBNC_IE, 1);
|
||||
@ -564,6 +567,15 @@ static void sprd_eic_irq_handler(struct irq_desc *desc)
|
||||
chained_irq_exit(ic, desc);
|
||||
}
|
||||
|
||||
static const struct irq_chip sprd_eic_irq = {
|
||||
.name = "sprd-eic",
|
||||
.irq_ack = sprd_eic_irq_ack,
|
||||
.irq_mask = sprd_eic_irq_mask,
|
||||
.irq_unmask = sprd_eic_irq_unmask,
|
||||
.irq_set_type = sprd_eic_irq_set_type,
|
||||
.flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_IMMUTABLE,
|
||||
GPIOCHIP_IRQ_RESOURCE_HELPERS,
|
||||
};
|
||||
static int sprd_eic_probe(struct platform_device *pdev)
|
||||
{
|
||||
const struct sprd_eic_variant_data *pdata;
|
||||
@ -626,15 +638,8 @@ static int sprd_eic_probe(struct platform_device *pdev)
|
||||
break;
|
||||
}
|
||||
|
||||
sprd_eic->intc.name = dev_name(&pdev->dev);
|
||||
sprd_eic->intc.irq_ack = sprd_eic_irq_ack;
|
||||
sprd_eic->intc.irq_mask = sprd_eic_irq_mask;
|
||||
sprd_eic->intc.irq_unmask = sprd_eic_irq_unmask;
|
||||
sprd_eic->intc.irq_set_type = sprd_eic_irq_set_type;
|
||||
sprd_eic->intc.flags = IRQCHIP_SKIP_SET_WAKE;
|
||||
|
||||
irq = &sprd_eic->chip.irq;
|
||||
irq->chip = &sprd_eic->intc;
|
||||
gpio_irq_chip_set_chip(irq, &sprd_eic_irq);
|
||||
irq->handler = handle_bad_irq;
|
||||
irq->default_type = IRQ_TYPE_NONE;
|
||||
irq->parent_handler = sprd_eic_irq_handler;
|
||||
|
@ -474,6 +474,9 @@ static u8 pcal6534_recalc_addr(struct pca953x_chip *chip, int reg, int off)
|
||||
case PCAL6524_DEBOUNCE:
|
||||
pinctrl = ((reg & PCAL_PINCTRL_MASK) >> 1) + 0x1c;
|
||||
break;
|
||||
default:
|
||||
pinctrl = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return pinctrl + addr + (off / BANK_SZ);
|
||||
|
@ -47,7 +47,6 @@ enum {
|
||||
/**
|
||||
* struct sprd_pmic_eic - PMIC EIC controller
|
||||
* @chip: the gpio_chip structure.
|
||||
* @intc: the irq_chip structure.
|
||||
* @map: the regmap from the parent device.
|
||||
* @offset: the EIC controller's offset address of the PMIC.
|
||||
* @reg: the array to cache the EIC registers.
|
||||
@ -56,7 +55,6 @@ enum {
|
||||
*/
|
||||
struct sprd_pmic_eic {
|
||||
struct gpio_chip chip;
|
||||
struct irq_chip intc;
|
||||
struct regmap *map;
|
||||
u32 offset;
|
||||
u8 reg[CACHE_NR_REGS];
|
||||
@ -151,15 +149,21 @@ static void sprd_pmic_eic_irq_mask(struct irq_data *data)
|
||||
{
|
||||
struct gpio_chip *chip = irq_data_get_irq_chip_data(data);
|
||||
struct sprd_pmic_eic *pmic_eic = gpiochip_get_data(chip);
|
||||
u32 offset = irqd_to_hwirq(data);
|
||||
|
||||
pmic_eic->reg[REG_IE] = 0;
|
||||
pmic_eic->reg[REG_TRIG] = 0;
|
||||
|
||||
gpiochip_disable_irq(chip, offset);
|
||||
}
|
||||
|
||||
static void sprd_pmic_eic_irq_unmask(struct irq_data *data)
|
||||
{
|
||||
struct gpio_chip *chip = irq_data_get_irq_chip_data(data);
|
||||
struct sprd_pmic_eic *pmic_eic = gpiochip_get_data(chip);
|
||||
u32 offset = irqd_to_hwirq(data);
|
||||
|
||||
gpiochip_enable_irq(chip, offset);
|
||||
|
||||
pmic_eic->reg[REG_IE] = 1;
|
||||
pmic_eic->reg[REG_TRIG] = 1;
|
||||
@ -292,6 +296,17 @@ static irqreturn_t sprd_pmic_eic_irq_handler(int irq, void *data)
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static const struct irq_chip pmic_eic_irq_chip = {
|
||||
.name = "sprd-pmic-eic",
|
||||
.irq_mask = sprd_pmic_eic_irq_mask,
|
||||
.irq_unmask = sprd_pmic_eic_irq_unmask,
|
||||
.irq_set_type = sprd_pmic_eic_irq_set_type,
|
||||
.irq_bus_lock = sprd_pmic_eic_bus_lock,
|
||||
.irq_bus_sync_unlock = sprd_pmic_eic_bus_sync_unlock,
|
||||
.flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_IMMUTABLE,
|
||||
GPIOCHIP_IRQ_RESOURCE_HELPERS,
|
||||
};
|
||||
|
||||
static int sprd_pmic_eic_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct gpio_irq_chip *irq;
|
||||
@ -338,16 +353,8 @@ static int sprd_pmic_eic_probe(struct platform_device *pdev)
|
||||
pmic_eic->chip.set = sprd_pmic_eic_set;
|
||||
pmic_eic->chip.get = sprd_pmic_eic_get;
|
||||
|
||||
pmic_eic->intc.name = dev_name(&pdev->dev);
|
||||
pmic_eic->intc.irq_mask = sprd_pmic_eic_irq_mask;
|
||||
pmic_eic->intc.irq_unmask = sprd_pmic_eic_irq_unmask;
|
||||
pmic_eic->intc.irq_set_type = sprd_pmic_eic_irq_set_type;
|
||||
pmic_eic->intc.irq_bus_lock = sprd_pmic_eic_bus_lock;
|
||||
pmic_eic->intc.irq_bus_sync_unlock = sprd_pmic_eic_bus_sync_unlock;
|
||||
pmic_eic->intc.flags = IRQCHIP_SKIP_SET_WAKE;
|
||||
|
||||
irq = &pmic_eic->chip.irq;
|
||||
irq->chip = &pmic_eic->intc;
|
||||
gpio_irq_chip_set_chip(irq, &pmic_eic_irq_chip);
|
||||
irq->threaded = true;
|
||||
|
||||
ret = devm_gpiochip_add_data(&pdev->dev, &pmic_eic->chip, pmic_eic);
|
||||
|
@ -215,6 +215,7 @@ static int sifive_gpio_probe(struct platform_device *pdev)
|
||||
return -ENODEV;
|
||||
}
|
||||
parent = irq_find_host(irq_parent);
|
||||
of_node_put(irq_parent);
|
||||
if (!parent) {
|
||||
dev_err(dev, "no IRQ parent domain\n");
|
||||
return -ENODEV;
|
||||
|
@ -120,6 +120,7 @@ static void sprd_gpio_irq_mask(struct irq_data *data)
|
||||
u32 offset = irqd_to_hwirq(data);
|
||||
|
||||
sprd_gpio_update(chip, offset, SPRD_GPIO_IE, 0);
|
||||
gpiochip_disable_irq(chip, offset);
|
||||
}
|
||||
|
||||
static void sprd_gpio_irq_ack(struct irq_data *data)
|
||||
@ -136,6 +137,7 @@ static void sprd_gpio_irq_unmask(struct irq_data *data)
|
||||
u32 offset = irqd_to_hwirq(data);
|
||||
|
||||
sprd_gpio_update(chip, offset, SPRD_GPIO_IE, 1);
|
||||
gpiochip_enable_irq(chip, offset);
|
||||
}
|
||||
|
||||
static int sprd_gpio_irq_set_type(struct irq_data *data,
|
||||
@ -205,13 +207,14 @@ static void sprd_gpio_irq_handler(struct irq_desc *desc)
|
||||
chained_irq_exit(ic, desc);
|
||||
}
|
||||
|
||||
static struct irq_chip sprd_gpio_irqchip = {
|
||||
static const struct irq_chip sprd_gpio_irqchip = {
|
||||
.name = "sprd-gpio",
|
||||
.irq_ack = sprd_gpio_irq_ack,
|
||||
.irq_mask = sprd_gpio_irq_mask,
|
||||
.irq_unmask = sprd_gpio_irq_unmask,
|
||||
.irq_set_type = sprd_gpio_irq_set_type,
|
||||
.flags = IRQCHIP_SKIP_SET_WAKE,
|
||||
.flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_IMMUTABLE,
|
||||
GPIOCHIP_IRQ_RESOURCE_HELPERS,
|
||||
};
|
||||
|
||||
static int sprd_gpio_probe(struct platform_device *pdev)
|
||||
@ -245,7 +248,7 @@ static int sprd_gpio_probe(struct platform_device *pdev)
|
||||
sprd_gpio->chip.direction_output = sprd_gpio_direction_output;
|
||||
|
||||
irq = &sprd_gpio->chip.irq;
|
||||
irq->chip = &sprd_gpio_irqchip;
|
||||
gpio_irq_chip_set_chip(irq, &sprd_gpio_irqchip);
|
||||
irq->handler = handle_bad_irq;
|
||||
irq->default_type = IRQ_TYPE_NONE;
|
||||
irq->parent_handler = sprd_gpio_irq_handler;
|
||||
|
@ -3905,8 +3905,8 @@ static struct gpio_desc *gpiod_find_and_request(struct device *consumer,
|
||||
const char *label,
|
||||
bool platform_lookup_allowed)
|
||||
{
|
||||
unsigned long lookupflags = GPIO_LOOKUP_FLAGS_DEFAULT;
|
||||
struct gpio_desc *desc = ERR_PTR(-ENOENT);
|
||||
unsigned long lookupflags;
|
||||
int ret;
|
||||
|
||||
if (!IS_ERR_OR_NULL(fwnode))
|
||||
|
Loading…
Reference in New Issue
Block a user