size_t count, loff_t *ppos,
struct ag71xx *ag,
struct ag71xx_ring *ring,
- unsigned ring_size,
unsigned desc_reg)
{
char *buf;
u32 desc_hw;
int i;
- buflen = (ring_size * DESC_PRINT_LEN);
+ buflen = (ring->size * DESC_PRINT_LEN);
buf = kmalloc(buflen, GFP_KERNEL);
if (!buf)
return -ENOMEM;
spin_lock_irqsave(&ag->lock, flags);
- curr = (ring->curr % ring_size);
- dirty = (ring->dirty % ring_size);
+ curr = (ring->curr % ring->size);
+ dirty = (ring->dirty % ring->size);
desc_hw = ag71xx_rr(ag, desc_reg);
- for (i = 0; i < ring_size; i++) {
+ for (i = 0; i < ring->size; i++) {
struct ag71xx_buf *ab = &ring->buf[i];
+ u32 desc_dma = ((u32) ring->descs_dma) + i * ring->desc_size;
len += snprintf(buf + len, buflen - len,
"%3d %c%c%c %08x %08x %08x %08x %c %10lu\n",
i,
(i == curr) ? 'C' : ' ',
(i == dirty) ? 'D' : ' ',
- (desc_hw == ab->desc_dma) ? 'H' : ' ',
- ab->desc_dma,
+ (desc_hw == desc_dma) ? 'H' : ' ',
+ desc_dma,
ab->desc->next,
ab->desc->data,
ab->desc->ctrl,
struct ag71xx *ag = file->private_data;
return read_file_ring(file, user_buf, count, ppos, ag, &ag->tx_ring,
- AG71XX_TX_RING_SIZE, AG71XX_REG_TX_DESC);
+ AG71XX_REG_TX_DESC);
}
static const struct file_operations ag71xx_fops_tx_ring = {
struct ag71xx *ag = file->private_data;
return read_file_ring(file, user_buf, count, ppos, ag, &ag->rx_ring,
- AG71XX_RX_RING_SIZE, AG71XX_REG_RX_DESC);
+ AG71XX_REG_RX_DESC);
}
static const struct file_operations ag71xx_fops_rx_ring = {