Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C43AC7618D for ; Mon, 20 Mar 2023 08:50:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230512AbjCTIuz (ORCPT ); Mon, 20 Mar 2023 04:50:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231167AbjCTIuw (ORCPT ); Mon, 20 Mar 2023 04:50:52 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A320FA264; Mon, 20 Mar 2023 01:50:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=MIME-Version:Content-Transfer-Encoding: Content-Type:References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=I2Jl3JT8J1uJjpTjaCxXjzNckeeoraJU6znCrVmqum8=; t=1679302250; x=1680511850; b=v99Z71EgDbcGdHJvzex4PW3ZX+v1cBnLumCA5dwLKxM6EAG 3mObe211qGb7d0yhiCZBqL3vTGTHrSsaqyvXf6K4HebwTY6CyYrU1k2hlPyn03+ZGGoP165x7LPfy SuFVsT5JLr+1d1q+AQANbUNpG3jOivnsDtf8ZdU7GsPSknJVhIus2YK/erwITl3kBVDTfLstLgjGU lKllqmYK2admeZJ3mJb3jMvE+N6WU6r/oLP0JWBEqVHU3/jDT2Z5ELYH2QEeUfNNayzQykJsj61ij 0okU5YulrXQxU2QZiNrW2TW8tFuUwUo2IKCEKZ52mbm4k1P48RbNPZTNYS/o5kBQ==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1peBDw-008u1U-2K; Mon, 20 Mar 2023 09:50:36 +0100 Message-ID: <7cd746c7b585c5086cfbd9db22414a060356cdd8.camel@sipsolutions.net> Subject: Re: [PATCH 2/4] bitfield: Introduce the FIELD_MODIFY() macro From: Johannes Berg To: William Breathitt Gray , "linux-iio@vger.kernel.org" Cc: Jonathan Cameron , Andy Shevchenko , Andrew Morton , "linux-kernel@vger.kernel.org" Date: Mon, 20 Mar 2023 09:50:35 +0100 In-Reply-To: <1c1492558c1a72b64bb26f7a44c4e69fff0e6b44.1679149543.git.william.gray@linaro.org> References: <1c1492558c1a72b64bb26f7a44c4e69fff0e6b44.1679149543.git.william.gray@linaro.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4 (3.46.4-1.fc37) MIME-Version: 1.0 X-malware-bazaar: not-scanned Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2023-03-18 at 14:59 +0000, William Breathitt Gray wrote: > It is a common code pattern to modify a bitfield by masking the field > and performing a bitwise OR with the respective FIELD_PREP. Wrap such a > task into a macro by introducing FIELD_MODIFY() which modifies the field > specified by a mask from a bitfield by putting a val in the field. So I have no objection to adding this and you using FIELD_* macros, but just wanted to say that personally I've come to prefer the typed versions declared later in the fiel, and there we have _replace_bits() already. Hmm. And now that I mentioned that, maybe that means FIELD_REPLACE() would be nicer as a name? johannes