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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id A63C5E80A93 for ; Wed, 27 Sep 2023 06:49:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vnq+lrAwgOBhqZif5xpWyzhOQkaIdUfIKZ1+d0uiWLg=; b=qA5JHNFUR8OQKy rjSzNHGiLhYaHECGt290fHkr3w6AGopvjLzwpF1NRmv1+GWWaNMQdwvr0wXeTrWtnACSAq9Unu2D9 foirfeizwUDpPG9NnwEW3GmoP/JKV4lhp6EzT1y6PutVWjlcAliv391pu5T79DGfoomXnT/tKdvPA ya2FGWPexGjTFOw/yFBLEH5dPeFR801A3pX8Z9QGR61+gbQuljKwQ8AtpG+uISl+DSWKI7bYOaPGV FvqMnjXNdjOopXuJw/EBKlwLQ755crKUxEBUkaIgoRrIYKKgEjAM9Xli0yXT/jCzliCZOGlQx6CgU 6dIu1GjIk1angqN3BA6Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qlOLg-0007l3-1i; Wed, 27 Sep 2023 06:48:40 +0000 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qlOLe-0007kb-1o for linux-arm-kernel@lists.infradead.org; Wed, 27 Sep 2023 06:48:39 +0000 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1c5bf7871dcso81297745ad.1 for ; Tue, 26 Sep 2023 23:48:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695797317; x=1696402117; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=SuwAtYX6gqnY1oBY5U9XN8rrNUG8GpTYVOL7/kcBiJo=; b=T0g3I1v3X94dh+gbXFZBvtn8Um1pdl3jeqJVIFGpX8Y7uu5cGLqrWkiBxvenSihyzN b1WcknTX1Wp7ywhPjwqfK2xoOStOKsSEUH+7j/hpoHrW9juFvJYn/O9TVuUfHiMUDFfx lrHU/lP+7HG1Rv5VPda0tln+BG+RSow7+hMKKdzttx25VKGetjogqMC5QafWL/uiwy5j mNr7+1/+l3livaTLQm7qz9MX152Khc7QnvB+nKtNppBdd8Txaon8tzSljO+DhLnbjS+z Nrhi6j3cqPqMflTnaDGZVxdqmpUjJH+Xt+IQ4B2Z0k0gDGyNFGXEsHBE9tRAcvf0N/BJ j7rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695797317; x=1696402117; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=SuwAtYX6gqnY1oBY5U9XN8rrNUG8GpTYVOL7/kcBiJo=; b=EobtoziCOIv3uZhOWFnYzFGJ5hqoRGqQjw3lFO7dlxlVopYft+HbFNPz6HvBEPHt3x Mvbh/v62cFjPTnOg1liIx/2jxwtzZug0RBds5v9I/PkiKfNCplIIQWDH2RdyBdFnZ1gU 8fxhxjS8mVuhUWmwiogkeOiUIfs7MLp/SfBlY03M6h7Yf1Q2KNl1lxb0+Rftb2+bBAZW +JNYjbWUGvmkW71bZapLzo5vHH+D0SZu+ukEWkQ8zDlGXKwHjnxD0rVyzf9mFVk3vaFW Hb+k2ZPgdkemrqLrVTkF5aqgz6bTMf/P5HJMcCRb+GFniSrfFBhfd03O59PBGvFW159i 108g== X-Gm-Message-State: AOJu0YyGsR4UxL4RA9Fq407tW3TF1B7+OfWLx7X9MurUBNTkUWZQj4RE efBbulRiMvrVZK5EXMdMl3M= X-Google-Smtp-Source: AGHT+IFc8NZ42fyNpLIIUEAYBXpQjn58ccKZ/e7Jnkl0mwVBMEdJyOqn8C+M6jS1N/1ancR56WQRDg== X-Received: by 2002:a17:90a:f40f:b0:274:e8e0:1503 with SMTP id ch15-20020a17090af40f00b00274e8e01503mr837496pjb.16.1695797316632; Tue, 26 Sep 2023 23:48:36 -0700 (PDT) Received: from sol (60-242-83-31.tpgi.com.au. [60.242.83.31]) by smtp.gmail.com with ESMTPSA id gf4-20020a17090ac7c400b0026f919ff9a1sm12522329pjb.10.2023.09.26.23.48.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 23:48:36 -0700 (PDT) Date: Wed, 27 Sep 2023 14:48:28 +0800 From: Kent Gibson To: Yury Norov Cc: Andy Shevchenko , Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Shubhrajyoti Datta , Srinivas Neeli , Michal Simek , Bartosz Golaszewski , Andy Shevchenko , Rasmus Villemoes , Marek =?iso-8859-1?Q?Beh=FAn?= Subject: Re: [PATCH v1 5/5] gpiolib: cdev: Utilize more bitmap APIs Message-ID: References: <20230926052007.3917389-1-andriy.shevchenko@linux.intel.com> <20230926052007.3917389-6-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230926_234838_616028_E8D205AA X-CRM114-Status: GOOD ( 17.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Sep 26, 2023 at 05:46:07PM -0700, Yury Norov wrote: > On Tue, Sep 26, 2023 at 08:20:07AM +0300, Andy Shevchenko wrote: > > Currently we have a few bitmap calls that are open coded in the library > > module. Let's convert them to use generic bitmap APIs instead. > > > > Signed-off-by: Andy Shevchenko > > + bitmap_from_arr64(mask, &lv->mask, GPIO_V2_LINES_MAX); > > + bitmap_from_arr64(bits, &lv->bits, GPIO_V2_LINES_MAX); > > + > > + num_set = bitmap_gather(vals, bits, mask, lr->num_lines); > > It looks like GPIO_V2_LINES_MAX is always 64, and so I wonder: is > my understanding correct that all bits in ->mask and ->bits beyond > lr->num_lines are clear? > The lv fields come from userspace and so cannot be guaranteed to be zeroed beyond lr->num_lines. Any set bits beyond that must be ignored, one way or another. > If so, you can seemingly pass the GPIO_V2_LINES_MAX instead of > lr->num_lines, and that way it will be small_cons_nbits()-optimized. > But that would be decidedly non-optimal for the most common case where lr->num_lines == 1. Cheers, Kent. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel