Re: [PATCH V3 1/3] gpio: eic-sprd: Make the irqchip immutable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 12/28/2022 8:24 PM, Cixi Geng wrote:
From: Cixi Geng <cixi.geng1@xxxxxxxxxx>

Remove the irq_chip from pmic_eic structure,
use the various calls by defining the statically
irq_chip structure.

Signed-off-by: Cixi Geng <cixi.geng1@xxxxxxxxxx>
---
  drivers/gpio/gpio-eic-sprd.c | 23 ++++++++++++++---------
  1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/drivers/gpio/gpio-eic-sprd.c b/drivers/gpio/gpio-eic-sprd.c
index 8d722e026e9c..86563c0604e8 100644
--- a/drivers/gpio/gpio-eic-sprd.c
+++ b/drivers/gpio/gpio-eic-sprd.c
@@ -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-gpio",

Should be "sprd-eic". Otherwise looks good to me.
Reviewed-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>

+	.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;



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux