summaryrefslogtreecommitdiff
path: root/target/linux
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2016-02-11 22:48:36 +0000
committerFelix Fietkau <nbd@openwrt.org>2016-02-11 22:48:36 +0000
commit376e3ade79608221d394bee3e2b61c01eb1b8bdf (patch)
tree93e1d87e1532fa7e8ebded0b078bb9dfbb94f31c /target/linux
parent37dd95b7728fe11ffc8c06c7ec95287f372822e6 (diff)
downloadmtk-20170518-376e3ade79608221d394bee3e2b61c01eb1b8bdf.zip
mtk-20170518-376e3ade79608221d394bee3e2b61c01eb1b8bdf.tar.gz
mtk-20170518-376e3ade79608221d394bee3e2b61c01eb1b8bdf.tar.bz2
ag71xx: fix build error with debugfs code
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 48695
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_debugfs.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_debugfs.c b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_debugfs.c
index c480121..c86803c 100644
--- a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_debugfs.c
+++ b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_debugfs.c
@@ -157,6 +157,8 @@ static ssize_t read_file_ring(struct file *file, char __user *user_buf,
struct ag71xx_ring *ring,
unsigned desc_reg)
{
+ int ring_size = BIT(ring->order);
+ int ring_mask = ring_size - 1;
char *buf;
unsigned int buflen;
unsigned int len = 0;
@@ -167,7 +169,7 @@ static ssize_t read_file_ring(struct file *file, char __user *user_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;
@@ -178,13 +180,13 @@ static ssize_t read_file_ring(struct file *file, char __user *user_buf,
spin_lock_irqsave(&ag->lock, flags);
- curr = (ring->curr % ring->size);
- dirty = (ring->dirty % ring->size);
+ curr = (ring->curr & ring_mask);
+ dirty = (ring->dirty & ring_mask);
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];
struct ag71xx_desc *desc = ag71xx_ring_desc(ring, i);
- u32 desc_dma = ((u32) ring->descs_dma) + i * ring->desc_size;
+ u32 desc_dma = ((u32) ring->descs_dma) + i * AG71XX_DESC_SIZE;
len += snprintf(buf + len, buflen - len,
"%3d %c%c%c %08x %08x %08x %08x %c %10lu\n",