From patchwork Wed Jun 23 20:53:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 466081 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=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, USER_AGENT_SANE_1 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 CBA14C48BC2 for ; Wed, 23 Jun 2021 20:53:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AE032610A0 for ; Wed, 23 Jun 2021 20:53:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229800AbhFWU4B (ORCPT ); Wed, 23 Jun 2021 16:56:01 -0400 Received: from mxout03.lancloud.ru ([45.84.86.113]:37306 "EHLO mxout03.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229812AbhFWU4B (ORCPT ); Wed, 23 Jun 2021 16:56:01 -0400 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout03.lancloud.ru 6192320A8BE8 Received: from LanCloud Received: from LanCloud Received: from LanCloud Subject: [PATCH 1/5] i2c: hix5hd2: fix IRQ check From: Sergey Shtylyov To: References: Organization: Open Mobile Platform Message-ID: <512022d4-825d-33ae-00f9-33eaeba9579d@omp.ru> Date: Wed, 23 Jun 2021 23:53:32 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT01.lancloud.ru (fd00:f066::141) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Iff platform_get_irq() returns 0, the driver's probe() method will return 0 early (as if the method's call was successful). Let's consider IRQ0 valid for simplicity -- devm_request_irq() can always override that decision... Fixes: 15ef27756b23 ("i2c: hix5hd2: add i2c controller driver") Signed-off-by: Sergey Shtylyov --- drivers/i2c/busses/i2c-hix5hd2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: linux/drivers/i2c/busses/i2c-hix5hd2.c =================================================================== --- linux.orig/drivers/i2c/busses/i2c-hix5hd2.c +++ linux/drivers/i2c/busses/i2c-hix5hd2.c @@ -413,7 +413,7 @@ static int hix5hd2_i2c_probe(struct plat return PTR_ERR(priv->regs); irq = platform_get_irq(pdev, 0); - if (irq <= 0) + if (irq < 0) return irq; priv->clk = devm_clk_get(&pdev->dev, NULL); From patchwork Wed Jun 23 20:58:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 466080 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=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, USER_AGENT_SANE_1 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 0C00DC49EA5 for ; Wed, 23 Jun 2021 20:59:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DC7CC61075 for ; Wed, 23 Jun 2021 20:59:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229826AbhFWVBT (ORCPT ); Wed, 23 Jun 2021 17:01:19 -0400 Received: from mxout04.lancloud.ru ([45.84.86.114]:59696 "EHLO mxout04.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229660AbhFWVBT (ORCPT ); Wed, 23 Jun 2021 17:01:19 -0400 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout04.lancloud.ru 4E1FA20BBB08 Received: from LanCloud Received: from LanCloud Received: from LanCloud Subject: [PATCH 3/5] i2c: pmcmsp: fix-IRQ-check From: Sergey Shtylyov To: References: Organization: Open Mobile Platform Message-ID: <31a2d0c2-8069-6a73-ef7e-40e1146d5c56@omp.ru> Date: Wed, 23 Jun 2021 23:58:51 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT01.lancloud.ru (fd00:f066::141) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org The driver's probe() method is written as if platform_get_irq() returns 0 on error, while actually it returns a negative error code (with all the other values considered valid IRQs). Rewrite the driver's IRQ checking code to pass the positive IRQ #s to request_irq(), propagate -EPROBE_DEFER upstream, and use the polling mode when platform_get_irq() returns negative error code or 0... Fixes: 1b144df1d7d6 ("i2c: New PMC MSP71xx TWI bus driver") Signed-off-by: Sergey Shtylyov --- drivers/i2c/busses/i2c-pmcmsp.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) Index: linux/drivers/i2c/busses/i2c-pmcmsp.c =================================================================== --- linux.orig/drivers/i2c/busses/i2c-pmcmsp.c +++ linux/drivers/i2c/busses/i2c-pmcmsp.c @@ -291,8 +291,13 @@ static int pmcmsptwi_probe(struct platfo } /* request the irq */ - pmcmsptwi_data.irq = platform_get_irq(pldev, 0); - if (pmcmsptwi_data.irq) { + rc = platform_get_irq(pldev, 0); + if (rc == -EPROBE_DEFER) + return rc; + if (rc <= 0) { + pmcmsptwi_data.irq = 0; + } else { + pmcmsptwi_data.irq = rc; rc = request_irq(pmcmsptwi_data.irq, &pmcmsptwi_interrupt, IRQF_SHARED, pldev->name, &pmcmsptwi_data); if (rc == 0) { From patchwork Wed Jun 23 21:06:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 466079 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=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, USER_AGENT_SANE_1 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 91974C48BC2 for ; Wed, 23 Jun 2021 21:06:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6254F6128D for ; Wed, 23 Jun 2021 21:06:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229688AbhFWVJH (ORCPT ); Wed, 23 Jun 2021 17:09:07 -0400 Received: from mxout02.lancloud.ru ([45.84.86.82]:39846 "EHLO mxout02.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229660AbhFWVJH (ORCPT ); Wed, 23 Jun 2021 17:09:07 -0400 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout02.lancloud.ru 66BBB220E44C Received: from LanCloud Received: from LanCloud Received: from LanCloud Subject: [PATCH 5/5] i2c: xlp9xx: fix main IRQ check From: Sergey Shtylyov To: , George Cherian References: Organization: Open Mobile Platform Message-ID: <6c22992e-2eb9-22b9-2757-12d47571092f@omp.ru> Date: Thu, 24 Jun 2021 00:06:38 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT01.lancloud.ru (fd00:f066::141) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Iff platform_get_irq() returns 0 for the main IRQ, the driver's probe() method will return 0 early (as if the method's call was successful). Let's consider IRQ0 valid for simplicity -- devm_request_irq() can always override that decision... Fixes: 2bbd681ba2b ("i2c: xlp9xx: Driver for Netlogic XLP9XX/5XX I2C controller") Signed-off-by: Sergey Shtylyov --- drivers/i2c/busses/i2c-xlp9xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: linux/drivers/i2c/busses/i2c-xlp9xx.c =================================================================== --- linux.orig/drivers/i2c/busses/i2c-xlp9xx.c +++ linux/drivers/i2c/busses/i2c-xlp9xx.c @@ -517,7 +517,7 @@ static int xlp9xx_i2c_probe(struct platf return PTR_ERR(priv->base); priv->irq = platform_get_irq(pdev, 0); - if (priv->irq <= 0) + if (priv->irq < 0) return priv->irq; /* SMBAlert irq */ priv->alert_data.irq = platform_get_irq(pdev, 1);