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 07098E7D27B for ; Tue, 26 Sep 2023 10:41:43 +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=aATfeWfrof18caDGDi/wSGXt6/ko78Nf9neu1xYBBSs=; b=2w03iLvptgNy8Z ugdEzbZE06zhSyofNgns/9AP1fJpf6fJo2v9OAAFeFAyx/8ck8sKyqJE1hPJAHlcrmq98B4oKjNgX UBvkNOuayfjZjxt5aMYAFyGm2gkH9lfJPL66heID57X+tpA5n6CFN0cr6o+W+49z04bXPdrHXHXLX U7+Ux6bYVBEjoJYlNOSUKf0jmodtTSSNUnOlset22mqS2lC5XFmI8cmw0iUte8WEe20792w3DwBbl 9NIghsHks6WHH5a3dL7y2lcVAqWaExLBrbpE8HNWUZq9dfYfBDyzugB5GwNguMfvX9+dAVlKzkxuB C5RzX44LITKqak/ppObA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1ql5VE-00G9vd-1N; Tue, 26 Sep 2023 10:41:16 +0000 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1ql5VB-00G9qX-17 for linux-arm-kernel@lists.infradead.org; Tue, 26 Sep 2023 10:41:15 +0000 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1c3cbfa40d6so74347835ad.1 for ; Tue, 26 Sep 2023 03:41:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695724868; x=1696329668; 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=Yj6G1FPeamgYBfElta3qoZHccx9xx96N+48SOIoxSIc=; b=jJiYgRlEwltnTwplWqHWclc1qIBXR6jeKHVdcG7qvygdaqcil1PvLXmJi7kUnGYYhz f6BCyo+vOKYalXjeWDHsYJF1QwgiWNuIm8EJbUlW4HeXyVOs0xFnHTeuvDDNLQfSADNZ 2S2G0Yiyqrz3HonGqhRQ2xAWm9DPRW71+UQ+gOiOCfTAiC3naI0uA5E2GSyM3E7C4Rmb 6DgYXayvYpRDWtuLmvRpFqye21BLJfX3L+BcEJtt1Mzb0AZGkPtBTjPNxlhpGxUZuqIU cZToLbv2nAd1RclhGQp6cc5FWrIbqWltTtoHZD1YpIo/TjlBk92kWSdc5d8sATKRshQE O03A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695724868; x=1696329668; 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=Yj6G1FPeamgYBfElta3qoZHccx9xx96N+48SOIoxSIc=; b=q2vO5gLIeHnizPgpPeXCqwTpYB449U0tRKCCmCeq6W/WrJg0x3eEqvuIJkYW809qPO CgRvO/0a9BaX74Mz6ayYBzYj9K4QruWltwtM4afg/Fzop0lgQ6QB6445SyWOBEk/FaZ/ mxaiceNEq1zf7pUPTnZsNKLoEF8L4MNOFT0bM4lpmni0N7B/TEpcghlWGmFmpbGe6YWn to2aqD+W4TVWmCyDS3eXZks6CLyYX8f+IMOdxnYdu8C9Eh31Nb9NtBwV5X72aDO9JHOU Nnb/0IgxY8kQ8o1cf9YupLkSDI/37pP4IuQAzFp/UAWU2YaiBeXpWHucvrztrP68P4Im HUSg== X-Gm-Message-State: AOJu0Yy2W/P3Cdr82coTj4UgofeQd1FHKPWPMbTLMzeeYdEM50pfiMiP CuXO6zXrb6ZqiPxM5fMt2O8= X-Google-Smtp-Source: AGHT+IHo4UOrl+ovnhwC0HWOMFO6dlIhUqXGrFAnrdS0ISdnko+qf2F5BkR9v+hT/9K2Xb+ueFctfw== X-Received: by 2002:a17:902:c409:b0:1b8:954c:1f6 with SMTP id k9-20020a170902c40900b001b8954c01f6mr12402599plk.36.1695724867787; Tue, 26 Sep 2023 03:41:07 -0700 (PDT) Received: from sol (14-201-140-18.tpgi.com.au. [14.201.140.18]) by smtp.gmail.com with ESMTPSA id y12-20020a170902ed4c00b001c62c9d7289sm1539610plb.104.2023.09.26.03.41.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 03:41:07 -0700 (PDT) Date: Tue, 26 Sep 2023 18:41:00 +0800 From: Kent Gibson To: Andy Shevchenko Cc: Linus Walleij , Bartosz Golaszewski , Yury Norov , 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 4/5] gpio: xilinx: Replace bitmap_bitremap() calls Message-ID: References: <20230926052007.3917389-1-andriy.shevchenko@linux.intel.com> <20230926052007.3917389-5-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230926052007.3917389-5-andriy.shevchenko@linux.intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230926_034113_388674_AFA96AF9 X-CRM114-Status: GOOD ( 23.14 ) 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 08:20:06AM +0300, Andy Shevchenko wrote: > We have sparse and dence masks of the line mappings based on dense > the view point (Linux numbering or hardware numbering). Since > the Linux side uses sequential bits for the mask, we can simply > convert a Linux number to the hardware one and vise versa by vice > counting set bits in the respective mask. Hence replace > bitmap_bitremap() calls by simpler equivalents. > > With this done the dence mask is not needed and thus dropped. > And dense again. Cheers, Kent. > Signed-off-by: Andy Shevchenko > --- > drivers/gpio/gpio-xilinx.c | 9 ++------- > 1 file changed, 2 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpio/gpio-xilinx.c b/drivers/gpio/gpio-xilinx.c > index f103c30cc74f..14ca3097563a 100644 > --- a/drivers/gpio/gpio-xilinx.c > +++ b/drivers/gpio/gpio-xilinx.c > @@ -46,7 +46,6 @@ > * @gc: GPIO chip > * @regs: register block > * @hw_map: GPIO pin mapping on hardware side > - * @sw_map: GPIO pin mapping on software side > * @state: GPIO write state shadow register > * @last_irq_read: GPIO read state register from last interrupt > * @dir: GPIO direction shadow register > @@ -62,7 +61,6 @@ struct xgpio_instance { > struct gpio_chip gc; > void __iomem *regs; > DECLARE_BITMAP(hw_map, 64); > - DECLARE_BITMAP(sw_map, 64); > DECLARE_BITMAP(state, 64); > DECLARE_BITMAP(last_irq_read, 64); > DECLARE_BITMAP(dir, 64); > @@ -76,12 +74,12 @@ struct xgpio_instance { > > static inline int xgpio_from_bit(struct xgpio_instance *chip, int bit) > { > - return bitmap_bitremap(bit, chip->hw_map, chip->sw_map, 64); > + return bitmap_weight(chip->hw_map, bit + 1); > } > > static inline int xgpio_to_bit(struct xgpio_instance *chip, int gpio) > { > - return bitmap_bitremap(gpio, chip->sw_map, chip->hw_map, 64); > + return find_nth_bit(chip->hw_map, 64, gpio); > } > > static inline u32 xgpio_get_value32(const unsigned long *map, int bit) > @@ -619,9 +617,6 @@ static int xgpio_probe(struct platform_device *pdev) > if (width[1] > 32) > return -EINVAL; > > - /* Setup software pin mapping */ > - bitmap_set(chip->sw_map, 0, width[0] + width[1]); > - > /* Setup hardware pin mapping */ > bitmap_set(chip->hw_map, 0, width[0]); > bitmap_set(chip->hw_map, 32, width[1]); > -- > 2.40.0.1.gaa8946217a0b > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel