linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arend van Spriel <arend@broadcom.com>
To: "Rafał Miłecki" <zajec5@gmail.com>
Cc: Kalle Valo <kvalo@codeaurora.org>,
	linux-wireless <linux-wireless@vger.kernel.org>,
	Hante Meuleman <meuleman@broadcom.com>
Subject: Re: [PATCH v2 1/7] brcmfmac: Add support for host platform NVRAM loading.
Date: Wed, 19 Aug 2015 23:21:17 +0200	[thread overview]
Message-ID: <55D4F34D.2010505@broadcom.com> (raw)
In-Reply-To: <CACna6ryt8iVUt18fODjDMiD-c3RLM22T2J_PM8NtEvBvWm8yBg@mail.gmail.com>

subject changed to v2. So let's go over your beef.

On 07/11/2015 07:09 PM, Rafał Miłecki wrote:
> On 10 July 2015 at 20:31, Arend van Spriel <arend@broadcom.com> wrote:
>> @@ -146,7 +147,7 @@ brcmf_nvram_handle_value(struct nvram_parser *nvp)
>>          u32 cplen;
>>
>>          c = nvp->data[nvp->pos];
>> -       if (!is_nvram_char(c)) {
>> +       if (!is_nvram_char(c) && (c != ' ')) {
>
> This is redundant, please drop this change.
> See fc23e81eb8f4 ("brcmfmac: allow NVRAM values to contain spaces")

done

>> @@ -426,19 +428,34 @@ static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx)
>>          struct brcmf_fw *fwctx = ctx;
>>          u32 nvram_length = 0;
>>          void *nvram = NULL;
>> +       u8 *data = NULL;
>
> This can be const.

done

>> +       size_t data_len;
>> +       bool raw_nvram;
>>
>>          brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(fwctx->dev));
>> -       if (!fw && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL))
>> -               goto fail;
>> +       if ((fw) && (fw->data)) {
>
> I think I was already pointing similar coding issue to you. There is
> no need for these extra braces. And if they are not needed, don't use
> them. There is no point in using if (((foo))) schema just because it
> works. You could be confused by macros where we sometimes need tricks
> like this, but this is a standard part of code.

No confusion, just paranoid. You clearly have never been on road of 
chasing compiler issues with logical condition, but indeed it can be 
removed although checkpatch does not seem to be bothered with it. Will 
change it.

>> +               data = (u8 *)fw->data;
>
> Don't cast to workaround const != const. You won't need casting after
> making local "data" a const variable.

done

>> +               data_len = fw->size;
>> +               raw_nvram = false;
>> +       } else {
>> +               data = bcm47xx_nvram_get_contents(&data_len);
>> +               if (!data && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL))
>> +                       goto fail;
>> +               raw_nvram = true;
>> +       }
>>
>> -       if (fw) {
>> -               nvram = brcmf_fw_nvram_strip(fw->data, fw->size, &nvram_length,
>> +       if (data) {
>> +               nvram = brcmf_fw_nvram_strip(data, data_len, &nvram_length,
>>                                               fwctx->domain_nr, fwctx->bus_nr);
>> -               release_firmware(fw);
>> -               if (!nvram && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL))
>> -                       goto fail;
>> +               if (raw_nvram)
>> +                       bcm47xx_nvram_release_contents(data);
>
> This is cosmetical but maybe you could move above 2 lines next to the
> release_firmware? So we have all freeing code at one please? Do you
> think it would improve readability?
> Nothing important thought. Feel free to ignore me here.

confused! The release_firmware call is removed here, right?

>> @@ -473,15 +490,9 @@ static void brcmf_fw_request_code_done(const struct firmware *fw, void *ctx)
>>          if (!ret)
>>                  return;
>>
>> -       /* when nvram is optional call .done() callback here */
>> -       if (fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL) {
>> -               fwctx->done(fwctx->dev, fw, NULL, 0);
>> -               kfree(fwctx);
>> -               return;
>> -       }
>> +       brcmf_fw_request_nvram_done(NULL, fwctx);
>> +       return;
>
> It gave me a 5 minutes headache ;) Could you add a short comment why
> you call _done anyway? Something like
> /* Even if we failed to init user space fw request we may get a platform one */

For the resulting code I don't see value adding such comment. Reading 
this patch you might want Hante to explain this change, but you figured 
it out. Sorry for the headache ;-)

Regards,
Arend


  reply	other threads:[~2015-08-19 21:21 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-10 18:31 [PATCH 0/7] brcmfmac: nvram loading and code rework Arend van Spriel
2015-07-10 18:31 ` [PATCH 1/7] brcmfmac: Add support for host platform NVRAM loading Arend van Spriel
2015-07-11 17:09   ` Rafał Miłecki
2015-08-19 21:21     ` Arend van Spriel [this message]
2015-08-19 21:43       ` [PATCH v2 " Arend van Spriel
2015-08-20 15:53         ` Rafał Miłecki
2015-08-20 16:06           ` Arend van Spriel
2015-08-20 16:21             ` Rafał Miłecki
2015-08-20 15:59       ` Rafał Miłecki
2015-08-20 16:14         ` Arend van Spriel
2015-07-10 18:31 ` [PATCH 2/7] brcmfmac: correct interface combination info Arend van Spriel
2015-07-10 18:31 ` [PATCH 3/7] brcmfmac: Increase nr of supported flowrings Arend van Spriel
2015-07-10 18:31 ` [PATCH 4/7] brcmfmac: add debugfs entry for msgbuf statistics Arend van Spriel
2015-07-10 18:31 ` [PATCH 5/7] brcmfmac: make use of cfg80211_check_combinations() Arend van Spriel
2015-07-10 18:31 ` [PATCH 6/7] brcmfmac: consolidate ifp lookup in driver core Arend van Spriel
2015-07-10 18:31 ` [PATCH 7/7] brcmfmac: block the correct flowring when backup queue overflow Arend van Spriel
2015-07-19 15:05 ` [PATCH 0/7] brcmfmac: nvram loading and code rework Rafał Miłecki
2015-07-20 17:14   ` Arend van Spriel
2015-07-23 16:02     ` Kalle Valo
2015-07-26 11:08       ` Arend van Spriel
2015-07-26 12:08         ` Kalle Valo
2015-07-26 15:40     ` Rafał Miłecki
2015-08-12  8:58       ` Arend van Spriel
2015-08-12 14:07         ` Rafał Miłecki
2015-08-19 14:58           ` Rafał Miłecki
2015-08-19 23:06         ` Rafał Miłecki
2015-08-20 10:23           ` Arend van Spriel
2015-08-20 15:51             ` Rafał Miłecki
2015-08-20 19:41               ` Arend van Spriel
  -- strict thread matches above, loose matches on Subject: below --
2015-08-16  6:55 [PATCH V2 " Arend van Spriel
2015-08-16  6:55 ` [PATCH V2 1/7] brcmfmac: Add support for host platform NVRAM loading Arend van Spriel
2015-08-19 16:38   ` Rafał Miłecki
2015-08-19 20:55     ` Arend van Spriel
2015-08-20 19:50       ` Arend van Spriel
2015-08-24 19:28         ` Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55D4F34D.2010505@broadcom.com \
    --to=arend@broadcom.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=meuleman@broadcom.com \
    --cc=zajec5@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).