diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2016-08-23 09:09:40 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-09-02 09:05:48 -0400 |
commit | d2f5a7311bcaed681a41cb3419b8fe92a7b68bf5 (patch) | |
tree | 9a7669cb11f6314817fced673fd63d26d7bc5153 | |
parent | 46e36683f433528bfb7e5754ca5c5c86c204c40a (diff) |
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>
-rw-r--r-- | drivers/dma/hsu/hsu.c | 9 | ||||
-rw-r--r-- | drivers/dma/hsu/pci.c | 6 | ||||
-rw-r--r-- | drivers/tty/serial/8250/8250_mid.c | 8 | ||||
-rw-r--r-- | include/linux/dma/hsu.h | 9 |
4 files changed, 15 insertions, 17 deletions
diff --git a/drivers/dma/hsu/hsu.c b/drivers/dma/hsu/hsu.c index c5f21efd6090..29d04ca71d52 100644 --- a/drivers/dma/hsu/hsu.c +++ b/drivers/dma/hsu/hsu.c | |||
@@ -200,10 +200,9 @@ EXPORT_SYMBOL_GPL(hsu_dma_get_status); | |||
200 | * is not a normal timeout interrupt, ie. hsu_dma_get_status() returned 0. | 200 | * is not a normal timeout interrupt, ie. hsu_dma_get_status() returned 0. |
201 | * | 201 | * |
202 | * Return: | 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, | 205 | int hsu_dma_do_irq(struct hsu_dma_chip *chip, unsigned short nr, u32 status) |
206 | u32 status) | ||
207 | { | 206 | { |
208 | struct hsu_dma_chan *hsuc; | 207 | struct hsu_dma_chan *hsuc; |
209 | struct hsu_dma_desc *desc; | 208 | struct hsu_dma_desc *desc; |
@@ -211,7 +210,7 @@ irqreturn_t hsu_dma_do_irq(struct hsu_dma_chip *chip, unsigned short nr, | |||
211 | 210 | ||
212 | /* Sanity check */ | 211 | /* Sanity check */ |
213 | if (nr >= chip->hsu->nr_channels) | 212 | if (nr >= chip->hsu->nr_channels) |
214 | return IRQ_NONE; | 213 | return 0; |
215 | 214 | ||
216 | hsuc = &chip->hsu->chan[nr]; | 215 | hsuc = &chip->hsu->chan[nr]; |
217 | 216 | ||
@@ -230,7 +229,7 @@ irqreturn_t hsu_dma_do_irq(struct hsu_dma_chip *chip, unsigned short nr, | |||
230 | } | 229 | } |
231 | spin_unlock_irqrestore(&hsuc->vchan.lock, flags); | 230 | spin_unlock_irqrestore(&hsuc->vchan.lock, flags); |
232 | 231 | ||
233 | return IRQ_HANDLED; | 232 | return 1; |
234 | } | 233 | } |
235 | EXPORT_SYMBOL_GPL(hsu_dma_do_irq); | 234 | EXPORT_SYMBOL_GPL(hsu_dma_do_irq); |
236 | 235 | ||
diff --git a/drivers/dma/hsu/pci.c b/drivers/dma/hsu/pci.c index 9916058531d9..b51639f045ed 100644 --- a/drivers/dma/hsu/pci.c +++ b/drivers/dma/hsu/pci.c | |||
@@ -29,7 +29,7 @@ static irqreturn_t hsu_pci_irq(int irq, void *dev) | |||
29 | u32 dmaisr; | 29 | u32 dmaisr; |
30 | u32 status; | 30 | u32 status; |
31 | unsigned short i; | 31 | unsigned short i; |
32 | irqreturn_t ret = IRQ_NONE; | 32 | int ret = 0; |
33 | int err; | 33 | int err; |
34 | 34 | ||
35 | dmaisr = readl(chip->regs + HSU_PCI_DMAISR); | 35 | dmaisr = readl(chip->regs + HSU_PCI_DMAISR); |
@@ -37,14 +37,14 @@ static irqreturn_t hsu_pci_irq(int irq, void *dev) | |||
37 | if (dmaisr & 0x1) { | 37 | if (dmaisr & 0x1) { |
38 | err = hsu_dma_get_status(chip, i, &status); | 38 | err = hsu_dma_get_status(chip, i, &status); |
39 | if (err > 0) | 39 | if (err > 0) |
40 | ret |= IRQ_HANDLED; | 40 | ret |= 1; |
41 | else if (err == 0) | 41 | else if (err == 0) |
42 | ret |= hsu_dma_do_irq(chip, i, status); | 42 | ret |= hsu_dma_do_irq(chip, i, status); |
43 | } | 43 | } |
44 | dmaisr >>= 1; | 44 | dmaisr >>= 1; |
45 | } | 45 | } |
46 | 46 | ||
47 | return ret; | 47 | return IRQ_RETVAL(ret); |
48 | } | 48 | } |
49 | 49 | ||
50 | static int hsu_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) | 50 | static int hsu_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
diff --git a/drivers/tty/serial/8250/8250_mid.c b/drivers/tty/serial/8250/8250_mid.c index 339de9cd0866..121a7f2d4697 100644 --- a/drivers/tty/serial/8250/8250_mid.c +++ b/drivers/tty/serial/8250/8250_mid.c | |||
@@ -99,27 +99,27 @@ static int dnv_handle_irq(struct uart_port *p) | |||
99 | struct uart_8250_port *up = up_to_u8250p(p); | 99 | struct uart_8250_port *up = up_to_u8250p(p); |
100 | unsigned int fisr = serial_port_in(p, INTEL_MID_UART_DNV_FISR); | 100 | unsigned int fisr = serial_port_in(p, INTEL_MID_UART_DNV_FISR); |
101 | u32 status; | 101 | u32 status; |
102 | int ret = IRQ_NONE; | 102 | int ret = 0; |
103 | int err; | 103 | int err; |
104 | 104 | ||
105 | if (fisr & BIT(2)) { | 105 | if (fisr & BIT(2)) { |
106 | err = hsu_dma_get_status(&mid->dma_chip, 1, &status); | 106 | err = hsu_dma_get_status(&mid->dma_chip, 1, &status); |
107 | if (err > 0) { | 107 | if (err > 0) { |
108 | serial8250_rx_dma_flush(up); | 108 | serial8250_rx_dma_flush(up); |
109 | ret |= IRQ_HANDLED; | 109 | ret |= 1; |
110 | } else if (err == 0) | 110 | } else if (err == 0) |
111 | ret |= hsu_dma_do_irq(&mid->dma_chip, 1, status); | 111 | ret |= hsu_dma_do_irq(&mid->dma_chip, 1, status); |
112 | } | 112 | } |
113 | if (fisr & BIT(1)) { | 113 | if (fisr & BIT(1)) { |
114 | err = hsu_dma_get_status(&mid->dma_chip, 0, &status); | 114 | err = hsu_dma_get_status(&mid->dma_chip, 0, &status); |
115 | if (err > 0) | 115 | if (err > 0) |
116 | ret |= IRQ_HANDLED; | 116 | ret |= 1; |
117 | else if (err == 0) | 117 | else if (err == 0) |
118 | ret |= hsu_dma_do_irq(&mid->dma_chip, 0, status); | 118 | ret |= hsu_dma_do_irq(&mid->dma_chip, 0, status); |
119 | } | 119 | } |
120 | if (fisr & BIT(0)) | 120 | if (fisr & BIT(0)) |
121 | ret |= serial8250_handle_irq(p, serial_port_in(p, UART_IIR)); | 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 | #define DNV_DMA_CHAN_OFFSET 0x80 | 125 | #define DNV_DMA_CHAN_OFFSET 0x80 |
diff --git a/include/linux/dma/hsu.h b/include/linux/dma/hsu.h index aaff68efba5d..197eec63e501 100644 --- a/include/linux/dma/hsu.h +++ b/include/linux/dma/hsu.h | |||
@@ -41,8 +41,7 @@ struct hsu_dma_chip { | |||
41 | /* Export to the internal users */ | 41 | /* Export to the internal users */ |
42 | int hsu_dma_get_status(struct hsu_dma_chip *chip, unsigned short nr, | 42 | int hsu_dma_get_status(struct hsu_dma_chip *chip, unsigned short nr, |
43 | u32 *status); | 43 | u32 *status); |
44 | irqreturn_t hsu_dma_do_irq(struct hsu_dma_chip *chip, unsigned short nr, | 44 | int hsu_dma_do_irq(struct hsu_dma_chip *chip, unsigned short nr, u32 status); |
45 | u32 status); | ||
46 | 45 | ||
47 | /* Export to the platform drivers */ | 46 | /* Export to the platform drivers */ |
48 | int hsu_dma_probe(struct hsu_dma_chip *chip); | 47 | int hsu_dma_probe(struct hsu_dma_chip *chip); |
@@ -53,10 +52,10 @@ static inline int hsu_dma_get_status(struct hsu_dma_chip *chip, | |||
53 | { | 52 | { |
54 | return 0; | 53 | return 0; |
55 | } | 54 | } |
56 | static inline irqreturn_t hsu_dma_do_irq(struct hsu_dma_chip *chip, | 55 | static inline int hsu_dma_do_irq(struct hsu_dma_chip *chip, unsigned short nr, |
57 | unsigned short nr, u32 status) | 56 | u32 status) |
58 | { | 57 | { |
59 | return IRQ_NONE; | 58 | return 0; |
60 | } | 59 | } |
61 | static inline int hsu_dma_probe(struct hsu_dma_chip *chip) { return -ENODEV; } | 60 | static inline int hsu_dma_probe(struct hsu_dma_chip *chip) { return -ENODEV; } |
62 | static inline int hsu_dma_remove(struct hsu_dma_chip *chip) { return 0; } | 61 | static inline int hsu_dma_remove(struct hsu_dma_chip *chip) { return 0; } |