aboutsummaryrefslogtreecommitdiff
path: root/sound/pci/mixart/mixart_core.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/mixart/mixart_core.c')
-rw-r--r--sound/pci/mixart/mixart_core.c69
1 files changed, 47 insertions, 22 deletions
diff --git a/sound/pci/mixart/mixart_core.c b/sound/pci/mixart/mixart_core.c
index 785085e4835..71f4bdcc405 100644
--- a/sound/pci/mixart/mixart_core.c
+++ b/sound/pci/mixart/mixart_core.c
@@ -22,6 +22,7 @@
#include <linux/interrupt.h>
#include <linux/mutex.h>
+#include <linux/pci.h>
#include <asm/io.h>
#include <sound/core.h>
@@ -56,8 +57,10 @@ static int retrieve_msg_frame(struct mixart_mgr *mgr, u32 *msg_frame)
if (tailptr == headptr)
return 0; /* no message posted */
- snd_assert( tailptr >= MSG_OUTBOUND_POST_STACK, return 0); /* error */
- snd_assert( tailptr < (MSG_OUTBOUND_POST_STACK+MSG_BOUND_STACK_SIZE), return 0); /* error */
+ if (tailptr < MSG_OUTBOUND_POST_STACK)
+ return 0; /* error */
+ if (tailptr >= MSG_OUTBOUND_POST_STACK + MSG_BOUND_STACK_SIZE)
+ return 0; /* error */
*msg_frame = readl_be(MIXART_MEM(mgr, tailptr));
@@ -92,7 +95,8 @@ static int get_msg(struct mixart_mgr *mgr, struct mixart_msg *resp,
if( (size < MSG_DESCRIPTOR_SIZE) || (resp->size < (size - MSG_DESCRIPTOR_SIZE))) {
err = -EINVAL;
- snd_printk(KERN_ERR "problem with response size = %d\n", size);
+ dev_err(&mgr->pci->dev,
+ "problem with response size = %d\n", size);
goto _clean_exit;
}
size -= MSG_DESCRIPTOR_SIZE;
@@ -149,7 +153,8 @@ static int send_msg( struct mixart_mgr *mgr,
u32 msg_frame_address;
int err, i;
- snd_assert(msg->size % 4 == 0, return -EINVAL);
+ if (snd_BUG_ON(msg->size % 4))
+ return -EINVAL;
err = 0;
@@ -158,7 +163,7 @@ static int send_msg( struct mixart_mgr *mgr,
headptr = readl_be(MIXART_MEM(mgr, MSG_INBOUND_FREE_HEAD));
if (tailptr == headptr) {
- snd_printk(KERN_ERR "error: no message frame available\n");
+ dev_err(&mgr->pci->dev, "error: no message frame available\n");
return -EBUSY;
}
@@ -262,7 +267,8 @@ int snd_mixart_send_msg(struct mixart_mgr *mgr, struct mixart_msg *request, int
if (! timeout) {
/* error - no ack */
mutex_unlock(&mgr->msg_mutex);
- snd_printk(KERN_ERR "error: no reponse on msg %x\n", msg_frame);
+ dev_err(&mgr->pci->dev,
+ "error: no response on msg %x\n", msg_frame);
return -EIO;
}
@@ -275,7 +281,7 @@ int snd_mixart_send_msg(struct mixart_mgr *mgr, struct mixart_msg *request, int
err = get_msg(mgr, &resp, msg_frame);
if( request->message_id != resp.message_id )
- snd_printk(KERN_ERR "REPONSE ERROR!\n");
+ dev_err(&mgr->pci->dev, "RESPONSE ERROR!\n");
mutex_unlock(&mgr->msg_mutex);
return err;
@@ -289,9 +295,12 @@ int snd_mixart_send_msg_wait_notif(struct mixart_mgr *mgr,
wait_queue_t wait;
long timeout;
- snd_assert(notif_event != 0, return -EINVAL);
- snd_assert((notif_event & MSG_TYPE_MASK) == MSG_TYPE_NOTIFY, return -EINVAL);
- snd_assert((notif_event & MSG_CANCEL_NOTIFY_MASK) == 0, return -EINVAL);
+ if (snd_BUG_ON(!notif_event))
+ return -EINVAL;
+ if (snd_BUG_ON((notif_event & MSG_TYPE_MASK) != MSG_TYPE_NOTIFY))
+ return -EINVAL;
+ if (snd_BUG_ON(notif_event & MSG_CANCEL_NOTIFY_MASK))
+ return -EINVAL;
mutex_lock(&mgr->msg_mutex);
@@ -315,7 +324,8 @@ int snd_mixart_send_msg_wait_notif(struct mixart_mgr *mgr,
if (! timeout) {
/* error - no ack */
mutex_unlock(&mgr->msg_mutex);
- snd_printk(KERN_ERR "error: notification %x not received\n", notif_event);
+ dev_err(&mgr->pci->dev,
+ "error: notification %x not received\n", notif_event);
return -EIO;
}
@@ -372,7 +382,9 @@ void snd_mixart_msg_tasklet(unsigned long arg)
resp.size = sizeof(mixart_msg_data);
err = get_msg(mgr, &resp, addr);
if( err < 0 ) {
- snd_printk(KERN_ERR "tasklet: error(%d) reading mf %x\n", err, msg);
+ dev_err(&mgr->pci->dev,
+ "tasklet: error(%d) reading mf %x\n",
+ err, msg);
break;
}
@@ -382,10 +394,13 @@ void snd_mixart_msg_tasklet(unsigned long arg)
case MSG_STREAM_STOP_INPUT_STAGE_PACKET:
case MSG_STREAM_STOP_OUTPUT_STAGE_PACKET:
if(mixart_msg_data[0])
- snd_printk(KERN_ERR "tasklet : error MSG_STREAM_ST***_***PUT_STAGE_PACKET status=%x\n", mixart_msg_data[0]);
+ dev_err(&mgr->pci->dev,
+ "tasklet : error MSG_STREAM_ST***_***PUT_STAGE_PACKET status=%x\n",
+ mixart_msg_data[0]);
break;
default:
- snd_printdd("tasklet received mf(%x) : msg_id(%x) uid(%x, %x) size(%zd)\n",
+ dev_dbg(&mgr->pci->dev,
+ "tasklet received mf(%x) : msg_id(%x) uid(%x, %x) size(%zd)\n",
msg, resp.message_id, resp.uid.object_id, resp.uid.desc, resp.size);
break;
}
@@ -395,7 +410,9 @@ void snd_mixart_msg_tasklet(unsigned long arg)
case MSG_TYPE_COMMAND:
/* get_msg() necessary */
default:
- snd_printk(KERN_ERR "tasklet doesn't know what to do with message %x\n", msg);
+ dev_err(&mgr->pci->dev,
+ "tasklet doesn't know what to do with message %x\n",
+ msg);
} /* switch type */
/* decrement counter */
@@ -445,7 +462,9 @@ irqreturn_t snd_mixart_interrupt(int irq, void *dev_id)
resp.size = sizeof(mixart_msg_data);
err = get_msg(mgr, &resp, msg & ~MSG_TYPE_MASK);
if( err < 0 ) {
- snd_printk(KERN_ERR "interrupt: error(%d) reading mf %x\n", err, msg);
+ dev_err(&mgr->pci->dev,
+ "interrupt: error(%d) reading mf %x\n",
+ err, msg);
break;
}
@@ -466,7 +485,8 @@ irqreturn_t snd_mixart_interrupt(int irq, void *dev_id)
struct mixart_stream *stream;
if ((chip_number >= mgr->num_cards) || (pcm_number >= MIXART_PCM_TOTAL) || (sub_number >= MIXART_PLAYBACK_STREAMS)) {
- snd_printk(KERN_ERR "error MSG_SERVICES_TIMER_NOTIFY buffer_id (%x) pos(%d)\n",
+ dev_err(&mgr->pci->dev,
+ "error MSG_SERVICES_TIMER_NOTIFY buffer_id (%x) pos(%d)\n",
buffer_id, notify->streams[i].sample_pos_low_part);
break;
}
@@ -518,18 +538,22 @@ irqreturn_t snd_mixart_interrupt(int irq, void *dev_id)
}
#endif
((char*)mixart_msg_data)[resp.size - 1] = 0;
- snd_printdd("MIXART TRACE : %s\n", (char*)mixart_msg_data);
+ dev_dbg(&mgr->pci->dev,
+ "MIXART TRACE : %s\n",
+ (char *)mixart_msg_data);
}
break;
}
- snd_printdd("command %x not handled\n", resp.message_id);
+ dev_dbg(&mgr->pci->dev, "command %x not handled\n",
+ resp.message_id);
break;
case MSG_TYPE_NOTIFY:
if(msg & MSG_CANCEL_NOTIFY_MASK) {
msg &= ~MSG_CANCEL_NOTIFY_MASK;
- snd_printk(KERN_ERR "canceled notification %x !\n", msg);
+ dev_err(&mgr->pci->dev,
+ "canceled notification %x !\n", msg);
}
/* no break, continue ! */
case MSG_TYPE_ANSWER:
@@ -544,13 +568,14 @@ irqreturn_t snd_mixart_interrupt(int irq, void *dev_id)
mgr->msg_fifo[mgr->msg_fifo_writeptr] = msg;
mgr->msg_fifo_writeptr++;
mgr->msg_fifo_writeptr %= MSG_FIFO_SIZE;
- tasklet_hi_schedule(&mgr->msg_taskq);
+ tasklet_schedule(&mgr->msg_taskq);
}
spin_unlock(&mgr->msg_lock);
break;
case MSG_TYPE_REQUEST:
default:
- snd_printdd("interrupt received request %x\n", msg);
+ dev_dbg(&mgr->pci->dev,
+ "interrupt received request %x\n", msg);
/* TODO : are there things to do here ? */
break;
} /* switch on msg type */