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]
Message-ID: <9bc68261-9d5a-463c-82e8-c7a630dda79e@bootlin.com>
Date: Tue, 27 Aug 2024 10:14:29 +0200
From: Alexis Lothoré <alexis.lothore@...tlin.com>
To: Marek Vasut <marex@...x.de>, linux-wireless@...r.kernel.org
Cc: "David S. Miller" <davem@...emloft.net>,
 Adham Abozaeid <adham.abozaeid@...rochip.com>,
 Ajay Singh <ajay.kathat@...rochip.com>,
 Claudiu Beznea <claudiu.beznea@...on.dev>, Conor Dooley
 <conor+dt@...nel.org>, Eric Dumazet <edumazet@...gle.com>,
 Jakub Kicinski <kuba@...nel.org>, Kalle Valo <kvalo@...nel.org>,
 Krzysztof Kozlowski <krzk+dt@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
 Rob Herring <robh@...nel.org>, devicetree@...r.kernel.org,
 netdev@...r.kernel.org
Subject: Re: [PATCH v2 3/4] wifi: wilc1000: Fold
 chip_allow_sleep()/chip_wakeup() into wlan.c

On 8/23/24 18:08, Marek Vasut wrote:
> Neither chip_allow_sleep()/chip_wakeup() is used outside of wlan.c .
> Make both functions static and remove both the exported symbol and
> entries from wlan.h .
> 
> Make chip_allow_sleep() return error code in preparation for the
> follow up patches.
> 
> Move acquire_bus() and release_bus() to avoid forward declaration
> of chip_allow_sleep()/chip_wakeup().
> 
> Signed-off-by: Marek Vasut <marex@...x.de>
> ---
> Cc: "David S. Miller" <davem@...emloft.net>
> Cc: Adham Abozaeid <adham.abozaeid@...rochip.com>
> Cc: Ajay Singh <ajay.kathat@...rochip.com>
> Cc: Alexis Lothoré <alexis.lothore@...tlin.com>
> Cc: Claudiu Beznea <claudiu.beznea@...on.dev>
> Cc: Conor Dooley <conor+dt@...nel.org>
> Cc: Eric Dumazet <edumazet@...gle.com>
> Cc: Jakub Kicinski <kuba@...nel.org>
> Cc: Kalle Valo <kvalo@...nel.org>
> Cc: Krzysztof Kozlowski <krzk+dt@...nel.org>
> Cc: Marek Vasut <marex@...x.de>
> Cc: Paolo Abeni <pabeni@...hat.com>
> Cc: Rob Herring <robh@...nel.org>
> Cc: devicetree@...r.kernel.org
> Cc: linux-wireless@...r.kernel.org
> Cc: netdev@...r.kernel.org
> ---
> V2: New patch
> ---
>  .../net/wireless/microchip/wilc1000/wlan.c    | 47 +++++++++----------
>  .../net/wireless/microchip/wilc1000/wlan.h    |  2 -
>  2 files changed, 23 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
> index 1aab2f2dc159f..5fbba6876bd07 100644
> --- a/drivers/net/wireless/microchip/wilc1000/wlan.c
> +++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
> @@ -12,20 +12,6 @@
>  
>  #define WAKE_UP_TRIAL_RETRY		10000
>  
> -static inline void acquire_bus(struct wilc *wilc, enum bus_acquire acquire)
> -{
> -	mutex_lock(&wilc->hif_cs);
> -	if (acquire == WILC_BUS_ACQUIRE_AND_WAKEUP && wilc->power_save_mode)
> -		chip_wakeup(wilc);
> -}
> -
> -static inline void release_bus(struct wilc *wilc, enum bus_release release)
> -{
> -	if (release == WILC_BUS_RELEASE_ALLOW_SLEEP && wilc->power_save_mode)
> -		chip_allow_sleep(wilc);
> -	mutex_unlock(&wilc->hif_cs);
> -}
> -
>  static void wilc_wlan_txq_remove(struct wilc *wilc, u8 q_num,
>  				 struct txq_entry_t *tqe)
>  {
> @@ -555,7 +541,7 @@ static struct rxq_entry_t *wilc_wlan_rxq_remove(struct wilc *wilc)
>  	return rqe;
>  }
>  
> -void chip_allow_sleep(struct wilc *wilc)
> +static int chip_allow_sleep(struct wilc *wilc)
>  {
>  	u32 reg = 0;
>  	const struct wilc_hif_func *hif_func = wilc->hif_func;
> @@ -584,7 +570,7 @@ void chip_allow_sleep(struct wilc *wilc)
>  	while (--trials) {
>  		ret = hif_func->hif_read_reg(wilc, to_host_from_fw_reg, &reg);
>  		if (ret)
> -			return;
> +			return ret;

Forwarding error codes sounds like a good idea, but neither this patch nor the
next one is reading the return value from any chip_allow_sleep[XXX] function, so
it does not bring much value.

Alexis

-- 
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ