From patchwork Sat Jun 26 00:57:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 1497522 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=W1HrvGAb; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=lMB4Nv+9; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GBb814yRYz9sWQ for ; Sat, 26 Jun 2021 10:57:53 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ep/v7TFDYmG7r7yJmYrFKp3p8ifJdZWqQDvKHdvb9Dk=; b=W1HrvGAbezlOoM OubLLyIJzAcZotSZE5wH891QubRHeD7H49aFrQIZ+pMS4yzzGTR7A1cVEtDVy2E+gV7z1xW9Vh/jw OuuwN15rPQODF1hkaHYEbPrXhGViV3r0mQ/jjyeYLd4FzRmVxzE89T8DnPBfogPJyX+fyk8LJtWF2 vvQhhGfyfc+dnc86Zy+kFIOKgITUTLfDDx7sy6LbV5YeAqXO3xim5Nd8RiVUbCyUCJ3MA/ZTwKh6T KdLQ5Zs4Nl/FRbzXryL74ACmkLFB4bS4UZXzEky3sk/UZG5cqubHZzitM/nqqXyK8EfyiSDUJqguI myahNm4UPwAcJ3mFR1JQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwwdo-003B14-RY; Sat, 26 Jun 2021 00:57:48 +0000 Received: from esa1.hgst.iphmx.com ([68.232.141.245]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwwdk-003AyS-K9 for opensbi@lists.infradead.org; Sat, 26 Jun 2021 00:57:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1624669064; x=1656205064; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2Uy8LOJBKl39QWbNVvdF99m9s4V2r/iqvfma8ORR2NI=; b=lMB4Nv+9JAGbUjlKfiMYXDTJKdHCFnAvKRJSCFKu1/ViFXlgoCcWAbl7 mEUFXBMekEKjcE6jrxW24aYH25CGdzSINXJzRyFalumA3elsm5OZDrQYH sAx//LU/fgqFGD0hxBBCefobSd16mOvW/s620UjuC+4bJYq7s+Nw7Fsp/ g9rNvl6MIA4xk3l598FfQxHvwkWxgQ/DS8ld0Ro9+pp581Ubv6bwpsBDp r1PreKtrg6bntmJcr1BTqwZ92iFDhDMouKKXIzGpmFbAfnri3TAFGDjhK cWpVpkglIRICyJozsEuQxSdWzngBiGh8scsvgif1xxDJMCTd1BAZmyri8 Q==; IronPort-SDR: Ka4oCeoHJrXJwcMyiaqoiHf8CxCSj5yEus9wekWh2yb6JBPcU9QKmL4Twq7bFJIJ975iZUXFzb 6rMWj2MDfJhPRrC7L5DCpfE32D1gGhUYNJszSnYUWvhQFFtrbmNn60zMyuq2LPEX0V0Ei9/PDQ sSAZqzxAScBessKOvncz8bhFfFjsbCLViMWoGLVdcZBkKy2W/5BO/5UEjT5knprUDkW3jXzeRQ nMJmHvP5x32a1IiBK6svLVaU99x8Xq+s37QBEg0F6Rq3Bk8E7bnZjn6lcXcJsLF+d8PQ9L7FM2 2Lw= X-IronPort-AV: E=Sophos;i="5.83,300,1616428800"; d="scan'208";a="284438598" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 26 Jun 2021 08:57:44 +0800 IronPort-SDR: 6ZMElNtvfiP+oouY0KxXXtuy1SCde7TevC5H5OqGi6hA3zzAVnviPjEdwpZm9ZaadgyvyeVnvP n8zL+m5Nu0a0E66DiqC5fHDFakqWmMohQ4zUF49larksnifT7OWv1xxhO7TXKJOHK2eHVDPYwp 8IyZwEVHOYy2ocWfDez/VHGbM3aeR5AYjs/pWnq6LuLQl6LUUgunQ6BBdRhrJCyQPzIXp0Xbsv e6oqC2fb1FBAa/UvZQoqgKsDk7aWmjv8u958LiP/FHoHLHF8plxWOk6LTVK9fy8ooe0LunXdr5 v1ccqDBz6VAZlddeSv29iXun Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jun 2021 17:36:16 -0700 IronPort-SDR: g7UkpNmMCXaUEcqI1/Fj+aT4bRPfUA3bo4siNKlr6JVhXbp7biRGmASFlh7MY6sMy0MiqlWwos p9xRcQzp8QzqguJvs63ZC95s0e0/FpcWex8qs4o2fhP3ogUsHDy0tblBqZnfSOi7yokD6W2+5T czHjYIGcxT/mvNO2/CBNKz8wr9Tz+L+xx+g1ug1Io8/oUagHwfJ5trMd6mXUOkaHiCbmxO56G+ Jhe32SR8IVU3NzKbmSyGha/b6JdHwFnn1k/tJJUKdbiL5DhEk/HOwjRgEBLXncpMvcgmxaKwEn 3wk= WDCIronportException: Internal Received: from unknown (HELO jedi-01.wdc.com) ([10.225.163.19]) by uls-op-cesaip02.wdc.com with ESMTP; 25 Jun 2021 17:57:43 -0700 From: Atish Patra To: opensbi@lists.infradead.org Cc: Atish Patra , Anup Patel , Xiang W Subject: [PATCH v3 06/15] include: Add a list empty check function Date: Fri, 25 Jun 2021 17:57:12 -0700 Message-Id: <20210626005721.3600114-7-atish.patra@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210626005721.3600114-1-atish.patra@wdc.com> References: <20210626005721.3600114-1-atish.patra@wdc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210625_175745_040001_09D40EE6 X-CRM114-Status: UNSURE ( 9.67 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.5 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Implement a list helper function that checks for empty lists. Reviewed-by: Anup Patel Reviewed-by: Xiang W Signed-off-by: Atish Patra --- include/sbi/sbi_list.h | 11 +++++++++++ 1 file changed, 11 inser [...] Content analysis details: (-2.5 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.141.245 listed in list.dnswl.org] 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Implement a list helper function that checks for empty lists. Reviewed-by: Anup Patel Reviewed-by: Xiang W Signed-off-by: Atish Patra --- include/sbi/sbi_list.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/sbi/sbi_list.h b/include/sbi/sbi_list.h index 1174ad274c54..b1178dfc9b8e 100644 --- a/include/sbi/sbi_list.h +++ b/include/sbi/sbi_list.h @@ -43,6 +43,17 @@ static inline void __sbi_list_add(struct sbi_dlist *new, next->prev = new; } +/** + * Checks if the list is empty or not. + * @param head List head + * + * Retruns TRUE if list is empty, FALSE otherwise. + */ +static inline bool sbi_list_empty(struct sbi_dlist *head) +{ + return head->next == head; +} + /** * Adds the new node after the given head. * @param new New node that needs to be added to list.