Skip to content

Commit

Permalink
wifi: ath9k: use devm for gpio_request_one()
Browse files Browse the repository at this point in the history
Using devm_gpio_request_one() is simpler as then we don't need to call
gpio_free().

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://patch.msgid.link/20240731210312.7622-1-rosenp@gmail.com
  • Loading branch information
Rosen Penev authored and Kalle Valo committed Aug 7, 2024
1 parent 92da4ce commit 8aabc03
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/net/wireless/ath/ath9k/hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -2732,7 +2732,7 @@ static void ath9k_hw_gpio_cfg_soc(struct ath_hw *ah, u32 gpio, bool out,
if (ah->caps.gpio_requested & BIT(gpio))
return;

err = gpio_request_one(gpio, out ? GPIOF_OUT_INIT_LOW : GPIOF_IN, label);
err = devm_gpio_request_one(ah->dev, gpio, out ? GPIOF_OUT_INIT_LOW : GPIOF_IN, label);
if (err) {
ath_err(ath9k_hw_common(ah), "request GPIO%d failed:%d\n",
gpio, err);
Expand Down Expand Up @@ -2801,10 +2801,8 @@ void ath9k_hw_gpio_free(struct ath_hw *ah, u32 gpio)

WARN_ON(gpio >= ah->caps.num_gpio_pins);

if (ah->caps.gpio_requested & BIT(gpio)) {
gpio_free(gpio);
if (ah->caps.gpio_requested & BIT(gpio))
ah->caps.gpio_requested &= ~BIT(gpio);
}
}
EXPORT_SYMBOL(ath9k_hw_gpio_free);

Expand Down

0 comments on commit 8aabc03

Please sign in to comment.