* [PATCH] staging: wilc1000: correct inconsistent indenting
@ 2018-11-28 18:17 Michael Straube
2018-11-29 6:24 ` Joe Perches
0 siblings, 1 reply; 3+ messages in thread
From: Michael Straube @ 2018-11-28 18:17 UTC (permalink / raw)
To: gregkh; +Cc: ajay.kathat, adham.abozaeid, devel, linux-kernel, Michael Straube
Correct inconsistent indenting reported by smatch.
Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
drivers/staging/wilc1000/wilc_spi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index 35ff432587fe..6d1eb82d1df8 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -963,7 +963,7 @@ static int wilc_spi_read_int(struct wilc *wilc, u32 *int_status)
dev_err(&spi->dev,
"Unexpected interrupt(2):j=%d,tmp=%x,mask=%x\n",
j, tmp, unknown_mask);
- happened = 1;
+ happened = 1;
}
j++;
--
2.19.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: wilc1000: correct inconsistent indenting
2018-11-28 18:17 [PATCH] staging: wilc1000: correct inconsistent indenting Michael Straube
@ 2018-11-29 6:24 ` Joe Perches
2018-11-29 13:45 ` Michael Straube
0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2018-11-29 6:24 UTC (permalink / raw)
To: Michael Straube, gregkh; +Cc: ajay.kathat, adham.abozaeid, devel, linux-kernel
On Wed, 2018-11-28 at 19:17 +0100, Michael Straube wrote:
> Correct inconsistent indenting reported by smatch.
[]
> diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
[]
> @@ -963,7 +963,7 @@ static int wilc_spi_read_int(struct wilc *wilc, u32 *int_status)
> dev_err(&spi->dev,
> "Unexpected interrupt(2):j=%d,tmp=%x,mask=%x\n",
> j, tmp, unknown_mask);
> - happened = 1;
> + happened = 1;s a
> }
>
> j++;
Perhaps a little refactoring instead
---
drivers/staging/wilc1000/wilc_spi.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index 35ff432587fe..a38ddb1f0a1f 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -927,7 +927,8 @@ static int wilc_spi_read_int(struct wilc *wilc, u32 *int_status)
int ret;
u32 tmp;
u32 byte_cnt;
- int happened, j;
+ bool unexpected_irq;
+ int j;
u32 unknown_mask;
u32 irq_flags;
int k = IRG_FLAGS_OFFSET + 5;
@@ -947,8 +948,6 @@ static int wilc_spi_read_int(struct wilc *wilc, u32 *int_status)
j = 0;
do {
- happened = 0;
-
wilc_spi_read_reg(wilc, 0x1a90, &irq_flags);
tmp |= ((irq_flags >> 27) << IRG_FLAGS_OFFSET);
@@ -959,15 +958,14 @@ static int wilc_spi_read_int(struct wilc *wilc, u32 *int_status)
unknown_mask = ~((1ul << spi_priv->nint) - 1);
- if ((tmp >> IRG_FLAGS_OFFSET) & unknown_mask) {
+ unexpected_irq = (tmp >> IRG_FLAGS_OFFSET) & unknown_mask;
+ if (unexpected_irq)
dev_err(&spi->dev,
"Unexpected interrupt(2):j=%d,tmp=%x,mask=%x\n",
j, tmp, unknown_mask);
- happened = 1;
- }
j++;
- } while (happened);
+ } while (unexpected_irq);
*int_status = tmp;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: wilc1000: correct inconsistent indenting
2018-11-29 6:24 ` Joe Perches
@ 2018-11-29 13:45 ` Michael Straube
0 siblings, 0 replies; 3+ messages in thread
From: Michael Straube @ 2018-11-29 13:45 UTC (permalink / raw)
To: Joe Perches, gregkh; +Cc: ajay.kathat, adham.abozaeid, devel, linux-kernel
On 11/29/18 7:24 AM, Joe Perches wrote:
> On Wed, 2018-11-28 at 19:17 +0100, Michael Straube wrote:
>> Correct inconsistent indenting reported by smatch.
> []
>> diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
> []
>> @@ -963,7 +963,7 @@ static int wilc_spi_read_int(struct wilc *wilc, u32 *int_status)
>> dev_err(&spi->dev,
>> "Unexpected interrupt(2):j=%d,tmp=%x,mask=%x\n",
>> j, tmp, unknown_mask);
>> - happened = 1;
>> + happened = 1;s a
>> }
>>
>> j++;
>
> Perhaps a little refactoring instead
> ---
> drivers/staging/wilc1000/wilc_spi.c | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
> index 35ff432587fe..a38ddb1f0a1f 100644
> --- a/drivers/staging/wilc1000/wilc_spi.c
> +++ b/drivers/staging/wilc1000/wilc_spi.c
> @@ -927,7 +927,8 @@ static int wilc_spi_read_int(struct wilc *wilc, u32 *int_status)
> int ret;
> u32 tmp;
> u32 byte_cnt;
> - int happened, j;
> + bool unexpected_irq;
> + int j;
> u32 unknown_mask;
> u32 irq_flags;
> int k = IRG_FLAGS_OFFSET + 5;
> @@ -947,8 +948,6 @@ static int wilc_spi_read_int(struct wilc *wilc, u32 *int_status)
>
> j = 0;
> do {
> - happened = 0;
> -
> wilc_spi_read_reg(wilc, 0x1a90, &irq_flags);
> tmp |= ((irq_flags >> 27) << IRG_FLAGS_OFFSET);
>
> @@ -959,15 +958,14 @@ static int wilc_spi_read_int(struct wilc *wilc, u32 *int_status)
>
> unknown_mask = ~((1ul << spi_priv->nint) - 1);
>
> - if ((tmp >> IRG_FLAGS_OFFSET) & unknown_mask) {
> + unexpected_irq = (tmp >> IRG_FLAGS_OFFSET) & unknown_mask;
> + if (unexpected_irq)
> dev_err(&spi->dev,
> "Unexpected interrupt(2):j=%d,tmp=%x,mask=%x\n",
> j, tmp, unknown_mask);
> - happened = 1;
> - }
>
> j++;
> - } while (happened);
> + } while (unexpected_irq);
>
> *int_status = tmp;
>
>
Hi Joe,
that looks good to me.
Naming the loop condition unexpected_irq also improves readability.
I will send a new patch, thanks.
Michael
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-11-29 13:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-28 18:17 [PATCH] staging: wilc1000: correct inconsistent indenting Michael Straube
2018-11-29 6:24 ` Joe Perches
2018-11-29 13:45 ` Michael Straube
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox