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

2017-04-03 Thread Joe Perches
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 = >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 = >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(_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



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

2017-04-03 Thread Joe Perches
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 = >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 = >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(_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



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

2017-04-03 Thread Corentin Labbe
This patch fix all style issue for braces and alignment

Signed-off-by: Corentin Labbe 
---
 drivers/char/hpet.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
index f6096e1..fe52f39 100644
--- 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 = >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(_lock);
 
-   if (data)
+   if (data) {
break;
-   else if (file->f_flags & O_NONBLOCK) {
+   } else if (file->f_flags & O_NONBLOCK) {
retval = -EAGAIN;
goto out;
} else if (signal_pending(current)) {
@@ -987,7 +987,8 @@ static acpi_status hpet_resources(struct acpi_resource 
*res, void *data)
break;
 
irq = acpi_register_gsi(NULL, irqp->interrupts[i],
- irqp->triggering, irqp->polarity);
+   irqp->triggering,
+   irqp->polarity);
if (irq < 0)
return AE_ERROR;
 
-- 
2.10.2



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

2017-04-03 Thread Corentin Labbe
This patch fix all style issue for braces and alignment

Signed-off-by: Corentin Labbe 
---
 drivers/char/hpet.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
index f6096e1..fe52f39 100644
--- 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 = >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(_lock);
 
-   if (data)
+   if (data) {
break;
-   else if (file->f_flags & O_NONBLOCK) {
+   } else if (file->f_flags & O_NONBLOCK) {
retval = -EAGAIN;
goto out;
} else if (signal_pending(current)) {
@@ -987,7 +987,8 @@ static acpi_status hpet_resources(struct acpi_resource 
*res, void *data)
break;
 
irq = acpi_register_gsi(NULL, irqp->interrupts[i],
- irqp->triggering, irqp->polarity);
+   irqp->triggering,
+   irqp->polarity);
if (irq < 0)
return AE_ERROR;
 
-- 
2.10.2