diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2014-06-19 17:34:39 -0400 |
---|---|---|
committer | Jason Cooper <jason@lakedaemon.net> | 2014-06-24 08:37:34 -0400 |
commit | c5d1d857482b080875640bb68bc9d8b65ad29b6f (patch) | |
tree | bc8f80dafc298198ffbacc4deb6a5f351114989f /drivers/irqchip/spear-shirq.c | |
parent | f37ecbce8bf8867ce19fe9ef09e789002d7aad15 (diff) |
irqchip: spear_shirq: Namespace cleanup
The struct members of the shirq block struct are named to confuse the
hell out of the casual reader. Clean it up.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20140619212713.219411832@linutronix.de
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'drivers/irqchip/spear-shirq.c')
-rw-r--r-- | drivers/irqchip/spear-shirq.c | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/drivers/irqchip/spear-shirq.c b/drivers/irqchip/spear-shirq.c index 576968efbc4d..f7c25a77845a 100644 --- a/drivers/irqchip/spear-shirq.c +++ b/drivers/irqchip/spear-shirq.c | |||
@@ -47,20 +47,20 @@ struct shirq_regs { | |||
47 | /* | 47 | /* |
48 | * struct spear_shirq: shared irq structure | 48 | * struct spear_shirq: shared irq structure |
49 | * | 49 | * |
50 | * irq_base: base irq in linux domain | 50 | * base: Base register address |
51 | * irq_nr: no. of shared interrupts in a particular block | 51 | * regs: Register configuration for shared irq block |
52 | * irq_bit_off: starting bit offset in the status register | 52 | * virq_base: Base virtual interrupt number |
53 | * invalid_irq: irq group is currently disabled | 53 | * nr_irqs: Number of interrupts handled by this block |
54 | * base: base address of shared irq register | 54 | * offset: Bit offset of the first interrupt |
55 | * regs: register configuration for shared irq block | 55 | * disabled: Group is disabled, but accounted |
56 | */ | 56 | */ |
57 | struct spear_shirq { | 57 | struct spear_shirq { |
58 | u32 irq_base; | 58 | void __iomem *base; |
59 | u32 irq_nr; | 59 | struct shirq_regs regs; |
60 | u32 irq_bit_off; | 60 | u32 virq_base; |
61 | int invalid_irq; | 61 | u32 nr_irqs; |
62 | void __iomem *base; | 62 | u32 offset; |
63 | struct shirq_regs regs; | 63 | bool disabled; |
64 | }; | 64 | }; |
65 | 65 | ||
66 | static DEFINE_SPINLOCK(lock); | 66 | static DEFINE_SPINLOCK(lock); |
@@ -70,8 +70,8 @@ static DEFINE_SPINLOCK(lock); | |||
70 | #define SPEAR300_INT_STS_MASK_REG 0x58 | 70 | #define SPEAR300_INT_STS_MASK_REG 0x58 |
71 | 71 | ||
72 | static struct spear_shirq spear300_shirq_ras1 = { | 72 | static struct spear_shirq spear300_shirq_ras1 = { |
73 | .irq_nr = 9, | 73 | .offset = 0, |
74 | .irq_bit_off = 0, | 74 | .nr_irqs = 9, |
75 | .regs = { | 75 | .regs = { |
76 | .enb_reg = SPEAR300_INT_ENB_MASK_REG, | 76 | .enb_reg = SPEAR300_INT_ENB_MASK_REG, |
77 | .status_reg = SPEAR300_INT_STS_MASK_REG, | 77 | .status_reg = SPEAR300_INT_STS_MASK_REG, |
@@ -87,8 +87,8 @@ static struct spear_shirq *spear300_shirq_blocks[] = { | |||
87 | #define SPEAR310_INT_STS_MASK_REG 0x04 | 87 | #define SPEAR310_INT_STS_MASK_REG 0x04 |
88 | 88 | ||
89 | static struct spear_shirq spear310_shirq_ras1 = { | 89 | static struct spear_shirq spear310_shirq_ras1 = { |
90 | .irq_nr = 8, | 90 | .offset = 0, |
91 | .irq_bit_off = 0, | 91 | .nr_irqs = 8, |
92 | .regs = { | 92 | .regs = { |
93 | .enb_reg = -1, | 93 | .enb_reg = -1, |
94 | .status_reg = SPEAR310_INT_STS_MASK_REG, | 94 | .status_reg = SPEAR310_INT_STS_MASK_REG, |
@@ -97,8 +97,8 @@ static struct spear_shirq spear310_shirq_ras1 = { | |||
97 | }; | 97 | }; |
98 | 98 | ||
99 | static struct spear_shirq spear310_shirq_ras2 = { | 99 | static struct spear_shirq spear310_shirq_ras2 = { |
100 | .irq_nr = 5, | 100 | .offset = 8, |
101 | .irq_bit_off = 8, | 101 | .nr_irqs = 5, |
102 | .regs = { | 102 | .regs = { |
103 | .enb_reg = -1, | 103 | .enb_reg = -1, |
104 | .status_reg = SPEAR310_INT_STS_MASK_REG, | 104 | .status_reg = SPEAR310_INT_STS_MASK_REG, |
@@ -107,8 +107,8 @@ static struct spear_shirq spear310_shirq_ras2 = { | |||
107 | }; | 107 | }; |
108 | 108 | ||
109 | static struct spear_shirq spear310_shirq_ras3 = { | 109 | static struct spear_shirq spear310_shirq_ras3 = { |
110 | .irq_nr = 1, | 110 | .offset = 13, |
111 | .irq_bit_off = 13, | 111 | .nr_irqs = 1, |
112 | .regs = { | 112 | .regs = { |
113 | .enb_reg = -1, | 113 | .enb_reg = -1, |
114 | .status_reg = SPEAR310_INT_STS_MASK_REG, | 114 | .status_reg = SPEAR310_INT_STS_MASK_REG, |
@@ -117,8 +117,8 @@ static struct spear_shirq spear310_shirq_ras3 = { | |||
117 | }; | 117 | }; |
118 | 118 | ||
119 | static struct spear_shirq spear310_shirq_intrcomm_ras = { | 119 | static struct spear_shirq spear310_shirq_intrcomm_ras = { |
120 | .irq_nr = 3, | 120 | .offset = 14, |
121 | .irq_bit_off = 14, | 121 | .nr_irqs = 3, |
122 | .regs = { | 122 | .regs = { |
123 | .enb_reg = -1, | 123 | .enb_reg = -1, |
124 | .status_reg = SPEAR310_INT_STS_MASK_REG, | 124 | .status_reg = SPEAR310_INT_STS_MASK_REG, |
@@ -139,8 +139,8 @@ static struct spear_shirq *spear310_shirq_blocks[] = { | |||
139 | #define SPEAR320_INT_ENB_MASK_REG 0x08 | 139 | #define SPEAR320_INT_ENB_MASK_REG 0x08 |
140 | 140 | ||
141 | static struct spear_shirq spear320_shirq_ras1 = { | 141 | static struct spear_shirq spear320_shirq_ras1 = { |
142 | .irq_nr = 3, | 142 | .offset = 7, |
143 | .irq_bit_off = 7, | 143 | .nr_irqs = 3, |
144 | .regs = { | 144 | .regs = { |
145 | .enb_reg = -1, | 145 | .enb_reg = -1, |
146 | .status_reg = SPEAR320_INT_STS_MASK_REG, | 146 | .status_reg = SPEAR320_INT_STS_MASK_REG, |
@@ -150,8 +150,8 @@ static struct spear_shirq spear320_shirq_ras1 = { | |||
150 | }; | 150 | }; |
151 | 151 | ||
152 | static struct spear_shirq spear320_shirq_ras2 = { | 152 | static struct spear_shirq spear320_shirq_ras2 = { |
153 | .irq_nr = 1, | 153 | .offset = 10, |
154 | .irq_bit_off = 10, | 154 | .nr_irqs = 1, |
155 | .regs = { | 155 | .regs = { |
156 | .enb_reg = -1, | 156 | .enb_reg = -1, |
157 | .status_reg = SPEAR320_INT_STS_MASK_REG, | 157 | .status_reg = SPEAR320_INT_STS_MASK_REG, |
@@ -161,9 +161,9 @@ static struct spear_shirq spear320_shirq_ras2 = { | |||
161 | }; | 161 | }; |
162 | 162 | ||
163 | static struct spear_shirq spear320_shirq_ras3 = { | 163 | static struct spear_shirq spear320_shirq_ras3 = { |
164 | .irq_nr = 7, | 164 | .offset = 0, |
165 | .irq_bit_off = 0, | 165 | .nr_irqs = 7, |
166 | .invalid_irq = 1, | 166 | .disabled = 1, |
167 | .regs = { | 167 | .regs = { |
168 | .enb_reg = SPEAR320_INT_ENB_MASK_REG, | 168 | .enb_reg = SPEAR320_INT_ENB_MASK_REG, |
169 | .reset_to_enb = 1, | 169 | .reset_to_enb = 1, |
@@ -174,8 +174,8 @@ static struct spear_shirq spear320_shirq_ras3 = { | |||
174 | }; | 174 | }; |
175 | 175 | ||
176 | static struct spear_shirq spear320_shirq_intrcomm_ras = { | 176 | static struct spear_shirq spear320_shirq_intrcomm_ras = { |
177 | .irq_nr = 11, | 177 | .offset = 11, |
178 | .irq_bit_off = 11, | 178 | .nr_irqs = 11, |
179 | .regs = { | 179 | .regs = { |
180 | .enb_reg = -1, | 180 | .enb_reg = -1, |
181 | .status_reg = SPEAR320_INT_STS_MASK_REG, | 181 | .status_reg = SPEAR320_INT_STS_MASK_REG, |
@@ -194,7 +194,7 @@ static struct spear_shirq *spear320_shirq_blocks[] = { | |||
194 | static void shirq_irq_mask_unmask(struct irq_data *d, bool mask) | 194 | static void shirq_irq_mask_unmask(struct irq_data *d, bool mask) |
195 | { | 195 | { |
196 | struct spear_shirq *shirq = irq_data_get_irq_chip_data(d); | 196 | struct spear_shirq *shirq = irq_data_get_irq_chip_data(d); |
197 | u32 val, offset = d->irq - shirq->irq_base; | 197 | u32 val, offset = d->irq - shirq->virq_base; |
198 | unsigned long flags; | 198 | unsigned long flags; |
199 | 199 | ||
200 | if (shirq->regs.enb_reg == -1) | 200 | if (shirq->regs.enb_reg == -1) |
@@ -204,9 +204,9 @@ static void shirq_irq_mask_unmask(struct irq_data *d, bool mask) | |||
204 | val = readl(shirq->base + shirq->regs.enb_reg); | 204 | val = readl(shirq->base + shirq->regs.enb_reg); |
205 | 205 | ||
206 | if (mask ^ shirq->regs.reset_to_enb) | 206 | if (mask ^ shirq->regs.reset_to_enb) |
207 | val &= ~(0x1 << shirq->irq_bit_off << offset); | 207 | val &= ~(0x1 << shirq->offset << offset); |
208 | else | 208 | else |
209 | val |= 0x1 << shirq->irq_bit_off << offset; | 209 | val |= 0x1 << shirq->offset << offset; |
210 | 210 | ||
211 | writel(val, shirq->base + shirq->regs.enb_reg); | 211 | writel(val, shirq->base + shirq->regs.enb_reg); |
212 | spin_unlock_irqrestore(&lock, flags); | 212 | spin_unlock_irqrestore(&lock, flags); |
@@ -239,17 +239,17 @@ static void shirq_handler(unsigned irq, struct irq_desc *desc) | |||
239 | chip = irq_get_chip(irq); | 239 | chip = irq_get_chip(irq); |
240 | chip->irq_ack(&desc->irq_data); | 240 | chip->irq_ack(&desc->irq_data); |
241 | 241 | ||
242 | mask = ((0x1 << shirq->irq_nr) - 1) << shirq->irq_bit_off; | 242 | mask = ((0x1 << shirq->nr_irqs) - 1) << shirq->offset; |
243 | while ((val = readl(shirq->base + shirq->regs.status_reg) & | 243 | while ((val = readl(shirq->base + shirq->regs.status_reg) & |
244 | mask)) { | 244 | mask)) { |
245 | 245 | ||
246 | val >>= shirq->irq_bit_off; | 246 | val >>= shirq->offset; |
247 | for (i = 0, j = 1; i < shirq->irq_nr; i++, j <<= 1) { | 247 | for (i = 0, j = 1; i < shirq->nr_irqs; i++, j <<= 1) { |
248 | 248 | ||
249 | if (!(j & val)) | 249 | if (!(j & val)) |
250 | continue; | 250 | continue; |
251 | 251 | ||
252 | generic_handle_irq(shirq->irq_base + i); | 252 | generic_handle_irq(shirq->virq_base + i); |
253 | 253 | ||
254 | /* clear interrupt */ | 254 | /* clear interrupt */ |
255 | if (shirq->regs.clear_reg == -1) | 255 | if (shirq->regs.clear_reg == -1) |
@@ -257,9 +257,9 @@ static void shirq_handler(unsigned irq, struct irq_desc *desc) | |||
257 | 257 | ||
258 | tmp = readl(shirq->base + shirq->regs.clear_reg); | 258 | tmp = readl(shirq->base + shirq->regs.clear_reg); |
259 | if (shirq->regs.reset_to_clear) | 259 | if (shirq->regs.reset_to_clear) |
260 | tmp &= ~(j << shirq->irq_bit_off); | 260 | tmp &= ~(j << shirq->offset); |
261 | else | 261 | else |
262 | tmp |= (j << shirq->irq_bit_off); | 262 | tmp |= (j << shirq->offset); |
263 | writel(tmp, shirq->base + shirq->regs.clear_reg); | 263 | writel(tmp, shirq->base + shirq->regs.clear_reg); |
264 | } | 264 | } |
265 | } | 265 | } |
@@ -271,24 +271,24 @@ static void __init spear_shirq_register(struct spear_shirq *shirq, | |||
271 | { | 271 | { |
272 | int i; | 272 | int i; |
273 | 273 | ||
274 | if (shirq->invalid_irq) | 274 | if (shirq->disabled) |
275 | return; | 275 | return; |
276 | 276 | ||
277 | irq_set_chained_handler(parent_irq, shirq_handler); | 277 | irq_set_chained_handler(parent_irq, shirq_handler); |
278 | irq_set_handler_data(parent_irq, shirq); | 278 | irq_set_handler_data(parent_irq, shirq); |
279 | 279 | ||
280 | for (i = 0; i < shirq->irq_nr; i++) { | 280 | for (i = 0; i < shirq->nr_irqs; i++) { |
281 | irq_set_chip_and_handler(shirq->irq_base + i, | 281 | irq_set_chip_and_handler(shirq->virq_base + i, |
282 | &shirq_chip, handle_simple_irq); | 282 | &shirq_chip, handle_simple_irq); |
283 | set_irq_flags(shirq->irq_base + i, IRQF_VALID); | 283 | set_irq_flags(shirq->virq_base + i, IRQF_VALID); |
284 | irq_set_chip_data(shirq->irq_base + i, shirq); | 284 | irq_set_chip_data(shirq->virq_base + i, shirq); |
285 | } | 285 | } |
286 | } | 286 | } |
287 | 287 | ||
288 | static int __init shirq_init(struct spear_shirq **shirq_blocks, int block_nr, | 288 | static int __init shirq_init(struct spear_shirq **shirq_blocks, int block_nr, |
289 | struct device_node *np) | 289 | struct device_node *np) |
290 | { | 290 | { |
291 | int i, parent_irq, irq_base, hwirq = 0, irq_nr = 0; | 291 | int i, parent_irq, virq_base, hwirq = 0, nr_irqs = 0; |
292 | struct irq_domain *shirq_domain; | 292 | struct irq_domain *shirq_domain; |
293 | void __iomem *base; | 293 | void __iomem *base; |
294 | 294 | ||
@@ -299,15 +299,15 @@ static int __init shirq_init(struct spear_shirq **shirq_blocks, int block_nr, | |||
299 | } | 299 | } |
300 | 300 | ||
301 | for (i = 0; i < block_nr; i++) | 301 | for (i = 0; i < block_nr; i++) |
302 | irq_nr += shirq_blocks[i]->irq_nr; | 302 | nr_irqs += shirq_blocks[i]->nr_irqs; |
303 | 303 | ||
304 | irq_base = irq_alloc_descs(-1, 0, irq_nr, 0); | 304 | virq_base = irq_alloc_descs(-1, 0, nr_irqs, 0); |
305 | if (IS_ERR_VALUE(irq_base)) { | 305 | if (IS_ERR_VALUE(virq_base)) { |
306 | pr_err("%s: irq desc alloc failed\n", __func__); | 306 | pr_err("%s: irq desc alloc failed\n", __func__); |
307 | goto err_unmap; | 307 | goto err_unmap; |
308 | } | 308 | } |
309 | 309 | ||
310 | shirq_domain = irq_domain_add_legacy(np, irq_nr, irq_base, 0, | 310 | shirq_domain = irq_domain_add_legacy(np, nr_irqs, virq_base, 0, |
311 | &irq_domain_simple_ops, NULL); | 311 | &irq_domain_simple_ops, NULL); |
312 | if (WARN_ON(!shirq_domain)) { | 312 | if (WARN_ON(!shirq_domain)) { |
313 | pr_warn("%s: irq domain init failed\n", __func__); | 313 | pr_warn("%s: irq domain init failed\n", __func__); |
@@ -316,18 +316,18 @@ static int __init shirq_init(struct spear_shirq **shirq_blocks, int block_nr, | |||
316 | 316 | ||
317 | for (i = 0; i < block_nr; i++) { | 317 | for (i = 0; i < block_nr; i++) { |
318 | shirq_blocks[i]->base = base; | 318 | shirq_blocks[i]->base = base; |
319 | shirq_blocks[i]->irq_base = irq_find_mapping(shirq_domain, | 319 | shirq_blocks[i]->virq_base = irq_find_mapping(shirq_domain, |
320 | hwirq); | 320 | hwirq); |
321 | 321 | ||
322 | parent_irq = irq_of_parse_and_map(np, i); | 322 | parent_irq = irq_of_parse_and_map(np, i); |
323 | spear_shirq_register(shirq_blocks[i], parent_irq); | 323 | spear_shirq_register(shirq_blocks[i], parent_irq); |
324 | hwirq += shirq_blocks[i]->irq_nr; | 324 | hwirq += shirq_blocks[i]->nr_irqs; |
325 | } | 325 | } |
326 | 326 | ||
327 | return 0; | 327 | return 0; |
328 | 328 | ||
329 | err_free_desc: | 329 | err_free_desc: |
330 | irq_free_descs(irq_base, irq_nr); | 330 | irq_free_descs(virq_base, nr_irqs); |
331 | err_unmap: | 331 | err_unmap: |
332 | iounmap(base); | 332 | iounmap(base); |
333 | return -ENXIO; | 333 | return -ENXIO; |