From patchwork Mon Jun 17 08:32:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 804869 Delivered-To: patch@linaro.org Received: by 2002:adf:fb90:0:b0:360:93e7:1765 with SMTP id a16csp455588wrr; Mon, 17 Jun 2024 01:33:04 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWmwNKv90/YUOyN1Dm0I8XlSIW6hYyfrDuosfiC40SWfgXIkAJQniGm47hQrB9Wchm+QC9XipW5z3vij1egiF13 X-Google-Smtp-Source: AGHT+IH4nCDNw5MhrpS0ojdX7Y7/im1IR0+R8h0ia6MrxbS9cI5nr8Tjit/WRfHkZ/W1gI2/cNv7 X-Received: by 2002:a17:906:4a4f:b0:a6f:38:6968 with SMTP id a640c23a62f3a-a6f60d2bd3dmr560094466b.32.1718613184662; Mon, 17 Jun 2024 01:33:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718613184; cv=none; d=google.com; s=arc-20160816; b=ptk3XsDSllShXf6o+1sRK9JBlVBLfNFMFZKQSgK7we9GSZTvwUR10t1OnKirKL/6D9 32/Kkibvi35ppzCDdQHLmAsJvk+HzzAHl4OMcNf3Qf5Duttip/RcMt46N4+3MOD36GHz TERr7ZyZjg6kAMmgNNOCCovv6vHAqSEuX6si8f0rIrLT6agVV/yi6l1cmUiMsNa2q0z5 bs1TDUBD3uXpT3ZGWI2APOpYBcuuzCjxc5AGtsqWuY96lcOOlS9gPKsjz20ihzxJgWqh BHWbsf3cZZySVkCGRkAs+/4pASwGwH3U7pj6Ee/BMGDYGlCQXH9C6aZ6BeXUdZj5W3jr PLjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=qMzvVINs+Ml1vhbtsKTrYpL3/dZ9FBcxJvPoJfV6XH0=; fh=/XivWHF+vo8fEJZkIifbJJS5exQ4Pz1Cdxakj2MFy4s=; b=nVJBj9JoSnW85GBNljcfN8bOaxtno6YmndN+tyeaKlMHOsSV5NZRhQjwrbKxxNP8QQ oFNgTz0CoqHX7VH12sl18Z3FxmyQzN/UuTGJk2LZhUMV8OGiWouz7HpqPT1MFzoIHRbi +KVfVrTVBZmUQmoSQvigOWwC30DkWODTCh1WCuqZsd/ueWxSx7JOZXHIBi7OLkS9HPhn jjveXAvEbrWf3EXK+G58ACcUSx5MCPtcSp446duekjGlVVMk6DHpfbz+K1YGJ4D7131Y z3bnbKL5dzov6JOJ+KjIpJvNXWlQILoY8SlBZ/WM5r1fLoho0hz1ekLE8Z4DuOHDpj6A lalg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WJAJlKjC; 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 Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f56d4b50fsi420247166b.224.2024.06.17.01.33.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 01:33:04 -0700 (PDT) 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=WJAJlKjC; 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 Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 94F7587DC7; Mon, 17 Jun 2024 10:32:56 +0200 (CEST) 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="WJAJlKjC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 30CD688137; Mon, 17 Jun 2024 10:32:53 +0200 (CEST) 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,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) (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 48E3588025 for ; Mon, 17 Jun 2024 10:32:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-57cd26347d3so1391122a12.1 for ; Mon, 17 Jun 2024 01:32:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718613171; x=1719217971; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=qMzvVINs+Ml1vhbtsKTrYpL3/dZ9FBcxJvPoJfV6XH0=; b=WJAJlKjCU9Wy4KuKiOY4PcT+63hDDwmQGInfRyJkj8aXWoxq1uaX6WJLEj/rP7LQ63 ws7AgSoI3EeVbZOyB5CCmcbyCEU6Oqqx3Hwgp1PDyQiKjAoS6cZmJC0M7Qt3bYbVRFar raDMfkaFzYePMxnGhpm4sdf/EsPmSmrqCVjP0XI4RKIPlBA3TBoF40rk1//JMbcRrsO7 NgVMoZWahcz1VZtR8LgzYT05z0WBQDEOA06n1G6mIksbwopwyYDHDELzkkGk/xYW02JY U2PKWZGVQyu5+LjZlecyz8lNh84t88h78upnWg9avs23nEBcZV1GUpfdvZi1QEfrsBoj L4mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718613171; x=1719217971; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qMzvVINs+Ml1vhbtsKTrYpL3/dZ9FBcxJvPoJfV6XH0=; b=XSPR0osHiFiBaW0jtlzPmtmxkgKV0mRXKEeagsjFf/0g/CE0slPmbMEDQ1s4BNFdiO OI0IaXvu87hdxGW9HO/+5eO1fNDIRjXANBu2z8vv7QSN4pXaUuXZzPGDbAa8IwGjRZzB ZVxESEhrWV5nnpzbo5xD7w3zvLHeyLi5ac29MyghWYB2wBl935NpGQ0/VAXL/WD/fSaA +zt7+b7V90GAm14JbDjg5PVzUlvUTY+83g/BHDeqxvDb6SMrJ+y58XzY9wFDCls0pKgC gI5TCiYOiBzIlP8UKJj60KKD5jug46xjt9FbMJFQZFckoMPkqeqnOqSW39e08Q2NN3NH fczw== X-Gm-Message-State: AOJu0YxcPtUXKibV9ZWAUrXM39b3QAziEq3OMj1gMeNqY02AxSPCtYEp Q2YSwv1ush8RifmEWmT2xC1uMjA1okLg3Z0aFGDaL4P3qt79lL/zY7e6Wkunq48= X-Received: by 2002:a50:8ad0:0:b0:57c:6861:d72b with SMTP id 4fb4d7f45d1cf-57cbd6742d5mr5388431a12.9.1718613170689; Mon, 17 Jun 2024 01:32:50 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::52af]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57cb72cdfd0sm6110031a12.5.2024.06.17.01.32.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 01:32:50 -0700 (PDT) From: Caleb Connolly Date: Mon, 17 Jun 2024 10:32:46 +0200 Subject: [PATCH 1/3] linux/bitmap.h: add bitmap_empty helper MIME-Version: 1.0 Message-Id: <20240617-b4-qcom-rpmh-v1-1-bd2336923e0a@linaro.org> References: <20240617-b4-qcom-rpmh-v1-0-bd2336923e0a@linaro.org> In-Reply-To: <20240617-b4-qcom-rpmh-v1-0-bd2336923e0a@linaro.org> To: Tom Rini , Caleb Connolly , Neil Armstrong , Sumit Garg , Jaehoon Chung Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=882; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=H1zB70/xZeR9/o5jzaMKotSNZr1pxsG/RDzxnhxvFkU=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmb/SwQWfAAKXoaF7NXtabvs2Na2gf+fsUlxSaf 1slfruv916JAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZm/0sAAKCRAFgzErGV9k thMpD/0ZFStbYOXOBnL1x9Fm3uaAJTbKX41Z7h1LZBgh+SPf6tXOGMFovucByYlFCs3oY7K4QpY nqTT4yEE2fodhBsU90O7Hfp2cqXhcVQHptMnxWNQd3AuirKPEIhqX3oztWT41z1ZEdzQlxwkCiq gmDHvOOh/Udcpp7L+X+yalPkwoozlrD63wPwC8+NYWh7xb1pM7zClrjyAcOq4PqWSlcjh2Anqbp fFVZYoXzaD4gkGNRmT3BjYoToB4tBZrRzxYbS3u4oZ3My9nbWiI1Bv0TKxjy4KVPsbL8/r8sKiT 40RwOO8QOOkENSX7chSmKZp/wOoqk84weLc4eSjcKsEd09hFsvENOitWd558+frwG08jHZzxEhV 5pHlhAigLC+wor7gWCYw6v0oPE1Fjjo7fgT8Hd0IlyJLWiIXtlogBZQkFbhGNO4xcPC6ItBEzbd i2lwUH4knN+6ppgZTqGHmAaJgDrFB6dLlJpC998ucY7yBM5XP1XZ40OIBYhHvkTH7Qr/46c0777 ErS19WGMJn00VYjYadp3S814pT7/nFKzB4/TH0sUfkBGdkI26jl5eVyP31itavUllwP53tE4s6V v/fUDCQuF99YEkGuko/DK1b6p1wErAMJDWqGBXXblEKmsOt4mGc/vQ+JXJ1msQvluqEgz37WtYh 3LLXoe+PhIcB5dw== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 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 Import this function from Linux. Signed-off-by: Caleb Connolly --- include/linux/bitmap.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h index 0a8503af9f14..40ca2212cb40 100644 --- a/include/linux/bitmap.h +++ b/include/linux/bitmap.h @@ -195,8 +195,16 @@ static inline void bitmap_fill(unsigned long *dst, unsigned int nbits) memset(dst, 0xff, len); } } +static inline bool bitmap_empty(const unsigned long *src, unsigned int nbits) +{ + if (small_const_nbits(nbits)) + return !(*src & BITMAP_LAST_WORD_MASK(nbits)); + + return find_first_bit(src, nbits) == nbits; +} + static inline void bitmap_or(unsigned long *dst, const unsigned long *src1, const unsigned long *src2, unsigned int nbits) { if (small_const_nbits(nbits))