public inbox for iwd@lists.linux.dev
 help / color / mirror / Atom feed
* Re: [PATCH v4 1/2] wiphy: update wiphy_radio_work_is_running to return int
@ 2021-12-06 20:13 Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2021-12-06 20:13 UTC (permalink / raw)
  To: iwd 

[-- Attachment #1: Type: text/plain, Size: 422 bytes --]

Hi James,

On 12/6/21 2:17 PM, James Prestwood wrote:
> This differentiates between pending, running, and non-existent:
> false, true, -ENOENT respectively
> ---
>   src/wiphy.c | 10 +++++-----
>   src/wiphy.h |  2 +-
>   2 files changed, 6 insertions(+), 6 deletions(-)
> 
> v4:
>   * Changed to return true/false and -ENOENT rather than a zero success return
> 

Both applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 2+ messages in thread
* [PATCH v4 1/2] wiphy: update wiphy_radio_work_is_running to return int
@ 2021-12-06 20:17 James Prestwood
  0 siblings, 0 replies; 2+ messages in thread
From: James Prestwood @ 2021-12-06 20:17 UTC (permalink / raw)
  To: iwd 

[-- Attachment #1: Type: text/plain, Size: 1505 bytes --]

This differentiates between pending, running, and non-existent:
false, true, -ENOENT respectively
---
 src/wiphy.c | 10 +++++-----
 src/wiphy.h |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

v4:
 * Changed to return true/false and -ENOENT rather than a zero success return

diff --git a/src/wiphy.c b/src/wiphy.c
index bb1f9824..56400ea8 100644
--- a/src/wiphy.c
+++ b/src/wiphy.c
@@ -2013,14 +2013,14 @@ void wiphy_radio_work_done(struct wiphy *wiphy, uint32_t id)
 		wiphy_radio_work_next(wiphy);
 }
 
-bool wiphy_radio_work_is_running(struct wiphy *wiphy, uint32_t id)
+int wiphy_radio_work_is_running(struct wiphy *wiphy, uint32_t id)
 {
-	struct wiphy_radio_work_item *item = l_queue_peek_head(wiphy->work);
-
+	struct wiphy_radio_work_item *item = l_queue_find(wiphy->work, match_id,
+							L_UINT_TO_PTR(id));
 	if (!item)
-		return false;
+		return -ENOENT;
 
-	return item->id == id;
+	return item == l_queue_peek_head(wiphy->work) ? 1 : 0;
 }
 
 static int wiphy_init(void)
diff --git a/src/wiphy.h b/src/wiphy.h
index 9f0d6d07..592eba70 100644
--- a/src/wiphy.h
+++ b/src/wiphy.h
@@ -130,4 +130,4 @@ uint32_t wiphy_radio_work_insert(struct wiphy *wiphy,
 				int priority,
 				const struct wiphy_radio_work_item_ops *ops);
 void wiphy_radio_work_done(struct wiphy *wiphy, uint32_t id);
-bool wiphy_radio_work_is_running(struct wiphy *wiphy, uint32_t id);
+int wiphy_radio_work_is_running(struct wiphy *wiphy, uint32_t id);
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-06 20:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-06 20:13 [PATCH v4 1/2] wiphy: update wiphy_radio_work_is_running to return int Denis Kenzior
  -- strict thread matches above, loose matches on Subject: below --
2021-12-06 20:17 James Prestwood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox