struct dmasg *desc, temp_desc;
unsigned long flags;
- BUG_ON(sport->dummy_rx_desc == NULL);
- BUG_ON(sport->curr_rx_desc == sport->dummy_rx_desc);
+ if (WARN_ON(!sport->dummy_rx_desc) ||
+ WARN_ON(sport->curr_rx_desc == sport->dummy_rx_desc))
+ return -EINVAL;
/* Maybe the dummy buffer descriptor ring is damaged */
sport->dummy_rx_desc->next_desc_addr = sport->dummy_rx_desc + 1;
return -EBUSY;
if (sport->tx_run) {
/* tx is running, rx is not running */
- BUG_ON(sport->dma_rx_desc == NULL);
- BUG_ON(sport->curr_rx_desc != sport->dummy_rx_desc);
+ if (WARN_ON(!sport->dma_rx_desc) ||
+ WARN_ON(sport->curr_rx_desc != sport->dummy_rx_desc))
+ return -EINVAL;
local_irq_save(flags);
while ((get_dma_curr_desc_ptr(sport->dma_rx_chan) -
sizeof(struct dmasg)) != sport->dummy_rx_desc)
struct dmasg *desc, temp_desc;
unsigned long flags;
- BUG_ON(sport->dummy_tx_desc == NULL);
- BUG_ON(sport->curr_tx_desc == sport->dummy_tx_desc);
+ if (WARN_ON(!sport->dummy_tx_desc) ||
+ WARN_ON(sport->curr_tx_desc == sport->dummy_tx_desc))
+ return -EINVAL;
sport->dummy_tx_desc->next_desc_addr = sport->dummy_tx_desc + 1;
if (sport->tx_run)
return -EBUSY;
if (sport->rx_run) {
- BUG_ON(sport->dma_tx_desc == NULL);
- BUG_ON(sport->curr_tx_desc != sport->dummy_tx_desc);
+ if (WARN_ON(!sport->dma_tx_desc) ||
+ WARN_ON(sport->curr_tx_desc != sport->dummy_tx_desc))
+ return -EINVAL;
/* Hook the normal buffer descriptor */
local_irq_save(flags);
while ((get_dma_curr_desc_ptr(sport->dma_tx_chan) -
int sport_set_rx_callback(struct sport_device *sport,
void (*rx_callback)(void *), void *rx_data)
{
- BUG_ON(rx_callback == NULL);
+ if (WARN_ON(!rx_callback))
+ return -EINVAL;
sport->rx_callback = rx_callback;
sport->rx_data = rx_data;
int sport_set_tx_callback(struct sport_device *sport,
void (*tx_callback)(void *), void *tx_data)
{
- BUG_ON(tx_callback == NULL);
+ if (WARN_ON(!tx_callback))
+ return -EINVAL;
sport->tx_callback = tx_callback;
sport->tx_data = tx_data;
int sport_set_err_callback(struct sport_device *sport,
void (*err_callback)(void *), void *err_data)
{
- BUG_ON(err_callback == NULL);
+ if (WARN_ON(!err_callback))
+ return -EINVAL;
sport->err_callback = err_callback;
sport->err_data = err_data;
param.wdsize = wdsize;
param.dummy_count = dummy_count;
- BUG_ON(param.wdsize == 0 || param.dummy_count == 0);
+ if (WARN_ON(param.wdsize == 0 || param.dummy_count == 0))
+ return NULL;
ret = sport_config_pdev(pdev, ¶m);
if (ret)