Skip to content

Commit 7111fa1

Browse files
committed
Merge tag 'gpio-v5.4-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio
Pull GPIO fixes from Linus Walleij: "More GPIO fixes! We found a late regression in the Intel Merrifield driver. Oh well. We fixed it up. - Fix a build error in the tools used for kselftest - A series of reverts to bring the Intel Merrifield back to working. We will likely unrevert the reverts for v5.5 but we can't have v5.4 broken" * tag 'gpio-v5.4-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: Revert "gpio: merrifield: Pass irqchip when adding gpiochip" Revert "gpio: merrifield: Restore use of irq_base" Revert "gpio: merrifield: Move hardware initialization to callback" tools: gpio: Use !building_out_of_srctree to determine srctree
2 parents a99d808 + 1173c3c commit 7111fa1

File tree

2 files changed

+18
-21
lines changed

2 files changed

+18
-21
lines changed

drivers/gpio/gpio-merrifield.c

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,8 @@ static void mrfld_irq_handler(struct irq_desc *desc)
362362
chained_irq_exit(irqchip, desc);
363363
}
364364

365-
static int mrfld_irq_init_hw(struct gpio_chip *chip)
365+
static void mrfld_irq_init_hw(struct mrfld_gpio *priv)
366366
{
367-
struct mrfld_gpio *priv = gpiochip_get_data(chip);
368367
void __iomem *reg;
369368
unsigned int base;
370369

@@ -376,8 +375,6 @@ static int mrfld_irq_init_hw(struct gpio_chip *chip)
376375
reg = gpio_reg(&priv->chip, base, GFER);
377376
writel(0, reg);
378377
}
379-
380-
return 0;
381378
}
382379

383380
static const char *mrfld_gpio_get_pinctrl_dev_name(struct mrfld_gpio *priv)
@@ -400,7 +397,6 @@ static int mrfld_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *id
400397
{
401398
const struct mrfld_gpio_pinrange *range;
402399
const char *pinctrl_dev_name;
403-
struct gpio_irq_chip *girq;
404400
struct mrfld_gpio *priv;
405401
u32 gpio_base, irq_base;
406402
void __iomem *base;
@@ -448,21 +444,6 @@ static int mrfld_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *id
448444

449445
raw_spin_lock_init(&priv->lock);
450446

451-
girq = &priv->chip.irq;
452-
girq->chip = &mrfld_irqchip;
453-
girq->init_hw = mrfld_irq_init_hw;
454-
girq->parent_handler = mrfld_irq_handler;
455-
girq->num_parents = 1;
456-
girq->parents = devm_kcalloc(&pdev->dev, girq->num_parents,
457-
sizeof(*girq->parents),
458-
GFP_KERNEL);
459-
if (!girq->parents)
460-
return -ENOMEM;
461-
girq->parents[0] = pdev->irq;
462-
girq->first = irq_base;
463-
girq->default_type = IRQ_TYPE_NONE;
464-
girq->handler = handle_bad_irq;
465-
466447
pci_set_drvdata(pdev, priv);
467448
retval = devm_gpiochip_add_data(&pdev->dev, &priv->chip, priv);
468449
if (retval) {
@@ -484,6 +465,18 @@ static int mrfld_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *id
484465
}
485466
}
486467

468+
retval = gpiochip_irqchip_add(&priv->chip, &mrfld_irqchip, irq_base,
469+
handle_bad_irq, IRQ_TYPE_NONE);
470+
if (retval) {
471+
dev_err(&pdev->dev, "could not connect irqchip to gpiochip\n");
472+
return retval;
473+
}
474+
475+
mrfld_irq_init_hw(priv);
476+
477+
gpiochip_set_chained_irqchip(&priv->chip, &mrfld_irqchip, pdev->irq,
478+
mrfld_irq_handler);
479+
487480
return 0;
488481
}
489482

tools/gpio/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ include ../scripts/Makefile.include
33

44
bindir ?= /usr/bin
55

6-
ifeq ($(srctree),)
6+
# This will work when gpio is built in tools env. where srctree
7+
# isn't set and when invoked from selftests build, where srctree
8+
# is set to ".". building_out_of_srctree is undefined for in srctree
9+
# builds
10+
ifndef building_out_of_srctree
711
srctree := $(patsubst %/,%,$(dir $(CURDIR)))
812
srctree := $(patsubst %/,%,$(dir $(srctree)))
913
endif

0 commit comments

Comments
 (0)