Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp444210pxj; Thu, 20 May 2021 13:04:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxnpxrnnxVn0z4UZ5USi/eXfNke73mwMJ5Hpd1X9nyIHz3Af+gkTkfAu7wb1scqYRMJlruG X-Received: by 2002:a50:abc1:: with SMTP id u59mr5771374edc.7.1621541088003; Thu, 20 May 2021 13:04:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621541087; cv=none; d=google.com; s=arc-20160816; b=0H7eGNaoCPXFo4Rjzr4s0IuVGzdY5T9hPPUkaqNcIQzxkU9yV1rbwR+WMner62Op2R lvV3MRZw9CibXLnj2waDC7T8SF/ZeSoIanPHEWGJrLqjBn9JfXa4TYbvuftn8yEJeSoo qzCa3hotjQ3H+Io+VtKAwAzXBCg0apUa1qTS6+CHPKG6Xm4TrWUFtFWbwubBzV5oQvps pyQsiqhJ1+uohYkctWzRbgNRnIAjkugopKmZeTdQhOxp3PjTf0PIn0fN8xtLJ6ZkxozM mimjrvlTouADu+cmU01D8KhyA4arKGgKk+z5TWogJSeSKSJkPmr3QO/oQ84CkoItTMll MRkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RWZ/zuzjkrAyQVi8AJ6GMi0Uxray844xQenpttCOgwM=; b=vjE01EAZ3FSOfvaHMscWHkblYC6ZEuz9TYjdeA6HQoZ3qDXdGu1/KuCWiadJB4HDuX PxMEkD8pHQ+1VGBdCEsuL+5z5TWg4Jz6uvmz3qfofm3E1/2Zu/TMWzMuGlTCfLZpsoNc 6kPnZ/VkXGOnKwK2sgrf7FMyyqv98vWKMyodg43u5LerGDWh0E7Ab3CEVadKAdyyy4wg DUbS7phhqJfXzFFfPYYo2J1VhA8lyvsq3AI/puUt8LpMRVqzffhPqlYnxZHktdD21lrV hDptJr7cM7KnvlwLmmbD83rDcFetDJg4ftZjYL9A5hSA5N5qZnvOGYZfEA41Jj1Z0TaZ gVPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ivtq9E3E; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t18si2803308edr.386.2021.05.20.13.04.24; Thu, 20 May 2021 13:04:47 -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=pass header.i=@linuxfoundation.org header.s=korg header.b=Ivtq9E3E; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236875AbhETKqL (ORCPT + 99 others); Thu, 20 May 2021 06:46:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:60494 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237164AbhETK3l (ORCPT ); Thu, 20 May 2021 06:29:41 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A298B60551; Thu, 20 May 2021 09:51:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504299; bh=EVw1yJLDoY2u+9KBb7oQsjBEFyKgubZGB4jVr4IBGjA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ivtq9E3EVkiztKoDn3y2WVL6Sb+vRG8SXjcYFiBtk9O5wC8V+0qhTKHVWD7q5uGps vXfcHbdtul+Mql0hwXIMLBJTNz7d3FDp4jgtLtZoOpxOzEtiZAXJwRRo4k2bzoxGS6 d8w47rSv/LCodhE2m/Uhf6tmC/I4UpHsHUdrH6rM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Shtylyov , Viresh Kumar , Jens Axboe , Sasha Levin Subject: [PATCH 4.14 183/323] pata_arasan_cf: fix IRQ check Date: Thu, 20 May 2021 11:21:15 +0200 Message-Id: <20210520092126.382872080@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sergey Shtylyov [ Upstream commit c7e8f404d56b99c80990b19a402c3f640d74be05 ] 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 ata_host_activate(), propagate upstream -EPROBE_DEFER, and set up the driver to polling mode on (negative) errors and IRQ0 (libata treats IRQ #0 as a polling mode anyway)... Fixes: a480167b23ef ("pata_arasan_cf: Adding support for arasan compact flash host controller") Signed-off-by: Sergey Shtylyov Acked-by: Viresh Kumar Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- drivers/ata/pata_arasan_cf.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c index b4d54771c9fe..623199fab8fe 100644 --- a/drivers/ata/pata_arasan_cf.c +++ b/drivers/ata/pata_arasan_cf.c @@ -819,12 +819,19 @@ static int arasan_cf_probe(struct platform_device *pdev) else quirk = CF_BROKEN_UDMA; /* as it is on spear1340 */ - /* if irq is 0, support only PIO */ - acdev->irq = platform_get_irq(pdev, 0); - if (acdev->irq) + /* + * If there's an error getting IRQ (or we do get IRQ0), + * support only PIO + */ + ret = platform_get_irq(pdev, 0); + if (ret > 0) { + acdev->irq = ret; irq_handler = arasan_cf_interrupt; - else + } else if (ret == -EPROBE_DEFER) { + return ret; + } else { quirk |= CF_BROKEN_MWDMA | CF_BROKEN_UDMA; + } acdev->pbase = res->start; acdev->vbase = devm_ioremap_nocache(&pdev->dev, res->start, -- 2.30.2