linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mmc: reduce nesting and join error strings into one line
@ 2016-02-09 11:43 Masahiro Yamada
  2016-04-15  9:01 ` Masahiro Yamada
  0 siblings, 1 reply; 7+ messages in thread
From: Masahiro Yamada @ 2016-02-09 11:43 UTC (permalink / raw)
  To: linux-mmc
  Cc: Masahiro Yamada, Adrian Hunter, linux-kernel, Chaotian Jing, Ulf Hansson

No reason to use the double "if" nesting.  This fix allows to move
the nested block to the left and tidy up the error message without
80-col overflow.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/mmc/core/mmc.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index bf49e44..3789a50 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -345,14 +345,14 @@ static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd)
 
 	/* Version is coded in the CSD_STRUCTURE byte in the EXT_CSD register */
 	card->ext_csd.raw_ext_csd_structure = ext_csd[EXT_CSD_STRUCTURE];
-	if (card->csd.structure == 3) {
-		if (card->ext_csd.raw_ext_csd_structure > 2) {
-			pr_err("%s: unrecognised EXT_CSD structure "
-				"version %d\n", mmc_hostname(card->host),
-					card->ext_csd.raw_ext_csd_structure);
-			err = -EINVAL;
-			goto out;
-		}
+
+	if (card->csd.structure == 3 &&
+	    card->ext_csd.raw_ext_csd_structure > 2) {
+		pr_err("%s: unrecognised EXT_CSD structure version %d\n",
+		       mmc_hostname(card->host),
+		       card->ext_csd.raw_ext_csd_structure);
+		err = -EINVAL;
+		goto out;
 	}
 
 	np = mmc_of_find_child_device(card->host, 0);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] mmc: reduce nesting and join error strings into one line
  2016-02-09 11:43 [PATCH] mmc: reduce nesting and join error strings into one line Masahiro Yamada
@ 2016-04-15  9:01 ` Masahiro Yamada
  2016-04-15  9:26   ` Ulf Hansson
  0 siblings, 1 reply; 7+ messages in thread
From: Masahiro Yamada @ 2016-04-15  9:01 UTC (permalink / raw)
  To: linux-mmc
  Cc: Masahiro Yamada, Adrian Hunter, Linux Kernel Mailing List,
	Chaotian Jing, Ulf Hansson

Hi Ulf,

No interest in this clean-up?


2016-02-09 20:43 GMT+09:00 Masahiro Yamada <yamada.masahiro@socionext.com>:
> No reason to use the double "if" nesting.  This fix allows to move
> the nested block to the left and tidy up the error message without
> 80-col overflow.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
>  drivers/mmc/core/mmc.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index bf49e44..3789a50 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -345,14 +345,14 @@ static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd)
>
>         /* Version is coded in the CSD_STRUCTURE byte in the EXT_CSD register */
>         card->ext_csd.raw_ext_csd_structure = ext_csd[EXT_CSD_STRUCTURE];
> -       if (card->csd.structure == 3) {
> -               if (card->ext_csd.raw_ext_csd_structure > 2) {
> -                       pr_err("%s: unrecognised EXT_CSD structure "
> -                               "version %d\n", mmc_hostname(card->host),
> -                                       card->ext_csd.raw_ext_csd_structure);
> -                       err = -EINVAL;
> -                       goto out;
> -               }
> +
> +       if (card->csd.structure == 3 &&
> +           card->ext_csd.raw_ext_csd_structure > 2) {
> +               pr_err("%s: unrecognised EXT_CSD structure version %d\n",
> +                      mmc_hostname(card->host),
> +                      card->ext_csd.raw_ext_csd_structure);
> +               err = -EINVAL;
> +               goto out;
>         }
>
>         np = mmc_of_find_child_device(card->host, 0);
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mmc: reduce nesting and join error strings into one line
  2016-04-15  9:01 ` Masahiro Yamada
@ 2016-04-15  9:26   ` Ulf Hansson
  2016-04-15  9:30     ` Masahiro Yamada
  0 siblings, 1 reply; 7+ messages in thread
From: Ulf Hansson @ 2016-04-15  9:26 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-mmc, Adrian Hunter, Linux Kernel Mailing List, Chaotian Jing

On 15 April 2016 at 11:01, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> Hi Ulf,
>
> No interest in this clean-up?
>

Well, no.

Don't get me wrong, I am interested in clean-ups, but this doesn't
improve code quality that much.

Kind regards
Uffe

>
> 2016-02-09 20:43 GMT+09:00 Masahiro Yamada <yamada.masahiro@socionext.com>:
>> No reason to use the double "if" nesting.  This fix allows to move
>> the nested block to the left and tidy up the error message without
>> 80-col overflow.
>>
>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>> ---
>>
>>  drivers/mmc/core/mmc.c | 16 ++++++++--------
>>  1 file changed, 8 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
>> index bf49e44..3789a50 100644
>> --- a/drivers/mmc/core/mmc.c
>> +++ b/drivers/mmc/core/mmc.c
>> @@ -345,14 +345,14 @@ static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd)
>>
>>         /* Version is coded in the CSD_STRUCTURE byte in the EXT_CSD register */
>>         card->ext_csd.raw_ext_csd_structure = ext_csd[EXT_CSD_STRUCTURE];
>> -       if (card->csd.structure == 3) {
>> -               if (card->ext_csd.raw_ext_csd_structure > 2) {
>> -                       pr_err("%s: unrecognised EXT_CSD structure "
>> -                               "version %d\n", mmc_hostname(card->host),
>> -                                       card->ext_csd.raw_ext_csd_structure);
>> -                       err = -EINVAL;
>> -                       goto out;
>> -               }
>> +
>> +       if (card->csd.structure == 3 &&
>> +           card->ext_csd.raw_ext_csd_structure > 2) {
>> +               pr_err("%s: unrecognised EXT_CSD structure version %d\n",
>> +                      mmc_hostname(card->host),
>> +                      card->ext_csd.raw_ext_csd_structure);
>> +               err = -EINVAL;
>> +               goto out;
>>         }
>>
>>         np = mmc_of_find_child_device(card->host, 0);
>> --
>> 1.9.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>
>
> --
> Best Regards
> Masahiro Yamada

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mmc: reduce nesting and join error strings into one line
  2016-04-15  9:26   ` Ulf Hansson
@ 2016-04-15  9:30     ` Masahiro Yamada
  2016-04-15  9:36       ` Ulf Hansson
  0 siblings, 1 reply; 7+ messages in thread
From: Masahiro Yamada @ 2016-04-15  9:30 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: linux-mmc, Adrian Hunter, Linux Kernel Mailing List, Chaotian Jing

2016-04-15 18:26 GMT+09:00 Ulf Hansson <ulf.hansson@linaro.org>:
> On 15 April 2016 at 11:01, Masahiro Yamada
> <yamada.masahiro@socionext.com> wrote:
>> Hi Ulf,
>>
>> No interest in this clean-up?
>>
>
> Well, no.
>
> Don't get me wrong, I am interested in clean-ups, but this doesn't
> improve code quality that much.
>

At least, current code splits the error message string into two lines.



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mmc: reduce nesting and join error strings into one line
  2016-04-15  9:30     ` Masahiro Yamada
@ 2016-04-15  9:36       ` Ulf Hansson
  2016-04-15 10:14         ` Masahiro Yamada
  0 siblings, 1 reply; 7+ messages in thread
From: Ulf Hansson @ 2016-04-15  9:36 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-mmc, Adrian Hunter, Linux Kernel Mailing List, Chaotian Jing

On 15 April 2016 at 11:30, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> 2016-04-15 18:26 GMT+09:00 Ulf Hansson <ulf.hansson@linaro.org>:
>> On 15 April 2016 at 11:01, Masahiro Yamada
>> <yamada.masahiro@socionext.com> wrote:
>>> Hi Ulf,
>>>
>>> No interest in this clean-up?
>>>
>>
>> Well, no.
>>
>> Don't get me wrong, I am interested in clean-ups, but this doesn't
>> improve code quality that much.
>>
>
> At least, current code splits the error message string into two lines.
>
>

Yes, and that minor improvement also makes it more cumbersome to use
"git blame" when trying to understand why something was changed.

Hopes that clarifies how I think. It's balance. :-)

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mmc: reduce nesting and join error strings into one line
  2016-04-15  9:36       ` Ulf Hansson
@ 2016-04-15 10:14         ` Masahiro Yamada
  2016-04-15 11:03           ` Ulf Hansson
  0 siblings, 1 reply; 7+ messages in thread
From: Masahiro Yamada @ 2016-04-15 10:14 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: linux-mmc, Adrian Hunter, Linux Kernel Mailing List, Chaotian Jing

2016-04-15 18:36 GMT+09:00 Ulf Hansson <ulf.hansson@linaro.org>:
> On 15 April 2016 at 11:30, Masahiro Yamada
> <yamada.masahiro@socionext.com> wrote:
>> 2016-04-15 18:26 GMT+09:00 Ulf Hansson <ulf.hansson@linaro.org>:
>>> On 15 April 2016 at 11:01, Masahiro Yamada
>>> <yamada.masahiro@socionext.com> wrote:
>>>> Hi Ulf,
>>>>
>>>> No interest in this clean-up?
>>>>
>>>
>>> Well, no.
>>>
>>> Don't get me wrong, I am interested in clean-ups, but this doesn't
>>> improve code quality that much.
>>>
>>
>> At least, current code splits the error message string into two lines.
>>
>>
>
> Yes, and that minor improvement also makes it more cumbersome to use
> "git blame" when trying to understand why something was changed.
>
> Hopes that clarifies how I think. It's balance. :-)

OK.  This balance slightly varies from maintainer to maintainer.

I am quite new to this sub-system, so I need to learn your criteria.

I spent some time to read the MMC core code before starting to write
my own MMC driver.
During diving into the code, I left some tiny patches,
which I think clean-ups(, but perhaps sound cumbersome for you).

So, please give me your 1 minute to learn how your bar's height.

For example, is the following above or below your bar?
https://github.com/masahir0y/linux-yamada/commit/fe4e4bc06

If welcome, I am happy to post it, of course.
but if not, please feel free to say so.

Thanks.

-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mmc: reduce nesting and join error strings into one line
  2016-04-15 10:14         ` Masahiro Yamada
@ 2016-04-15 11:03           ` Ulf Hansson
  0 siblings, 0 replies; 7+ messages in thread
From: Ulf Hansson @ 2016-04-15 11:03 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-mmc, Adrian Hunter, Linux Kernel Mailing List, Chaotian Jing

On 15 April 2016 at 12:14, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> 2016-04-15 18:36 GMT+09:00 Ulf Hansson <ulf.hansson@linaro.org>:
>> On 15 April 2016 at 11:30, Masahiro Yamada
>> <yamada.masahiro@socionext.com> wrote:
>>> 2016-04-15 18:26 GMT+09:00 Ulf Hansson <ulf.hansson@linaro.org>:
>>>> On 15 April 2016 at 11:01, Masahiro Yamada
>>>> <yamada.masahiro@socionext.com> wrote:
>>>>> Hi Ulf,
>>>>>
>>>>> No interest in this clean-up?
>>>>>
>>>>
>>>> Well, no.
>>>>
>>>> Don't get me wrong, I am interested in clean-ups, but this doesn't
>>>> improve code quality that much.
>>>>
>>>
>>> At least, current code splits the error message string into two lines.
>>>
>>>
>>
>> Yes, and that minor improvement also makes it more cumbersome to use
>> "git blame" when trying to understand why something was changed.
>>
>> Hopes that clarifies how I think. It's balance. :-)
>
> OK.  This balance slightly varies from maintainer to maintainer.
>
> I am quite new to this sub-system, so I need to learn your criteria.
>
> I spent some time to read the MMC core code before starting to write
> my own MMC driver.
> During diving into the code, I left some tiny patches,
> which I think clean-ups(, but perhaps sound cumbersome for you).
>
> So, please give me your 1 minute to learn how your bar's height.
>
> For example, is the following above or below your bar?
> https://github.com/masahir0y/linux-yamada/commit/fe4e4bc06

This one is good. Although not because of changing to use the BIT
macro, but because you remove an unnecessary check.

>
> If welcome, I am happy to post it, of course.
> but if not, please feel free to say so.

Feel free to post it. Hopes this clarifies!

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-04-15 11:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-09 11:43 [PATCH] mmc: reduce nesting and join error strings into one line Masahiro Yamada
2016-04-15  9:01 ` Masahiro Yamada
2016-04-15  9:26   ` Ulf Hansson
2016-04-15  9:30     ` Masahiro Yamada
2016-04-15  9:36       ` Ulf Hansson
2016-04-15 10:14         ` Masahiro Yamada
2016-04-15 11:03           ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).