lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 24 Jun 2022 11:24:01 +0200
From:   Arend Van Spriel <aspriel@...il.com>
To:     Paul Cercueil <paul@...pouillou.net>,
        Franky Lin <franky.lin@...adcom.com>
Cc:     linux-wireless@...r.kernel.org,
        brcm80211-dev-list.pdl@...adcom.com,
        SHA-cyfmac-dev-list@...ineon.com, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] brcmfmac: Remove #ifdef guards for PM related
 functions

On 6/23/2022 2:42 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.
> 
> Some other functions not directly called by the .suspend/.resume
> callbacks, but still related to PM were also taken outside #ifdef
> guards.
> 
> The advantage is then that these functions are now always compiled
> independently of any Kconfig option, and thanks to that bugs and
> regressions are easier to catch.

Reviewed-by: Arend van Spriel <aspriel@...il.com>
> Signed-off-by: Paul Cercueil <paul@...pouillou.net>
> ---
> 
> Notes:
>      v2:
>      - Move checks for IS_ENABLED(CONFIG_PM_SLEEP) inside functions to keep
>        the calling functions intact.
>      - Reword the commit message to explain why this patch is useful.
> 
>   .../broadcom/brcm80211/brcmfmac/bcmsdh.c      | 38 +++++++------------
>   .../broadcom/brcm80211/brcmfmac/sdio.c        |  5 +--
>   .../broadcom/brcm80211/brcmfmac/sdio.h        | 16 --------
>   3 files changed, 16 insertions(+), 43 deletions(-)
> 
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
> index 9c598ea97499..11ad878a906b 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
> @@ -784,9 +784,11 @@ void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev)
>   	sdiodev->txglomsz = sdiodev->settings->bus.sdio.txglomsz;
>   }
>   
> -#ifdef CONFIG_PM_SLEEP
>   static int brcmf_sdiod_freezer_attach(struct brcmf_sdio_dev *sdiodev)
>   {
> +	if (!IS_ENABLED(CONFIG_PM_SLEEP))
> +		return 0;
> +
>   	sdiodev->freezer = kzalloc(sizeof(*sdiodev->freezer), GFP_KERNEL);
>   	if (!sdiodev->freezer)
>   		return -ENOMEM;
> @@ -799,7 +801,7 @@ static int brcmf_sdiod_freezer_attach(struct brcmf_sdio_dev *sdiodev)
>   
>   static void brcmf_sdiod_freezer_detach(struct brcmf_sdio_dev *sdiodev)
>   {
> -	if (sdiodev->freezer) {
> +	if (IS_ENABLED(CONFIG_PM_SLEEP) && sdiodev->freezer) {

This change is not necessary. sdiodev->freezer will be NULL when 
CONFIG_PM_SLEEP is not enabled.

>   		WARN_ON(atomic_read(&sdiodev->freezer->freezing));
>   		kfree(sdiodev->freezer);
>   	}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ