diff options
author | Tudor Laurentiu <b10716@freescale.com> | 2014-08-19 07:25:01 -0400 |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2014-09-04 19:41:29 -0400 |
commit | 834952314c8bae7331b0797a071958dda9bec60d (patch) | |
tree | 133a937dafd225ad293a2c2b3289c458324ecf6f | |
parent | 26a047ab101a6ab765b805c7417e82e1ed413ff2 (diff) |
powerpc/fsl_msi: reorganize structs to improve clarity and flexibility
Store cascade_data in an array inside the driver
data for later use.
Get rid of the msi_virq array since now we can
encapsulate the virqs in the cascade_data
directly and access them through the array
mentioned earlier.
Signed-off-by: Laurentiu Tudor <Laurentiu.Tudor@freescale.com>
Cc: Scott Wood <scottwood@freescale.com>
Cc: Mihai Caraman <mihai.caraman@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
-rw-r--r-- | arch/powerpc/sysdev/fsl_msi.c | 17 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_msi.h | 4 |
2 files changed, 14 insertions, 7 deletions
diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c index 9fadc6e4dc47..05a0dd918de2 100644 --- a/arch/powerpc/sysdev/fsl_msi.c +++ b/arch/powerpc/sysdev/fsl_msi.c | |||
@@ -50,6 +50,7 @@ struct fsl_msi_feature { | |||
50 | struct fsl_msi_cascade_data { | 50 | struct fsl_msi_cascade_data { |
51 | struct fsl_msi *msi_data; | 51 | struct fsl_msi *msi_data; |
52 | int index; | 52 | int index; |
53 | int virq; | ||
53 | }; | 54 | }; |
54 | 55 | ||
55 | static inline u32 fsl_msi_read(u32 __iomem *base, unsigned int reg) | 56 | static inline u32 fsl_msi_read(u32 __iomem *base, unsigned int reg) |
@@ -327,15 +328,18 @@ static int fsl_of_msi_remove(struct platform_device *ofdev) | |||
327 | { | 328 | { |
328 | struct fsl_msi *msi = platform_get_drvdata(ofdev); | 329 | struct fsl_msi *msi = platform_get_drvdata(ofdev); |
329 | int virq, i; | 330 | int virq, i; |
330 | struct fsl_msi_cascade_data *cascade_data; | ||
331 | 331 | ||
332 | if (msi->list.prev != NULL) | 332 | if (msi->list.prev != NULL) |
333 | list_del(&msi->list); | 333 | list_del(&msi->list); |
334 | for (i = 0; i < NR_MSI_REG_MAX; i++) { | 334 | for (i = 0; i < NR_MSI_REG_MAX; i++) { |
335 | virq = msi->msi_virqs[i]; | 335 | if (msi->cascade_array[i]) { |
336 | if (virq != NO_IRQ) { | 336 | virq = msi->cascade_array[i]->virq; |
337 | cascade_data = irq_get_handler_data(virq); | 337 | |
338 | kfree(cascade_data); | 338 | BUG_ON(virq == NO_IRQ); |
339 | BUG_ON(msi->cascade_array[i] != | ||
340 | irq_get_handler_data(virq)); | ||
341 | |||
342 | kfree(msi->cascade_array[i]); | ||
339 | irq_dispose_mapping(virq); | 343 | irq_dispose_mapping(virq); |
340 | } | 344 | } |
341 | } | 345 | } |
@@ -369,9 +373,10 @@ static int fsl_msi_setup_hwirq(struct fsl_msi *msi, struct platform_device *dev, | |||
369 | return -ENOMEM; | 373 | return -ENOMEM; |
370 | } | 374 | } |
371 | irq_set_lockdep_class(virt_msir, &fsl_msi_irq_class); | 375 | irq_set_lockdep_class(virt_msir, &fsl_msi_irq_class); |
372 | msi->msi_virqs[irq_index] = virt_msir; | ||
373 | cascade_data->index = offset; | 376 | cascade_data->index = offset; |
374 | cascade_data->msi_data = msi; | 377 | cascade_data->msi_data = msi; |
378 | cascade_data->virq = virt_msir; | ||
379 | msi->cascade_array[irq_index] = cascade_data; | ||
375 | irq_set_handler_data(virt_msir, cascade_data); | 380 | irq_set_handler_data(virt_msir, cascade_data); |
376 | irq_set_chained_handler(virt_msir, fsl_msi_cascade); | 381 | irq_set_chained_handler(virt_msir, fsl_msi_cascade); |
377 | 382 | ||
diff --git a/arch/powerpc/sysdev/fsl_msi.h b/arch/powerpc/sysdev/fsl_msi.h index df9aa9fe0933..420cfcbdac01 100644 --- a/arch/powerpc/sysdev/fsl_msi.h +++ b/arch/powerpc/sysdev/fsl_msi.h | |||
@@ -27,6 +27,8 @@ | |||
27 | #define FSL_PIC_IP_IPIC 0x00000002 | 27 | #define FSL_PIC_IP_IPIC 0x00000002 |
28 | #define FSL_PIC_IP_VMPIC 0x00000003 | 28 | #define FSL_PIC_IP_VMPIC 0x00000003 |
29 | 29 | ||
30 | struct fsl_msi_cascade_data; | ||
31 | |||
30 | struct fsl_msi { | 32 | struct fsl_msi { |
31 | struct irq_domain *irqhost; | 33 | struct irq_domain *irqhost; |
32 | 34 | ||
@@ -37,7 +39,7 @@ struct fsl_msi { | |||
37 | u32 srs_shift; /* Shift of the shared interrupt register select */ | 39 | u32 srs_shift; /* Shift of the shared interrupt register select */ |
38 | void __iomem *msi_regs; | 40 | void __iomem *msi_regs; |
39 | u32 feature; | 41 | u32 feature; |
40 | int msi_virqs[NR_MSI_REG_MAX]; | 42 | struct fsl_msi_cascade_data *cascade_array[NR_MSI_REG_MAX]; |
41 | 43 | ||
42 | struct msi_bitmap bitmap; | 44 | struct msi_bitmap bitmap; |
43 | 45 | ||