diff mbox

[1/8] rfkill: Documentation and style fixes

Message ID 1453218163-31998-2-git-send-email-jprvita@endlessm.com
State Awaiting Upstream, archived
Delegated to: David Miller
Headers show

Commit Message

=?UTF-8?q?Jo=C3=A3o=20Paulo=20Rechi=20Vita?= Jan. 19, 2016, 3:42 p.m. UTC
Fixes some small typos, punctuation, and copy & paste issues. Also
removes an extra blank line.

Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
---
 include/linux/rfkill.h | 7 ++++---
 net/rfkill/core.c      | 5 ++---
 2 files changed, 6 insertions(+), 6 deletions(-)

Comments

Johannes Berg Jan. 19, 2016, 8:11 p.m. UTC | #1
>  /**
>   * rfkill_resume_polling(struct rfkill *rfkill)
>   *
> - * Pause polling -- say transmitter is off for other reasons.
> + * Resume polling previously paused with rfkill_pause_polling.
>   * NOTE: not necessary for suspend/resume -- in that case the
> - * core stops polling anyway
> + * core restarts polling anyway, even if was explicitly paused
> + * before suspending.
>   */

If this is true, that's a bug, no? Drivers would call pause/resume when
their status changes, and shouldn't be required to check status at
resume time?

johannes
=?UTF-8?q?Jo=C3=A3o=20Paulo=20Rechi=20Vita?= Jan. 19, 2016, 8:19 p.m. UTC | #2
On 19 January 2016 at 15:11, Johannes Berg <johannes@sipsolutions.net> wrote:
>
>>  /**
>>   * rfkill_resume_polling(struct rfkill *rfkill)
>>   *
>> - * Pause polling -- say transmitter is off for other reasons.
>> + * Resume polling previously paused with rfkill_pause_polling.
>>   * NOTE: not necessary for suspend/resume -- in that case the
>> - * core stops polling anyway
>> + * core restarts polling anyway, even if was explicitly paused
>> + * before suspending.
>>   */
>
> If this is true, that's a bug, no? Drivers would call pause/resume when
> their status changes, and shouldn't be required to check status at
> resume time?
>

I did not dive too much into the logic here, but
rfkill_resume_polling() is called unconditionally on rfkill_resume(),
so it seems that if a driver call rfkill_pause_polling() before
suspend, on resume polling will be "un-paused". That indeed looks
strange.

--
João Paulo Rechi Vita
http://about.me/jprvita
diff mbox

Patch

diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index d901078..3dcbaf6 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -104,16 +104,17 @@  int __must_check rfkill_register(struct rfkill *rfkill);
  *
  * Pause polling -- say transmitter is off for other reasons.
  * NOTE: not necessary for suspend/resume -- in that case the
- * core stops polling anyway
+ * core stops polling anyway.
  */
 void rfkill_pause_polling(struct rfkill *rfkill);
 
 /**
  * rfkill_resume_polling(struct rfkill *rfkill)
  *
- * Pause polling -- say transmitter is off for other reasons.
+ * Resume polling previously paused with rfkill_pause_polling.
  * NOTE: not necessary for suspend/resume -- in that case the
- * core stops polling anyway
+ * core restarts polling anyway, even if was explicitly paused
+ * before suspending.
  */
 void rfkill_resume_polling(struct rfkill *rfkill);
 
diff --git a/net/rfkill/core.c b/net/rfkill/core.c
index f53bf3b6..4d6d726 100644
--- a/net/rfkill/core.c
+++ b/net/rfkill/core.c
@@ -303,8 +303,8 @@  static void rfkill_set_block(struct rfkill *rfkill, bool blocked)
 	spin_lock_irqsave(&rfkill->lock, flags);
 	if (err) {
 		/*
-		 * Failed -- reset status to _prev, this may be different
-		 * from what set set _PREV to earlier in this function
+		 * Failed -- reset status to _PREV. This may be different
+		 * from what we have set _PREV to earlier in this function
 		 * if rfkill_set_sw_state was invoked.
 		 */
 		if (rfkill->state & RFKILL_BLOCK_SW_PREV)
@@ -477,7 +477,6 @@  bool rfkill_get_global_sw_state(const enum rfkill_type type)
 }
 #endif
 
-
 bool rfkill_set_hw_state(struct rfkill *rfkill, bool blocked)
 {
 	bool ret, change;