Received: by 2002:a25:d80d:0:0:0:0:0 with SMTP id p13csp159854ybg; Sat, 23 May 2020 10:09:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwL73daPpvKuPMWmryhV3E/U06Gx3Fp7mnu3s523SDHSWS/I0vdlKZV+5JjMhTa7LcaOlNr X-Received: by 2002:a50:fb1a:: with SMTP id d26mr7907961edq.83.1590253793007; Sat, 23 May 2020 10:09:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590253793; cv=none; d=google.com; s=arc-20160816; b=feW4Vro3YqCy4X8tIGEOMINbxSgcOFzhqk4oPBBxNIXVtI0uoaVDfSz16ZvUt/hTfe XJyhqBzvLoCxcyZeTUHB81slt0SKbkK5nBE19KDnl8JR+JnEC74U820czgq5m/+i23wF LVyxEm5TsYl5mrfK5TdMYK58kz03FYSOyUqOWOh6E22flYevefg8CiBVazWDgYW6fvFO EajeBYJaQMBaiImJoWLXbyouILIOgaXi3YoHYVmehKHcsqmo7HMLafAYlZthbZzk4ZO9 BEDAhOGHZqA4q1Q7SSNYdjqMTVTlIKSZxRHd1/go1ZoW7Wffuse77nKJKxtrNSejmzkY Vpfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature; bh=bROKX/djbcXfyKcI+T3w7r8zl613AlHc8MDTB/AnzJI=; b=Q1/d8HFZIOkR22DDrV5pDPL267sluFNgVPEuHj2ySv/KjgR/PNN1b0FgvlxVe5+f1L m8EmK0LVsD3Va0FMlvKCiulEyS/5R1jko9hd5JzqYkQcrq6lbVdNjs7TQSDfOAUCyzbt 7jzLp1awQR0WiEBOw/3rGGAFBORN98l9J0hIW5nCPYknSQ95OfhI3M4dmkMT+WNqjkHd mHGYYguFsBhhr4BpdZb4f5aZul3Tj2i8C/aBKM5zeo7h6fpViDKgU4NBLHuPaX7Cprew yj4vYArV6TCAt5GGJDGELwBv5k0WVAuogp/wvweqNplJRelmhS1mHHPO1cTxFZuSh1hU w3Qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=R1XZgxxW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sa8si6756012ejb.222.2020.05.23.10.09.29; Sat, 23 May 2020 10:09:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=R1XZgxxW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728590AbgEWRHZ (ORCPT + 99 others); Sat, 23 May 2020 13:07:25 -0400 Received: from mail26.static.mailgun.info ([104.130.122.26]:44105 "EHLO mail26.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728476AbgEWRHZ (ORCPT ); Sat, 23 May 2020 13:07:25 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1590253644; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Sender; bh=bROKX/djbcXfyKcI+T3w7r8zl613AlHc8MDTB/AnzJI=; b=R1XZgxxW+9eiyEZfYQFLl8/at/DmRTgfmV1G1Wub2hmwXAIUHX5t2ltWj8Zbf+RTbz0EDShe TRIx+6uyVZJ+v4RbxGyIDLcepkP9UOGQY+0eenJdtHWpR5rM1KyqUddNuOpslWykfH4LWWsQ KquworR7RhQUn+pD7/qQhCOZU/Y= X-Mailgun-Sending-Ip: 104.130.122.26 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n05.prod.us-west-2.postgun.com with SMTP id 5ec95838569a62550d6cb5f0 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Sat, 23 May 2020 17:07:04 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id E6496C43387; Sat, 23 May 2020 17:07:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from [192.168.43.137] (unknown [106.213.147.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mkshah) by smtp.codeaurora.org (Postfix) with ESMTPSA id 6317FC433C6; Sat, 23 May 2020 17:06:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 6317FC433C6 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=mkshah@codeaurora.org Subject: Re: [PATCH 1/4] gpio: gpiolib: Allow GPIO IRQs to lazy disable To: Marc Zyngier Cc: bjorn.andersson@linaro.org, linus.walleij@linaro.org, swboyd@chromium.org, evgreen@chromium.org, mka@chromium.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-gpio@vger.kernel.org, agross@kernel.org, tglx@linutronix.de, jason@lakedaemon.net, dianders@chromium.org, rnayak@codeaurora.org, ilina@codeaurora.org, lsrao@codeaurora.org References: <1590153569-21706-1-git-send-email-mkshah@codeaurora.org> <1590153569-21706-2-git-send-email-mkshah@codeaurora.org> <5888fc645d26b4780e9d9c6fd582374f@kernel.org> From: Maulik Shah Message-ID: Date: Sat, 23 May 2020 22:36:51 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <5888fc645d26b4780e9d9c6fd582374f@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 5/23/2020 3:12 PM, Marc Zyngier wrote: > On 2020-05-22 14:19, Maulik Shah wrote: >> With 'commit 461c1a7d4733 ("gpiolib: override irq_enable/disable")' >> gpiolib >> overrides irqchip's irq_enable and irq_disable callbacks. If irq_disable >> callback is implemented then genirq takes unlazy path to disable irq. >> >> Underlying irqchip may not want to implement irq_disable callback to >> lazy >> disable irq when client drivers invokes disable_irq(). By overriding >> irq_disable callback, gpiolib ends up always unlazy disabling IRQ. >> >> Allow gpiolib to lazy disable IRQs by overriding irq_disable callback >> only >> if irqchip implemented irq_disable. In cases where irq_disable is not >> implemented irq_mask is overridden. Similarly override irq_enable >> callback >> only if irqchip implemented irq_enable otherwise irq_unmask is >> overridden. >> >> Fixes: 461c1a7d47 (gpiolib: override irq_enable/disable) >> Signed-off-by: Maulik Shah >> --- >>  drivers/gpio/gpiolib.c      | 59 >> +++++++++++++++++++++++++++++---------------- >>  include/linux/gpio/driver.h | 13 ++++++++++ >>  2 files changed, 51 insertions(+), 21 deletions(-) >> >> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c >> index eaa0e20..a8fdc74 100644 >> --- a/drivers/gpio/gpiolib.c >> +++ b/drivers/gpio/gpiolib.c >> @@ -2465,33 +2465,38 @@ static void gpiochip_irq_relres(struct >> irq_data *d) >>      gpiochip_relres_irq(gc, d->hwirq); >>  } >> >> +static void gpiochip_irq_mask(struct irq_data *d) >> +{ >> +    struct gpio_chip *chip = irq_data_get_irq_chip_data(d); >> + >> +    if (chip->irq.irq_mask) >> +        chip->irq.irq_mask(d); >> +    gpiochip_disable_irq(chip, d->hwirq); >> +} >> + >> +static void gpiochip_irq_unmask(struct irq_data *d) >> +{ >> +    struct gpio_chip *chip = irq_data_get_irq_chip_data(d); >> + >> +    gpiochip_enable_irq(chip, d->hwirq); >> +    if (chip->irq.irq_unmask) >> +        chip->irq.irq_unmask(d); >> +} >> + >>  static void gpiochip_irq_enable(struct irq_data *d) >>  { >>      struct gpio_chip *gc = irq_data_get_irq_chip_data(d); >> >> -    gpiochip_enable_irq(gc, d->hwirq); >> -    if (gc->irq.irq_enable) >> -        gc->irq.irq_enable(d); >> -    else >> -        gc->irq.chip->irq_unmask(d); >> +    gpiochip_enable_irq(chip, d->hwirq); > > You really never compiled this, did you? > > I've stopped looking at this. Please send something that you will have > actually tested. > >         M. Apologies. I did tested out on internal devices based on kernel 5.4 as well as linux-next with sc7180. While posting i somehow taken patch from kernel 5.4 and messed up this patch during merge conflicts. I fixed this in v2 and posted out changes that cleanly applies on latest linux-next tag (next-20200521). Thanks, Maulik -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation