Received: by 10.223.176.5 with SMTP id f5csp18220wra; Mon, 5 Feb 2018 15:42:32 -0800 (PST) X-Google-Smtp-Source: AH8x224ZxvMWbLz7uQZuZ4p+CIlfJ/q+o0xijoxptbZmFEumPSnjs5GHZV/C+tCt1GmTFzFvbsb+ X-Received: by 2002:a17:902:2843:: with SMTP id e61-v6mr476636plb.260.1517874152062; Mon, 05 Feb 2018 15:42:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517874152; cv=none; d=google.com; s=arc-20160816; b=y2zObpa4pEYsMpmLmZputfEzmbhptX8Uww9Cfu69M24u8BtgkIFfq1u63zcHPUKyjI TmW+18fU2+zbhQ4ANp9LBjtjx7cpjhnnQ+DFkEddBE7cahM5HqD37ukPTisbLUuEgfoc bP3FIqABeqCveQjNDRs3GCUcdKr3wjYIXe9ft/sHuySHRaDPCEjsJX11PSKgGN7hxMHl ki3cx+jp4WQq7e9rWIwUHTbiUzRWwby5m+HX4MTtUCVjvq178zx6SkPeM3ozmnwzo1LB 8ievlBxK5/WRCKBAKT56GoCPSrzstfeay+4akw9a6DMVWgqzcHyxcH46Fs2STJGObEwX PxDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=tFOiWljNvn1k9zcTlxmn14ujxC074k5GPPAn0G/btCE=; b=b+5yGBW33uQUf6OoUyK+xGHMbCVT4Ja333fnG1UWsyAqRuHm1WBOEUYFsnFBtIfEOa n0ycQdw3ks6naohs5DFIGUkLOegLPjCR/lElwjZjoWB4NdjRCwxnY1PgeZxE30LEUOFA W0L4rdtecYrsq7Za+WgrlYtFMaeHwAsTQ0q1OhS9gdRZrVJLPStrnBEjfU7QJu7clIt0 7J5Dtoao2kglJksZWs0eMbvXebuL91bk7V9RB6nO9K/QfLslDvh7QInglekZqS9HPDeO Zd3rIPa1gG/1jukuWHA9TGrPWkOFcy+0Af3hlkZi911TRJexlOrTMTEgyykL0aN+VsN+ alMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AQdWhkX2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 2si4865604pfd.275.2018.02.05.15.42.18; Mon, 05 Feb 2018 15:42:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AQdWhkX2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752009AbeBEXl3 (ORCPT + 99 others); Mon, 5 Feb 2018 18:41:29 -0500 Received: from mail-pg0-f50.google.com ([74.125.83.50]:39868 "EHLO mail-pg0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750862AbeBEXlX (ORCPT ); Mon, 5 Feb 2018 18:41:23 -0500 Received: by mail-pg0-f50.google.com with SMTP id w17so82016pgv.6 for ; Mon, 05 Feb 2018 15:41:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=tFOiWljNvn1k9zcTlxmn14ujxC074k5GPPAn0G/btCE=; b=AQdWhkX26os1geo6hmkuIvKTr58r8dNmGEA2eKttg5m+nMgw23puR2Ns+6V/lfUfUW ISOgxhXwmJyD9lP6OSo9FGRTv1BcklkHpzUsYCJYC/4ZLOGzsqX9O3XmaJ/FW3IWNV7c CTnTE8hCgLb/HRRt8KYWQFfjVPrvJB6kAEEJ4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=tFOiWljNvn1k9zcTlxmn14ujxC074k5GPPAn0G/btCE=; b=dBPROfTvx2YFK8eptG/M5DY+kXo+RgBZQpv2QTFM8j3jMs5RqgecCveKrJZEkuXuTh cPU9wgAkhrYu0tlASoJzVnZ8jYxXUaDHP46tGD5gVo0Z+pRq7Jdm6/g0XBeeyFkGE55C Wcxizk8LYF7NcQbo7n9EASrOZD56KmtxsjwijycG8851vjUOdNfEHJw4KmsxrE2U1OGX m94PLYUEYjfa3+lG1IJqznLMXMafm4qGm3RXFryp40HdTk3RDWsaUfDC0cavMqSA45fa GM1gUsNTgvYl0D7VTkbpZOTH6l1HO6Ux6wKYnwcE/kkKav02bgabUF8rjvCzQPEMz/hx Yqbg== X-Gm-Message-State: APf1xPBNnLeB5KUULaBsPtHHcuo7sTLRia1keSt0cUIZPs/8TqdFLgp5 by36VWZCwSlTRuObFymv648MPA== X-Received: by 10.99.125.25 with SMTP id y25mr380139pgc.172.1517874082780; Mon, 05 Feb 2018 15:41:22 -0800 (PST) Received: from builder (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id t8sm12786988pgn.93.2018.02.05.15.41.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Feb 2018 15:41:21 -0800 (PST) Date: Mon, 5 Feb 2018 15:41:20 -0800 From: Bjorn Andersson To: Srinivas Ramana Cc: linus.walleij@linaro.org, timur@codeaurora.org, sboyd@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] pinctrl: qcom: Add irq_enable callback for msm gpio Message-ID: <20180205234120.GG9465@builder> References: <1516626208-5655-1-git-send-email-sramana@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1516626208-5655-1-git-send-email-sramana@codeaurora.org> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 22 Jan 05:03 PST 2018, Srinivas Ramana wrote: > +static void msm_gpio_irq_enable(struct irq_data *d) > +{ > + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); > + struct msm_pinctrl *pctrl = gpiochip_get_data(gc); > + const struct msm_pingroup *g; > + unsigned long flags; > + u32 val; > + > + g = &pctrl->soc->groups[d->hwirq]; > + > + raw_spin_lock_irqsave(&pctrl->lock, flags); > + > + /* > + * clear the interrupt status bit before unmask to avoid > + * any erroneous interrupts that would have got latched > + * when the intterupt is not in use. > + */ > + val = readl(pctrl->regs + g->intr_status_reg); > + val &= ~BIT(g->intr_status_bit); > + writel(val, pctrl->regs + g->intr_status_reg); > + > + val = readl(pctrl->regs + g->intr_cfg_reg); > + val |= BIT(g->intr_enable_bit); > + writel(val, pctrl->regs + g->intr_cfg_reg); > + > + set_bit(d->hwirq, pctrl->enabled_irqs); > + > + raw_spin_unlock_irqrestore(&pctrl->lock, flags); > +} Hi Srinivas, This makes sense, but I would prefer if you extract this code into a common: static void __msm_gpio_irq_unmask(struct msm_pinctrl *pctrl, bool status_clear) which you call from the two callbacks. Regards, Bjorn