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

dmaengine: hsu: refactor hsu_dma_do_irq() to return int

Since we have nice macro IRQ_RETVAL() we would use it to convert a flag of
handled interrupt from int to irqreturn_t.

The rationale of doing this is:
a) hence we implicitly mark hsu_dma_do_irq() as an auxiliary function that
can't be used as interrupt handler directly, and
b) to be in align with serial driver which is using serial8250_handle_irq()
that returns plain int by design.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Andy Shevchenko and committed by
Greg Kroah-Hartman
d2f5a731 46e36683

+15 -17
+4 -5
drivers/dma/hsu/hsu.c
··· 200 200 * is not a normal timeout interrupt, ie. hsu_dma_get_status() returned 0. 201 201 * 202 202 * Return: 203 - * IRQ_NONE for invalid channel number, IRQ_HANDLED otherwise. 203 + * 0 for invalid channel number, 1 otherwise. 204 204 */ 205 - irqreturn_t hsu_dma_do_irq(struct hsu_dma_chip *chip, unsigned short nr, 206 - u32 status) 205 + int hsu_dma_do_irq(struct hsu_dma_chip *chip, unsigned short nr, u32 status) 207 206 { 208 207 struct hsu_dma_chan *hsuc; 209 208 struct hsu_dma_desc *desc; ··· 210 211 211 212 /* Sanity check */ 212 213 if (nr >= chip->hsu->nr_channels) 213 - return IRQ_NONE; 214 + return 0; 214 215 215 216 hsuc = &chip->hsu->chan[nr]; 216 217 ··· 229 230 } 230 231 spin_unlock_irqrestore(&hsuc->vchan.lock, flags); 231 232 232 - return IRQ_HANDLED; 233 + return 1; 233 234 } 234 235 EXPORT_SYMBOL_GPL(hsu_dma_do_irq); 235 236
+3 -3
drivers/dma/hsu/pci.c
··· 29 29 u32 dmaisr; 30 30 u32 status; 31 31 unsigned short i; 32 - irqreturn_t ret = IRQ_NONE; 32 + int ret = 0; 33 33 int err; 34 34 35 35 dmaisr = readl(chip->regs + HSU_PCI_DMAISR); ··· 37 37 if (dmaisr & 0x1) { 38 38 err = hsu_dma_get_status(chip, i, &status); 39 39 if (err > 0) 40 - ret |= IRQ_HANDLED; 40 + ret |= 1; 41 41 else if (err == 0) 42 42 ret |= hsu_dma_do_irq(chip, i, status); 43 43 } 44 44 dmaisr >>= 1; 45 45 } 46 46 47 - return ret; 47 + return IRQ_RETVAL(ret); 48 48 } 49 49 50 50 static int hsu_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
+4 -4
drivers/tty/serial/8250/8250_mid.c
··· 99 99 struct uart_8250_port *up = up_to_u8250p(p); 100 100 unsigned int fisr = serial_port_in(p, INTEL_MID_UART_DNV_FISR); 101 101 u32 status; 102 - int ret = IRQ_NONE; 102 + int ret = 0; 103 103 int err; 104 104 105 105 if (fisr & BIT(2)) { 106 106 err = hsu_dma_get_status(&mid->dma_chip, 1, &status); 107 107 if (err > 0) { 108 108 serial8250_rx_dma_flush(up); 109 - ret |= IRQ_HANDLED; 109 + ret |= 1; 110 110 } else if (err == 0) 111 111 ret |= hsu_dma_do_irq(&mid->dma_chip, 1, status); 112 112 } 113 113 if (fisr & BIT(1)) { 114 114 err = hsu_dma_get_status(&mid->dma_chip, 0, &status); 115 115 if (err > 0) 116 - ret |= IRQ_HANDLED; 116 + ret |= 1; 117 117 else if (err == 0) 118 118 ret |= hsu_dma_do_irq(&mid->dma_chip, 0, status); 119 119 } 120 120 if (fisr & BIT(0)) 121 121 ret |= serial8250_handle_irq(p, serial_port_in(p, UART_IIR)); 122 - return ret; 122 + return IRQ_RETVAL(ret); 123 123 } 124 124 125 125 #define DNV_DMA_CHAN_OFFSET 0x80
+4 -5
include/linux/dma/hsu.h
··· 41 41 /* Export to the internal users */ 42 42 int hsu_dma_get_status(struct hsu_dma_chip *chip, unsigned short nr, 43 43 u32 *status); 44 - irqreturn_t hsu_dma_do_irq(struct hsu_dma_chip *chip, unsigned short nr, 45 - u32 status); 44 + int hsu_dma_do_irq(struct hsu_dma_chip *chip, unsigned short nr, u32 status); 46 45 47 46 /* Export to the platform drivers */ 48 47 int hsu_dma_probe(struct hsu_dma_chip *chip); ··· 52 53 { 53 54 return 0; 54 55 } 55 - static inline irqreturn_t hsu_dma_do_irq(struct hsu_dma_chip *chip, 56 - unsigned short nr, u32 status) 56 + static inline int hsu_dma_do_irq(struct hsu_dma_chip *chip, unsigned short nr, 57 + u32 status) 57 58 { 58 - return IRQ_NONE; 59 + return 0; 59 60 } 60 61 static inline int hsu_dma_probe(struct hsu_dma_chip *chip) { return -ENODEV; } 61 62 static inline int hsu_dma_remove(struct hsu_dma_chip *chip) { return 0; }