locomo.c: make irq register access typesafe
Subsystems (3)
PATCH 1/1 locomo.c: make irq register access typesafe
In locomo_setup_irq a void __iomem * is stored by set_irq_chip_data to hold the base address for the irq registers. Unfortunately chip_data is a void *. This will cause a number of (different address space) sparse warnings.
Create a new struct to hold the void __iomem * and use a static variable of that type to use as the chip_data.
---
I have no way of actually testing this patch. If someone could test this I would appreciate it.
arch/arm/common/locomo.c +71 -30
@@ -166,10 +166,17 @@ static struct locomo_dev_info locomo_devices[] = {#define LOCOMO_IRQ_LT_START (IRQ_LOCOMO_LT)#define LOCOMO_IRQ_SPI_START (IRQ_LOCOMO_SPI_RFR) +struct locomo_irq_chip_data { +void __iomem *mapbase; +}; + +static struct locomo_irq_chip_data locomo_irq_chip; +static void locomo_handler (unsigned int irq,struct irq_desc *desc) { +struct locomo_irq_chip_data *chip =get_irq_chip_data (irq); +void __iomem *mapbase = chip->mapbase;int req, i; -void __iomem *mapbase =get_irq_chip_data (irq);/* Acknowledge the parent IRQ */ desc->chip->ack (irq);
@@ -195,8 +202,10 @@ static void locomo_ack_irq(unsigned int irq)static void locomo_mask_irq (unsigned int irq) { -void __iomem *mapbase =get_irq_chip_data (irq); +struct locomo_irq_chip_data *chip =get_irq_chip_data (irq); +void __iomem *mapbase = chip->mapbase;unsigned int r; + r =locomo_readl (mapbase +LOCOMO_ICR ); r &= ~(0x0010 << (irq -LOCOMO_IRQ_START ));locomo_writel (r, mapbase +LOCOMO_ICR );
@@ -204,8 +213,10 @@ static void locomo_mask_irq(unsigned int irq)static void locomo_unmask_irq (unsigned int irq) { -void __iomem *mapbase =get_irq_chip_data (irq); +struct locomo_irq_chip_data *chip =get_irq_chip_data (irq); +void __iomem *mapbase = chip->mapbase;unsigned int r; + r =locomo_readl (mapbase +LOCOMO_ICR ); r |= (0x0010 << (irq -LOCOMO_IRQ_START ));locomo_writel (r, mapbase +LOCOMO_ICR );
@@ -220,7 +231,8 @@ static struct irq_chip locomo_chip = {static void locomo_key_handler (unsigned int irq,struct irq_desc *desc) { -void __iomem *mapbase =get_irq_chip_data (irq); +struct locomo_irq_chip_data *chip =get_irq_chip_data (irq); +void __iomem *mapbase = chip->mapbase;if (locomo_readl (mapbase +LOCOMO_KEYBOARD +LOCOMO_KIC ) &0x0001 ) {generic_handle_irq (LOCOMO_IRQ_KEY_START );
@@ -229,8 +241,10 @@ static void locomo_key_handler(unsigned int irq, struct irq_desc *desc)static void locomo_key_ack_irq (unsigned int irq) { -void __iomem *mapbase =get_irq_chip_data (irq); +struct locomo_irq_chip_data *chip =get_irq_chip_data (irq); +void __iomem *mapbase = chip->mapbase;unsigned int r; + r =locomo_readl (mapbase +LOCOMO_KEYBOARD +LOCOMO_KIC ); r &= ~(0x0100 << (irq -LOCOMO_IRQ_KEY_START ));locomo_writel (r, mapbase +LOCOMO_KEYBOARD +LOCOMO_KIC );
@@ -238,8 +252,10 @@ static void locomo_key_ack_irq(unsigned int irq)static void locomo_key_mask_irq (unsigned int irq) { -void __iomem *mapbase =get_irq_chip_data (irq); +struct locomo_irq_chip_data *chip =get_irq_chip_data (irq); +void __iomem *mapbase = chip->mapbase;unsigned int r; + r =locomo_readl (mapbase +LOCOMO_KEYBOARD +LOCOMO_KIC ); r &= ~(0x0010 << (irq -LOCOMO_IRQ_KEY_START ));locomo_writel (r, mapbase +LOCOMO_KEYBOARD +LOCOMO_KIC );
@@ -247,8 +263,10 @@ static void locomo_key_mask_irq(unsigned int irq)static void locomo_key_unmask_irq (unsigned int irq) { -void __iomem *mapbase =get_irq_chip_data (irq); +struct locomo_irq_chip_data *chip =get_irq_chip_data (irq); +void __iomem *mapbase = chip->mapbase;unsigned int r; + r =locomo_readl (mapbase +LOCOMO_KEYBOARD +LOCOMO_KIC ); r |= (0x0010 << (irq -LOCOMO_IRQ_KEY_START ));locomo_writel (r, mapbase +LOCOMO_KEYBOARD +LOCOMO_KIC );
@@ -263,8 +281,9 @@ static struct irq_chip locomo_key_chip = {static void locomo_gpio_handler (unsigned int irq,struct irq_desc *desc) { +struct locomo_irq_chip_data *chip =get_irq_chip_data (irq); +void __iomem *mapbase = chip->mapbase;int req, i; -void __iomem *mapbase =get_irq_chip_data (irq); req =locomo_readl (mapbase +LOCOMO_GIR ) & locomo_readl(mapbase + LOCOMO_GPD) &
@@ -282,8 +301,10 @@ static void locomo_gpio_handler(unsigned int irq, struct irq_desc *desc)static void locomo_gpio_ack_irq (unsigned int irq) { -void __iomem *mapbase =get_irq_chip_data (irq); +struct locomo_irq_chip_data *chip =get_irq_chip_data (irq); +void __iomem *mapbase = chip->mapbase;unsigned int r; + r =locomo_readl (mapbase +LOCOMO_GWE ); r |= (0x0001 << (irq -LOCOMO_IRQ_GPIO_START ));locomo_writel (r, mapbase +LOCOMO_GWE );
@@ -299,8 +320,10 @@ static void locomo_gpio_ack_irq(unsigned int irq)static void locomo_gpio_mask_irq (unsigned int irq) { -void __iomem *mapbase =get_irq_chip_data (irq); +struct locomo_irq_chip_data *chip =get_irq_chip_data (irq); +void __iomem *mapbase = chip->mapbase;unsigned int r; + r =locomo_readl (mapbase +LOCOMO_GIE ); r &= ~(0x0001 << (irq -LOCOMO_IRQ_GPIO_START ));locomo_writel (r, mapbase +LOCOMO_GIE );
@@ -308,8 +331,10 @@ static void locomo_gpio_mask_irq(unsigned int irq)static void locomo_gpio_unmask_irq (unsigned int irq) { -void __iomem *mapbase =get_irq_chip_data (irq); +struct locomo_irq_chip_data *chip =get_irq_chip_data (irq); +void __iomem *mapbase = chip->mapbase;unsigned int r; + r =locomo_readl (mapbase +LOCOMO_GIE ); r |= (0x0001 << (irq -LOCOMO_IRQ_GPIO_START ));locomo_writel (r, mapbase +LOCOMO_GIE );
@@ -320,8 +345,9 @@ static int GPIO_IRQ_falling_edge;static int locomo_gpio_type (unsigned int irq,unsigned int type) { +struct locomo_irq_chip_data *chip =get_irq_chip_data (irq); +void __iomem *mapbase = chip->mapbase;unsigned int mask; -void __iomem *mapbase =get_irq_chip_data (irq); mask =1 << (irq -LOCOMO_IRQ_GPIO_START );
@@ -355,7 +381,8 @@ static struct irq_chip locomo_gpio_chip = {static void locomo_lt_handler (unsigned int irq,struct irq_desc *desc) { -void __iomem *mapbase =get_irq_chip_data (irq); +struct locomo_irq_chip_data *chip =get_irq_chip_data (irq); +void __iomem *mapbase = chip->mapbase;if (locomo_readl (mapbase +LOCOMO_LTINT ) &0x0001 ) {generic_handle_irq (LOCOMO_IRQ_LT_START );
@@ -364,8 +391,10 @@ static void locomo_lt_handler(unsigned int irq, struct irq_desc *desc)static void locomo_lt_ack_irq (unsigned int irq) { -void __iomem *mapbase =get_irq_chip_data (irq); +struct locomo_irq_chip_data *chip =get_irq_chip_data (irq); +void __iomem *mapbase = chip->mapbase;unsigned int r; + r =locomo_readl (mapbase +LOCOMO_LTINT ); r &= ~(0x0100 << (irq -LOCOMO_IRQ_LT_START ));locomo_writel (r, mapbase +LOCOMO_LTINT );
@@ -373,8 +402,10 @@ static void locomo_lt_ack_irq(unsigned int irq)static void locomo_lt_mask_irq (unsigned int irq) { -void __iomem *mapbase =get_irq_chip_data (irq); +struct locomo_irq_chip_data *chip =get_irq_chip_data (irq); +void __iomem *mapbase = chip->mapbase;unsigned int r; + r =locomo_readl (mapbase +LOCOMO_LTINT ); r &= ~(0x0010 << (irq -LOCOMO_IRQ_LT_START ));locomo_writel (r, mapbase +LOCOMO_LTINT );
@@ -382,8 +413,10 @@ static void locomo_lt_mask_irq(unsigned int irq)static void locomo_lt_unmask_irq (unsigned int irq) { -void __iomem *mapbase =get_irq_chip_data (irq); +struct locomo_irq_chip_data *chip =get_irq_chip_data (irq); +void __iomem *mapbase = chip->mapbase;unsigned int r; + r =locomo_readl (mapbase +LOCOMO_LTINT ); r |= (0x0010 << (irq -LOCOMO_IRQ_LT_START ));locomo_writel (r, mapbase +LOCOMO_LTINT );
@@ -398,8 +431,9 @@ static struct irq_chip locomo_lt_chip = {static void locomo_spi_handler (unsigned int irq,struct irq_desc *desc) { +struct locomo_irq_chip_data *chip =get_irq_chip_data (irq); +void __iomem *mapbase = chip->mapbase;int req, i; -void __iomem *mapbase =get_irq_chip_data (irq); req =locomo_readl (mapbase +LOCOMO_SPI +LOCOMO_SPIIR ) &0x000F ;if (req) {
@@ -415,8 +449,10 @@ static void locomo_spi_handler(unsigned int irq, struct irq_desc *desc)static void locomo_spi_ack_irq (unsigned int irq) { -void __iomem *mapbase =get_irq_chip_data (irq); +struct locomo_irq_chip_data *chip =get_irq_chip_data (irq); +void __iomem *mapbase = chip->mapbase;unsigned int r; + r =locomo_readl (mapbase +LOCOMO_SPI +LOCOMO_SPIWE ); r |= (0x0001 << (irq -LOCOMO_IRQ_SPI_START ));locomo_writel (r, mapbase +LOCOMO_SPI +LOCOMO_SPIWE );
@@ -432,8 +468,10 @@ static void locomo_spi_ack_irq(unsigned int irq)static void locomo_spi_mask_irq (unsigned int irq) { -void __iomem *mapbase =get_irq_chip_data (irq); +struct locomo_irq_chip_data *chip =get_irq_chip_data (irq); +void __iomem *mapbase = chip->mapbase;unsigned int r; + r =locomo_readl (mapbase +LOCOMO_SPI +LOCOMO_SPIIE ); r &= ~(0x0001 << (irq -LOCOMO_IRQ_SPI_START ));locomo_writel (r, mapbase +LOCOMO_SPI +LOCOMO_SPIIE );
@@ -441,8 +479,10 @@ static void locomo_spi_mask_irq(unsigned int irq)static void locomo_spi_unmask_irq (unsigned int irq) { -void __iomem *mapbase =get_irq_chip_data (irq); +struct locomo_irq_chip_data *chip =get_irq_chip_data (irq); +void __iomem *mapbase = chip->mapbase;unsigned int r; + r =locomo_readl (mapbase +LOCOMO_SPI +LOCOMO_SPIIE ); r |= (0x0001 << (irq -LOCOMO_IRQ_SPI_START ));locomo_writel (r, mapbase +LOCOMO_SPI +LOCOMO_SPIIE );
@@ -458,56 +498,57 @@ static struct irq_chip locomo_spi_chip = {static void locomo_setup_irq (struct locomo *lchip) {int irq; -void __iomem *irqbase = lchip->base; + + locomo_irq_chip->mapbase = lchip->base;/* * Install handler for IRQ_LOCOMO_HW. */ set_irq_type (lchip->irq,IRQ_TYPE_EDGE_FALLING ); -set_irq_chip_data (lchip->irq, irqbase); +set_irq_chip_data (lchip->irq, &locomo_irq_chip);set_irq_chained_handler (lchip->irq, locomo_handler);/* Install handlers for IRQ_LOCOMO_*_BASE */ set_irq_chip (IRQ_LOCOMO_KEY_BASE , &locomo_chip); -set_irq_chip_data (IRQ_LOCOMO_KEY_BASE , irqbase); +set_irq_chip_data (IRQ_LOCOMO_KEY_BASE , &locomo_irq_chip);set_irq_chained_handler (IRQ_LOCOMO_KEY_BASE , locomo_key_handler);set_irq_chip (IRQ_LOCOMO_GPIO_BASE , &locomo_chip); -set_irq_chip_data (IRQ_LOCOMO_GPIO_BASE , irqbase); +set_irq_chip_data (IRQ_LOCOMO_GPIO_BASE , &locomo_irq_chip);set_irq_chained_handler (IRQ_LOCOMO_GPIO_BASE , locomo_gpio_handler);set_irq_chip (IRQ_LOCOMO_LT_BASE , &locomo_chip); -set_irq_chip_data (IRQ_LOCOMO_LT_BASE , irqbase); +set_irq_chip_data (IRQ_LOCOMO_LT_BASE , &locomo_irq_chip);set_irq_chained_handler (IRQ_LOCOMO_LT_BASE , locomo_lt_handler);set_irq_chip (IRQ_LOCOMO_SPI_BASE , &locomo_chip); -set_irq_chip_data (IRQ_LOCOMO_SPI_BASE , irqbase); +set_irq_chip_data (IRQ_LOCOMO_SPI_BASE , &locomo_irq_chip);set_irq_chained_handler (IRQ_LOCOMO_SPI_BASE , locomo_spi_handler);/* install handlers for IRQ_LOCOMO_KEY_BASE generated interrupts */ set_irq_chip (LOCOMO_IRQ_KEY_START , &locomo_key_chip); -set_irq_chip_data (LOCOMO_IRQ_KEY_START , irqbase); +set_irq_chip_data (LOCOMO_IRQ_KEY_START , &locomo_irq_chip);set_irq_handler (LOCOMO_IRQ_KEY_START , handle_edge_irq);set_irq_flags (LOCOMO_IRQ_KEY_START ,IRQF_VALID |IRQF_PROBE );/* install handlers for IRQ_LOCOMO_GPIO_BASE generated interrupts */ for (irq =LOCOMO_IRQ_GPIO_START ; irq <LOCOMO_IRQ_GPIO_START +16 ; irq++) {set_irq_chip (irq, &locomo_gpio_chip); -set_irq_chip_data (irq, irqbase); +set_irq_chip_data (irq, &locomo_irq_chip);set_irq_handler (irq, handle_edge_irq);set_irq_flags (irq,IRQF_VALID |IRQF_PROBE ); }/* install handlers for IRQ_LOCOMO_LT_BASE generated interrupts */ set_irq_chip (LOCOMO_IRQ_LT_START , &locomo_lt_chip); -set_irq_chip_data (LOCOMO_IRQ_LT_START , irqbase); +set_irq_chip_data (LOCOMO_IRQ_LT_START , &locomo_irq_chip);set_irq_handler (LOCOMO_IRQ_LT_START , handle_edge_irq);set_irq_flags (LOCOMO_IRQ_LT_START ,IRQF_VALID |IRQF_PROBE );/* install handlers for IRQ_LOCOMO_SPI_BASE generated interrupts */ for (irq =LOCOMO_IRQ_SPI_START ; irq <LOCOMO_IRQ_SPI_START +4 ; irq++) {set_irq_chip (irq, &locomo_spi_chip); -set_irq_chip_data (irq, irqbase); +set_irq_chip_data (irq, &locomo_irq_chip);set_irq_handler (irq, handle_edge_irq);set_irq_flags (irq,IRQF_VALID |IRQF_PROBE ); }
PATCH 1/1 locomo.c: make irq register access typesafe
Quoted 5 lines · H Hartley Sweeten
In
locomo_setup_irqa void__iomem* is stored byset_irq_chip_datato hold the base address for the irq registers. ?Unfortunatelychip_datais a void *. This will cause a number of (different address space) sparse warnings.
That's actually been fixed as a side effect in my previous proposed irq cleanup patches. The way is to pass locomo chip as the data instead of a raw pointer. Please let me know how you think, the specific patch follows:
commit a53c2b1a0b2641ad9403a0e3e990e885fa56ded2
Author: Eric Miao <[email protected]> Date: Fri Dec 25 23:01:39 2009 +0800
[ARM] locomo: allow cascaded IRQ base to be specified by platforms
arch/arm/common/locomo.c +23 -19
@@ -32,6 +32,12 @@#include <asm/hardware/locomo.h> +/* LoCoMo Interrupts */ +#define IRQ_LOCOMO_KEY (0) +#define IRQ_LOCOMO_GPIO (1) +#define IRQ_LOCOMO_LT (2) +#define IRQ_LOCOMO_SPI (3) +/* M62332 output channel selection */ #define M62332_EVR_CH 1/* M62332 volume channel number */ /* 0 : CH.1 , 1 : CH. 2 */
@@ -58,6 +64,7 @@ struct locomo {struct device *dev;unsigned long phys;unsigned int irq; +int irq_base;spinlock_t lock;void __iomem *base;#ifdef CONFIG_PM
@@ -81,9 +88,7 @@ struct locomo_dev_info {static struct locomo_dev_info locomo_devices[] = { { .devid =LOCOMO_DEVID_KEYBOARD , - .irq = { -IRQ_LOCOMO_KEY , - }, + .irq = {IRQ_LOCOMO_KEY }, .name ="locomo-keyboard" , .offset =LOCOMO_KEYBOARD , .length =16 ,
@@ -135,18 +140,18 @@ static struct locomo_dev_info locomo_devices[] = {static void locomo_handler (unsigned int irq,struct irq_desc *desc) { +struct locomo *lchip =get_irq_chip_data (irq);int req, i; -void __iomem *mapbase =get_irq_chip_data (irq);/* Acknowledge the parent IRQ */ desc->chip->ack (irq);/* check why this interrupt was generated */ - req =locomo_readl (mapbase +LOCOMO_ICR ) &0x0f00 ; + req =locomo_readl (lchip->base +LOCOMO_ICR ) &0x0f00 ;if (req) {/* generate the next interrupt(s) */ - irq =IRQ_LOCOMO_KEY ; + irq = lchip->irq_base;for (i =0 ; i <=3 ; i++, irq++) {if (req & (0x0100 << i)) {generic_handle_irq (irq);
@@ -162,20 +167,20 @@ static void locomo_ack_irq(unsigned int irq)static void locomo_mask_irq (unsigned int irq) { -void __iomem *mapbase =get_irq_chip_data (irq); +struct locomo *lchip =get_irq_chip_data (irq);unsigned int r; - r =locomo_readl (mapbase +LOCOMO_ICR ); - r &= ~(0x0010 << (irq -IRQ_LOCOMO_KEY )); -locomo_writel (r, mapbase +LOCOMO_ICR ); + r =locomo_readl (lchip->base +LOCOMO_ICR ); + r &= ~(0x0010 << (irq - lchip->irq_base)); +locomo_writel (r, lchip->base +LOCOMO_ICR ); }static void locomo_unmask_irq (unsigned int irq) { -void __iomem *mapbase =get_irq_chip_data (irq); +struct locomo *lchip =get_irq_chip_data (irq);unsigned int r; - r =locomo_readl (mapbase +LOCOMO_ICR ); - r |= (0x0010 << (irq -IRQ_LOCOMO_KEY )); -locomo_writel (r, mapbase +LOCOMO_ICR ); + r =locomo_readl (lchip->base +LOCOMO_ICR ); + r |= (0x0010 << (irq - lchip->irq_base)); +locomo_writel (r, lchip->base +LOCOMO_ICR ); }static struct irq_chip locomo_chip = {
@@ -187,20 +192,19 @@ static struct irq_chip locomo_chip = {static void locomo_setup_irq (struct locomo *lchip) { -int irq; -void __iomem *irqbase = lchip->base; +int irq = lchip->irq_base;/* * Install handler for IRQ_LOCOMO_HW. */ set_irq_type (lchip->irq,IRQ_TYPE_EDGE_FALLING ); -set_irq_chip_data (lchip->irq, irqbase); +set_irq_chip_data (lchip->irq, lchip);set_irq_chained_handler (lchip->irq, locomo_handler);/* Install handlers for IRQ_LOCOMO_* */ -for (irq =IRQ_LOCOMO_KEY ; irq <=IRQ_LOCOMO_SPI ; irq++) { +for ( ; irq <= lchip->irq_base +3 ; irq++) {set_irq_chip (irq, &locomo_chip); -set_irq_chip_data (irq, irqbase); +set_irq_chip_data (irq, lchip);set_irq_handler (irq, handle_level_irq);set_irq_flags (irq,IRQF_VALID |IRQF_PROBE ); }
@@ -247,7 +251,8 @@ locomo_init_one_child(struct locomo *lchip, struct
locomo_dev_info *info)
dev->mapbase = 0;
dev->length = info->length;
- memmove(dev->irq, info->irq, sizeof(dev->irq));
+ dev->irq[0] = (lchip->irq_base == NO_IRQ) ?
+ NO_IRQ : lchip->irq_base + info->irq[0];
ret = device_register(&dev->dev);
if (ret) {
@@ -364,6 +369,7 @@ static int locomo_resume(struct platform_device *dev)
static int
__locomo_probe(struct device *me, struct resource *mem, int irq) {
+ struct locomo_platform_data *pdata = me->platform_data;
struct locomo *lchip;
unsigned long r;
int i, ret = -ENODEV;
@@ -379,6 +385,7 @@ __locomo_probe(struct device *me, struct resource *mem, int irq)
lchip->phys = mem->start;
lchip->irq = irq;
+ lchip->irq_base = (pdata) ? pdata->irq_base : NO_IRQ;
/*
* Map the whole region. This also maps the
@@ -445,7 +452,7 @@ __locomo_probe(struct device *me, struct resource *mem, int irq)
* The interrupt controller must be initialised before any
* other device to ensure that the interrupts are available. */
- if (lchip->irq != NO_IRQ)
+ if (lchip->irq != NO_IRQ && lchip->irq_base != NO_IRQ)
locomo_setup_irq(lchip);
for (i = 0; i < ARRAY_SIZE(locomo_devices); i++)
(quoted diff) +0 -0
b/arch/arm/include/asm/hardware/locomo.h
index 954b1be..74e51d6 100644
arch/arm/include/asm/hardware/locomo.h +0 -0
@@ -214,4 +214,8 @@ void locomo_m62332_senddata(struct locomo_dev
*ldev, unsigned int dac_data, int
/* Frontlight control */
void locomo_frontlight_set(struct locomo_dev *dev, int duty, int vr, int bpwf);
+struct locomo_platform_data {
+ int irq_base; /* IRQ base for cascaded on-chip IRQs */
+};
+
#endif
(quoted diff) +0 -0
b/arch/arm/mach-pxa/include/mach/irqs.h
index 56a2c61..83b14f1 100644
arch/arm/mach-pxa/include/mach/irqs.h +0 -6
@@ -247,12 +247,6 @@#define BALLOON3_CODEC_IRQ IRQ_GPIO(BALLOON3_GPIO_CODEC_IRQ)#define BALLOON3_S0_CD_IRQ IRQ_GPIO(BALLOON3_GPIO_S0_CD) -/* LoCoMo Interrupts (CONFIG_SHARP_LOCOMO) */ -#define IRQ_LOCOMO_KEY (IRQ_BOARD_START + 0) -#define IRQ_LOCOMO_GPIO (IRQ_BOARD_START + 1) -#define IRQ_LOCOMO_LT (IRQ_BOARD_START + 2) -#define IRQ_LOCOMO_SPI (IRQ_BOARD_START + 3) -/* phyCORE-PXA270 (PCM027) Interrupts */ #define PCM027_IRQ (x) (IRQ_BOARD_START + (x))#define PCM027_BTDET_IRQ PCM027_IRQ(0)
arch/arm/mach-pxa/poodle.c +7 -0
@@ -193,11 +193,18 @@ static struct resource locomo_resources[] = { }, }; +static struct locomo_platform_data locomo_info = { + .irq_base =IRQ_BOARD_START , +}; +struct platform_device poodle_locomo_device = { .name ="locomo" , .id =0 , .num_resources =ARRAY_SIZE (locomo_resources), .resource = locomo_resources, + .dev = { + .platform_data = &locomo_info, + }, };EXPORT_SYMBOL (poodle_locomo_device);
arch/arm/mach-sa1100/collie.c +4 -0
@@ -234,6 +234,10 @@ static struct resource locomo_resources[] = { }, }; +static struct locomo_platform_data locomo_info = { + .irq_base =IRQ_BOARD_START , +}; +struct platform_device collie_locomo_device = { .name ="locomo" , .id =0 ,
(quoted diff) +0 -0
b/arch/arm/mach-sa1100/include/mach/irqs.h
index a8dc68e..bc67722 100644
arch/arm/mach-sa1100/include/mach/irqs.h +2 -9
@@ -124,13 +124,13 @@* Figure out the MAX IRQ number. * * If we have an SA1111, the max IRQ is S1_BVD1_STSCHG+1. -* If we have an LoCoMo, the max IRQ is IRQ_LOCOMO_SPI_TEND+1 +* If we have an LoCoMo, the max IRQ is IRQ_BOARD_START + 4 * Otherwise, we have the standard IRQs only. */ #ifdef CONFIG_SA1111 #define NR_IRQS (IRQ_S1_BVD1_STSCHG + 1)#elif CONFIG_SHARPSL_LOCOMO -#define NR_IRQS (IRQ_LOCOMO_SPI + 1) +#define NR_IRQS (IRQ_BOARD_START + 4)#else #define NR_IRQS (IRQ_BOARD_START)#endif
@@ -142,10 +142,3 @@#define IRQ_NEPONSET_SMC9196 (IRQ_BOARD_START + 0)#define IRQ_NEPONSET_USAR (IRQ_BOARD_START + 1)#define IRQ_NEPONSET_SA1111 (IRQ_BOARD_START + 2) - -/* LoCoMo Interrupts (CONFIG_SHARP_LOCOMO) */ -#define IRQ_LOCOMO_KEY (IRQ_BOARD_START + 0) -#define IRQ_LOCOMO_GPIO (IRQ_BOARD_START + 1) -#define IRQ_LOCOMO_LT (IRQ_BOARD_START + 2) -#define IRQ_LOCOMO_SPI (IRQ_BOARD_START + 3) -
PATCH 1/1 locomo.c: make irq register access typesafe
Quoted 8 lines · Eric Miao
Quoted 5 lines · H Hartley Sweeten
In
locomo_setup_irqa void__iomem* is stored byset_irq_chip_datato hold the base address for the irq registers. ?Unfortunatelychip_datais a void *. This will cause a number of (different address space) sparse warnings.
Quoted 4 lines
That's actually been fixed as a side effect in my previous proposed irq cleanup patches. The way is to pass locomo chip as the data instead of a raw pointer. Please let me know how you think, the specific patch follows:
There must be some other patches to locomo.c that remove the locomo_key_*, locomo_gpio_*, locomo_lt_*, and locomo_spi_* related stuff. Were all of them merged into common code? Where can I find a reference to the original patches?
Other than that it looks good to me. Please ignore my patch.
Regards,
Hartley
PATCH 1/1 locomo.c: make irq register access typesafe
Quoted 14 lines · H Hartley Sweeten
Quoted 8 lines · Eric Miao
Quoted 5 lines · H Hartley Sweeten
In
locomo_setup_irqa void__iomem* is stored byset_irq_chip_datato hold the base address for the irq registers. ?Unfortunatelychip_datais a void *. This will cause a number of (different address space) sparse warnings.Quoted 4 lines
That's actually been fixed as a side effect in my previous proposed irq cleanup patches. The way is to pass locomo chip as the data instead of a raw pointer. Please let me know how you think, the specific patch follows:
Quoted 5 lines
There must be some other patches to
locomo.cthat remove the locomo_key_*, locomo_gpio_*, locomo_lt_*, and locomo_spi_* related stuff. ?Were all of them merged into common code? ?Where can I find a reference to the original patches?
Cannot find the reference atm but they were posted weeks ago.
Quoted 1 line
Other than that it looks good to me.
Thanks.
PATCH 1/1 locomo.c: make irq register access typesafe
Quoted 16 lines · Eric Miao
Quoted 14 lines · H Hartley Sweeten
Quoted 12 lines · Eric Miao
Quoted 5 lines · H Hartley Sweeten
In
locomo_setup_irqa void__iomem* is stored byset_irq_chip_datato hold the base address for the irq registers. ?Unfortunatelychip_datais a void *. This will cause a number of (different address space) sparse warnings.That's actually been fixed as a side effect in my previous proposed irq cleanup patches. The way is to pass locomo chip as the data instead of a raw pointer. Please let me know how you think, the specific patch follows:
Quoted 7 lines
Quoted 5 lines
There must be some other patches to
locomo.cthat remove the locomo_key_*, locomo_gpio_*, locomo_lt_*, and locomo_spi_* related stuff. ?Were all of them merged into common code? ?Where can I find a reference to the original patches?Cannot find the reference atm but they were posted weeks ago.
Located them at:
http://lists.infradead.org/pipermail/linux-arm-kernel/2009-December/thread.html
I'll try to take a good look at them tomorrow and give you any feedback I have.
Quoted 3 lines
Quoted 1 line
Other than that it looks good to me.
Thanks.
Regards,
Hartley
PATCH 1/1 locomo.c: make irq register access typesafe
Quoted 23 lines · H Hartley Sweeten
Quoted 22 lines · Eric Miao
Quoted 19 lines · H Hartley Sweeten
Quoted 8 lines · Eric Miao
Quoted 5 lines · H Hartley Sweeten
In
locomo_setup_irqa void__iomem* is stored byset_irq_chip_datato hold the base address for the irq registers. ?Unfortunatelychip_datais a void *. This will cause a number of (different address space) sparse warnings.Quoted 4 lines
That's actually been fixed as a side effect in my previous proposed irq cleanup patches. The way is to pass locomo chip as the data instead of a raw pointer. Please let me know how you think, the specific patch follows:
There must be some other patches to
locomo.cthat remove the locomo_key_*, locomo_gpio_*, locomo_lt_*, and locomo_spi_* related stuff. ?Were all of them merged into common code? ?Where can I find a reference to the original patches?
Quoted 12 lines
Quoted 1 line
Cannot find the reference atm but they were posted weeks ago.
Located them at:
http://lists.infradead.org/pipermail/linux-arm-kernel/2009-December/thread.html
I'll try to take a good look at them tomorrow and give you any feedback I have.
Quoted 3 lines
Quoted 1 line
Other than that it looks good to me.
Thanks.
Eric,
Did your locomo irq cleanup patches get lost somewhere? I see three pending patches in linux-next but they did not show up in Linus' tree during the merge window.
commit da8065ac3ea29d1bfdb5a163be346fbe35066f8d [ARM] locomo: avoid unnecessary cascaded keyboard IRQ
commit 00dd8027b913088ff9b656c5aaa6336c303b7f26 [ARM] locomo: remove unused IRQs and avoid unnecessary cascade
commit ac609d266e4af4ebf586d610bd76e04dddae0c4c
[ARM] locomo: allow cascaded IRQ base to be specified by platforms
Regards,
Hartley
PATCH 1/1 locomo.c: make irq register access typesafe
Quoted 3 lines · H Hartley Sweeten
Did your locomo irq cleanup patches get lost somewhere? I see three pending patches in linux-next but they did not show up in Linus' tree during the merge window.
*All* the trees which I merged into mine have not made it into mainline - Linus seems to have released -rc1 two days early.
I'm currently uncertain what this means - whether all this work is going to have to wait for the next merge window.
If it is going to have to wait, there's a lesson in there for not sending me headache inducing git tree pull requests *after* the merge window has opened.
PATCH 1/1 locomo.c: make irq register access typesafe
Quoted 8 lines · Russell King
Quoted 3 lines · H Hartley Sweeten
Did your locomo irq cleanup patches get lost somewhere? I see three pending patches in linux-next but they did not show up in Linus' tree during the merge window.
*All* the trees which I merged into mine have not made it into mainline - Linus seems to have released -rc1 two days early.
Quoted 6 lines
I'm currently uncertain what this means - whether all this work is going to have to wait for the next merge window.
If it is going to have to wait, there's a lesson in there for not sending me headache inducing git tree pull requests *after* the merge window has opened.
Russell,
Thanks for the heads up. And, thanks for all your help as the maintainer. If it has to wait, it has to wait...
Regards,
Hartley