RE: [PATCH 13/19] staging: comedi: amplc_pci230: remove unnecessary braces
From: Hartley Sweeten
Date: Tue Jul 29 2014 - 20:34:09 EST
On Tuesday, July 29, 2014 4:58 AM, Ian Abbott wrote:
> Signed-off-by: Ian Abbott <abbotti@xxxxxxxxx>
> ---
> drivers/staging/comedi/drivers/amplc_pci230.c | 151 ++++++++++----------------
> 1 file changed, 58 insertions(+), 93 deletions(-)
>
> diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c
> index 4222e28..df58679 100644
> --- a/drivers/staging/comedi/drivers/amplc_pci230.c
> +++ b/drivers/staging/comedi/drivers/amplc_pci230.c
> @@ -672,7 +672,7 @@ static int get_resources(struct comedi_device *dev, unsigned int res_mask,
> ok = 1;
> claimed = 0;
> spin_lock_irqsave(&devpriv->res_spinlock, irqflags);
> - for (b = 1, i = 0; (i < NUM_RESOURCES) && res_mask; b <<= 1, i++) {
> + for (b = 1, i = 0; (i < NUM_RESOURCES) && res_mask; b <<= 1, i++)
> if (res_mask & b) {
> res_mask &= ~b;
> if (devpriv->res_owner[i] == OWNER_NONE) {
> @@ -690,7 +690,6 @@ static int get_resources(struct comedi_device *dev, unsigned int res_mask,
> break;
> }
> }
> - }
Technically the braces you remove in this patch _are_
unnecessary. But, I think the driver is more confusing
with them removed.
In a lot of places there is quite a bit of code between
where the opening and closing braces would be.
Granted, a lot of them are due to the wordy comments
but some are in places like:
for (...)
if (...) {
...
}
There aren't too bad but the one like this are:
If (...)
If (...)
...
else
...
else
...
The nested if/else blocks are easy to break.
Just my two cents...
Hartley
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/