On Tue, Feb 28, 2017 at 02:36:25PM +0000, Ian Abbott wrote: > 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. When I went to redo this patch I noticed a better, more simple fix. It does not remove the initial checkpatch warning but it's a fix none the less. I have sent the patch with subject; [PATCH] staging: comedi: cb_pcidas64: move loop invariant This email is just to link the work and give you some reference. thanks, Tobin. _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel