linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bug report] ath9k: make GPIO API to support both of WMAC and SOC
@ 2021-08-02 13:18 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2021-08-02 13:18 UTC (permalink / raw)
  To: miaoqing; +Cc: ath9k-devel, linux-gpio

Hello Miaoqing Pan,

The patch b2d70d4944c1: "ath9k: make GPIO API to support both of WMAC
and SOC" from Mar 7, 2016, leads to the following static checker
warning:

	drivers/gpio/gpiolib.c:1960 gpiod_free_commit()
	warn: sleeping in atomic context

drivers/net/wireless/ath/ath9k/hw.c
  2728  static void ath9k_hw_gpio_cfg_soc(struct ath_hw *ah, u32 gpio, bool out,
  2729                                    const char *label)
  2730  {
  2731          if (ah->caps.gpio_requested & BIT(gpio))
  2732                  return;
  2733  
  2734          /* may be requested by BSP, free anyway */
  2735          gpio_free(gpio);
                ^^^^^^^^^^^^^^^^
The problem is that gpio_free() can sleep and the cfg_soc() can be
called with spinlocks held.  One problematic call tree is:

--> ath_reset_internal() takes &sc->sc_pcu_lock spin lock
    --> ath9k_hw_reset()
        --> ath9k_hw_gpio_request_in()
            --> ath9k_hw_gpio_request()
                --> ath9k_hw_gpio_cfg_soc()

  2736  
  2737          if (gpio_request_one(gpio, out ? GPIOF_OUT_INIT_LOW : GPIOF_IN, label))
  2738                  return;
  2739  
  2740          ah->caps.gpio_requested |= BIT(gpio);
  2741  }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-02 13:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-02 13:18 [bug report] ath9k: make GPIO API to support both of WMAC and SOC Dan Carpenter

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).