Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp341963pxj; Thu, 20 May 2021 10:32:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3vRH2vnY8VGspfyN9Sg2TMrrwX3TUsW10qE1ifq7skXOsG576w1fSEpSk3Ww3DZS2DebN X-Received: by 2002:a17:906:2ed0:: with SMTP id s16mr5818192eji.543.1621531949497; Thu, 20 May 2021 10:32:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621531949; cv=none; d=google.com; s=arc-20160816; b=aXL2rhDDN/MuenM4iqqdQqyC0+ehWO0Ek59oqvnE3QONYS9TRr3qzdY9gWwncYbAOW 0rIC0dfLqoWIxAGNwkUIkPZkhIeTUHkJ24ZNjYPODkGhvvL6lF5qJ7WHuZt8wRoMI8Ti D91foHOVPDIvBqwVYrJBJkp91ty1WCyhUfBkCcvZNXvU38qiVVP7rHqkXoHHg3km9saU Vh86ars+Jq4ndL30AWQ2rKczYzTu0k+cuqjn+4aoeop33fyl/5NOPB7NI2HTKHs1Tx4E N/0kOsYEZg+JFupMKcx39gi65xq9tMxDrMlxuy7YYYWqMw/i5330mL3YBQ9+i0pcB820 CVGw== 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=ik/kn3vh9LpehHIIsZHsQ663YluSj0UQVIVnwipaNoY=; b=PLRBdKHAQvUDTLWtyNIFj4gsHhT+v0bhQCvkqzrH4QSliWt5jJcVQN6N7qtMbv4fPD e+Ymkh8J6hJPn11v5Q2xW7x+SFdsL8DiufR5JDDdFWmPlp9izAsX6/BqeK1FffcooLa4 5tJecjnpvuJsKWOUIPB8nPpdgrfYTrKLbUnwYzgSHVHXU3wZausIaqWyRJufJWUljUw2 dpK7l+7Ca/J/hcqbyaWeNJKpo6eYEd/aSHGSLEMe8lxo9Jrs39PLh8utGCH9qnSpcXIC pFTnD85fbfRgmh3g/087aKwLgc3LMW7KmGkwAiziYR7lNf7K+Oy9tppo7Rz2o4FAb7YL 2TEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VYeROhow; 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 n21si2631927edq.44.2021.05.20.10.32.05; Thu, 20 May 2021 10:32:29 -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=VYeROhow; 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 S234489AbhETKA7 (ORCPT + 99 others); Thu, 20 May 2021 06:00:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:58388 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234574AbhETJ4f (ORCPT ); Thu, 20 May 2021 05:56:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D648D61625; Thu, 20 May 2021 09:37:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503458; bh=LGwtOfhf3UQ1DQ9WVpBeow0KxotWDRS9s++tcrpDvLg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VYeROhowv+b9eTSbDU5+nmkjEzG0rusq4gHNzB2nUpxhvIvGLOuLhA15OqKobjv7c p3UPMu11FJ4QQA8tWd2TQgnozdaYBR/Lu2zefPeKkS3ZfWQCzoD0xvWQz0iNPSeuQb tJuVdEpGsPo+SGRYBiH3clWxsYm0ODPXWluliF5U= 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.19 231/425] pata_arasan_cf: fix IRQ check Date: Thu, 20 May 2021 11:20:00 +0200 Message-Id: <20210520092139.027604008@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092131.308959589@linuxfoundation.org> References: <20210520092131.308959589@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 ebecab8c3f36..7c1c399450f3 100644 --- a/drivers/ata/pata_arasan_cf.c +++ b/drivers/ata/pata_arasan_cf.c @@ -817,12 +817,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