Linux backports project
 help / color / mirror / Atom feed
From: Arend van Spriel <arend.vanspriel@broadcom.com>
To: Johannes Berg <johannes.berg@intel.com>
Cc: backports@vger.kernel.org,
	Arend van Spriel <arend.vanspriel@broadcom.com>
Subject: [PATCH 2/4] backports: add backport for idr_remove
Date: Thu,  9 Mar 2017 12:57:31 +0000	[thread overview]
Message-ID: <1489064253-3652-3-git-send-email-arend.vanspriel@broadcom.com> (raw)
In-Reply-To: <1489064253-3652-1-git-send-email-arend.vanspriel@broadcom.com>

Since commit d3e709e63e97 ("idr: Return the deleted entry from
idr_remove") the function signature changed so provide a backport
which does a idr_find() and subsequent idr_remove().

Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
---
Hi Johannes,

Not sure if the find/remove approach is a good one here. Better solutions
are welcome.

Regards,
Arend
---
 backport/backport-include/linux/idr.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/backport/backport-include/linux/idr.h b/backport/backport-include/linux/idr.h
index d7cf9f0..01aa2c2 100644
--- a/backport/backport-include/linux/idr.h
+++ b/backport/backport-include/linux/idr.h
@@ -61,4 +61,14 @@ static inline void idr_preload_end(void)
 	for (id = 0; ((entry) = idr_get_next(idp, &(id))) != NULL; ++id)
 #endif

+#if LINUX_VERSION_IS_LESS(4, 11, 0)
+static inline void *backport_idr_remove(struct idr *idr, int id)
+{
+	void *item = idr_find(idr, id);
+	idr_remove(idr, id);
+	return item;
+}
+#define idr_remove	backport_idr_remove
+#endif
+
 #endif /* __BACKPORT_IDR_H */
--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

  parent reply	other threads:[~2017-03-09 13:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-09 12:57 [PATCH 0/4] backports: fixes for wireless-testing Arend van Spriel
2017-03-09 12:57 ` [PATCH 1/4] patches: update crypto-ccm.patch for v4.11-rc1 Arend van Spriel
2017-03-10  6:34   ` Johannes Berg
2017-03-10  9:49     ` Arend Van Spriel
2017-03-10  9:52       ` Johannes Berg
2017-03-10 10:08         ` Arend Van Spriel
2017-03-10 10:09           ` Johannes Berg
2017-03-09 12:57 ` Arend van Spriel [this message]
2017-03-09 12:57 ` [PATCH 3/4] backports: introduce new definition for DECLARE_EWMA macro Arend van Spriel
2017-03-10  6:36   ` Johannes Berg
2017-03-10  9:53     ` Arend Van Spriel
2017-03-14 13:49       ` Johannes Berg
2017-03-09 12:57 ` [PATCH 4/4] backports: add dummy include/linux/sched/signal.h Arend van Spriel
2017-03-31  7:29 ` [PATCH 0/4] backports: fixes for wireless-testing Johannes Berg

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=1489064253-3652-3-git-send-email-arend.vanspriel@broadcom.com \
    --to=arend.vanspriel@broadcom.com \
    --cc=backports@vger.kernel.org \
    --cc=johannes.berg@intel.com \
    /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