From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D4DC3644D2; Wed, 17 Dec 2025 10:26:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765967191; cv=none; b=XtFHiPs48pAdXP7KuAXok2tIFl14v7QUY5kyWrXuANMKZhDp/7CJFloRAk3ktSRycK/iVI9WcmzI8ect2iNqxczKKj1ZZQzBncvnjLgTPLMzsbNec2RSKBpxotSamCcruuwsgiWnNHyJpuvpvtIU6u/zsHWpNnOpy2xqPHSBtxA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765967191; c=relaxed/simple; bh=kIStRyETvmykF7bKMutCRsxWmly1z40IKQfiXhf4ZZU=; h=Date:From:To:CC:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dWU7hmBbgyeI6lKKcMj0APapblqtIhyCPRz1zpC8oJtOiFX6VtC6plQa9M/2yqyKEEDOaM7veZTGE8GwYKFbTmjb9UIrXi+8/eHiOcHaaT46FexG3lmxzIix8xgxg+AKj/cvnswWUuPqPHRXWCOB2pqUHt+LOUFw3oUE6Q8zldw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.224.150]) by frasgout.his.huawei.com (SkyGuard) with ESMTPS id 4dWVLr0pGqzHnHMQ; Wed, 17 Dec 2025 18:25:56 +0800 (CST) Received: from dubpeml100005.china.huawei.com (unknown [7.214.146.113]) by mail.maildlp.com (Postfix) with ESMTPS id 2068640565; Wed, 17 Dec 2025 18:26:21 +0800 (CST) Received: from localhost (10.203.177.15) by dubpeml100005.china.huawei.com (7.214.146.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.36; Wed, 17 Dec 2025 10:26:20 +0000 Date: Wed, 17 Dec 2025 10:26:18 +0000 From: Jonathan Cameron To: CC: Yury Norov , Rasmus Villemoes , , , Geert Uytterhoeven , Alexandre Belloni , Crt Mori , Richard Genoud , "Andy Shevchenko" , Luo Jie , Peter Zijlstra , Jakub Kicinski , , "David S . Miller" , "Mika Westerberg" , Andreas Noever , Yehezkel Bernat , Nicolas Frattaroli Subject: Re: [PATCH v2 08/16] bitfield: Simplify __BF_FIELD_CHECK_REG() Message-ID: <20251217102618.0000465f@huawei.com> In-Reply-To: <20251212193721.740055-9-david.laight.linux@gmail.com> References: <20251212193721.740055-1-david.laight.linux@gmail.com> <20251212193721.740055-9-david.laight.linux@gmail.com> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.42; x86_64-w64-mingw32) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: lhrpeml500009.china.huawei.com (7.191.174.84) To dubpeml100005.china.huawei.com (7.214.146.113) On Fri, 12 Dec 2025 19:37:13 +0000 david.laight.linux@gmail.com wrote: > From: David Laight > > Simplify the check for 'reg' being large enough to hold 'mask' using > sizeof (reg) rather than a convoluted scheme to generate an unsigned > type the same size as 'reg'. > > Signed-off-by: David Laight Hi David, Just one really trivial comment inline. Feel free to ignore. Jonathan > --- > @@ -75,8 +59,8 @@ > }) > > #define __BF_FIELD_CHECK_REG(mask, reg, pfx) \ > - BUILD_BUG_ON_MSG(__bf_cast_unsigned(mask, mask) > \ > - __bf_cast_unsigned(reg, ~0ull), \ > + BUILD_BUG_ON_MSG((mask) + 0U + 0UL + 0ULL > \ > + ~0ULL >> (64 - 8 * sizeof (reg)), \ Trivial. sizeof(reg) is much more comment syntax in kernel code. > pfx "type of reg too small for mask") > > #define __BF_FIELD_CHECK(mask, reg, val, pfx) \