diff options
author | Siva Yerramreddy <yshivakrishna@gmail.com> | 2014-07-11 17:04:24 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-07-11 21:31:12 -0400 |
commit | 9c3d37c7a1efcb1815ec5cb22f70ca98da24f6b1 (patch) | |
tree | 01e90380e46fac715f19207f911f4eb1ff8bea84 /drivers/misc | |
parent | d4ef098e4cd836b3726781eabe064d7010b6eaa8 (diff) |
misc: mic: add threaded irq support in card driver
Add threaded irq support in mic_request_card_irq which will be used
for virtual devices added on mic bus.
Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Reviewed-by: Nikhil Rao <nikhil.rao@intel.com>
Reviewed-by: Sudeep Dutt <sudeep.dutt@intel.com>
Signed-off-by: Siva Yerramreddy <yshivakrishna@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/mic/card/mic_device.c | 23 | ||||
-rw-r--r-- | drivers/misc/mic/card/mic_device.h | 5 | ||||
-rw-r--r-- | drivers/misc/mic/card/mic_virtio.c | 7 |
3 files changed, 20 insertions, 15 deletions
diff --git a/drivers/misc/mic/card/mic_device.c b/drivers/misc/mic/card/mic_device.c index d0980ff96833..83819eee553b 100644 --- a/drivers/misc/mic/card/mic_device.c +++ b/drivers/misc/mic/card/mic_device.c | |||
@@ -83,8 +83,8 @@ static int mic_shutdown_init(void) | |||
83 | int shutdown_db; | 83 | int shutdown_db; |
84 | 84 | ||
85 | shutdown_db = mic_next_card_db(); | 85 | shutdown_db = mic_next_card_db(); |
86 | shutdown_cookie = mic_request_card_irq(mic_shutdown_isr, | 86 | shutdown_cookie = mic_request_card_irq(mic_shutdown_isr, NULL, |
87 | "Shutdown", mdrv, shutdown_db); | 87 | "Shutdown", mdrv, shutdown_db); |
88 | if (IS_ERR(shutdown_cookie)) | 88 | if (IS_ERR(shutdown_cookie)) |
89 | rc = PTR_ERR(shutdown_cookie); | 89 | rc = PTR_ERR(shutdown_cookie); |
90 | else | 90 | else |
@@ -136,7 +136,8 @@ static void mic_dp_uninit(void) | |||
136 | /** | 136 | /** |
137 | * mic_request_card_irq - request an irq. | 137 | * mic_request_card_irq - request an irq. |
138 | * | 138 | * |
139 | * @func: The callback function that handles the interrupt. | 139 | * @handler: interrupt handler passed to request_threaded_irq. |
140 | * @thread_fn: thread fn. passed to request_threaded_irq. | ||
140 | * @name: The ASCII name of the callee requesting the irq. | 141 | * @name: The ASCII name of the callee requesting the irq. |
141 | * @data: private data that is returned back when calling the | 142 | * @data: private data that is returned back when calling the |
142 | * function handler. | 143 | * function handler. |
@@ -149,17 +150,19 @@ static void mic_dp_uninit(void) | |||
149 | * error code. | 150 | * error code. |
150 | * | 151 | * |
151 | */ | 152 | */ |
152 | struct mic_irq *mic_request_card_irq(irqreturn_t (*func)(int irq, void *data), | 153 | struct mic_irq * |
153 | const char *name, void *data, int index) | 154 | mic_request_card_irq(irq_handler_t handler, |
155 | irq_handler_t thread_fn, const char *name, | ||
156 | void *data, int index) | ||
154 | { | 157 | { |
155 | int rc = 0; | 158 | int rc = 0; |
156 | unsigned long cookie; | 159 | unsigned long cookie; |
157 | struct mic_driver *mdrv = g_drv; | 160 | struct mic_driver *mdrv = g_drv; |
158 | 161 | ||
159 | rc = request_irq(mic_db_to_irq(mdrv, index), func, | 162 | rc = request_threaded_irq(mic_db_to_irq(mdrv, index), handler, |
160 | 0, name, data); | 163 | thread_fn, 0, name, data); |
161 | if (rc) { | 164 | if (rc) { |
162 | dev_err(mdrv->dev, "request_irq failed rc = %d\n", rc); | 165 | dev_err(mdrv->dev, "request_threaded_irq failed rc = %d\n", rc); |
163 | goto err; | 166 | goto err; |
164 | } | 167 | } |
165 | mdrv->irq_info.irq_usage_count[index]++; | 168 | mdrv->irq_info.irq_usage_count[index]++; |
@@ -172,9 +175,9 @@ err: | |||
172 | /** | 175 | /** |
173 | * mic_free_card_irq - free irq. | 176 | * mic_free_card_irq - free irq. |
174 | * | 177 | * |
175 | * @cookie: cookie obtained during a successful call to mic_request_irq | 178 | * @cookie: cookie obtained during a successful call to mic_request_threaded_irq |
176 | * @data: private data specified by the calling function during the | 179 | * @data: private data specified by the calling function during the |
177 | * mic_request_irq | 180 | * mic_request_threaded_irq |
178 | * | 181 | * |
179 | * returns: none. | 182 | * returns: none. |
180 | */ | 183 | */ |
diff --git a/drivers/misc/mic/card/mic_device.h b/drivers/misc/mic/card/mic_device.h index 306f502be95e..e12a0c2ddb3d 100644 --- a/drivers/misc/mic/card/mic_device.h +++ b/drivers/misc/mic/card/mic_device.h | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/workqueue.h> | 30 | #include <linux/workqueue.h> |
31 | #include <linux/io.h> | 31 | #include <linux/io.h> |
32 | #include <linux/irqreturn.h> | 32 | #include <linux/irqreturn.h> |
33 | #include <linux/interrupt.h> | ||
33 | 34 | ||
34 | /** | 35 | /** |
35 | * struct mic_intr_info - Contains h/w specific interrupt sources info | 36 | * struct mic_intr_info - Contains h/w specific interrupt sources info |
@@ -116,8 +117,8 @@ mic_mmio_write(struct mic_mw *mw, u32 val, u32 offset) | |||
116 | int mic_driver_init(struct mic_driver *mdrv); | 117 | int mic_driver_init(struct mic_driver *mdrv); |
117 | void mic_driver_uninit(struct mic_driver *mdrv); | 118 | void mic_driver_uninit(struct mic_driver *mdrv); |
118 | int mic_next_card_db(void); | 119 | int mic_next_card_db(void); |
119 | struct mic_irq *mic_request_card_irq(irqreturn_t (*func)(int irq, void *data), | 120 | struct mic_irq *mic_request_card_irq(irq_handler_t handler, |
120 | const char *name, void *data, int intr_src); | 121 | irq_handler_t thread_fn, const char *name, void *data, int intr_src); |
121 | void mic_free_card_irq(struct mic_irq *cookie, void *data); | 122 | void mic_free_card_irq(struct mic_irq *cookie, void *data); |
122 | u32 mic_read_spad(struct mic_device *mdev, unsigned int idx); | 123 | u32 mic_read_spad(struct mic_device *mdev, unsigned int idx); |
123 | void mic_send_intr(struct mic_device *mdev, int doorbell); | 124 | void mic_send_intr(struct mic_device *mdev, int doorbell); |
diff --git a/drivers/misc/mic/card/mic_virtio.c b/drivers/misc/mic/card/mic_virtio.c index 653799b96bfa..f14b60080c21 100644 --- a/drivers/misc/mic/card/mic_virtio.c +++ b/drivers/misc/mic/card/mic_virtio.c | |||
@@ -417,7 +417,7 @@ static int mic_add_device(struct mic_device_desc __iomem *d, | |||
417 | 417 | ||
418 | virtio_db = mic_next_card_db(); | 418 | virtio_db = mic_next_card_db(); |
419 | mvdev->virtio_cookie = mic_request_card_irq(mic_virtio_intr_handler, | 419 | mvdev->virtio_cookie = mic_request_card_irq(mic_virtio_intr_handler, |
420 | "virtio intr", mvdev, virtio_db); | 420 | NULL, "virtio intr", mvdev, virtio_db); |
421 | if (IS_ERR(mvdev->virtio_cookie)) { | 421 | if (IS_ERR(mvdev->virtio_cookie)) { |
422 | ret = PTR_ERR(mvdev->virtio_cookie); | 422 | ret = PTR_ERR(mvdev->virtio_cookie); |
423 | goto kfree; | 423 | goto kfree; |
@@ -606,8 +606,9 @@ int mic_devices_init(struct mic_driver *mdrv) | |||
606 | mic_scan_devices(mdrv, !REMOVE_DEVICES); | 606 | mic_scan_devices(mdrv, !REMOVE_DEVICES); |
607 | 607 | ||
608 | config_db = mic_next_card_db(); | 608 | config_db = mic_next_card_db(); |
609 | virtio_config_cookie = mic_request_card_irq(mic_extint_handler, | 609 | virtio_config_cookie = mic_request_card_irq(mic_extint_handler, NULL, |
610 | "virtio_config_intr", mdrv, config_db); | 610 | "virtio_config_intr", mdrv, |
611 | config_db); | ||
611 | if (IS_ERR(virtio_config_cookie)) { | 612 | if (IS_ERR(virtio_config_cookie)) { |
612 | rc = PTR_ERR(virtio_config_cookie); | 613 | rc = PTR_ERR(virtio_config_cookie); |
613 | goto exit; | 614 | goto exit; |