Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1615691

Re: [PATCH v2 6/6] hpet: fix style issue about braces and alignment

From Joe Perches <joe@perches.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 6/6] hpet: fix style issue about braces and alignment
Date 2017-04-04 05:50 +0200
Message-ID <tsnDH-7L4-11@gated-at.bofh.it> (permalink)
References <ts97I-6L2-1@gated-at.bofh.it> <ts97J-6L2-27@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, 2017-04-03 at 14:15 +0200, Corentin Labbe wrote:
> This patch fix all style issue for braces and alignment
[]
> diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
[]
> @@ -255,9 +255,9 @@ static int hpet_open(struct inode *inode, struct file *file)
>  
>  	for (devp = NULL, hpetp = hpets; hpetp && !devp; hpetp = hpetp->hp_next)
>  		for (i = 0; i < hpetp->hp_ntimer; i++)
> -			if (hpetp->hp_dev[i].hd_flags & HPET_OPEN)
> +			if (hpetp->hp_dev[i].hd_flags & HPET_OPEN) {
>  				continue;
> -			else {
> +			} else {
>  				devp = &hpetp->hp_dev[i];
>  				break;
>  			}

Perhaps this is clearer as:

 	for (devp = NULL, hpetp = hpets; hpetp && !devp; hpetp = hpetp->hp_next) {
		for (i = 0; i < hpetp->hp_ntimer; i++) {
			if (!(hpetp->hp_dev[i].hd_flags & HPET_OPEN)) {
				devp = &hpetp->hp_dev[i];
				break;
			}
		}
	}
		
> @@ -304,9 +304,9 @@ hpet_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
>  		devp->hd_irqdata = 0;
>  		spin_unlock_irq(&hpet_lock);
>  
> -		if (data)
> +		if (data) {
>  			break;
> -		else if (file->f_flags & O_NONBLOCK) {
> +		} else if (file->f_flags & O_NONBLOCK) {

break; else is almost always better as break
and reduced indentation

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/6] hpet: fix build warnings and style Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-04-03 14:20 +0200
  [PATCH v2 1/6] hpet: remove unused variable hpet in hpet_ioctl_common Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-04-03 14:20 +0200
  [PATCH v2 5/6] hpet: removing unused variable m in hpet_interrupt Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-04-03 14:20 +0200
    Re: [PATCH v2 5/6] hpet: removing unused variable m in hpet_interrupt Clemens Ladisch <clemens@ladisch.de> - 2017-04-03 15:10 +0200
      Re: [PATCH 1/2] Alps HID I2C T4 device support Nikolaus Rath <Nikolaus@rath.org> - 2017-04-04 05:10 +0200
        RE: [PATCH 1/2] Alps HID I2C T4 device support Masaki Ota <masaki.ota@jp.alps.com> - 2017-04-04 09:00 +0200
          RE: [PATCH 1/2] Alps HID I2C T4 device support Masaki Ota <masaki.ota@jp.alps.com> - 2017-04-05 01:50 +0200
            Re: [PATCH 1/2] Alps HID I2C T4 device support Nikolaus Rath <Nikolaus@rath.org> - 2017-04-05 01:50 +0200
              RE: [PATCH 1/2] Alps HID I2C T4 device support Masaki Ota <masaki.ota@jp.alps.com> - 2017-04-05 01:50 +0200
                Re: [PATCH 1/2] Alps HID I2C T4 device support Nikolaus Rath <Nikolaus@rath.org> - 2017-04-05 02:10 +0200
                RE: [PATCH 1/2] Alps HID I2C T4 device support Masaki Ota <masaki.ota@jp.alps.com> - 2017-04-05 10:50 +0200
                Re: [PATCH 1/2] Alps HID I2C T4 device support Nikolaus Rath <Nikolaus@rath.org> - 2017-04-05 20:40 +0200
                RE: [PATCH 1/2] Alps HID I2C T4 device support Masaki Ota <masaki.ota@jp.alps.com> - 2017-04-06 03:10 +0200
                Re: [PATCH 1/2] Alps HID I2C T4 device support Nikolaus Rath <Nikolaus@rath.org> - 2017-04-07 01:10 +0200
  [PATCH v2 2/6] hpet: remove unused writeq/readq function definitions Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-04-03 14:20 +0200
  [PATCH v2 6/6] hpet: fix style issue about braces and alignment Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-04-03 14:20 +0200
    Re: [PATCH v2 6/6] hpet: fix style issue about braces and alignment Joe Perches <joe@perches.com> - 2017-04-04 05:50 +0200
  [PATCH v2 4/6] hpet: replace printk by their pr_xxx counterparts Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-04-03 14:20 +0200
    Re: [PATCH v2 4/6] hpet: replace printk by their pr_xxx counterparts Joe Perches <joe@perches.com> - 2017-04-03 21:50 +0200
  [PATCH v2 3/6] hpet: fix checkpatch complains about spaces Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-04-03 14:20 +0200

csiph-web