Commit deed75ed authored by Andy Walls's avatar Andy Walls Committed by Mauro Carvalho Chehab

V4L/DVB (11615): cx18: Rename the work queue to "in_work_queue"

Rename the work queue to "in_work_queue" to indicate it is handling
incoming mailbox commands.  This is preparation for adding a work queue
for handling deferrable outgoing mailbox commands.
Signed-off-by: default avatarAndy Walls <awalls@radix.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 56600093
...@@ -562,16 +562,18 @@ static int __devinit cx18_init_struct1(struct cx18 *cx) ...@@ -562,16 +562,18 @@ static int __devinit cx18_init_struct1(struct cx18 *cx)
mutex_init(&cx->epu2apu_mb_lock); mutex_init(&cx->epu2apu_mb_lock);
mutex_init(&cx->epu2cpu_mb_lock); mutex_init(&cx->epu2cpu_mb_lock);
cx->work_queue = create_singlethread_workqueue(cx->v4l2_dev.name); snprintf(cx->in_workq_name, sizeof(cx->in_workq_name), "%s-in",
if (cx->work_queue == NULL) { cx->v4l2_dev.name);
CX18_ERR("Unable to create work hander thread\n"); cx->in_work_queue = create_singlethread_workqueue(cx->in_workq_name);
if (cx->in_work_queue == NULL) {
CX18_ERR("Unable to create incoming mailbox handler thread\n");
return -ENOMEM; return -ENOMEM;
} }
for (i = 0; i < CX18_MAX_EPU_WORK_ORDERS; i++) { for (i = 0; i < CX18_MAX_IN_WORK_ORDERS; i++) {
cx->epu_work_order[i].cx = cx; cx->in_work_order[i].cx = cx;
cx->epu_work_order[i].str = cx->epu_debug_str; cx->in_work_order[i].str = cx->epu_debug_str;
INIT_WORK(&cx->epu_work_order[i].work, cx18_epu_work_handler); INIT_WORK(&cx->in_work_order[i].work, cx18_in_work_handler);
} }
/* start counting open_id at 1 */ /* start counting open_id at 1 */
...@@ -944,7 +946,7 @@ static int __devinit cx18_probe(struct pci_dev *pci_dev, ...@@ -944,7 +946,7 @@ static int __devinit cx18_probe(struct pci_dev *pci_dev,
free_mem: free_mem:
release_mem_region(cx->base_addr, CX18_MEM_SIZE); release_mem_region(cx->base_addr, CX18_MEM_SIZE);
free_workqueue: free_workqueue:
destroy_workqueue(cx->work_queue); destroy_workqueue(cx->in_work_queue);
err: err:
if (retval == 0) if (retval == 0)
retval = -ENODEV; retval = -ENODEV;
...@@ -1053,11 +1055,11 @@ int cx18_init_on_first_open(struct cx18 *cx) ...@@ -1053,11 +1055,11 @@ int cx18_init_on_first_open(struct cx18 *cx)
return 0; return 0;
} }
static void cx18_cancel_epu_work_orders(struct cx18 *cx) static void cx18_cancel_in_work_orders(struct cx18 *cx)
{ {
int i; int i;
for (i = 0; i < CX18_MAX_EPU_WORK_ORDERS; i++) for (i = 0; i < CX18_MAX_IN_WORK_ORDERS; i++)
cancel_work_sync(&cx->epu_work_order[i].work); cancel_work_sync(&cx->in_work_order[i].work);
} }
static void cx18_remove(struct pci_dev *pci_dev) static void cx18_remove(struct pci_dev *pci_dev)
...@@ -1079,9 +1081,9 @@ static void cx18_remove(struct pci_dev *pci_dev) ...@@ -1079,9 +1081,9 @@ static void cx18_remove(struct pci_dev *pci_dev)
cx18_halt_firmware(cx); cx18_halt_firmware(cx);
cx18_cancel_epu_work_orders(cx); cx18_cancel_in_work_orders(cx);
destroy_workqueue(cx->work_queue); destroy_workqueue(cx->in_work_queue);
cx18_streams_cleanup(cx, 1); cx18_streams_cleanup(cx, 1);
......
...@@ -305,7 +305,7 @@ struct cx18_scb; /* forward reference */ ...@@ -305,7 +305,7 @@ struct cx18_scb; /* forward reference */
#define CX18_MAX_MDL_ACKS 2 #define CX18_MAX_MDL_ACKS 2
#define CX18_MAX_EPU_WORK_ORDERS (CX18_MAX_FW_MDLS_PER_STREAM + 7) #define CX18_MAX_IN_WORK_ORDERS (CX18_MAX_FW_MDLS_PER_STREAM + 7)
/* CPU_DE_RELEASE_MDL can burst CX18_MAX_FW_MDLS_PER_STREAM orders in a group */ /* CPU_DE_RELEASE_MDL can burst CX18_MAX_FW_MDLS_PER_STREAM orders in a group */
#define CX18_F_EWO_MB_STALE_UPON_RECEIPT 0x1 #define CX18_F_EWO_MB_STALE_UPON_RECEIPT 0x1
...@@ -313,7 +313,7 @@ struct cx18_scb; /* forward reference */ ...@@ -313,7 +313,7 @@ struct cx18_scb; /* forward reference */
#define CX18_F_EWO_MB_STALE \ #define CX18_F_EWO_MB_STALE \
(CX18_F_EWO_MB_STALE_UPON_RECEIPT | CX18_F_EWO_MB_STALE_WHILE_PROC) (CX18_F_EWO_MB_STALE_UPON_RECEIPT | CX18_F_EWO_MB_STALE_WHILE_PROC)
struct cx18_epu_work_order { struct cx18_in_work_order {
struct work_struct work; struct work_struct work;
atomic_t pending; atomic_t pending;
struct cx18 *cx; struct cx18 *cx;
...@@ -568,8 +568,9 @@ struct cx18 { ...@@ -568,8 +568,9 @@ struct cx18 {
u32 sw2_irq_mask; u32 sw2_irq_mask;
u32 hw2_irq_mask; u32 hw2_irq_mask;
struct workqueue_struct *work_queue; struct workqueue_struct *in_work_queue;
struct cx18_epu_work_order epu_work_order[CX18_MAX_EPU_WORK_ORDERS]; char in_workq_name[11]; /* "cx18-NN-in" */
struct cx18_in_work_order in_work_order[CX18_MAX_IN_WORK_ORDERS];
char epu_debug_str[256]; /* CX18_EPU_DEBUG is rare: use shared space */ char epu_debug_str[256]; /* CX18_EPU_DEBUG is rare: use shared space */
/* i2c */ /* i2c */
......
...@@ -131,7 +131,7 @@ static void dump_mb(struct cx18 *cx, struct cx18_mailbox *mb, char *name) ...@@ -131,7 +131,7 @@ static void dump_mb(struct cx18 *cx, struct cx18_mailbox *mb, char *name)
* Functions that run in a work_queue work handling context * Functions that run in a work_queue work handling context
*/ */
static void epu_dma_done(struct cx18 *cx, struct cx18_epu_work_order *order) static void epu_dma_done(struct cx18 *cx, struct cx18_in_work_order *order)
{ {
u32 handle, mdl_ack_count, id; u32 handle, mdl_ack_count, id;
struct cx18_mailbox *mb; struct cx18_mailbox *mb;
...@@ -213,7 +213,7 @@ static void epu_dma_done(struct cx18 *cx, struct cx18_epu_work_order *order) ...@@ -213,7 +213,7 @@ static void epu_dma_done(struct cx18 *cx, struct cx18_epu_work_order *order)
wake_up(&s->waitq); wake_up(&s->waitq);
} }
static void epu_debug(struct cx18 *cx, struct cx18_epu_work_order *order) static void epu_debug(struct cx18 *cx, struct cx18_in_work_order *order)
{ {
char *p; char *p;
char *str = order->str; char *str = order->str;
...@@ -224,7 +224,7 @@ static void epu_debug(struct cx18 *cx, struct cx18_epu_work_order *order) ...@@ -224,7 +224,7 @@ static void epu_debug(struct cx18 *cx, struct cx18_epu_work_order *order)
CX18_INFO("FW version: %s\n", p - 1); CX18_INFO("FW version: %s\n", p - 1);
} }
static void epu_cmd(struct cx18 *cx, struct cx18_epu_work_order *order) static void epu_cmd(struct cx18 *cx, struct cx18_in_work_order *order)
{ {
switch (order->rpu) { switch (order->rpu) {
case CPU: case CPU:
...@@ -253,18 +253,18 @@ static void epu_cmd(struct cx18 *cx, struct cx18_epu_work_order *order) ...@@ -253,18 +253,18 @@ static void epu_cmd(struct cx18 *cx, struct cx18_epu_work_order *order)
} }
static static
void free_epu_work_order(struct cx18 *cx, struct cx18_epu_work_order *order) void free_in_work_order(struct cx18 *cx, struct cx18_in_work_order *order)
{ {
atomic_set(&order->pending, 0); atomic_set(&order->pending, 0);
} }
void cx18_epu_work_handler(struct work_struct *work) void cx18_in_work_handler(struct work_struct *work)
{ {
struct cx18_epu_work_order *order = struct cx18_in_work_order *order =
container_of(work, struct cx18_epu_work_order, work); container_of(work, struct cx18_in_work_order, work);
struct cx18 *cx = order->cx; struct cx18 *cx = order->cx;
epu_cmd(cx, order); epu_cmd(cx, order);
free_epu_work_order(cx, order); free_in_work_order(cx, order);
} }
...@@ -272,7 +272,7 @@ void cx18_epu_work_handler(struct work_struct *work) ...@@ -272,7 +272,7 @@ void cx18_epu_work_handler(struct work_struct *work)
* Functions that run in an interrupt handling context * Functions that run in an interrupt handling context
*/ */
static void mb_ack_irq(struct cx18 *cx, struct cx18_epu_work_order *order) static void mb_ack_irq(struct cx18 *cx, struct cx18_in_work_order *order)
{ {
struct cx18_mailbox __iomem *ack_mb; struct cx18_mailbox __iomem *ack_mb;
u32 ack_irq, req; u32 ack_irq, req;
...@@ -308,7 +308,7 @@ static void mb_ack_irq(struct cx18 *cx, struct cx18_epu_work_order *order) ...@@ -308,7 +308,7 @@ static void mb_ack_irq(struct cx18 *cx, struct cx18_epu_work_order *order)
return; return;
} }
static int epu_dma_done_irq(struct cx18 *cx, struct cx18_epu_work_order *order) static int epu_dma_done_irq(struct cx18 *cx, struct cx18_in_work_order *order)
{ {
u32 handle, mdl_ack_offset, mdl_ack_count; u32 handle, mdl_ack_offset, mdl_ack_count;
struct cx18_mailbox *mb; struct cx18_mailbox *mb;
...@@ -334,7 +334,7 @@ static int epu_dma_done_irq(struct cx18 *cx, struct cx18_epu_work_order *order) ...@@ -334,7 +334,7 @@ static int epu_dma_done_irq(struct cx18 *cx, struct cx18_epu_work_order *order)
} }
static static
int epu_debug_irq(struct cx18 *cx, struct cx18_epu_work_order *order) int epu_debug_irq(struct cx18 *cx, struct cx18_in_work_order *order)
{ {
u32 str_offset; u32 str_offset;
char *str = order->str; char *str = order->str;
...@@ -355,7 +355,7 @@ int epu_debug_irq(struct cx18 *cx, struct cx18_epu_work_order *order) ...@@ -355,7 +355,7 @@ int epu_debug_irq(struct cx18 *cx, struct cx18_epu_work_order *order)
} }
static inline static inline
int epu_cmd_irq(struct cx18 *cx, struct cx18_epu_work_order *order) int epu_cmd_irq(struct cx18 *cx, struct cx18_in_work_order *order)
{ {
int ret = -1; int ret = -1;
...@@ -387,12 +387,12 @@ int epu_cmd_irq(struct cx18 *cx, struct cx18_epu_work_order *order) ...@@ -387,12 +387,12 @@ int epu_cmd_irq(struct cx18 *cx, struct cx18_epu_work_order *order)
} }
static inline static inline
struct cx18_epu_work_order *alloc_epu_work_order_irq(struct cx18 *cx) struct cx18_in_work_order *alloc_in_work_order_irq(struct cx18 *cx)
{ {
int i; int i;
struct cx18_epu_work_order *order = NULL; struct cx18_in_work_order *order = NULL;
for (i = 0; i < CX18_MAX_EPU_WORK_ORDERS; i++) { for (i = 0; i < CX18_MAX_IN_WORK_ORDERS; i++) {
/* /*
* We only need "pending" atomic to inspect its contents, * We only need "pending" atomic to inspect its contents,
* and need not do a check and set because: * and need not do a check and set because:
...@@ -401,8 +401,8 @@ struct cx18_epu_work_order *alloc_epu_work_order_irq(struct cx18 *cx) ...@@ -401,8 +401,8 @@ struct cx18_epu_work_order *alloc_epu_work_order_irq(struct cx18 *cx)
* 2. "pending" is only set here, and we're serialized because * 2. "pending" is only set here, and we're serialized because
* we're called in an IRQ handler context. * we're called in an IRQ handler context.
*/ */
if (atomic_read(&cx->epu_work_order[i].pending) == 0) { if (atomic_read(&cx->in_work_order[i].pending) == 0) {
order = &cx->epu_work_order[i]; order = &cx->in_work_order[i];
atomic_set(&order->pending, 1); atomic_set(&order->pending, 1);
break; break;
} }
...@@ -414,7 +414,7 @@ void cx18_api_epu_cmd_irq(struct cx18 *cx, int rpu) ...@@ -414,7 +414,7 @@ void cx18_api_epu_cmd_irq(struct cx18 *cx, int rpu)
{ {
struct cx18_mailbox __iomem *mb; struct cx18_mailbox __iomem *mb;
struct cx18_mailbox *order_mb; struct cx18_mailbox *order_mb;
struct cx18_epu_work_order *order; struct cx18_in_work_order *order;
int submit; int submit;
switch (rpu) { switch (rpu) {
...@@ -428,7 +428,7 @@ void cx18_api_epu_cmd_irq(struct cx18 *cx, int rpu) ...@@ -428,7 +428,7 @@ void cx18_api_epu_cmd_irq(struct cx18 *cx, int rpu)
return; return;
} }
order = alloc_epu_work_order_irq(cx); order = alloc_in_work_order_irq(cx);
if (order == NULL) { if (order == NULL) {
CX18_WARN("Unable to find blank work order form to schedule " CX18_WARN("Unable to find blank work order form to schedule "
"incoming mailbox command processing\n"); "incoming mailbox command processing\n");
...@@ -461,7 +461,7 @@ void cx18_api_epu_cmd_irq(struct cx18 *cx, int rpu) ...@@ -461,7 +461,7 @@ void cx18_api_epu_cmd_irq(struct cx18 *cx, int rpu)
*/ */
submit = epu_cmd_irq(cx, order); submit = epu_cmd_irq(cx, order);
if (submit > 0) { if (submit > 0) {
queue_work(cx->work_queue, &order->work); queue_work(cx->in_work_queue, &order->work);
} }
} }
......
...@@ -95,6 +95,6 @@ int cx18_api_func(void *priv, u32 cmd, int in, int out, ...@@ -95,6 +95,6 @@ int cx18_api_func(void *priv, u32 cmd, int in, int out,
void cx18_api_epu_cmd_irq(struct cx18 *cx, int rpu); void cx18_api_epu_cmd_irq(struct cx18 *cx, int rpu);
void cx18_epu_work_handler(struct work_struct *work); void cx18_in_work_handler(struct work_struct *work);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment