Re: [PATCH 2/3] staging: comedi: Remove level of indentation

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

 



On Wed, Feb 22, 2017 at 11:52:49AM +0000, Ian Abbott wrote:
> On 21/02/17 20:32, Tobin C. Harding wrote:
> >On Tue, Feb 21, 2017 at 03:55:18PM +0000, Ian Abbott wrote:
> >>On 21/02/17 11:18, Tobin C. Harding wrote:
> >>
> >>For comedi patches affecting a single driver, we prefer the driver name to
> >>be mentioned in the patch subject, like...
> >>
> >>staging: comedi: cb_pcidas64: blah blah
> >>
> >>>For loop contains only an if conditional (and body of if conditional).
> >>>Conditional can be inverted and the loop continued if the new
> >>>conditional is true without modifying the program logic. This allows
> >>>one level of indentation to be removed.
> >>>
> >>>Invert conditional and continue loop if new conditional evaluates to
> >>>true. Remove one level of indentation from subsequent loop body.
> >>>
> >>>Signed-off-by: Tobin C. Harding <me@xxxxxxxx>
> >>>---
> >>>drivers/staging/comedi/drivers/cb_pcidas64.c | 20 ++++++++++----------
> >>>1 file changed, 10 insertions(+), 10 deletions(-)
> >>>
> >>>diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c
> >>>index cb9c269..352f754 100644
> >>>--- a/drivers/staging/comedi/drivers/cb_pcidas64.c
> >>>+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
> >>>@@ -1497,16 +1497,16 @@ static int alloc_and_init_dma_members(struct comedi_device *dev)
> >>>			return -ENOMEM;
> >>>	}
> >>>	for (i = 0; i < AO_DMA_RING_COUNT; i++) {
> >>>-		if (ao_cmd_is_supported(board)) {
> >>>-			devpriv->ao_buffer[i] =
> >>>-				dma_alloc_coherent(&pcidev->dev,
> >>>-						   DMA_BUFFER_SIZE,
> >>>-						   &devpriv->
> >>>-						   ao_buffer_bus_addr[i],
> >>>-						   GFP_KERNEL);
> >>>-			if (!devpriv->ao_buffer[i])
> >>>-				return -ENOMEM;
> >>>-		}
> >>>+		if (!ao_cmd_is_supported(board))
> >>>+			continue;
> >>>+		devpriv->ao_buffer[i] =
> >>>+			dma_alloc_coherent(&pcidev->dev,
> >>>+					DMA_BUFFER_SIZE,
> >>>+					&devpriv->
> >>>+					ao_buffer_bus_addr[i],
> >>>+					GFP_KERNEL);
> >>
> >>Since you are unindenting the code, you can reformat those function
> >>parameters at the same time to fix the multiline dereference.
> >
> >Righto, so for comedi/drivers prefer to group multiple checkpatch fixes to one
> >driver in a patch as apposed to grouping by individual checkpatch warning
> >but mixing drivers?
> 
> It's more a case of there being no harm in using up the spare space at the
> end of the lines that you have created to reduce the the number of lines.
> The fact that it fixes another checkpatch warning is a bonus!

Cool, thanks. I'll wait until the merge window closes before
re-submitting this.

thanks,
Tobin.
_______________________________________________
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