OSDN Git Service

net: ipa: repurpose CLOCK_HELD flag
authorAlex Elder <elder@linaro.org>
Thu, 17 Sep 2020 17:39:24 +0000 (12:39 -0500)
committerDavid S. Miller <davem@davemloft.net>
Sat, 19 Sep 2020 00:47:07 +0000 (17:47 -0700)
commit3c6ccdde0fe37efaa3d1ae7a141a31b4e054ab03
treec597f63af576bde5c275cc5c4f614e76defd4188
parent8529b4b0dca31244aae495dbbe0013b5a4b2a6ee
net: ipa: repurpose CLOCK_HELD flag

The previous patch causes a system resume to be triggered when a
packet is available for receipt on a suspended RX endpoint.

The CLOCK_HELD flag was previously used to indicate that an extra
clock reference was held, preventing suspend.  But we no longer need
such a flag:
  - We take an initial reference in ipa_config().
  - That reference is held until ipa_suspend() releases it.
  - A subsequent system resume leads to a reference getting
    re-acquired in ipa_resume().
  - This can repeat until ultimately the module is removed, where
    ipa_remove() releases the reference.
We no longer need a special flag to determine whether this extra
reference is held--it is, provided probe has completed successfully
and the driver is not suspended (or removed).

On the other hand, once suspended, it's possible for more than one
endpoint to trip the IPA SUSPEND interrupt, and we only want to
trigger the system resume once.  So repurpose the Boolean CLOCK_HELD
flag to record whether the IPA SUSPEND handler should initiate a
system resume.

The flag will be be cleared each time ipa_suspend() is called,
*before* any endpoints are suspended.  And it will be set inside the
IPA SUSPEND interrupt handler exactly once per suspend.

Rename the flag IPA_FLAG_RESUMED to reflect its new purpose.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ipa/ipa.h
drivers/net/ipa/ipa_main.c