Re: [PATCH 2/2] staging: comedi: cb_pcidas64: refactor relocated code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 27/02/17 21:08, Tobin C. Harding wrote:
Code was moved to a separate function in a previous patch. Code
structure wast maintained to ease review. Code may now be refactored
to ease reading.

Move multi-line dereference onto single line. Give function parameter
more meaningful name. Fix minor alignment issue.

Signed-off-by: Tobin C. Harding <me@xxxxxxxx>
---
 drivers/staging/comedi/drivers/cb_pcidas64.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c
index 385f007..16d2491 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas64.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
@@ -1480,18 +1480,17 @@ static void init_stc_registers(struct comedi_device *dev)
 	disable_ai_pacing(dev);
 };

-static int alloc_dma_member(int i, struct comedi_device *dev)
+static int alloc_dma_member(int member, struct comedi_device *dev)
 {
 	struct pci_dev *pcidev = comedi_to_pci_dev(dev);
 	struct pcidas64_private *devpriv = dev->private;

-	devpriv->ao_buffer[i] =
+	devpriv->ao_buffer[member] =
 		dma_alloc_coherent(&pcidev->dev,
-				DMA_BUFFER_SIZE,
-				&devpriv->
-				ao_buffer_bus_addr[i],
-				GFP_KERNEL);
-	if (!devpriv->ao_buffer[i])
+				   DMA_BUFFER_SIZE,
+				   &devpriv->ao_buffer_bus_addr[member],
+				   GFP_KERNEL);
+	if (!devpriv->ao_buffer[member])
 		return -ENOMEM;
 	return 0;
 }


This could be merged with the other patch. Also, the parameter 'member' is an index into the list of buffers, so you could call it 'index' or 'bufidx' or something.

--
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@xxxxxxxxx> )=-
-=(                          Web: http://www.mev.co.uk/  )=-
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux