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=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham 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 8EE01C433ED for ; Thu, 1 Apr 2021 12:53:24 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 08596611C0 for ; Thu, 1 Apr 2021 12:53:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 08596611C0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=B6c/SfbByFafVtmTwZ1Eas95HkhQjAw1zWiZBQmahoI=; b=Kg58wQSHjwQ2wFPdw2ybBznni 7GDBnZ70iP2HzwLh/SZrZfvY8SlO9mqXOsVPneaSJ100UlRYaQSRspVjde5M97SLyRo6CiwuOMenw D1doEtfV63uBftkgCimu/JfNct5mvPSlBvl/bjFX31Eotphgq4P6CBq9Dt4AnscLaciVHSG8Sd9SE 6QJFfi3dbe9RfbP0h2u2L31h2VPN2jiNH4ExFcS0XjHe4XbxD1lxv9JeO/JOCpyksb2Pa+Ej4ybDy ErSICI885n4G4Gs7QCUwZ8O7G1r7xVgn+FWU82tY+3BFhmkiCTLaX6uZnZIHORbjREWv0SNNQ9I8Z bs+X3SDsw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lRwni-009dB7-Fl; Thu, 01 Apr 2021 12:51:54 +0000 Received: from mail-yb1-xb33.google.com ([2607:f8b0:4864:20::b33]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lRwnd-009dAU-HM for linux-arm-kernel@lists.infradead.org; Thu, 01 Apr 2021 12:51:51 +0000 Received: by mail-yb1-xb33.google.com with SMTP id x189so1664556ybg.5 for ; Thu, 01 Apr 2021 05:51:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=M1VB1ralBR7+e/H7JqA/6mMiYo3JOylCfFNbfyvT27M=; b=C8Z1fGmD0ugXE9aGQpDEEcbJPwy2biu89w6Y8hjTLRV+uZ6Y+fa5ayeevztvzJk+dU PX2Rwh+sIiRbjGzRPRKXUXZk7IfGSsgtMCvqlVkz2WF9P4XXjC9JtmvDJGd8cQp5iUEW 7h6YWHc3ZAchF/U59kTlgfc/r1dtfTFNnoFrMgOKzlAVOcb3zHPu9VtojLYbJwtLFk/6 +oKvoicUnGd7b8+54QGsxVhMEFiJZjn8JHAoY4jACV/jFQTp8R152wz4eg52V/LGZfJp JojHcn5GNEp6DijbKwabno/N5j2/fkHlrKTeccFq0wC3lrmyC7nKB0xUN6+/ttzTnaXt bEpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=M1VB1ralBR7+e/H7JqA/6mMiYo3JOylCfFNbfyvT27M=; b=PZi1n7sJYJdfSKo83SPRgtMyw5SCbFripBTeO7MW1tKOU3AzxpLLEV+cPUAMHmnL71 py37BJZxrLzwpHvEToXQUOFDEOjvsAoiWDXqNgXtMF93qVl4dr7H9oXxYtfPKP/hwtpR APEeKBv3pyAr6S/hPslgprJJTzSQGcUTFuCkk2Hk2F+ThgHtKolRydWaXI/EsO8CKbz7 Ee41hTRs/h2rOsVYPapPVjEaBPTM1MUYZp+x2mOIrU8yzLQ2QLb9vxQYcvIEFnqc0Ngb ZIWBWR9UU1gcGKLeMyDPjUl+Z3N2L7GmBQI0Y/4nusrQ9p3cIsWHhcEDdnd9bZPlvKVo E9fw== X-Gm-Message-State: AOAM532K9Uod1Lb6wo3sdanIaNWi8oJ1qtPO3anidjyKsqkil5yGMIhh S7YSr2coHF4KrzQxTYAiyk3G/gPppffv/H5aNb/LvQ== X-Google-Smtp-Source: ABdhPJzvynb+mFT6Mi7hEx6IXLxnNBonNu1ObAo/1/4cv6eeRaXfFt+HU09XZQgNU5/AQabX6bp6nFyK8dybNvj64T8= X-Received: by 2002:a25:d2d3:: with SMTP id j202mr11341988ybg.157.1617281507590; Thu, 01 Apr 2021 05:51:47 -0700 (PDT) MIME-Version: 1.0 References: <4c259d34b5943bf384fd3cb0d98eccf798a34f0f.1615038553.git.syednwaris@gmail.com> <36db7be3-73b6-c822-02e8-13e3864b0463@xilinx.com> In-Reply-To: From: Bartosz Golaszewski Date: Thu, 1 Apr 2021 14:51:36 +0200 Message-ID: Subject: Re: [PATCH v3 3/3] gpio: xilinx: Utilize generic bitmap_get_value and _set_value To: Syed Nayyar Waris Cc: Michal Simek , Andy Shevchenko , William Breathitt Gray , Arnd Bergmann , Robert Richter , Linus Walleij , Masahiro Yamada , Andrew Morton , Zhang Rui , Daniel Lezcano , Amit Kucheria , Linux-Arch , linux-gpio , LKML , arm-soc , linux-pm , Srinivas Goud , Srinivas Neeli X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210401_135149_735098_773F0DE7 X-CRM114-Status: GOOD ( 39.73 ) 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 Thu, Apr 1, 2021 at 1:16 PM Syed Nayyar Waris wrote: > > On Wed, Mar 31, 2021 at 8:56 PM Srinivas Neeli wrote: > > > > Hi, > > > > > -----Original Message----- > > > From: Bartosz Golaszewski > > > Sent: Friday, March 26, 2021 10:58 PM > > > To: Michal Simek > > > Cc: Syed Nayyar Waris ; Srinivas Neeli > > > ; Andy Shevchenko > > > ; William Breathitt Gray > > > ; Arnd Bergmann ; Robert > > > Richter ; Linus Walleij ; > > > Masahiro Yamada ; Andrew Morton > > > ; Zhang Rui ; Daniel > > > Lezcano ; Amit Kucheria > > > ; Linux-Arch ; > > > linux-gpio ; LKML > > kernel@vger.kernel.org>; arm-soc ; > > > linux-pm ; Srinivas Goud > > > Subject: Re: [PATCH v3 3/3] gpio: xilinx: Utilize generic bitmap_get_value and > > > _set_value > > > > > > On Mon, Mar 8, 2021 at 8:13 AM Michal Simek > > > wrote: > > > > > > > > > > > > > > > > On 3/6/21 3:06 PM, Syed Nayyar Waris wrote: > > > > > This patch reimplements the xgpio_set_multiple() function in > > > > > drivers/gpio/gpio-xilinx.c to use the new generic functions: > > > > > bitmap_get_value() and bitmap_set_value(). The code is now simpler > > > > > to read and understand. Moreover, instead of looping for each bit in > > > > > xgpio_set_multiple() function, now we can check each channel at a > > > > > time and save cycles. > > > > > > > > > > Cc: Bartosz Golaszewski > > > > > Cc: Michal Simek > > > > > Signed-off-by: Syed Nayyar Waris > > > > > Acked-by: William Breathitt Gray > > > > > --- > > > > > drivers/gpio/gpio-xilinx.c | 63 > > > > > +++++++++++++++++++------------------- > > > > > 1 file changed, 32 insertions(+), 31 deletions(-) > > > > > > > > > > diff --git a/drivers/gpio/gpio-xilinx.c b/drivers/gpio/gpio-xilinx.c > > > > > index be539381fd82..8445e69cf37b 100644 > > > > > --- a/drivers/gpio/gpio-xilinx.c > > > > > +++ b/drivers/gpio/gpio-xilinx.c > > > > > @@ -15,6 +15,7 @@ > > > > > #include > > > > > #include > > > > > #include > > > > > +#include "gpiolib.h" > > > > > > > > > > /* Register Offset Definitions */ > > > > > #define XGPIO_DATA_OFFSET (0x0) /* Data register */ > > > > > @@ -141,37 +142,37 @@ static void xgpio_set_multiple(struct > > > > > gpio_chip *gc, unsigned long *mask, { > > > > > unsigned long flags; > > > > > struct xgpio_instance *chip = gpiochip_get_data(gc); > > > > > - int index = xgpio_index(chip, 0); > > > > > - int offset, i; > > > > > - > > > > > - spin_lock_irqsave(&chip->gpio_lock[index], flags); > > > > > - > > > > > - /* Write to GPIO signals */ > > > > > - for (i = 0; i < gc->ngpio; i++) { > > > > > - if (*mask == 0) > > > > > - break; > > > > > - /* Once finished with an index write it out to the register */ > > > > > - if (index != xgpio_index(chip, i)) { > > > > > - xgpio_writereg(chip->regs + XGPIO_DATA_OFFSET + > > > > > - index * XGPIO_CHANNEL_OFFSET, > > > > > - chip->gpio_state[index]); > > > > > - spin_unlock_irqrestore(&chip->gpio_lock[index], flags); > > > > > - index = xgpio_index(chip, i); > > > > > - spin_lock_irqsave(&chip->gpio_lock[index], flags); > > > > > - } > > > > > - if (__test_and_clear_bit(i, mask)) { > > > > > - offset = xgpio_offset(chip, i); > > > > > - if (test_bit(i, bits)) > > > > > - chip->gpio_state[index] |= BIT(offset); > > > > > - else > > > > > - chip->gpio_state[index] &= ~BIT(offset); > > > > > - } > > > > > - } > > > > > - > > > > > - xgpio_writereg(chip->regs + XGPIO_DATA_OFFSET + > > > > > - index * XGPIO_CHANNEL_OFFSET, chip->gpio_state[index]); > > > > > - > > > > > - spin_unlock_irqrestore(&chip->gpio_lock[index], flags); > > > > > + u32 *const state = chip->gpio_state; > > > > > + unsigned int *const width = chip->gpio_width; > > > > > + > > > > > + DECLARE_BITMAP(old, 64); > > > > > + DECLARE_BITMAP(new, 64); > > > > > + DECLARE_BITMAP(changed, 64); > > > > > + > > > > > + spin_lock_irqsave(&chip->gpio_lock[0], flags); > > > > > + spin_lock(&chip->gpio_lock[1]); > > > > > + > > > > > + bitmap_set_value(old, 64, state[0], width[0], 0); > > > > > + bitmap_set_value(old, 64, state[1], width[1], width[0]); > > > > > + bitmap_replace(new, old, bits, mask, gc->ngpio); > > > > > + > > > > > + bitmap_set_value(old, 64, state[0], 32, 0); > > > > > + bitmap_set_value(old, 64, state[1], 32, 32); > > > > > + state[0] = bitmap_get_value(new, 0, width[0]); > > > > > + state[1] = bitmap_get_value(new, width[0], width[1]); > > > > > + bitmap_set_value(new, 64, state[0], 32, 0); > > > > > + bitmap_set_value(new, 64, state[1], 32, 32); > > > > > + bitmap_xor(changed, old, new, 64); > > > > > + > > > > > + if (((u32 *)changed)[0]) > > > > > + xgpio_writereg(chip->regs + XGPIO_DATA_OFFSET, > > > > > + state[0]); > > > > > + if (((u32 *)changed)[1]) > > > > > + xgpio_writereg(chip->regs + XGPIO_DATA_OFFSET + > > > > > + XGPIO_CHANNEL_OFFSET, state[1]); > > > > > + > > > > > + spin_unlock(&chip->gpio_lock[1]); > > > > > + spin_unlock_irqrestore(&chip->gpio_lock[0], flags); > > > > > } > > > > > > > > > > /** > > > > > > > > > > > > > Srinivas N: Can you please test this code? > > > > > > > > Thanks, > > > > Michal > > > > > > Hey, any chance of getting that Tested-by? > > I tested patches with few modifications in code (spin_lock handling and merge conflict). > > functionality wise it's working fine. > > > > > > > > Bart > > Hi Bartosz, > > May I please know the URL of the tree that you are using. I had been > using the tree below for submitting this patchset on GPIO to you. > https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git > > I think I am using the wrong tree. On which tree should I base my > patches on for my next (v4) submission? Should I use the tree below? > : > https://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git > > Regards > Syed Nayyar Waris Yes this is the one. Please address new issues raised by reviewers. Bart _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel