Skip to content

Commit 9c3d37c

Browse files
yshivakrishnagregkh
authored andcommitted
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>
1 parent d4ef098 commit 9c3d37c

3 files changed

Lines changed: 20 additions & 15 deletions

File tree

‎drivers/misc/mic/card/mic_device.c‎

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ static int mic_shutdown_init(void)
8383
int shutdown_db;
8484

8585
shutdown_db = mic_next_card_db();
86-
shutdown_cookie = mic_request_card_irq(mic_shutdown_isr,
87-
"Shutdown", mdrv, shutdown_db);
86+
shutdown_cookie = mic_request_card_irq(mic_shutdown_isr, NULL,
87+
"Shutdown", mdrv, shutdown_db);
8888
if (IS_ERR(shutdown_cookie))
8989
rc = PTR_ERR(shutdown_cookie);
9090
else
@@ -136,7 +136,8 @@ static void mic_dp_uninit(void)
136136
/**
137137
* mic_request_card_irq - request an irq.
138138
*
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.
140141
* @name: The ASCII name of the callee requesting the irq.
141142
* @data: private data that is returned back when calling the
142143
* function handler.
@@ -149,17 +150,19 @@ static void mic_dp_uninit(void)
149150
* error code.
150151
*
151152
*/
152-
struct mic_irq *mic_request_card_irq(irqreturn_t (*func)(int irq, void *data),
153-
const char *name, void *data, int index)
153+
struct mic_irq *
154+
mic_request_card_irq(irq_handler_t handler,
155+
irq_handler_t thread_fn, const char *name,
156+
void *data, int index)
154157
{
155158
int rc = 0;
156159
unsigned long cookie;
157160
struct mic_driver *mdrv = g_drv;
158161

159-
rc = request_irq(mic_db_to_irq(mdrv, index), func,
160-
0, name, data);
162+
rc = request_threaded_irq(mic_db_to_irq(mdrv, index), handler,
163+
thread_fn, 0, name, data);
161164
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);
163166
goto err;
164167
}
165168
mdrv->irq_info.irq_usage_count[index]++;
@@ -172,9 +175,9 @@ struct mic_irq *mic_request_card_irq(irqreturn_t (*func)(int irq, void *data),
172175
/**
173176
* mic_free_card_irq - free irq.
174177
*
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
176179
* @data: private data specified by the calling function during the
177-
* mic_request_irq
180+
* mic_request_threaded_irq
178181
*
179182
* returns: none.
180183
*/

‎drivers/misc/mic/card/mic_device.h‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <linux/workqueue.h>
3131
#include <linux/io.h>
3232
#include <linux/irqreturn.h>
33+
#include <linux/interrupt.h>
3334

3435
/**
3536
* 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)
116117
int mic_driver_init(struct mic_driver *mdrv);
117118
void mic_driver_uninit(struct mic_driver *mdrv);
118119
int mic_next_card_db(void);
119-
struct mic_irq *mic_request_card_irq(irqreturn_t (*func)(int irq, void *data),
120-
const char *name, void *data, int intr_src);
120+
struct mic_irq *mic_request_card_irq(irq_handler_t handler,
121+
irq_handler_t thread_fn, const char *name, void *data, int intr_src);
121122
void mic_free_card_irq(struct mic_irq *cookie, void *data);
122123
u32 mic_read_spad(struct mic_device *mdev, unsigned int idx);
123124
void mic_send_intr(struct mic_device *mdev, int doorbell);

‎drivers/misc/mic/card/mic_virtio.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ static int mic_add_device(struct mic_device_desc __iomem *d,
417417

418418
virtio_db = mic_next_card_db();
419419
mvdev->virtio_cookie = mic_request_card_irq(mic_virtio_intr_handler,
420-
"virtio intr", mvdev, virtio_db);
420+
NULL, "virtio intr", mvdev, virtio_db);
421421
if (IS_ERR(mvdev->virtio_cookie)) {
422422
ret = PTR_ERR(mvdev->virtio_cookie);
423423
goto kfree;
@@ -606,8 +606,9 @@ int mic_devices_init(struct mic_driver *mdrv)
606606
mic_scan_devices(mdrv, !REMOVE_DEVICES);
607607

608608
config_db = mic_next_card_db();
609-
virtio_config_cookie = mic_request_card_irq(mic_extint_handler,
610-
"virtio_config_intr", mdrv, config_db);
609+
virtio_config_cookie = mic_request_card_irq(mic_extint_handler, NULL,
610+
"virtio_config_intr", mdrv,
611+
config_db);
611612
if (IS_ERR(virtio_config_cookie)) {
612613
rc = PTR_ERR(virtio_config_cookie);
613614
goto exit;

0 commit comments

Comments
 (0)