[PATCH 1/2] glamo-core: remove unused enum

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH 1/2] glamo-core: remove unused enum

Thibaut Girka
---
 drivers/mfd/glamo-core.c |   12 +++---------
 1 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/mfd/glamo-core.c b/drivers/mfd/glamo-core.c
index 135856a..b90146a 100644
--- a/drivers/mfd/glamo-core.c
+++ b/drivers/mfd/glamo-core.c
@@ -246,24 +246,18 @@ static struct resource glamo_mmc_resources[] = {
  },
 };
 
-enum glamo_cells {
- GLAMO_CELL_FB,
- GLAMO_CELL_MMC,
- GLAMO_CELL_GPIO,
-};
-
 static const struct mfd_cell glamo_cells[] = {
- [GLAMO_CELL_FB] = {
+ {
  .name = "glamo-fb",
  .num_resources = ARRAY_SIZE(glamo_fb_resources),
  .resources = glamo_fb_resources,
  },
- [GLAMO_CELL_MMC] = {
+ {
  .name = "glamo-mci",
  .num_resources = ARRAY_SIZE(glamo_mmc_resources),
  .resources = glamo_mmc_resources,
  },
- [GLAMO_CELL_GPIO] = {
+ {
  .name = "glamo-gpio",
  },
 };
--
1.7.1


Reply | Threaded
Open this post in threaded view
|

[PATCH 2/2] glamo-core: use a standard irq handler for irq demultiplexing

Thibaut Girka
Use a standard irq handler for irq demultiplexing instead of a chained handler.
Remove reimplementation of handle_level_irq and simplifies code.
---
 drivers/mfd/glamo-core.c |   59 +++++++++++++--------------------------------
 1 files changed, 17 insertions(+), 42 deletions(-)

diff --git a/drivers/mfd/glamo-core.c b/drivers/mfd/glamo-core.c
index b90146a..48f56fa 100644
--- a/drivers/mfd/glamo-core.c
+++ b/drivers/mfd/glamo-core.c
@@ -302,46 +302,18 @@ static struct irq_chip glamo_irq_chip = {
  .unmask = glamo_unmask_irq,
 };
 
-static void glamo_irq_demux_handler(unsigned int irq, struct irq_desc *desc)
+static irqreturn_t glamo_irq_demux_handler(int irq, void *data)
 {
- struct glamo_core *glamo = get_irq_desc_data(desc);
- desc->status &= ~(IRQ_REPLAY | IRQ_WAITING);
-
- if (unlikely(desc->status & IRQ_INPROGRESS)) {
- desc->status |= (IRQ_PENDING | IRQ_MASKED);
- desc->chip->mask(irq);
- desc->chip->ack(irq);
- return;
+ struct glamo_core *glamo = data;
+ uint16_t irqstatus;
+ int i;
+ /* read IRQ status register */
+ irqstatus = __reg_read(glamo, GLAMO_REG_IRQ_STATUS);
+ for (i = 0; i < 9; ++i) {
+ if (irqstatus & BIT(i))
+ generic_handle_irq(glamo->irq_base + i);
  }
- kstat_incr_irqs_this_cpu(irq, desc);
-
- desc->chip->ack(irq);
- desc->status |= IRQ_INPROGRESS;
-
- do {
- uint16_t irqstatus;
- int i;
-
- if (unlikely((desc->status &
- (IRQ_PENDING | IRQ_MASKED | IRQ_DISABLED)) ==
- (IRQ_PENDING | IRQ_MASKED))) {
- /* dealing with pending IRQ, unmasking */
- desc->chip->unmask(irq);
- desc->status &= ~IRQ_MASKED;
- }
-
- desc->status &= ~IRQ_PENDING;
-
- /* read IRQ status register */
- irqstatus = __reg_read(glamo, GLAMO_REG_IRQ_STATUS);
- for (i = 0; i < 9; ++i) {
- if (irqstatus & BIT(i))
- generic_handle_irq(glamo->irq_base + i);
- }
-
- } while ((desc->status & (IRQ_PENDING | IRQ_DISABLED)) == IRQ_PENDING);
-
- desc->status &= ~IRQ_INPROGRESS;
+ return IRQ_HANDLED;
 }
 
 /*
@@ -985,10 +957,6 @@ static int __devinit glamo_probe(struct platform_device *pdev)
  handle_level_irq);
  }
 
- set_irq_type(glamo->irq, IRQ_TYPE_EDGE_FALLING);
- set_irq_data(glamo->irq, glamo);
- set_irq_chained_handler(glamo->irq, glamo_irq_demux_handler);
-
  ret = mfd_add_devices(&pdev->dev, pdev->id, glamo_cells,
  ARRAY_SIZE(glamo_cells), mem, glamo->irq_base);
 
@@ -997,6 +965,13 @@ static int __devinit glamo_probe(struct platform_device *pdev)
  goto err_free_irqs;
  }
 
+ ret = request_irq(glamo->irq, glamo_irq_demux_handler, 0,
+  "glamo-core", glamo);
+ if (ret) {
+ dev_err(&pdev->dev, "Failed to grab irq%d: %d\n", glamo->irq, ret);
+ goto err_free_irqs;
+ }
+
  dev_info(&glamo->pdev->dev, "Glamo core PLL1: %uHz, PLL2: %uHz\n",
  glamo_pll_rate(glamo, GLAMO_PLL1),
  glamo_pll_rate(glamo, GLAMO_PLL2));
--
1.7.1