From patchwork Fri Sep 23 18:26:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacob Chen X-Patchwork-Id: 9348571 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DBFED607F2 for ; Fri, 23 Sep 2016 18:27:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D09A32AD73 for ; Fri, 23 Sep 2016 18:27:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C39612AD75; Fri, 23 Sep 2016 18:27:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 550A02AD73 for ; Fri, 23 Sep 2016 18:27:45 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bnVCJ-0001l9-4o; Fri, 23 Sep 2016 18:27:43 +0000 Received: from mail-pf0-f195.google.com ([209.85.192.195]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bnVCF-0001P0-OZ for linux-rockchip@lists.infradead.org; Fri, 23 Sep 2016 18:27:41 +0000 Received: by mail-pf0-f195.google.com with SMTP id q2so5598902pfj.0 for ; Fri, 23 Sep 2016 11:27:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=KRX1JCyVwclsZwOtgfGxncfmXIiuZAjwi2PTDXJRsHI=; b=QcfXFT4kXqYwUkkqjW+rFZJ7NSbYi4CLhVksIHnUf1KwoTntNm8G6cFgojFxU0LrNQ geA9KnMY+F5aY7qvqOLfedR+3cDrm0WoZcy/twA0o3WxQ3YkcKqgBAV/fWM1sDKZIEuN OSNGNhCRqihowDUZ8KpiNTYlf9vEbsJXdCCvI5CxIa1iwavuutMWT3XdAEQQ0xb2Okjl ZCm/8Q8rgPoxgYykZ1fUl3PBMCxfzTOwrX+qFt18YdDq/Y0Jk73SsRlaBITZXeD0Eva5 2v/KbwijjCs/wBDV1U9vH2w3JstomQbR4716BfEFr+WugfZpxbjHXbrQSZ4p5NcBJoB8 eV3w== X-Gm-Message-State: AE9vXwML8EYDLMfbIiXh9syJkukKpm2+WWd1dJrIe7krNsIdKxHTxguXd3CZlGM/X7zALw== X-Received: by 10.98.80.136 with SMTP id g8mr14844789pfj.185.1474655237739; Fri, 23 Sep 2016 11:27:17 -0700 (PDT) Received: from localhost.localdomain ([120.32.114.91]) by smtp.gmail.com with ESMTPSA id u19sm13148965pfa.40.2016.09.23.11.27.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 23 Sep 2016 11:27:16 -0700 (PDT) From: Jacob Chen To: linux-kernel@vger.kernel.org Subject: [PATCH] pinctrl: rockchip: don't disable clk when irq mask is already set Date: Sat, 24 Sep 2016 02:26:37 +0800 Message-Id: <1474655197-26919-1-git-send-email-jacob-chen@iotwrt.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160923_112739_917292_FFB1E3FF X-CRM114-Status: UNSURE ( 8.19 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rockchip@lists.infradead.org, linus.walleij@linaro.org, Jacob Chen , heiko@sntech.de, linux-gpio@vger.kernel.org MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jacob Chen In some drivers, disable_irq() call don't be symmetric with enable_irq() , disable_irq() will be called before call free_irq(). But both disable_irq() and free_irq() will call rockchip_irq_gc_mask_set_bit, and clk_disable() will be called more times than clk_enable(), which will cause bugs. I think we can correct that by checking of mask.If mask is already set, do nothing. Change-Id: If19912c7658253e15531c04db6c70fdbffd5960a Signed-off-by: Jacob Chen --- drivers/pinctrl/pinctrl-rockchip.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.7.4 diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index c6c04ac..9a8804a 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c @@ -2334,8 +2334,12 @@ static void rockchip_irq_gc_mask_clr_bit(struct irq_data *d) void rockchip_irq_gc_mask_set_bit(struct irq_data *d) { struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); + struct irq_chip_type *ct = irq_data_get_chip_type(d); struct rockchip_pin_bank *bank = gc->private; + if (*ct->mask_cache & d->mask) + return; + irq_gc_mask_set_bit(d); clk_disable(bank->clk); }