Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

soc: ixp4xx: Uninline several functions

These inline functions immediately exploit the static ioremaps
for the queue manager memory region. This does not work with
multiplatform where everything need to be dynamically remapped,
so get rid of these inlines and create new exports for those
used by other drivers.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

+124 -120
+117
drivers/soc/ixp4xx/ixp4xx-qmgr.c
··· 32 32 char qmgr_queue_descs[QUEUES][32]; 33 33 #endif 34 34 35 + void qmgr_put_entry(unsigned int queue, u32 val) 36 + { 37 + #if DEBUG_QMGR 38 + BUG_ON(!qmgr_queue_descs[queue]); /* not yet requested */ 39 + 40 + printk(KERN_DEBUG "Queue %s(%i) put %X\n", 41 + qmgr_queue_descs[queue], queue, val); 42 + #endif 43 + __raw_writel(val, &qmgr_regs->acc[queue][0]); 44 + } 45 + 46 + u32 qmgr_get_entry(unsigned int queue) 47 + { 48 + u32 val; 49 + val = __raw_readl(&qmgr_regs->acc[queue][0]); 50 + #if DEBUG_QMGR 51 + BUG_ON(!qmgr_queue_descs[queue]); /* not yet requested */ 52 + 53 + printk(KERN_DEBUG "Queue %s(%i) get %X\n", 54 + qmgr_queue_descs[queue], queue, val); 55 + #endif 56 + return val; 57 + } 58 + 59 + static int __qmgr_get_stat1(unsigned int queue) 60 + { 61 + return (__raw_readl(&qmgr_regs->stat1[queue >> 3]) 62 + >> ((queue & 7) << 2)) & 0xF; 63 + } 64 + 65 + static int __qmgr_get_stat2(unsigned int queue) 66 + { 67 + BUG_ON(queue >= HALF_QUEUES); 68 + return (__raw_readl(&qmgr_regs->stat2[queue >> 4]) 69 + >> ((queue & 0xF) << 1)) & 0x3; 70 + } 71 + 72 + /** 73 + * qmgr_stat_empty() - checks if a hardware queue is empty 74 + * @queue: queue number 75 + * 76 + * Returns non-zero value if the queue is empty. 77 + */ 78 + int qmgr_stat_empty(unsigned int queue) 79 + { 80 + BUG_ON(queue >= HALF_QUEUES); 81 + return __qmgr_get_stat1(queue) & QUEUE_STAT1_EMPTY; 82 + } 83 + 84 + /** 85 + * qmgr_stat_below_low_watermark() - checks if a queue is below low watermark 86 + * @queue: queue number 87 + * 88 + * Returns non-zero value if the queue is below low watermark. 89 + */ 90 + int qmgr_stat_below_low_watermark(unsigned int queue) 91 + { 92 + if (queue >= HALF_QUEUES) 93 + return (__raw_readl(&qmgr_regs->statne_h) >> 94 + (queue - HALF_QUEUES)) & 0x01; 95 + return __qmgr_get_stat1(queue) & QUEUE_STAT1_NEARLY_EMPTY; 96 + } 97 + 98 + /** 99 + * qmgr_stat_above_high_watermark() - checks if a queue is above high watermark 100 + * @queue: queue number 101 + * 102 + * Returns non-zero value if the queue is above high watermark 103 + */ 104 + static int qmgr_stat_above_high_watermark(unsigned int queue) 105 + { 106 + BUG_ON(queue >= HALF_QUEUES); 107 + return __qmgr_get_stat1(queue) & QUEUE_STAT1_NEARLY_FULL; 108 + } 109 + 110 + /** 111 + * qmgr_stat_full() - checks if a hardware queue is full 112 + * @queue: queue number 113 + * 114 + * Returns non-zero value if the queue is full. 115 + */ 116 + int qmgr_stat_full(unsigned int queue) 117 + { 118 + if (queue >= HALF_QUEUES) 119 + return (__raw_readl(&qmgr_regs->statf_h) >> 120 + (queue - HALF_QUEUES)) & 0x01; 121 + return __qmgr_get_stat1(queue) & QUEUE_STAT1_FULL; 122 + } 123 + 124 + /** 125 + * qmgr_stat_underflow() - checks if a hardware queue experienced underflow 126 + * @queue: queue number 127 + * 128 + * Returns non-zero value if the queue experienced underflow. 129 + */ 130 + static int qmgr_stat_underflow(unsigned int queue) 131 + { 132 + return __qmgr_get_stat2(queue) & QUEUE_STAT2_UNDERFLOW; 133 + } 134 + 135 + /** 136 + * qmgr_stat_overflow() - checks if a hardware queue experienced overflow 137 + * @queue: queue number 138 + * 139 + * Returns non-zero value if the queue experienced overflow. 140 + */ 141 + int qmgr_stat_overflow(unsigned int queue) 142 + { 143 + return __qmgr_get_stat2(queue) & QUEUE_STAT2_OVERFLOW; 144 + } 145 + 35 146 void qmgr_set_irq(unsigned int queue, int src, 36 147 void (*handler)(void *pdev), void *pdev) 37 148 { ··· 486 375 MODULE_LICENSE("GPL v2"); 487 376 MODULE_AUTHOR("Krzysztof Halasa"); 488 377 378 + EXPORT_SYMBOL(qmgr_put_entry); 379 + EXPORT_SYMBOL(qmgr_get_entry); 380 + EXPORT_SYMBOL(qmgr_stat_empty); 381 + EXPORT_SYMBOL(qmgr_stat_below_low_watermark); 382 + EXPORT_SYMBOL(qmgr_stat_full); 383 + EXPORT_SYMBOL(qmgr_stat_overflow); 489 384 EXPORT_SYMBOL(qmgr_set_irq); 490 385 EXPORT_SYMBOL(qmgr_enable_irq); 491 386 EXPORT_SYMBOL(qmgr_disable_irq);
+7 -120
include/linux/soc/ixp4xx/qmgr.h
··· 57 57 u32 sram[2048]; /* 0x2000 - 0x3FFF - config and buffer */ 58 58 }; 59 59 60 + void qmgr_put_entry(unsigned int queue, u32 val); 61 + u32 qmgr_get_entry(unsigned int queue); 62 + int qmgr_stat_empty(unsigned int queue); 63 + int qmgr_stat_below_low_watermark(unsigned int queue); 64 + int qmgr_stat_full(unsigned int queue); 65 + int qmgr_stat_overflow(unsigned int queue); 66 + void qmgr_release_queue(unsigned int queue); 60 67 void qmgr_set_irq(unsigned int queue, int src, 61 68 void (*handler)(void *pdev), void *pdev); 62 69 void qmgr_enable_irq(unsigned int queue); ··· 87 80 __qmgr_request_queue(queue, len, nearly_empty_watermark, \ 88 81 nearly_full_watermark) 89 82 #endif 90 - 91 - void qmgr_release_queue(unsigned int queue); 92 - 93 - 94 - static inline void qmgr_put_entry(unsigned int queue, u32 val) 95 - { 96 - struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT; 97 - #if DEBUG_QMGR 98 - BUG_ON(!qmgr_queue_descs[queue]); /* not yet requested */ 99 - 100 - printk(KERN_DEBUG "Queue %s(%i) put %X\n", 101 - qmgr_queue_descs[queue], queue, val); 102 - #endif 103 - __raw_writel(val, &qmgr_regs->acc[queue][0]); 104 - } 105 - 106 - static inline u32 qmgr_get_entry(unsigned int queue) 107 - { 108 - u32 val; 109 - const struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT; 110 - val = __raw_readl(&qmgr_regs->acc[queue][0]); 111 - #if DEBUG_QMGR 112 - BUG_ON(!qmgr_queue_descs[queue]); /* not yet requested */ 113 - 114 - printk(KERN_DEBUG "Queue %s(%i) get %X\n", 115 - qmgr_queue_descs[queue], queue, val); 116 - #endif 117 - return val; 118 - } 119 - 120 - static inline int __qmgr_get_stat1(unsigned int queue) 121 - { 122 - const struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT; 123 - return (__raw_readl(&qmgr_regs->stat1[queue >> 3]) 124 - >> ((queue & 7) << 2)) & 0xF; 125 - } 126 - 127 - static inline int __qmgr_get_stat2(unsigned int queue) 128 - { 129 - const struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT; 130 - BUG_ON(queue >= HALF_QUEUES); 131 - return (__raw_readl(&qmgr_regs->stat2[queue >> 4]) 132 - >> ((queue & 0xF) << 1)) & 0x3; 133 - } 134 - 135 - /** 136 - * qmgr_stat_empty() - checks if a hardware queue is empty 137 - * @queue: queue number 138 - * 139 - * Returns non-zero value if the queue is empty. 140 - */ 141 - static inline int qmgr_stat_empty(unsigned int queue) 142 - { 143 - BUG_ON(queue >= HALF_QUEUES); 144 - return __qmgr_get_stat1(queue) & QUEUE_STAT1_EMPTY; 145 - } 146 - 147 - /** 148 - * qmgr_stat_below_low_watermark() - checks if a queue is below low watermark 149 - * @queue: queue number 150 - * 151 - * Returns non-zero value if the queue is below low watermark. 152 - */ 153 - static inline int qmgr_stat_below_low_watermark(unsigned int queue) 154 - { 155 - const struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT; 156 - if (queue >= HALF_QUEUES) 157 - return (__raw_readl(&qmgr_regs->statne_h) >> 158 - (queue - HALF_QUEUES)) & 0x01; 159 - return __qmgr_get_stat1(queue) & QUEUE_STAT1_NEARLY_EMPTY; 160 - } 161 - 162 - /** 163 - * qmgr_stat_above_high_watermark() - checks if a queue is above high watermark 164 - * @queue: queue number 165 - * 166 - * Returns non-zero value if the queue is above high watermark 167 - */ 168 - static inline int qmgr_stat_above_high_watermark(unsigned int queue) 169 - { 170 - BUG_ON(queue >= HALF_QUEUES); 171 - return __qmgr_get_stat1(queue) & QUEUE_STAT1_NEARLY_FULL; 172 - } 173 - 174 - /** 175 - * qmgr_stat_full() - checks if a hardware queue is full 176 - * @queue: queue number 177 - * 178 - * Returns non-zero value if the queue is full. 179 - */ 180 - static inline int qmgr_stat_full(unsigned int queue) 181 - { 182 - const struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT; 183 - if (queue >= HALF_QUEUES) 184 - return (__raw_readl(&qmgr_regs->statf_h) >> 185 - (queue - HALF_QUEUES)) & 0x01; 186 - return __qmgr_get_stat1(queue) & QUEUE_STAT1_FULL; 187 - } 188 - 189 - /** 190 - * qmgr_stat_underflow() - checks if a hardware queue experienced underflow 191 - * @queue: queue number 192 - * 193 - * Returns non-zero value if the queue experienced underflow. 194 - */ 195 - static inline int qmgr_stat_underflow(unsigned int queue) 196 - { 197 - return __qmgr_get_stat2(queue) & QUEUE_STAT2_UNDERFLOW; 198 - } 199 - 200 - /** 201 - * qmgr_stat_overflow() - checks if a hardware queue experienced overflow 202 - * @queue: queue number 203 - * 204 - * Returns non-zero value if the queue experienced overflow. 205 - */ 206 - static inline int qmgr_stat_overflow(unsigned int queue) 207 - { 208 - return __qmgr_get_stat2(queue) & QUEUE_STAT2_OVERFLOW; 209 - } 210 83 211 84 #endif