linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arend van Spriel <arend.vanspriel@broadcom.com>
To: Paul Cercueil <paul@crapouillou.net>,
	Arend van Spriel <aspriel@gmail.com>,
	Franky Lin <franky.lin@broadcom.com>,
	Hante Meuleman <hante.meuleman@broadcom.com>,
	Kalle Valo <kvalo@kernel.org>
Cc: linux-wireless@vger.kernel.org,
	brcm80211-dev-list.pdl@broadcom.com,
	SHA-cyfmac-dev-list@infineon.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] brcmfmac: Remove #ifdef guards for PM related functions
Date: Mon, 18 Apr 2022 09:09:46 +0200	[thread overview]
Message-ID: <afb9ea60-7f93-a646-da82-4f408051c748@broadcom.com> (raw)
In-Reply-To: <20220415200322.7511-1-paul@crapouillou.net>

[-- Attachment #1: Type: text/plain, Size: 2365 bytes --]

On 4/15/2022 10:03 PM, Paul Cercueil wrote:
> Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to
> handle the .suspend/.resume callbacks.
> 
> These macros allow the suspend and resume functions to be automatically
> dropped by the compiler when CONFIG_SUSPEND is disabled, without having
> to use #ifdef guards. The advantage is then that these functions are not
> conditionally compiled.

The advantage stated here may not be obvious to everyone and that is 
because it only scratches the surface. The code is always compiled 
independent from the Kconfig options used and because of that the real 
advantage is that build regressions are easier to catch.

> Some other functions not directly called by the .suspend/.resume
> callbacks, but still related to PM were also taken outside #ifdef
> guards.

a few comments on this inline...

> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
>   .../broadcom/brcm80211/brcmfmac/bcmsdh.c      | 44 +++++++------------
>   .../broadcom/brcm80211/brcmfmac/sdio.c        |  5 +--
>   .../broadcom/brcm80211/brcmfmac/sdio.h        | 16 -------
>   3 files changed, 19 insertions(+), 46 deletions(-)
> 
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
> index ac02244a6fdf..a8cf5a570101 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c

[...]

> @@ -873,7 +865,8 @@ int brcmf_sdiod_remove(struct brcmf_sdio_dev *sdiodev)
>   		sdiodev->bus = NULL;
>   	}
>   
> -	brcmf_sdiod_freezer_detach(sdiodev);
> +	if (IS_ENABLED(CONFIG_PM_SLEEP))
> +		brcmf_sdiod_freezer_detach(sdiodev);

Please move the if statement inside the function to keep the code flow 
in the calling function the same as before.

>   
>   	/* Disable Function 2 */
>   	sdio_claim_host(sdiodev->func2);
> @@ -949,9 +942,11 @@ int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev)
>   		goto out;
>   	}
>   
> -	ret = brcmf_sdiod_freezer_attach(sdiodev);
> -	if (ret)
> -		goto out;
> +	if (IS_ENABLED(CONFIG_PM_SLEEP)) {
> +		ret = brcmf_sdiod_freezer_attach(sdiodev);
> +		if (ret)
> +			goto out;
> +	}

Dito. Move the if statement inside the function.

>   
>   	/* try to attach to the target device */
>   	sdiodev->bus = brcmf_sdio_probe(sdiodev);

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4219 bytes --]

  reply	other threads:[~2022-04-18  7:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-15 20:03 [PATCH] brcmfmac: Remove #ifdef guards for PM related functions Paul Cercueil
2022-04-18  7:09 ` Arend van Spriel [this message]
2022-04-19 17:22   ` Paul Cercueil

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=afb9ea60-7f93-a646-da82-4f408051c748@broadcom.com \
    --to=arend.vanspriel@broadcom.com \
    --cc=SHA-cyfmac-dev-list@infineon.com \
    --cc=aspriel@gmail.com \
    --cc=brcm80211-dev-list.pdl@broadcom.com \
    --cc=franky.lin@broadcom.com \
    --cc=hante.meuleman@broadcom.com \
    --cc=kvalo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=paul@crapouillou.net \
    /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).