public inbox for iwd@lists.linux.dev
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj at gmail.com>
To: iwd at lists.01.org
Subject: [PATCH v4 1/2] wiphy: update wiphy_radio_work_is_running to return int
Date: Mon, 06 Dec 2021 12:17:25 -0800	[thread overview]
Message-ID: <20211206201726.1192621-1-prestwoj@gmail.com> (raw)

[-- 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

             reply	other threads:[~2021-12-06 20:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-06 20:17 James Prestwood [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-12-06 20:13 [PATCH v4 1/2] wiphy: update wiphy_radio_work_is_running to return int Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211206201726.1192621-1-prestwoj@gmail.com \
    --to=iwd@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox