From patchwork Wed Dec 11 02:25:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 849135 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:2c4:b0:385:e875:8a9e with SMTP id o4csp100717wry; Tue, 10 Dec 2024 18:26:07 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU75WNtXp60ZbngE8G9LanzjO3uSLS6lcs8Y2Ab3rV77Q/yRxqFFSd0fxgyUGDTDE3D/ALxHA==@linaro.org X-Google-Smtp-Source: AGHT+IHk032Z8QlKwx+mT7GGShyJ8qIqpzB6B1Ru9FWA+L8NUTM6F1eDVucFxqJW/sl9svAgzwCo X-Received: by 2002:a17:907:6e8d:b0:aa6:9134:decd with SMTP id a640c23a62f3a-aa6b16fdf57mr62689566b.27.1733883967560; Tue, 10 Dec 2024 18:26:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733883967; cv=none; d=google.com; s=arc-20240605; b=KVWu0WGzPKrm70kXD+YjYeDF+rZxKNbcot9axvyeSoKrqDPqgmx66PMSJ2MgVBRxZM 7z17N+e9kqNqrEw+K0gULKeXVR6AngfTJL6GJdnQmP2DvIyJCX8ETsARwElLmAtHmE3t thhB+CXc+5kxaUwduYsj2xMXcn769MFmCxKdvKYx1GVaYtBDAwZM+bTqWtZQDT1PKFCB xOJ46Nh+gv/dnmwu83YSgq0EsB3RCeR3rr4rWYV/LwvLvsAno8Lw8FhbldZ5axoY+PJz vFOMVCpgNffPPx0yiuiplBPYIo7m7mzHHUPac4Zpe08er/D2RBZB4ZpR+2sdmqpc9Kan 70Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JtanFdORLhTmdzbVZdrqL+jolyIQBa2nxpLfZ7SB234=; fh=ikOsYIFg/b0oFvnyknHAHJuc4OM0MUyn5XRoWwfSJF8=; b=V6Wk+289xOcJspo4qsn6G8Tr7El4iyx5oRHsTbeq6lQTauIRpjqTEEfct5s55urHTu iiHkDWwCvAkxXrtH/4NM8modROGJqOjk3TX2xuIV//AbTIRTXpqy3DvnqgG7dr1MYH6+ RFoNzm7NsMUH/OKRk6NYwinsE1zkC7yxoey+hYbl2F7kiSLoQU9sUOX5elcj1U8e9s1o jIGKbHNmKEN6IZb3k1uwYSjxp6xwmOo2uE/LMGb48LWmFdaRnO3jdiUXDYTNnnnwhsoA 1FH0WiYIHNX6PoiO37xItxWv2DsbbwGODfAlX/hOAWUVY4REOYGgD7pCqTYFzEuWYGcl ExjA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YalCHL1a; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id a640c23a62f3a-aa681305236si415169666b.140.2024.12.10.18.26.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 18:26:07 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YalCHL1a; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0AB7E8021D; Wed, 11 Dec 2024 03:25:58 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="YalCHL1a"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6CDDF8023C; Wed, 11 Dec 2024 03:25:57 +0100 (CET) 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, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x22b.google.com (mail-oi1-x22b.google.com [IPv6:2607:f8b0:4864:20::22b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AC63280212 for ; Wed, 11 Dec 2024 03:25:53 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oi1-x22b.google.com with SMTP id 5614622812f47-3eb7e725aa0so348858b6e.0 for ; Tue, 10 Dec 2024 18:25:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733883952; x=1734488752; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JtanFdORLhTmdzbVZdrqL+jolyIQBa2nxpLfZ7SB234=; b=YalCHL1aKYqVcM2Afbj+b4RWBt1770lV4l9v0eGsBPv1UMyWdfMyOfor9SNr3hUE37 AL37ehsH/Euc4RNa9DEVyEx9jAuke91hfx/dCXzexY3tHfiIdnrPn6E2U4tRR5Qs1Ef7 CU9QfOn+4b3dT/omtOHC42obdTUE00NKwUdog09fWNnukgkqLcSQDeIT3+58nXGuV5+i MJy+nRiCQtQhZspOxmt2KCzph2WPXSz9roUEJX4OSdkzBwVT9XWYKhAIO9VyDQRijHdB sARTQWBnUB0vCU8xUb225OyVespfzYY5FvAlYc02Gr3I+j1cGwoL9UYtIqHZY10llTyp IDgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733883952; x=1734488752; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JtanFdORLhTmdzbVZdrqL+jolyIQBa2nxpLfZ7SB234=; b=dNFuPA215UlC0R6Aemk8SuJNkC9Uk7wDihdx7Gg1MEIr3opFnlxz2Crrzx2aFrcGZM 7VShlRZ5fj8qfZlFgpSEhvCpa41e+PBLhh1zNggLqUoSKUA5nkFiD9RhjtQ9iKnlle5x 3J7s0lnNyZVRK3QcTtHI+FyaGMOE9GgBySyZzXxXzjzt78sh8ELmfC5psWcvveKI7IfM vghTFlsjM3o8iKH41fU5Ewm/qx3Q2yNSsZK/tDv87AEpJezNj2fdPt38MKWmGSmKoibP +5C8CXmD8x+fwXOegwLmwQFpCen2TpPytAIc7bLGqi8ZqNP5TfNc5Xvrvgb4tEdWs3g+ 9jKA== X-Forwarded-Encrypted: i=1; AJvYcCV76WRTbtiI8ui+UZbWMur8wE0YPlhX7qV7OjLVO/josgE0VeTT6v9LQyrwRFHUFw0M27OwtZ0=@lists.denx.de X-Gm-Message-State: AOJu0YwHm0L00qDJzzP9hgHmXAzRrIJAvbINGC6uPB1UmXhcvfdfAbZl JQbSpJCMbubzpOv5NXUINjO5FKIxw2eTmCrdwzALCIAJl2YSiK+J+hk6t5J3Glo= X-Gm-Gg: ASbGncvt36xAyuRG5bsdd14Nhtq6OTc38PZ3P7OQQz8/4uzxUQN5djn+uxY7gjKPSX3 iZddGvm5waHBHgtkavlFFd+O5vXFmckSjViLThjDYShMlIC9g76i1WQ1XNmQxSJqia0rEib0fsf zdAWtV3j4Yi05oC9Aw+WEG5JVRrfS6oJ1hQ93m1gLBSHwLsb9Br0udNqKcvniK2Kmgu2ksqdpNp 7pw0SYl1sbAvBduK5mNRToLffse4czIdE6J0PdWP5Ep9av0qcL+h9bRQeE= X-Received: by 2002:a05:6808:19a4:b0:3ea:5880:fe1d with SMTP id 5614622812f47-3eb85dda405mr527832b6e.35.1733883952450; Tue, 10 Dec 2024 18:25:52 -0800 (PST) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71dc4a0267esm3130892a34.52.2024.12.10.18.25.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 18:25:52 -0800 (PST) From: Sam Protsenko To: Tom Rini Cc: Ilias Apalodimas , Sughosh Ganu , Heinrich Schuchardt , Simon Glass , Caleb Connolly , Marek Vasut , Laurent Pinchart , Patrick Delaunay , u-boot@lists.denx.de Subject: [PATCH v2 1/4] lmb: Fix flags data type in lmb_add_region_flags() Date: Tue, 10 Dec 2024 20:25:47 -0600 Message-Id: <20241211022550.2995-2-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241211022550.2995-1-semen.protsenko@linaro.org> References: <20241211022550.2995-1-semen.protsenko@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean rgnflags variable in lmb_add_region_flags() has incorrect type: it's declared as phys_size_t when it should be enum lmb_flags. That copy-paste mistake was firstly introduced in commit 59c0ea5df33f ("lmb: Add support of flags for no-map properties"), and then copied further into commit ed17a33fed29 ("lmb: make LMB memory map persistent and global"). Fix it by using the correct type to match struct lmb_region field. No functional change. Signed-off-by: Sam Protsenko Reviewed-by: Ilias Apalodimas Acked-by: Sughosh Ganu --- Changes in v2: - Added R-b tag from Ilias - Added Acked-by tag from Sughosh - Removed Fixes tags, as suggested by Sughosh lib/lmb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/lmb.c b/lib/lmb.c index a695edf70dfa..1d57f48bff67 100644 --- a/lib/lmb.c +++ b/lib/lmb.c @@ -202,7 +202,7 @@ static long lmb_add_region_flags(struct alist *lmb_rgn_lst, phys_addr_t base, for (i = 0; i < lmb_rgn_lst->count; i++) { phys_addr_t rgnbase = rgn[i].base; phys_size_t rgnsize = rgn[i].size; - phys_size_t rgnflags = rgn[i].flags; + enum lmb_flags rgnflags = rgn[i].flags; ret = lmb_addrs_adjacent(base, size, rgnbase, rgnsize); if (ret > 0) { From patchwork Wed Dec 11 02:25:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 849136 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:2c4:b0:385:e875:8a9e with SMTP id o4csp100765wry; Tue, 10 Dec 2024 18:26:19 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVqDyOWTysowK9fDBLZ0FCJFRIW8tok0JCmvuO3Ui+ywhDVH1VVSdjLCDWp6vK4WJVxRzcUdg==@linaro.org X-Google-Smtp-Source: AGHT+IFqZFEX9nZQxhVc1nrbAI2WlSmuQ2z3L3qiTJCj5vCRaG4hlVkKmUjOwN8q0EH//JIVPYjw X-Received: by 2002:a05:6402:2790:b0:5d3:fc60:a50d with SMTP id 4fb4d7f45d1cf-5d433194a87mr712465a12.34.1733883979532; Tue, 10 Dec 2024 18:26:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733883979; cv=none; d=google.com; s=arc-20240605; b=KAODR0g1/D8t6ytCoe7wrOkQhxqDm/L/TuJwMkyXpLHzAOGWLAYFs0L1vWrP2F4daT uZ2fXTdzdUcjGcsZ0dZJ2ezmUFRNFv5u6DZLRiYREEdgsSJ8Kd7TqdRN/DWXXadHNIR1 g5q+HWQk0I6bVnNYg2AH9k1DA7k8h9zzSCehBPPaximiPiX/ECWgpgi6V024aCxH1bA6 dkOQ8LB/BsMtGyaFieMj97SlPVvT5AwdRUp9ddLd/D4/iBkpEj2Ed+fC/LbSod8Z+ICg qBpOPIp9QXG1RgRxquD92tcUxQxu/nKoSeOeIkSQTu5eZRtTBBlDAWkGuX0FwSpOvjx+ stmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CX6PD4cNnpNfjYBZCnKJCMA89BiMVHR+VdvUJYthjPE=; fh=Vo8XIS4Sv/dUM0BI9QhXJH+LpdE6lJIKxWrv6KDzfKE=; b=QdnWTbP/7FSpNRzqEADA35Txh3ihCzHne+DHckVbtUGgeqYyawYH3bbLAgFvm1kTH8 hy9g1fq3/Fak6J625Fb79LN9SPWIrc1YVzxpk7qDaS4bW1CkAkYLaoNjpnDFCFL8K3Wy 8OHUNI0Eb1/VI1RQPJd9yehwMvBMKLG5SM5FWP8e+S9HlSAkbdXfjTFL2kGPko/TAHiS u2BuCo2iGqB9iommFIH+cte8xu1mbQD95Y29gMO93CCACHwJn5a2hHaWqXsTdhWbDutl xrk7LK1Oj6j9hf0DhaNnzwepJVgnkAGUKtjCljLS1JdjnXHLK9WqFfGgah9v0U/l0HGy JLrw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DlR9IGb6; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5d158c4de1csi9318890a12.421.2024.12.10.18.26.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 18:26:19 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DlR9IGb6; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6940C80200; Wed, 11 Dec 2024 03:25:58 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="DlR9IGb6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 768B980212; Wed, 11 Dec 2024 03:25:57 +0100 (CET) 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, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x32d.google.com (mail-ot1-x32d.google.com [IPv6:2607:f8b0:4864:20::32d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id CC5E980219 for ; Wed, 11 Dec 2024 03:25:54 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-ot1-x32d.google.com with SMTP id 46e09a7af769-71e17de2816so232627a34.0 for ; Tue, 10 Dec 2024 18:25:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733883953; x=1734488753; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CX6PD4cNnpNfjYBZCnKJCMA89BiMVHR+VdvUJYthjPE=; b=DlR9IGb6+Bnh7apSBKlcuk1Qvo0HAX4ozFaarMnXrAy1nMIYJ9g9E5rSmrvW+RiZgp 4H6qK+eLTPbnFuXrTSLuF6X1XgzIDMWctTXt7wHjtLUJjGVG50ABT+ylQfg0euKhQ61g S90ad0BwaIpJ/FAOhhTkZIGZgucX/9UEIzzay3bbI7RX3fHyix6eR9m1mPNCghpiSnSt nloitb2JcRG93mBKY8Soy2yoe7vTGWJA9pE5SIWK0LIo0OfS3gxELJCg2fFzd8o1zvVt 9g0UZY6QOxGWHgtIA8DCSR42MLPxD0RuCXprGvapNv1YisLJfU7J5veaLYajOaO70yKs ISIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733883953; x=1734488753; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CX6PD4cNnpNfjYBZCnKJCMA89BiMVHR+VdvUJYthjPE=; b=RAM9DKQyqszYXLuaW8htFSTEQbir5sB+0uWyjLcFFJyh++5F44h5VQMwvR6MemXcue 9tvkMXIEmx5x/nv4DprPCJJnqFALtGrrqjNPEmeRWAISsUAFjWWrYYW+7Y4THWlv6wJ1 XtFmjRza6PUyiqNWEYeHcic2gbTX+pe6Spn7R2+XeXS2TsLstfi/5U2amF++b3KNPLSv ACJ9hKpIDCXCFfE14bDUjKplaiJmrK7oYEwffn2hZgdkOFN0vgY5/fUHe2Xu81LSRKZ5 iXeXr5PtSxsRxs/AnP0G5f/tJVrQMbApC1kywtHhKPzcbpVqcDUat9iDB8vQHKRARzls epjw== X-Forwarded-Encrypted: i=1; AJvYcCV+r9w7V+wEwU/3ofhIZUsGVgCFROxeKDAJowBL3veQ/G88DyrqiAhnCIyxOR8xmUMZMCEOeAQ=@lists.denx.de X-Gm-Message-State: AOJu0Yyi3tstJYAA/fhBfsQYDcj4PKtH+HzgR0FEbssD0TQO37SvT6vU B2iDgq4jJzAo0JG+KnR/y3ywo3im+LTFo7y/CzU30JKC+EnpHIjG0fCW7nE0pXU= X-Gm-Gg: ASbGncuVRpPgkWWvRdaN7/wf+g7ekP0jkxShLnxesJrP3LKeV6CbyzpXOrNF12EzzW2 VSP5Xo+Q+Df6+sQvk80EdTn9vxLOXyaoN5OZxaL5sIWdj4X4I1SVfL2RyvMz6DRJG5GbqfntBPd WpSSTf68Ebl0Whqza4M4fBGa4CeTSdIb7s173U/lY5YQ6axgij22jGf6pM2ibPGjIB0BqR7st/T AJrF42vQiGfTNdrEugcCvFvWs5AU+R8KPxXytNTWJmEFvnvzro5DYL+d3w= X-Received: by 2002:a05:6830:4888:b0:71d:e900:2322 with SMTP id 46e09a7af769-71e197c959emr514454a34.8.1733883953569; Tue, 10 Dec 2024 18:25:53 -0800 (PST) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71de723c753sm1931257a34.72.2024.12.10.18.25.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 18:25:53 -0800 (PST) From: Sam Protsenko To: Tom Rini Cc: Ilias Apalodimas , Sughosh Ganu , Heinrich Schuchardt , Simon Glass , Caleb Connolly , Marek Vasut , Laurent Pinchart , Patrick Delaunay , u-boot@lists.denx.de Subject: [PATCH v2 2/4] lmb: Make const flag_str[] in lmb_print_region_flags() more const Date: Tue, 10 Dec 2024 20:25:48 -0600 Message-Id: <20241211022550.2995-3-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241211022550.2995-1-semen.protsenko@linaro.org> References: <20241211022550.2995-1-semen.protsenko@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean flag_str[] is a pointer to const. Make it also a const pointer. Improve a style a bit while a it, to make this line fit 80 characters limit. No functional change. Signed-off-by: Sam Protsenko Reviewed-by: Ilias Apalodimas --- Changes in v2: - Added R-b tag from Ilias lib/lmb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/lmb.c b/lib/lmb.c index 1d57f48bff67..0f9de26b64af 100644 --- a/lib/lmb.c +++ b/lib/lmb.c @@ -472,7 +472,8 @@ static int lmb_map_update_notify(phys_addr_t addr, phys_size_t size, u8 op, static void lmb_print_region_flags(enum lmb_flags flags) { - const char *flag_str[] = { "none", "no-map", "no-overwrite", "no-notify" }; + const char * const flag_str[] = { "none", "no-map", "no-overwrite", + "no-notify" }; unsigned int pflags = flags & (LMB_NOMAP | LMB_NOOVERWRITE | LMB_NONOTIFY); From patchwork Wed Dec 11 02:25:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 849137 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:2c4:b0:385:e875:8a9e with SMTP id o4csp100802wry; Tue, 10 Dec 2024 18:26:29 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWlG7XoWZkZ3utoYgd/4G1M3uTF98ZLSiVoxLj5sVqfYTXMPQZbXAxRx2rOZHpRCiGo498Vhg==@linaro.org X-Google-Smtp-Source: AGHT+IFazqkeiAvXajkR3eJACenHjV+2Exmy+N0WW0kGQYhs+nHshF6QtvIMIroPByx5ujAEEqqt X-Received: by 2002:a17:907:9557:b0:aa6:a966:da12 with SMTP id a640c23a62f3a-aa6b11e5117mr95223866b.29.1733883989303; Tue, 10 Dec 2024 18:26:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733883989; cv=none; d=google.com; s=arc-20240605; b=eotp8vUQU3kLBxrw8slFzOOC/zhL3gM1aAzMOfdxeyMoUKmFId+tr8noXPlqMRv1JL 05pdD35AIy/1x1xlKH537JFZB2lwsrAQcyM/SzVWWLtYx0p/nJej84f8QfAMnuqxezvI hR+a3RdKrm7CBc8aHjjsjccDqsZ0ew7KIEKwvyRMhl73aPmXdNOeX5pBETdvWNYz0ZA2 gNBVc+vC65nzMRvtq+uahyf5Ai1YUhef+zt2McA/DiSViz75d4Z4JZ7b4zG4f6plPFZk EXhAAwf28uPzykkohl3QEhnA3/agBiOjwgRdvvXSG4JmSCP5sS0ggGjUMirpTb5wQtCj wUOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VUULVKp6JsJMDTs4uADkfys/dyoa4YYb7jx4+q3kuks=; fh=j9Hj8qRV3q2pmBXEOUkyGHs6CC8rmeOzGSzCDNV/NiI=; b=Bp7YrKaEXg6I1KkucvF8u2lhCdJKGaUWeaxsyd+deLxKUypK07cy4o6/+NbIkNHcSh h/QiciUjyhoKcebVMCafsn9fFaDYR5YYcIZ/XBxpGIsWAVTtvRfLR9nG/SYuBKOkmbQj TN1qTfSWQNodI320uV4PBkld1jPsh9n9vq72t5aOXLnCEOQ9Vu5paqvA1viX4HUvRS8J A9TrN3M11T+vWW7RnG+gfxyqiSLj+xbOLAf88mgKQKKjvqivZ8eKbUnuuiy5o4b7r6xm Uw1bmOzvLXAbbLcYHzEHqvoWep8R+gocfXN2PmXoqory6+NNqmczPDYQjbv+DSZ9iSah uwrg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BaFsQ2PC; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id a640c23a62f3a-aa66f6bbc71si540654466b.403.2024.12.10.18.26.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 18:26:29 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BaFsQ2PC; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BB8CA80274; Wed, 11 Dec 2024 03:25:59 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="BaFsQ2PC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 57BE28023C; Wed, 11 Dec 2024 03:25:58 +0100 (CET) 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, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oa1-x32.google.com (mail-oa1-x32.google.com [IPv6:2001:4860:4864:20::32]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 071A3801FE for ; Wed, 11 Dec 2024 03:25:56 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oa1-x32.google.com with SMTP id 586e51a60fabf-29645a83b1bso3161896fac.1 for ; Tue, 10 Dec 2024 18:25:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733883955; x=1734488755; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VUULVKp6JsJMDTs4uADkfys/dyoa4YYb7jx4+q3kuks=; b=BaFsQ2PCbLabqBBTUGKMjd3CMG1Rtf7lJCfpjFhVaIYbqN//TEkFVtSbBnIdCgg18t zu9g6mBEhgarQ2g7/+iu7Z0sjM7YYz9GeJ1sHX9/7FHsal6/QUr0g8jsXpO/+9A1jvkQ 7kZDkJJMU5upEELBtxFlg+YWBtOVRzYPzu6sWTM/rQ8++mp/raXB1Ae4PreWjHY1PZfs QUNyXq9oXPPAzwnTsSe9BOYtMrYtlqx92pKb+K3nsukWDkQJEiLkKntJfcnGcD52E5OL IVogIGS11Bg38rcrIXs5gcEy1Scy12CI0t6At+k7aDLv0BlKLQWaahF7u5+Ne4tbNbxb CCRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733883955; x=1734488755; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VUULVKp6JsJMDTs4uADkfys/dyoa4YYb7jx4+q3kuks=; b=EKHAr51kth2MsT5yGuZ02dLQzGMrJSM80TEtcpZtehJLP224ddH1N9kG1QMDVL2RdO DeqOj5QgSfLd9LfyuTHnwOvBKC91LIrmIB8DmLx+jHMjsKhNcLTC7PI6lxbnqb4iEkqB INDuGo1+nJZPDA0nwcsWJyfKUEGvuo1/3AiBHZGB0IVVtbKdB8mi5+8fLnVGA7EB+mqt u0gvh6mUDqNFFWSoDGG7TolAfecXUTyqU+FkPl0My67yEpRWVZ3JUpZZ0umpes4jTD6t FBX5utvYcVYt+wn6n01ZbTDxpfHaexmGRIk+0eApM/qepimBq6pxuFq8qZVKHfCjcWzF 9lpw== X-Forwarded-Encrypted: i=1; AJvYcCV6wwZ6D0l4sMC6qGQSSSaYCIQFuqvJ9h6iiX5S79wdzcaDG/hnNPd4yVZvgAf14KamFmLpGos=@lists.denx.de X-Gm-Message-State: AOJu0YwO5JGIMocjC/JqhIhDwxANkBAbnVJP2ahOm9VLu+MRaZLRnsVA nrZplUgPOzsO5sK3FKzOTVd8vMSHT07pnOGM1xPf8Vcp/S3cAianLD4CV9G9DQE= X-Gm-Gg: ASbGncsDN8m/u9uoU/PDFDvsXEEOoO39cW2F5qIfBvnpVrwJtQbJECWWmGCHqhSefT2 eO5Q7D3KMq/d1isVFvih4vErD95NyJ1Bx5FLmlTVhp0B+fSphFEaQfnGIVNLTZk3Jll076UrXvV a8EJa4G8+B29gDScrOoOE6JYvW2BxzkFYsSpLxp0WPFhIntx1MyfH3Ky5CtrMT9s9bhSSKrNjnY OI5wy5x+tGT4WKUJAAmEGvieVZZ9kSIJwSA63wA2fo7xLQB3FJZTld2OCk= X-Received: by 2002:a05:6871:8916:b0:29e:29ac:5ade with SMTP id 586e51a60fabf-2a012e19fdfmr860987fac.35.1733883954846; Tue, 10 Dec 2024 18:25:54 -0800 (PST) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-29fd866f393sm1582995fac.21.2024.12.10.18.25.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 18:25:54 -0800 (PST) From: Sam Protsenko To: Tom Rini Cc: Ilias Apalodimas , Sughosh Ganu , Heinrich Schuchardt , Simon Glass , Caleb Connolly , Marek Vasut , Laurent Pinchart , Patrick Delaunay , u-boot@lists.denx.de Subject: [PATCH v2 3/4] lmb: Improve coding style Date: Tue, 10 Dec 2024 20:25:49 -0600 Message-Id: <20241211022550.2995-4-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241211022550.2995-1-semen.protsenko@linaro.org> References: <20241211022550.2995-1-semen.protsenko@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Fix checkpatch warnings. No functional change. Signed-off-by: Sam Protsenko Acked-by: Ilias Apalodimas --- Changes in v2: - Added Acked-by tag from Ilias lib/lmb.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/lib/lmb.c b/lib/lmb.c index 0f9de26b64af..40f03151929c 100644 --- a/lib/lmb.c +++ b/lib/lmb.c @@ -57,7 +57,6 @@ static long lmb_regions_overlap(struct alist *lmb_rgn_lst, unsigned long r1, unsigned long r2) { struct lmb_region *rgn = lmb_rgn_lst->data; - phys_addr_t base1 = rgn[r1].base; phys_size_t size1 = rgn[r1].size; phys_addr_t base2 = rgn[r2].base; @@ -70,11 +69,11 @@ static long lmb_regions_adjacent(struct alist *lmb_rgn_lst, unsigned long r1, unsigned long r2) { struct lmb_region *rgn = lmb_rgn_lst->data; - phys_addr_t base1 = rgn[r1].base; phys_size_t size1 = rgn[r1].size; phys_addr_t base2 = rgn[r2].base; phys_size_t size2 = rgn[r2].size; + return lmb_addrs_adjacent(base1, size1, base2, size2); } @@ -228,6 +227,8 @@ static long lmb_add_region_flags(struct alist *lmb_rgn_lst, phys_addr_t base, coalesced++; break; + + return -1; } } @@ -278,14 +279,17 @@ static long _lmb_free(struct alist *lmb_rgn_lst, phys_addr_t base, phys_addr_t end = base + size - 1; int i; - rgnbegin = rgnend = 0; /* supress gcc warnings */ + /* Suppress GCC warnings */ + rgnbegin = 0; + rgnend = 0; + rgn = lmb_rgn_lst->data; /* Find the region where (base, size) belongs to */ for (i = 0; i < lmb_rgn_lst->count; i++) { rgnbegin = rgn[i].base; rgnend = rgnbegin + rgn[i].size - 1; - if ((rgnbegin <= base) && (end <= rgnend)) + if (rgnbegin <= base && end <= rgnend) break; } @@ -294,7 +298,7 @@ static long _lmb_free(struct alist *lmb_rgn_lst, phys_addr_t base, return -1; /* Check to see if we are removing entire region */ - if ((rgnbegin == base) && (rgnend == end)) { + if (rgnbegin == base && rgnend == end) { lmb_remove_region(lmb_rgn_lst, i); return 0; } @@ -330,6 +334,7 @@ static long lmb_overlaps_region(struct alist *lmb_rgn_lst, phys_addr_t base, for (i = 0; i < lmb_rgn_lst->count; i++) { phys_addr_t rgnbase = rgn[i].base; phys_size_t rgnsize = rgn[i].size; + if (lmb_addrs_overlap(base, size, rgnbase, rgnsize)) break; } @@ -705,7 +710,7 @@ long lmb_reserve(phys_addr_t base, phys_size_t size) } static phys_addr_t _lmb_alloc_base(phys_size_t size, ulong align, - phys_addr_t max_addr, enum lmb_flags flags) + phys_addr_t max_addr, enum lmb_flags flags) { int ret; long i, rgn; @@ -720,16 +725,18 @@ static phys_addr_t _lmb_alloc_base(phys_size_t size, ulong align, if (lmbsize < size) continue; - if (max_addr == LMB_ALLOC_ANYWHERE) + + if (max_addr == LMB_ALLOC_ANYWHERE) { base = lmb_align_down(lmbbase + lmbsize - size, align); - else if (lmbbase < max_addr) { + } else if (lmbbase < max_addr) { base = lmbbase + lmbsize; if (base < lmbbase) base = -1; base = min(base, max_addr); base = lmb_align_down(base - size, align); - } else + } else { continue; + } while (base && lmbbase <= base) { rgn = lmb_overlaps_region(&lmb.used_mem, base, size); @@ -803,7 +810,7 @@ phys_addr_t lmb_alloc_base_flags(phys_size_t size, ulong align, } static phys_addr_t _lmb_alloc_addr(phys_addr_t base, phys_size_t size, - enum lmb_flags flags) + enum lmb_flags flags) { long rgn; struct lmb_region *lmb_memory = lmb.free_mem.data; From patchwork Wed Dec 11 02:25:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 849138 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:2c4:b0:385:e875:8a9e with SMTP id o4csp100860wry; Tue, 10 Dec 2024 18:26:40 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUkG6HFgR/5EQFMEo+qmpTFFYyJNMCSI6S1HLwNrbu1cu1LcWmPsR35nANYpMTQim1A4U/Acg==@linaro.org X-Google-Smtp-Source: AGHT+IFJsjlZPUSJXwYZLpR66qNNLLEXlRtWtCcE/QnPLTgjUB5E2yWvxZ1A9r/lgAVS0+24Wlxj X-Received: by 2002:a05:6402:234f:b0:5d2:7346:3ecb with SMTP id 4fb4d7f45d1cf-5d433081e4amr830667a12.12.1733884000069; Tue, 10 Dec 2024 18:26:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733884000; cv=none; d=google.com; s=arc-20240605; b=itojalXlnGiRtzlZ+x4ZVxrro5I6rQBO45SDqyEfNZBNyhghOrAa8SiXllYfmnVH9e b7QbquSVQ4ZNnhPW0hztKggpBziHdSRyEYBCzwie0e1Q99rItHOSWbtXlotu6XBAMuLo tVaeJm7dCn6A+2M5U3do9Mp4OusPIXcpI+HuxipyKWDm69qt0MU2hddd8jQZ4NYWTUlM FrtL+9+fSXLG+N03FTuUXJ6z+Nh8xig7n0LVABOeeklTDCIpy8EHAObPBSfioDvRPrU1 0YkDh3cqNV54zNVnirz1dyaez6Ie5Gy59Zak/qpPt2tJw4FdlLiOLyDcbuVOvTgFKxbz Gpqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZO8TXtqf2xRIVOtoc49ccfZf5XLnyi2rq2LUb4sCKyg=; fh=LI2ljVWvi6v8yiNy533nmpdl4CALkYgKbbQV4g9JKOc=; b=dpMZ1y3D2nxohrB0VOKfMDudv3ICnnrE2ihSMgGyYcGHrZCGCBbJE3iY6hrTiRQ1EV 1UlX+RDV2Ns6pf5zv1dwJQb8of58bSqG7n/C33yvFr+NNzaMuFaBeMpjCphceJryBtaP pZ2MTkH+0wIqdy2ONvh6r/xJ28E6rAjQLIgZp+dJbgcEWWIQwcsUFC0X6Ss+BPB1SY5N aTA+NrDLxNPVqufGq9Bs4hFMFygQj7fOV0jH7Cs/6N+v1NvlCBUWQ6lB/pZZgAKJvDvd Vbw1WH9yQza8zAkSRnPxOybqpOd3+tqW3ctkHU7aJNjv8nNkPCWZsV8YX+i1jbXpmHQo jw2w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uBJATvEX; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5d40a6fe604si3455971a12.321.2024.12.10.18.26.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 18:26:40 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uBJATvEX; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3BE048022E; Wed, 11 Dec 2024 03:26:06 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="uBJATvEX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 044428022E; Wed, 11 Dec 2024 03:26:05 +0100 (CET) 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, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x232.google.com (mail-oi1-x232.google.com [IPv6:2607:f8b0:4864:20::232]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 48DF48023A for ; Wed, 11 Dec 2024 03:25:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oi1-x232.google.com with SMTP id 5614622812f47-3eb4da24f3bso1414243b6e.1 for ; Tue, 10 Dec 2024 18:25:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733883956; x=1734488756; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZO8TXtqf2xRIVOtoc49ccfZf5XLnyi2rq2LUb4sCKyg=; b=uBJATvEXhHm3/PVbkfuPxD1DEMLg9ab3pv3pQ0WoWIY5DfHDIHbCvWyaGmma/2RpBy ZgDGYLQ/U2uWD7qfNOCgF51Ai2PlFKRjRzZ5n6rBSgleeBAFDb3E2ldqKsCh4535Jca8 yOZRNTdU04bnfBG766EP/rGc+QwXJ00lPZNq1V4dxKIR22VIPomGmP4i/7IeR3ixoTU4 qwflPgt33W2R6PNZz02fyYCKInq+b2wi1Apgehgj0v2ZtLNVoKGcMHbbHa2qXrVR3VZZ GnPVEcokVka4MJLA6rmB/mkj2e+806T3v7SAqCiPmaAy81OvHF/M1wlKhzQNlwLomR/a If7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733883956; x=1734488756; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZO8TXtqf2xRIVOtoc49ccfZf5XLnyi2rq2LUb4sCKyg=; b=PDX0kcuMPyMURAqXDNLlwQjbdzYFy0guRdKp2Dt28yF8mfWiOQwwrDWPBZNYVCeB73 XCWYE6yk9cNr+NONlXhHMSr19pRDoKiTjWn3A/enYkV32tz63Lya2FpcW8fCvHZnryGO uK0XF0LvzMPAR/fuOxtI9fmb1ZBHoMGI9gV/g09qaCWcO8Drzcu8v4mGeD6By9g4Fmma +SRX6XixJBPzou9VnP7cS3DlIR9uywMDANN0wkiCOyfkckOjldtUNrZkhEkFZC3m9E5i f0fW5qHXPsNwS0QSayl/sgWWopI1bGYmxmXBZRk0rHsy/xx4D3FyF8X01PiQ4NJQsA8c uMOg== X-Forwarded-Encrypted: i=1; AJvYcCUcrQE1U8tdZTJmS/d7DOylKbmRp0ndLa2T0XM3JLRMekOyjG5jCJyCfP19MsjoaJr3VWJjnfw=@lists.denx.de X-Gm-Message-State: AOJu0YyqMs/9ORPbpy2A1xJHhEb7rnIILtGaTaDqQ0RPhN3m5W4/ZYKX 9qC/R30QqAehI0eMl9joHtF/KlQO7DO3vBva/ciec1RfKfrtYibfxsL87cd9to4= X-Gm-Gg: ASbGncuwZq+RUtN7PnA05X3A0dDnLDmdjJdSPy0Cfz3WuGKVD/uDFp5RNoyta5DYu49 CSBp2to4F2gPwfdhSE+vcl8BFew97Kh5s51HHo7sLS5JJg5KjTz+3hr8hQcr0n6mVhtYi1VaAB0 sbqmcB7IAPQChpIT4hn6LHECmU1usLvaiCrRgEcgUOPS2mI1iV7W8Tf6aLML+wZRi4tyG3FU62F PE4QwEBdUa9jF5C0XjaRtDEgE8DlX6w6YVRWV3HYFiUMD8Z4wts7JJLiPc= X-Received: by 2002:a05:6808:1b2c:b0:3ea:5d19:63c8 with SMTP id 5614622812f47-3eb85ae336cmr830824b6e.6.1733883955934; Tue, 10 Dec 2024 18:25:55 -0800 (PST) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71e11447b0fsm412398a34.57.2024.12.10.18.25.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 18:25:55 -0800 (PST) From: Sam Protsenko To: Tom Rini Cc: Ilias Apalodimas , Sughosh Ganu , Heinrich Schuchardt , Simon Glass , Caleb Connolly , Marek Vasut , Laurent Pinchart , Patrick Delaunay , u-boot@lists.denx.de Subject: [PATCH v2 4/4] lmb: Improve kernel-doc comments Date: Tue, 10 Dec 2024 20:25:50 -0600 Message-Id: <20241211022550.2995-5-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241211022550.2995-1-semen.protsenko@linaro.org> References: <20241211022550.2995-1-semen.protsenko@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Fix warnings from kernel-doc script. Improve and unify overall style of kernel-doc comments in lmb source files. Move all kernel-doc comments for public functions into the header, as recommended in U-Boot documentation [1]: Non-trivial functions should have a comment which describes what they do. If it is an exported function, put the comment in the header file so the API is in one place. If it is a static function, put it in the C file. This also takes care of existing duplication. While at it, do a bit of cosmetic cleanups as well. No functional change. [1] doc/develop/codingstyle.rst Signed-off-by: Sam Protsenko Acked-by: Ilias Apalodimas --- Changes in v2: - Added Acked-by tag from Ilias - Provided the excerpt from U-Boot doc about comments for public API include/lmb.h | 125 ++++++++++++++++++++++++++++++-------------------- lib/lmb.c | 55 ---------------------- 2 files changed, 74 insertions(+), 106 deletions(-) diff --git a/include/lmb.h b/include/lmb.h index f221f0cce8f7..03d5fac6aa79 100644 --- a/include/lmb.h +++ b/include/lmb.h @@ -1,6 +1,13 @@ /* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Logical memory blocks. + * + * Copyright (C) 2001 Peter Bergner, IBM Corp. + */ + #ifndef _LINUX_LMB_H #define _LINUX_LMB_H + #ifdef __KERNEL__ #include @@ -8,21 +15,15 @@ #include #include -/* - * Logical memory blocks. - * - * Copyright (C) 2001 Peter Bergner, IBM Corp. - */ - -#define LMB_ALLOC_ANYWHERE 0 -#define LMB_ALIST_INITIAL_SIZE 4 +#define LMB_ALLOC_ANYWHERE 0 +#define LMB_ALIST_INITIAL_SIZE 4 /** - * enum lmb_flags - definition of memory region attributes - * @LMB_NONE: no special request - * @LMB_NOMAP: don't add to mmu configuration - * @LMB_NOOVERWRITE: the memory region cannot be overwritten/re-reserved - * @LMB_NONOTIFY: do not notify other modules of changes to this memory region + * enum lmb_flags - Definition of memory region attributes + * @LMB_NONE: No special request + * @LMB_NOMAP: Don't add to MMU configuration + * @LMB_NOOVERWRITE: The memory region cannot be overwritten/re-reserved + * @LMB_NONOTIFY: Do not notify other modules of changes to this memory region */ enum lmb_flags { LMB_NONE = 0, @@ -32,11 +33,10 @@ enum lmb_flags { }; /** - * struct lmb_region - Description of one region. - * - * @base: Base address of the region. - * @size: Size of the region - * @flags: memory region attributes + * struct lmb_region - Description of one region + * @base: Base address of the region + * @size: Size of the region + * @flags: Memory region attributes */ struct lmb_region { phys_addr_t base; @@ -46,10 +46,9 @@ struct lmb_region { /** * struct lmb - The LMB structure - * - * @free_mem: List of free memory regions - * @used_mem: List of used/reserved memory regions - * @test: Is structure being used for LMB tests + * @free_mem: List of free memory regions + * @used_mem: List of used/reserved memory regions + * @test: Is structure being used for LMB tests */ struct lmb { struct alist free_mem; @@ -58,51 +57,77 @@ struct lmb { }; /** - * lmb_init() - Initialise the LMB module + * lmb_init() - Initialise the LMB module. + * + * Return: 0 on success, negative error code on failure. * * Initialise the LMB lists needed for keeping the memory map. There - * are two lists, in form of alloced list data structure. One for the + * are two lists, in form of allocated list data structure. One for the * available memory, and one for the used memory. Initialise the two * lists as part of board init. Add memory to the available memory * list and reserve common areas by adding them to the used memory * list. - * - * Return: 0 on success, -ve on error */ int lmb_init(void); /** - * lmb_add_memory() - Add memory range for LMB allocations + * lmb_add_memory() - Add memory range for LMB allocations. * * Add the entire available memory range to the pool of memory that * can be used by the LMB module for allocations. - * - * Return: None */ void lmb_add_memory(void); long lmb_add(phys_addr_t base, phys_size_t size); -long lmb_reserve(phys_addr_t base, phys_size_t size); + /** - * lmb_reserve_flags - Reserve one region with a specific flags bitfield. + * lmb_reserve() - Reserve a memory region (with no special flags) + * @base: Base address of the memory region + * @size: Size of the memory region * - * @base: base address of the memory region - * @size: size of the memory region - * @flags: flags for the memory region - * Return: 0 if OK, > 0 for coalesced region or a negative error code. + * Return: 0 on success, negative error code on failure. + */ +long lmb_reserve(phys_addr_t base, phys_size_t size); + +/** + * lmb_reserve_flags() - Reserve one region with a specific flags bitfield + * @base: Base address of the memory region + * @size: Size of the memory region + * @flags: Flags for the memory region + * + * Return: + * * %0 - Added successfully, or it's already added (only if LMB_NONE) + * * %-EEXIST - The region is already added, and flags != LMB_NONE + * * %-1 - Failure */ long lmb_reserve_flags(phys_addr_t base, phys_size_t size, enum lmb_flags flags); + phys_addr_t lmb_alloc(phys_size_t size, ulong align); phys_addr_t lmb_alloc_base(phys_size_t size, ulong align, phys_addr_t max_addr); phys_addr_t lmb_alloc_addr(phys_addr_t base, phys_size_t size); phys_size_t lmb_get_free_size(phys_addr_t addr); +/** + * lmb_alloc_base_flags() - Allocate specified memory region with specified + * attributes + * @size: Size of the region requested + * @align: Alignment of the memory region requested + * @max_addr: Maximum address of the requested region + * @flags: Memory region attributes to be set + * + * Allocate a region of memory with the attributes specified through the + * parameter. The max_addr parameter is used to specify the maximum address + * below which the requested region should be allocated. + * + * Return: Base address on success, 0 on error. + */ phys_addr_t lmb_alloc_base_flags(phys_size_t size, ulong align, phys_addr_t max_addr, uint flags); /** - * lmb_alloc_addr_flags() - Allocate specified memory address with specified attributes + * lmb_alloc_addr_flags() - Allocate specified memory address with specified + * attributes * @base: Base Address requested * @size: Size of the region requested * @flags: Memory region attributes to be set @@ -111,20 +136,21 @@ phys_addr_t lmb_alloc_base_flags(phys_size_t size, ulong align, * parameter. The base parameter is used to specify the base address * of the requested region. * - * Return: base address on success, 0 on error + * Return: Base address on success, 0 on error. */ phys_addr_t lmb_alloc_addr_flags(phys_addr_t base, phys_size_t size, uint flags); /** - * lmb_is_reserved_flags() - test if address is in reserved region with flag bits set + * lmb_is_reserved_flags() - Test if address is in reserved region with flag + * bits set + * @addr: Address to be tested + * @flags: Bitmap with bits to be tested * * The function checks if a reserved region comprising @addr exists which has * all flag bits set which are set in @flags. * - * @addr: address to be tested - * @flags: bitmap with bits to be tested - * Return: 1 if matching reservation exists, 0 otherwise + * Return: 1 if matching reservation exists, 0 otherwise. */ int lmb_is_reserved_flags(phys_addr_t addr, int flags); @@ -134,9 +160,7 @@ int lmb_is_reserved_flags(phys_addr_t addr, int flags); * @size: Size of the region to be freed * @flags: Memory region attributes * - * Free up a region of memory. - * - * Return: 0 if successful, -1 on failure + * Return: 0 on success, negative error code on failure. */ long lmb_free_flags(phys_addr_t base, phys_size_t size, uint flags); @@ -160,7 +184,7 @@ static inline int lmb_read_check(phys_addr_t addr, phys_size_t len) * io_lmb_setup() - Initialize LMB struct * @io_lmb: IO LMB to initialize * - * Returns: 0 on success, negative error code on failure + * Return: 0 on success, negative error code on failure. */ int io_lmb_setup(struct lmb *io_lmb); @@ -178,12 +202,13 @@ void io_lmb_teardown(struct lmb *io_lmb); * * Add the IOVA space [base, base + size] to be managed by io_lmb. * - * Returns: 0 if the region addition was successful, -1 on failure + * Return: 0 on success, negative error code on failure. */ long io_lmb_add(struct lmb *io_lmb, phys_addr_t base, phys_size_t size); /** - * io_lmb_alloc() - Allocate specified IO memory address with specified alignment + * io_lmb_alloc() - Allocate specified IO memory address with specified + * alignment * @io_lmb: LMB to alloc from * @size: Size of the region requested * @align: Required address and size alignment @@ -191,7 +216,7 @@ long io_lmb_add(struct lmb *io_lmb, phys_addr_t base, phys_size_t size); * Allocate a region of IO memory. The base parameter is used to specify the * base address of the requested region. * - * Return: base IO address on success, 0 on error + * Return: Base IO address on success, 0 on error. */ phys_addr_t io_lmb_alloc(struct lmb *io_lmb, phys_size_t size, ulong align); @@ -201,9 +226,7 @@ phys_addr_t io_lmb_alloc(struct lmb *io_lmb, phys_size_t size, ulong align); * @base: Base Address of region to be freed * @size: Size of the region to be freed * - * Free up a region of IOVA space. - * - * Return: 0 if successful, -1 on failure + * Return: 0 on success, negative error code on failure. */ long io_lmb_free(struct lmb *io_lmb, phys_addr_t base, phys_size_t size); diff --git a/lib/lmb.c b/lib/lmb.c index 40f03151929c..f9880a8dc62b 100644 --- a/lib/lmb.c +++ b/lib/lmb.c @@ -601,14 +601,6 @@ static __maybe_unused void lmb_reserve_common_spl(void) } } -/** - * lmb_add_memory() - Add memory range for LMB allocations - * - * Add the entire available memory range to the pool of memory that - * can be used by the LMB module for allocations. - * - * Return: None - */ void lmb_add_memory(void) { int i; @@ -665,16 +657,6 @@ long lmb_add(phys_addr_t base, phys_size_t size) return lmb_map_update_notify(base, size, MAP_OP_ADD, LMB_NONE); } -/** - * lmb_free_flags() - Free up a region of memory - * @base: Base Address of region to be freed - * @size: Size of the region to be freed - * @flags: Memory region attributes - * - * Free up a region of memory. - * - * Return: 0 if successful, negative error code on failure - */ long lmb_free_flags(phys_addr_t base, phys_size_t size, uint flags) { @@ -782,19 +764,6 @@ phys_addr_t lmb_alloc_base(phys_size_t size, ulong align, phys_addr_t max_addr) return alloc; } -/** - * lmb_alloc_base_flags() - Allocate specified memory region with specified attributes - * @size: Size of the region requested - * @align: Alignment of the memory region requested - * @max_addr: Maximum address of the requested region - * @flags: Memory region attributes to be set - * - * Allocate a region of memory with the attributes specified through the - * parameter. The max_addr parameter is used to specify the maximum address - * below which the requested region should be allocated. - * - * Return: base address on success, 0 on error - */ phys_addr_t lmb_alloc_base_flags(phys_size_t size, ulong align, phys_addr_t max_addr, uint flags) { @@ -843,18 +812,6 @@ phys_addr_t lmb_alloc_addr(phys_addr_t base, phys_size_t size) return _lmb_alloc_addr(base, size, LMB_NONE); } -/** - * lmb_alloc_addr_flags() - Allocate specified memory address with specified attributes - * @base: Base Address requested - * @size: Size of the region requested - * @flags: Memory region attributes to be set - * - * Allocate a region of memory with the attributes specified through the - * parameter. The base parameter is used to specify the base address - * of the requested region. - * - * Return: base address on success, 0 on error - */ phys_addr_t lmb_alloc_addr_flags(phys_addr_t base, phys_size_t size, uint flags) { @@ -927,18 +884,6 @@ static int lmb_setup(bool test) return 0; } -/** - * lmb_init() - Initialise the LMB module - * - * Initialise the LMB lists needed for keeping the memory map. There - * are two lists, in form of alloced list data structure. One for the - * available memory, and one for the used memory. Initialise the two - * lists as part of board init. Add memory to the available memory - * list and reserve common areas by adding them to the used memory - * list. - * - * Return: 0 on success, -ve on error - */ int lmb_init(void) { int ret;