diff options
author | Dwight Engen <dwight.engen@oracle.com> | 2014-12-11 18:26:15 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-12-12 03:52:45 +0100 |
commit | fe47c3c2623d6914655f507a317a6b881bc7c6a4 (patch) | |
tree | b9e30d272af800b1de1f59c7ebe661bc9ac7eb67 /drivers/block/sunvdc.c | |
parent | sunvdc: fix module unload/reload (diff) | |
download | linux-fe47c3c2623d6914655f507a317a6b881bc7c6a4.tar.xz linux-fe47c3c2623d6914655f507a317a6b881bc7c6a4.zip |
vio: create routines for inc,dec vio dring indexes
Both sunvdc and sunvnet implemented distinct functionality for incrementing
and decrementing dring indexes. Create common functions for use by both
from the sunvnet versions, which were chosen since they will still work
correctly in case a non power of two ring size is used.
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/block/sunvdc.c')
-rw-r--r-- | drivers/block/sunvdc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/block/sunvdc.c b/drivers/block/sunvdc.c index 089ff9035de6..65cec156cfb4 100644 --- a/drivers/block/sunvdc.c +++ b/drivers/block/sunvdc.c @@ -269,7 +269,7 @@ static void vdc_end_one(struct vdc_port *port, struct vio_dring_state *dr, ldc_unmap(port->vio.lp, desc->cookies, desc->ncookies); desc->hdr.state = VIO_DESC_FREE; - dr->cons = (index + 1) & (VDC_TX_RING_SIZE - 1); + dr->cons = vio_dring_next(dr, index); req = rqe->req; if (req == NULL) { @@ -472,7 +472,7 @@ static int __send_request(struct request *req) printk(KERN_ERR PFX "vdc_tx_trigger() failure, err=%d\n", err); } else { port->req_id++; - dr->prod = (dr->prod + 1) & (VDC_TX_RING_SIZE - 1); + dr->prod = vio_dring_next(dr, dr->prod); } return err; @@ -626,7 +626,7 @@ static int generic_request(struct vdc_port *port, u8 op, void *buf, int len) err = __vdc_tx_trigger(port); if (err >= 0) { port->req_id++; - dr->prod = (dr->prod + 1) & (VDC_TX_RING_SIZE - 1); + dr->prod = vio_dring_next(dr, dr->prod); spin_unlock_irqrestore(&port->vio.lock, flags); wait_for_completion(&comp.com); |