Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2218597/?format=api
{ "id": 2218597, "url": "http://patchwork.ozlabs.org/api/patches/2218597/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20260401-casey-ccf-compat-v2-6-414d5b7f040b@linaro.org/", "project": { "id": 18, "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api", "name": "U-Boot", "link_name": "uboot", "list_id": "u-boot.lists.denx.de", "list_email": "u-boot@lists.denx.de", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260401-casey-ccf-compat-v2-6-414d5b7f040b@linaro.org>", "list_archive_url": null, "date": "2026-04-01T14:15:22", "name": "[v2,06/11] compat: add kref implementation", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "211e063d9e66cc4e1c7229298f113ac6e538b5c3", "submitter": { "id": 90679, "url": "http://patchwork.ozlabs.org/api/people/90679/?format=api", "name": "Casey Connolly", "email": "casey.connolly@linaro.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20260401-casey-ccf-compat-v2-6-414d5b7f040b@linaro.org/mbox/", "series": [ { "id": 498341, "url": "http://patchwork.ozlabs.org/api/series/498341/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=498341", "date": "2026-04-01T14:15:17", "name": "Linux compat improvements and CCF prep", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/498341/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2218597/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2218597/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<u-boot-bounces@lists.denx.de>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=Nx0f5ImA;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)", "phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=linaro.org", "phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de", "phobos.denx.de;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=linaro.org header.i=@linaro.org header.b=\"Nx0f5ImA\";\n\tdkim-atps=neutral", "phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=linaro.org", "phobos.denx.de;\n spf=pass smtp.mailfrom=casey.connolly@linaro.org" ], "Received": [ "from phobos.denx.de (phobos.denx.de\n [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fm6VR3LTfz1yCp\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 02 Apr 2026 01:16:31 +1100 (AEDT)", "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 01C6E84105;\n\tWed, 1 Apr 2026 16:15:36 +0200 (CEST)", "by phobos.denx.de (Postfix, from userid 109)\n id C165784101; Wed, 1 Apr 2026 16:15:34 +0200 (CEST)", "from mail-wm1-x336.google.com (mail-wm1-x336.google.com\n [IPv6:2a00:1450:4864:20::336])\n (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id BBB2383CE3\n for <u-boot@lists.denx.de>; Wed, 1 Apr 2026 16:15:32 +0200 (CEST)", "by mail-wm1-x336.google.com with SMTP id\n 5b1f17b1804b1-4887d4c6234so23069095e9.1\n for <u-boot@lists.denx.de>; Wed, 01 Apr 2026 07:15:32 -0700 (PDT)", "from lion.localdomain (p4fc3dd86.dip0.t-ipconnect.de.\n [79.195.221.134]) by smtp.gmail.com with ESMTPSA id\n 5b1f17b1804b1-4887c8bcaf8sm43224135e9.27.2026.04.01.07.15.30\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 01 Apr 2026 07:15:31 -0700 (PDT)" ], "X-Spam-Checker-Version": "SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de", "X-Spam-Level": "", "X-Spam-Status": "No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,\n DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,\n SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1775052932; x=1775657732; darn=lists.denx.de;\n h=cc:to:in-reply-to:references:message-id:content-transfer-encoding\n :mime-version:subject:date:from:from:to:cc:subject:date:message-id\n :reply-to; bh=LclK/WFnKQsMrtdNvHDrf15plVujXWqfACmvsP31Zb4=;\n b=Nx0f5ImAIQUYWJGkks45BiOJJXVE1ulS8U3715nKNMD4ab0kMafrH9ty+w+CDfC73g\n kI0nsjODwWTH1yLH8Pnvk67/IXDm/MeuaElpw4BwHO5u4Tg7DvN/OBSPdHB+sGPmqvEb\n PpcoyYr2NeAtKvxMLVY396qqK8LXXEIc201nfAtxUyRD0olWUFbP/Jxy4xUs5iIFGHLB\n vvTRb5odkFTmtJN0yMCYmE1H1Or5qqHVmBC88SzYEk3EYAU6X+uF61tctVvB2B0HymhK\n va8C+b4VONydKTOd1qJ5erxecyZ6CWszd0gQnnmHpk6dROEeUTHO5+NO/hVdWWGstGT5\n AHoA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775052932; x=1775657732;\n h=cc:to:in-reply-to:references:message-id:content-transfer-encoding\n :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to\n :cc:subject:date:message-id:reply-to;\n bh=LclK/WFnKQsMrtdNvHDrf15plVujXWqfACmvsP31Zb4=;\n b=RKhd5lcCRVAQ/HzegMpYx/Ukte52LtV/UfBFQuE9+6vyQm9YN0BcrOgogvKA/GdrHd\n opAjqKLijf+ppI3T4T8ACWsoyAJDHq5hljc7lJnhKkhczNryNsqn1zfNaPR8wPLi/sV5\n mQSZxjdLzcrOArCfkIH2ZoEFkYoo4/aCgBh8JpYZ1jqTNSq+MQD6uz1fEtBFdJdWIgmH\n AuyAYk50MNPYfx62t4a82qFV8dvXWftgSVH5LIfjo56EVlBHQQouRgbtZTyPMY64LuYZ\n E9C4GJwkr5CbTgv5ufBKpU3Mu1JPqCs5Q5f9G2dl0VNdvaFGO//szY2fXUtyWmuTECzW\n cJRg==", "X-Gm-Message-State": "AOJu0YzZr2oUziMQdqm+s6OTyWA2jVUkMbHvhFXyYjWK74d5wbL/hZw1\n kOF+fsqwcu9YWv5qP5FRz/x7BY35IuYH5PoDoMuoqgCjdlXobKWum0yNpeHvIdzGTRY=", "X-Gm-Gg": "ATEYQzxWWagKSPGF5E3VDs+YQt/KxOE51pNQIX2Ss4ybFIjfWztfwGhyOr5QDy+pF6r\n RLiDrMgRsqf/V2lUm4E8IUdmkirVAx7us+POotEUj/vI5bztcxbQgFpEjM0r+iSurehk56kTMR8\n 7c3qDAB9rlcO0aMH6790J1BT1DCV+uIhaTe8fexnkzmgAWVf2tiiTsQyfe8ueUMzZz2cUuItyN9\n Y08NflmEJm9xKhQwYiydZD7UfcRWq+vYdRhQUIMPWm4kx+8pm4aX9yTIpoVOJsMf14b7Ke7gb8e\n Z0KdKQ1UIMjzNBolfXHiYc4Ak//TX8wYATqtfbC2Gz+bf/6zsej9vhJXaZVTYArH4YBAfVSx9NZ\n QJUxAnwkHN69YZme5reUT91f54CC+kuZa4Etw9KTDtICEsj8gJ+zUnrL4AIle5lKANmH4ePmKUq\n jKkgzY+Qe94iwdH/WxsvvOXwBiqmffKW/lc9jb4rCi0ablfjpqez+ZyneUPVR/eXz9ZKGa", "X-Received": "by 2002:a05:600c:818f:b0:485:3423:727d with SMTP id\n 5b1f17b1804b1-48883595de9mr60140335e9.26.1775052932026;\n Wed, 01 Apr 2026 07:15:32 -0700 (PDT)", "From": "Casey Connolly <casey.connolly@linaro.org>", "Date": "Wed, 01 Apr 2026 16:15:22 +0200", "Subject": "[PATCH v2 06/11] compat: add kref implementation", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "7bit", "Message-Id": "<20260401-casey-ccf-compat-v2-6-414d5b7f040b@linaro.org>", "References": "<20260401-casey-ccf-compat-v2-0-414d5b7f040b@linaro.org>", "In-Reply-To": "<20260401-casey-ccf-compat-v2-0-414d5b7f040b@linaro.org>", "To": "u-boot@lists.denx.de", "Cc": "Tom Rini <trini@konsulko.com>,\n Casey Connolly <casey.connolly@linaro.org>,\n Ilias Apalodimas <ilias.apalodimas@linaro.org>,\n Simon Glass <sjg@chromium.org>,\n Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>,\n Romain Gantois <romain.gantois@bootlin.com>,\n Andrew Goodbody <andrew.goodbody@linaro.org>,\n Patrice Chotard <patrice.chotard@foss.st.com>,\n Raymond Mao <raymondmaoca@gmail.com>, Peng Fan <peng.fan@nxp.com>", "X-Mailer": "b4 0.15-dev-47773", "X-Developer-Signature": "v=1; a=openpgp-sha256; l=4465;\n i=casey.connolly@linaro.org; h=from:subject:message-id;\n bh=IsUyr94uAbhBQSS9jsTFSHJPICURKHi5YxAKX4Vf8eI=;\n b=owGbwMvMwCFYaeA6f6eBkTjjabUkhsyzGlWvP6QmRqfZa0g5pW7Tir22mvPx175fTM8fs/qu+\n Cv6u/NGRykLgyAHg6yYIov4iWWWTWsv22tsX3ABZg4rE8gQBi5OAZjIayOG/77O9r0TNmZm7aw5\n rynt/zL0e/s2sV0f+BeX2qTYc94xVGf4Z1lSei7icfyLaYLvep+yXfJUt921eGKo45KWXVd1frK\n zeQEA", "X-Developer-Key": "i=casey.connolly@linaro.org; a=openpgp;\n fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47", "X-BeenThere": "u-boot@lists.denx.de", "X-Mailman-Version": "2.1.39", "Precedence": "list", "List-Id": "U-Boot discussion <u-boot.lists.denx.de>", "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>", "List-Archive": "<https://lists.denx.de/pipermail/u-boot/>", "List-Post": "<mailto:u-boot@lists.denx.de>", "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>", "List-Subscribe": "<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>", "Errors-To": "u-boot-bounces@lists.denx.de", "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>", "X-Virus-Scanned": "clamav-milter 0.103.8 at phobos.denx.de", "X-Virus-Status": "Clean" }, "content": "This is a very basic port of Linux' kref, we don't actually need atomics\nso we just use a simple counter. This is used by CCF to free unused\nclocks.\n\nSigned-off-by: Casey Connolly <casey.connolly@linaro.org>\n---\n include/linux/kref.h | 124 +++++++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 124 insertions(+)", "diff": "diff --git a/include/linux/kref.h b/include/linux/kref.h\nnew file mode 100644\nindex 000000000000..30927047d549\n--- /dev/null\n+++ b/include/linux/kref.h\n@@ -0,0 +1,124 @@\n+/* SPDX-License-Identifier: GPL-2.0-only */\n+/*\n+ * kref.h - library routines for handling generic reference counted objects\n+ *\n+ * Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>\n+ * Copyright (C) 2004 IBM Corp.\n+ *\n+ * based on kobject.h which was:\n+ * Copyright (C) 2002-2003 Patrick Mochel <mochel@osdl.org>\n+ * Copyright (C) 2002-2003 Open Source Development Labs\n+ */\n+\n+#ifndef _KREF_H_\n+#define _KREF_H_\n+\n+#include <linux/compat.h>\n+\n+struct kref {\n+\tlong refcount;\n+};\n+\n+#define KREF_INIT(n)\t{ .refcount = REFCOUNT_INIT(n), }\n+\n+/**\n+ * kref_init - initialize object.\n+ * @kref: object in question.\n+ */\n+static inline void kref_init(struct kref *kref)\n+{\n+\tkref->refcount = 1;\n+}\n+\n+static inline unsigned int kref_read(const struct kref *kref)\n+{\n+\treturn kref->refcount;\n+}\n+\n+/**\n+ * kref_get - increment refcount for object.\n+ * @kref: object.\n+ */\n+static inline void kref_get(struct kref *kref)\n+{\n+\tkref->refcount++;\n+}\n+\n+/**\n+ * kref_put - Decrement refcount for object\n+ * @kref: Object\n+ * @release: Pointer to the function that will clean up the object when the\n+ *\t last reference to the object is released.\n+ *\n+ * Decrement the refcount, and if 0, call @release. The caller may not\n+ * pass NULL or kfree() as the release function.\n+ *\n+ * Return: 1 if this call removed the object, otherwise return 0. Beware,\n+ * if this function returns 0, another caller may have removed the object\n+ * by the time this function returns. The return value is only certain\n+ * if you want to see if the object is definitely released.\n+ */\n+static inline int kref_put(struct kref *kref, void (*release)(struct kref *kref))\n+{\n+\tif (--kref->refcount == 0) {\n+\t\trelease(kref);\n+\t\treturn 1;\n+\t}\n+\treturn 0;\n+}\n+\n+/**\n+ * kref_put_mutex - Decrement refcount for object\n+ * @kref: Object\n+ * @release: Pointer to the function that will clean up the object when the\n+ *\t last reference to the object is released.\n+ * @mutex: Mutex which protects the release function.\n+ *\n+ * This variant of kref_lock() calls the @release function with the @mutex\n+ * held. The @release function will release the mutex.\n+ */\n+static inline int kref_put_mutex(struct kref *kref,\n+\t\t\t\t void (*release)(struct kref *kref),\n+\t\t\t\t struct mutex *mutex)\n+{\n+\treturn kref_put(kref, release);\n+}\n+\n+/**\n+ * kref_put_lock - Decrement refcount for object\n+ * @kref: Object\n+ * @release: Pointer to the function that will clean up the object when the\n+ *\t last reference to the object is released.\n+ * @lock: Spinlock which protects the release function.\n+ *\n+ * This variant of kref_lock() calls the @release function with the @lock\n+ * held. The @release function will release the lock.\n+ */\n+static inline int kref_put_lock(struct kref *kref,\n+\t\t\t\tvoid (*release)(struct kref *kref),\n+\t\t\t\tspinlock_t *lock)\n+{\n+\treturn kref_put(kref, release);\n+}\n+\n+/**\n+ * kref_get_unless_zero - Increment refcount for object unless it is zero.\n+ * @kref: object.\n+ *\n+ * This function is intended to simplify locking around refcounting for\n+ * objects that can be looked up from a lookup structure, and which are\n+ * removed from that lookup structure in the object destructor.\n+ * Operations on such objects require at least a read lock around\n+ * lookup + kref_get, and a write lock around kref_put + remove from lookup\n+ * structure. Furthermore, RCU implementations become extremely tricky.\n+ * With a lookup followed by a kref_get_unless_zero *with return value check*\n+ * locking in the kref_put path can be deferred to the actual removal from\n+ * the lookup structure and RCU lookups become trivial.\n+ *\n+ * Return: non-zero if the increment succeeded. Otherwise return 0.\n+ */\n+static inline int kref_get_unless_zero(struct kref *kref)\n+{\n+\treturn kref->refcount ? kref->refcount++ : 0;\n+}\n+#endif /* _KREF_H_ */\n", "prefixes": [ "v2", "06/11" ] }