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=-8.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 9B9E3C433E0 for ; Sat, 23 May 2020 17:07:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7C0CF2053B for ; Sat, 23 May 2020 17:07:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="R1XZgxxW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728622AbgEWRHZ (ORCPT ); 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) 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