diff options
-rw-r--r-- | kernel/irq/generic-chip.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/kernel/irq/generic-chip.c b/kernel/irq/generic-chip.c index c89295a8f668..0e6ba789056c 100644 --- a/kernel/irq/generic-chip.c +++ b/kernel/irq/generic-chip.c | |||
@@ -16,11 +16,6 @@ | |||
16 | static LIST_HEAD(gc_list); | 16 | static LIST_HEAD(gc_list); |
17 | static DEFINE_RAW_SPINLOCK(gc_lock); | 17 | static DEFINE_RAW_SPINLOCK(gc_lock); |
18 | 18 | ||
19 | static inline struct irq_chip_regs *cur_regs(struct irq_data *d) | ||
20 | { | ||
21 | return &container_of(d->chip, struct irq_chip_type, chip)->regs; | ||
22 | } | ||
23 | |||
24 | /** | 19 | /** |
25 | * irq_gc_noop - NOOP function | 20 | * irq_gc_noop - NOOP function |
26 | * @d: irq_data | 21 | * @d: irq_data |
@@ -39,10 +34,11 @@ void irq_gc_noop(struct irq_data *d) | |||
39 | void irq_gc_mask_disable_reg(struct irq_data *d) | 34 | void irq_gc_mask_disable_reg(struct irq_data *d) |
40 | { | 35 | { |
41 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | 36 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); |
37 | struct irq_chip_type *ct = irq_data_get_chip_type(d); | ||
42 | u32 mask = 1 << (d->irq - gc->irq_base); | 38 | u32 mask = 1 << (d->irq - gc->irq_base); |
43 | 39 | ||
44 | irq_gc_lock(gc); | 40 | irq_gc_lock(gc); |
45 | irq_reg_writel(mask, gc->reg_base + cur_regs(d)->disable); | 41 | irq_reg_writel(mask, gc->reg_base + ct->regs.disable); |
46 | gc->mask_cache &= ~mask; | 42 | gc->mask_cache &= ~mask; |
47 | irq_gc_unlock(gc); | 43 | irq_gc_unlock(gc); |
48 | } | 44 | } |
@@ -57,11 +53,12 @@ void irq_gc_mask_disable_reg(struct irq_data *d) | |||
57 | void irq_gc_mask_set_bit(struct irq_data *d) | 53 | void irq_gc_mask_set_bit(struct irq_data *d) |
58 | { | 54 | { |
59 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | 55 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); |
56 | struct irq_chip_type *ct = irq_data_get_chip_type(d); | ||
60 | u32 mask = 1 << (d->irq - gc->irq_base); | 57 | u32 mask = 1 << (d->irq - gc->irq_base); |
61 | 58 | ||
62 | irq_gc_lock(gc); | 59 | irq_gc_lock(gc); |
63 | gc->mask_cache |= mask; | 60 | gc->mask_cache |= mask; |
64 | irq_reg_writel(gc->mask_cache, gc->reg_base + cur_regs(d)->mask); | 61 | irq_reg_writel(gc->mask_cache, gc->reg_base + ct->regs.mask); |
65 | irq_gc_unlock(gc); | 62 | irq_gc_unlock(gc); |
66 | } | 63 | } |
67 | 64 | ||
@@ -75,11 +72,12 @@ void irq_gc_mask_set_bit(struct irq_data *d) | |||
75 | void irq_gc_mask_clr_bit(struct irq_data *d) | 72 | void irq_gc_mask_clr_bit(struct irq_data *d) |
76 | { | 73 | { |
77 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | 74 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); |
75 | struct irq_chip_type *ct = irq_data_get_chip_type(d); | ||
78 | u32 mask = 1 << (d->irq - gc->irq_base); | 76 | u32 mask = 1 << (d->irq - gc->irq_base); |
79 | 77 | ||
80 | irq_gc_lock(gc); | 78 | irq_gc_lock(gc); |
81 | gc->mask_cache &= ~mask; | 79 | gc->mask_cache &= ~mask; |
82 | irq_reg_writel(gc->mask_cache, gc->reg_base + cur_regs(d)->mask); | 80 | irq_reg_writel(gc->mask_cache, gc->reg_base + ct->regs.mask); |
83 | irq_gc_unlock(gc); | 81 | irq_gc_unlock(gc); |
84 | } | 82 | } |
85 | 83 | ||
@@ -93,10 +91,11 @@ void irq_gc_mask_clr_bit(struct irq_data *d) | |||
93 | void irq_gc_unmask_enable_reg(struct irq_data *d) | 91 | void irq_gc_unmask_enable_reg(struct irq_data *d) |
94 | { | 92 | { |
95 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | 93 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); |
94 | struct irq_chip_type *ct = irq_data_get_chip_type(d); | ||
96 | u32 mask = 1 << (d->irq - gc->irq_base); | 95 | u32 mask = 1 << (d->irq - gc->irq_base); |
97 | 96 | ||
98 | irq_gc_lock(gc); | 97 | irq_gc_lock(gc); |
99 | irq_reg_writel(mask, gc->reg_base + cur_regs(d)->enable); | 98 | irq_reg_writel(mask, gc->reg_base + ct->regs.enable); |
100 | gc->mask_cache |= mask; | 99 | gc->mask_cache |= mask; |
101 | irq_gc_unlock(gc); | 100 | irq_gc_unlock(gc); |
102 | } | 101 | } |
@@ -108,10 +107,11 @@ void irq_gc_unmask_enable_reg(struct irq_data *d) | |||
108 | void irq_gc_ack_set_bit(struct irq_data *d) | 107 | void irq_gc_ack_set_bit(struct irq_data *d) |
109 | { | 108 | { |
110 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | 109 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); |
110 | struct irq_chip_type *ct = irq_data_get_chip_type(d); | ||
111 | u32 mask = 1 << (d->irq - gc->irq_base); | 111 | u32 mask = 1 << (d->irq - gc->irq_base); |
112 | 112 | ||
113 | irq_gc_lock(gc); | 113 | irq_gc_lock(gc); |
114 | irq_reg_writel(mask, gc->reg_base + cur_regs(d)->ack); | 114 | irq_reg_writel(mask, gc->reg_base + ct->regs.ack); |
115 | irq_gc_unlock(gc); | 115 | irq_gc_unlock(gc); |
116 | } | 116 | } |
117 | 117 | ||
@@ -122,10 +122,11 @@ void irq_gc_ack_set_bit(struct irq_data *d) | |||
122 | void irq_gc_ack_clr_bit(struct irq_data *d) | 122 | void irq_gc_ack_clr_bit(struct irq_data *d) |
123 | { | 123 | { |
124 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | 124 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); |
125 | struct irq_chip_type *ct = irq_data_get_chip_type(d); | ||
125 | u32 mask = ~(1 << (d->irq - gc->irq_base)); | 126 | u32 mask = ~(1 << (d->irq - gc->irq_base)); |
126 | 127 | ||
127 | irq_gc_lock(gc); | 128 | irq_gc_lock(gc); |
128 | irq_reg_writel(mask, gc->reg_base + cur_regs(d)->ack); | 129 | irq_reg_writel(mask, gc->reg_base + ct->regs.ack); |
129 | irq_gc_unlock(gc); | 130 | irq_gc_unlock(gc); |
130 | } | 131 | } |
131 | 132 | ||
@@ -136,11 +137,12 @@ void irq_gc_ack_clr_bit(struct irq_data *d) | |||
136 | void irq_gc_mask_disable_reg_and_ack(struct irq_data *d) | 137 | void irq_gc_mask_disable_reg_and_ack(struct irq_data *d) |
137 | { | 138 | { |
138 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | 139 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); |
140 | struct irq_chip_type *ct = irq_data_get_chip_type(d); | ||
139 | u32 mask = 1 << (d->irq - gc->irq_base); | 141 | u32 mask = 1 << (d->irq - gc->irq_base); |
140 | 142 | ||
141 | irq_gc_lock(gc); | 143 | irq_gc_lock(gc); |
142 | irq_reg_writel(mask, gc->reg_base + cur_regs(d)->mask); | 144 | irq_reg_writel(mask, gc->reg_base + ct->regs.mask); |
143 | irq_reg_writel(mask, gc->reg_base + cur_regs(d)->ack); | 145 | irq_reg_writel(mask, gc->reg_base + ct->regs.ack); |
144 | irq_gc_unlock(gc); | 146 | irq_gc_unlock(gc); |
145 | } | 147 | } |
146 | 148 | ||
@@ -151,10 +153,11 @@ void irq_gc_mask_disable_reg_and_ack(struct irq_data *d) | |||
151 | void irq_gc_eoi(struct irq_data *d) | 153 | void irq_gc_eoi(struct irq_data *d) |
152 | { | 154 | { |
153 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | 155 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); |
156 | struct irq_chip_type *ct = irq_data_get_chip_type(d); | ||
154 | u32 mask = 1 << (d->irq - gc->irq_base); | 157 | u32 mask = 1 << (d->irq - gc->irq_base); |
155 | 158 | ||
156 | irq_gc_lock(gc); | 159 | irq_gc_lock(gc); |
157 | irq_reg_writel(mask, gc->reg_base + cur_regs(d)->eoi); | 160 | irq_reg_writel(mask, gc->reg_base + ct->regs.eoi); |
158 | irq_gc_unlock(gc); | 161 | irq_gc_unlock(gc); |
159 | } | 162 | } |
160 | 163 | ||