From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFBCAC47247 for ; Tue, 5 May 2020 14:54:15 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A2EE120735 for ; Tue, 5 May 2020 14:54:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="djod7jIP"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="X43eTslC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A2EE120735 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=5D0/UW4wjWrByiseRKZ8QFCBNaSbxCo0kl464bN0Ipo=; b=djod7jIPxZz05O5+dtJht5okt JLiUxAfIEsrKQHUV659VMckSX+j2ciOqVE97dhH0sk4QvXk0nWusHJv3s82cko6txL8/VCTlgL1yM hTW+L7Dp9B+A8mjgSXF8FxRcSJ/NTKm408/EoOqt3p4O5i4tVvERjNQdNlFThHgLUqF2anKRAxBKh ENwW5SQei4+4YpuvAQUNFH9ya16jDvPpgdt+rBhD7Y4dUr0JxGVhdAY24bJgMZHJOxmqC+gDsq0gV ytu/woxf0QFKe4nSeIRHWdUefx5nyx9pJm6OpN1eTAtiqdA3u8w4T/Nn8F9iw2aT3P6OEJF8PxrPT VDLunSpXA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVyxa-0004Cj-FZ; Tue, 05 May 2020 14:54:14 +0000 Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVyxX-0004C6-Eq for linux-arm-kernel@lists.infradead.org; Tue, 05 May 2020 14:54:12 +0000 Received: by mail-qk1-x741.google.com with SMTP id f13so2564948qkh.2 for ; Tue, 05 May 2020 07:54:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=jSocksHYb9zl/JGU+koYObwZ4sleYquXCNFXOruiZU0=; b=X43eTslCX/HNNmesYL3Fsx5aXrB31f7o5wrAqV4kmD0074bnyV3S/oxOdYGuTkrU0r O/fPkW9VYXn6njRBNjHvblOJh1jq/wrCGmnHWcWdlw40qUH+VmtdR+TvwdxF3TcAZB2x V2NcTJuHrq/2UvuAg+1vvFCuhzRk9R9fPP9X3lPGeKgUkjI3ePV/JFfZvFaoo9CK6Hgo KTwY9YxA1zIb4Bayqff9RZHp2a9O/kyquhucRegxrqCrqXmlfkA4TcwNaIsCH3PHEGP5 7QWeuCqRHAZJPC8hGH8s2QiNyQ93fqvw0veotMHke9Rtrc2+bf2AiEEMO1h9Jl/z4W61 ukhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=jSocksHYb9zl/JGU+koYObwZ4sleYquXCNFXOruiZU0=; b=VyQsudymnaF3Oxe0qx/UOXE9e2gHw5Jo5BFAzERld6esMpTT31J5EAHLxWYv5Ga6Vz pQn5tEOLxF631wEsNlBSrDmnW0/XMG+5TMFEUaTOYSlaDod/bTgtkSL+WIhxN1J1uiuQ NeMsARSoVhW0w62mMgy9NCW5DcCFhjv6x5oe9RJAAvLIKGYTpkAzvWO2P5/tbnADebX7 lCPIKjtO9/GgXZEXHCGlvjFDdxBdvjRJ+yOsX3+XioXF3wimOO0Tk/lex5Sb1M0pFbum neCkCAz9hJ33KprY6sxL+v0FlIFOSNwqCw7pgTJyQZcOdu9lnqHUMU9nUMJDqjxtLH8x 23Og== X-Gm-Message-State: AGi0PuZZzQjkHhPtSe4R/+yzSBRbNvObSVE1dxryRkdIyQ1Q0Tz28rZ5 7Faf/scfbRB8WWhpdZXpBE0= X-Google-Smtp-Source: APiQypKHZt/tsl7D6ZxkoYpLuHMfDxw0ggzb9p/Ze2te7v0luNbbLGjLb8VqX9Ukk2YwMWDPUKrTog== X-Received: by 2002:a05:620a:1f1:: with SMTP id x17mr3990168qkn.330.1588690449917; Tue, 05 May 2020 07:54:09 -0700 (PDT) Received: from shinobu (072-189-064-225.res.spectrum.com. [72.189.64.225]) by smtp.gmail.com with ESMTPSA id n124sm2004093qkn.24.2020.05.05.07.54.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 May 2020 07:54:09 -0700 (PDT) Date: Tue, 5 May 2020 10:53:49 -0400 From: William Breathitt Gray To: Andy Shevchenko , Linus Walleij , Bartosz Golaszewski , Michal Simek Subject: Re: [PATCH v5 0/4] Introduce the for_each_set_clump macro Message-ID: <20200505145250.GA5979@shinobu> References: <20200504114109.GE185537@smile.fi.intel.com> <20200504143638.GA4635@shinobu> MIME-Version: 1.0 In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200505_075411_505613_85433AD3 X-CRM114-Status: GOOD ( 19.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linux-Arch , Amit Kucheria , Arnd Bergmann , Masahiro Yamada , "open list:GPIO SUBSYSTEM" , Daniel Lezcano , Linux Kernel Mailing List , Bartosz Golaszewski , rrichter@marvell.com, Linux PM , Andrew Morton , Andy Shevchenko , Syed Nayyar Waris , "Zhang, Rui" , linux-arm Mailing List Content-Type: multipart/mixed; boundary="===============1623545897433488272==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============1623545897433488272== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="CblX+4bnyfN0pR09" Content-Disposition: inline --CblX+4bnyfN0pR09 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, May 05, 2020 at 04:51:56PM +0300, Andy Shevchenko wrote: > On Mon, May 4, 2020 at 5:41 PM William Breathitt Gray > wrote: > > On Mon, May 04, 2020 at 02:41:09PM +0300, Andy Shevchenko wrote: > > > On Sun, May 03, 2020 at 04:38:36AM +0530, Syed Nayyar Waris wrote: >=20 > ... >=20 > > > Looking into the last patches where we have examples I still do not s= ee a > > > benefit of variadic clump sizes. power of 2 sizes would make sense (a= nd be > > > optimized accordingly (64-bit, 32-bit). > > > > > > -- > > > With Best Regards, > > > Andy Shevchenko > > > > There is of course benefit in defining for_each_set_clump with clump > > sizes of powers of 2 (we can optimize for 32 and 64 bit sizes and avoid > > boundary checks that we know will not occur), but at the very least the > > variable size bitmap_set_value and bitmap_get_value provide significant > > benefit for the readability of the gpio-xilinx code: > > > > bitmap_set_value(old, state[0], 0, width[0]); > > bitmap_set_value(old, state[1], width[0], width[1]); > > ... > > state[0] =3D bitmap_get_value(new, 0, width[0]); > > state[1] =3D bitmap_get_value(new, width[0], width[1]); > > > > These lines are simple and clear to read: we know immediately what they > > do. But if we did not have bitmap_set_value/bitmap_get_value, we'd have > > to use several bitwise operations for each line; the obfuscation of the > > code would be an obvious hinderance here. >=20 > Do I understand correctly that width[0] and width[1] may not be power > of two and it's actually the case? >=20 > --=20 > With Best Regards, > Andy Shevchenko I'm under the impression that width[0] and width[1] are arbitrarily chosen by the user and could be any integer. I have never used this hardware so I'm hoping one of the gpio-xilinx or GPIO subsystem maintainers in this thread will respond with some guidance. If the values of width[0] and width[1] are restricted to powers of 2, then I agree that there is no need for generic bitmap_set_value and bitmap_get_value functions and we can instead use more optimized power of 2 versions. William Breathitt Gray --CblX+4bnyfN0pR09 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEk5I4PDJ2w1cDf/bghvpINdm7VJIFAl6xff0ACgkQhvpINdm7 VJI65w/8CTBNaBXzqQ6+AtgyAfLROsibTUPDE3wEs7s/eQkI4dlNN0BzmXwJ6sb6 oMCj6NqzTFksNVUoM6OSjyAGqHZVTJaSfFS97TG4+GrUZm4iWrLMmCipkYEh3qjB b10DXznOSf6l0IFFbB51QRFRaDu2hJEFYbtCM0hDHYssMXQyI3wMyw/9qCtPwPOC 1l0MYPTFb825gGxAnfNCJ8CODpBXFxbahDtK1gvkaNB7Bdq/BFHyaR4FqMP0QbCC hoxK7bdMqur6ghYjld9dPRw7iFMXZHt1gD90DMzyXZDl3FcOKlzaAsAz9abgCZ4d sNHU6i8bRUtdTy66niUDTFHuMKOsWzcHe223zeC6SXp9L00kRzWbSJ4RioncRIEP X1/Vc+7x62yX/PzECkI+jxhLA8G+wwWuizAxN2VxDDx3ei7XJ4UEfSnNYZwBYlyc DUhyQZ3UyeID5wDu0XiGGBM8/+Y6mQprrYG7pgsPqAMCMYbcuK58W6cC+uM9ilH9 oNFMz74DRUKaRrK6N/L+ujYD5R+uqVIzq4rwXsT9UOeh4N85uNI/Vjxx5jYO6ICG B4SGVNo2lwkdvH8XhnCfad+no1HV1XWPNflkedffcfALCxAsxhKF5riw4H1cmZ3B NbCZv5hfWtY/5opWhWKCVrxAdH512xxHdWBThcAdj8l2NGpZaYM= =lkYR -----END PGP SIGNATURE----- --CblX+4bnyfN0pR09-- --===============1623545897433488272== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============1623545897433488272==--