Search Linux Wireless

Re: [PATCH v2 1/3] mwifiex: Re-work support for SDIO HW reset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 12 Nov 2019 at 19:05, Doug Anderson <dianders@xxxxxxxxxxxx> wrote:
>
> Hi,
>
> On Tue, Nov 12, 2019 at 4:14 AM Ulf Hansson <ulf.hansson@xxxxxxxxxx> wrote:
> >
> > > > diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c
> > > > index 24c041dad9f6..2417c94c29c0 100644
> > > > --- a/drivers/net/wireless/marvell/mwifiex/sdio.c
> > > > +++ b/drivers/net/wireless/marvell/mwifiex/sdio.c
> > > > @@ -444,6 +444,9 @@ static int mwifiex_sdio_suspend(struct device *dev)
> > > >                 return 0;
> > > >         }
> > > >
> > > > +       if (!adapter->is_adapter_up)
> > > > +               return -EBUSY;
> > >
> > > I'm moderately concerned that there might be cases where firmware
> > > never got loaded but we could suspend/resume OK.  ...and now we never
> > > will?  I'm not familiar enough with the code to know if this is a real
> > > concern, so I guess we can do this and then see...
> >
> > There is a completion variable that is used to make sure the firmware
> > is loaded, before the mwifiex driver runs ->suspend|remove(). This is
> > needed, because during ->probe() the FW will be loaded asynchronously,
> > hence both mwifiex_sdio_remove() and mwifiex_sdio_suspend(), may be
> > called while waiting for the FW to be loaded.
> >
> > If a HW reset has been scheduled but not completed, which would be the
> > case if mmc_hw_reset() gets called after mmc_pm_notify() with a
> > PM_SUSPEND_PREPARE. This is because mmc_pm_notify() then disables the
> > rescan work, but then re-kicks/enables it at PM_POST_SUSPEND (after
> > the system has resumed).
> >
> > Returning -EBUSY, should allow the mmc rescan work to be completed
> > when the system have resumed.
> >
> > Of course, one could also considering using pm_wakeup_event(), in case
> > mmc_hw_reset() needed to schedule the reset, as to prevent the system
> > for suspending for a small amount of time. As to make sure the rescan
> > work, gets to run. But I am not sure that's needed here.
>
> I was more worried that we could get into a state where we'd return
> EBUSY forever, but I think I've convinced myself that this isn't
> possible.  If we fail to load things then the adapter variable will be
> freed anyway.
>
>
> > Finally, if you want to verify that the above system suspend path
> > works fine, you could change the call to "_mmc_detect_change(host, 0,
> > false)" in mmc_sdio_hw_reset(), into "_mmc_detect_change(host,
> > msecs_to_jiffies(30000), false)", in patch3.
> >
> > This should leave you a 30s window of where you can try to system
> > suspend the platform, while also waiting for the scheduled reset to be
> > completed.
>
> It worked.
>
> https://pastebin.com/NdsvAdE8

Great, thanks for confirming!

Kind regards
Uffe



[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux