Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp64180pxj; Thu, 20 May 2021 04:40:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqat/7ntPQf76TdKD3hnw7SwU3vINxF2/ATCpqcgloUVPdx+HAX62uAvW1A/w1R7wcLUlz X-Received: by 2002:a17:906:11cc:: with SMTP id o12mr4122361eja.547.1621510814361; Thu, 20 May 2021 04:40:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621510814; cv=none; d=google.com; s=arc-20160816; b=W8Y//T4THnNXAitT9GdpzIAt5oUpFokb7S+s428Fw4+x7NAJdR+EBoXsfafWiWNDaq KN4dsxY+I+g5AZRHyzqYWMHK79zIrUGdVqlGPQLU/Q6sKOl22gja9o1EAEHxzHkif5Ig WrAZUyi0XkYoRvaX0i0nHHDSWalrRgE5jB8pD1woJTfdJ6PecGee6AlH7QBOyhkN9SkV zJTnwjTWkfwRMEJnkH6khd7a+YlFC4rQGet2jnuwGopbkccncrxSB5dIMli/693OJNUX aZ/yzfUwF3mqXfHGeHm9e4H/fcFJL/ADFG8tN6Z8d7MIUyXt5/HusRJVbGN/kKpCbgL6 HTlQ== 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=/PbojppqEPjwfUFKjU6aLjLXGkweIAarmSGu+ukw1gQ=; b=Yz+V6x2FrtdekIPsZ/8IsUVebAn2tVCBW3lgbY35WD19GINcItE+CmNtiueOEMyWWO wpMvcZczkCnHfPQZUV3p4p8fpx+MerbGlFL+OWFBMjBMCj9iAMm2d90YeOlLVVhnDTZb HOm+orIC/VbVsDg4kKmVwB4pDYp+jTqPiXC7PHp8Idx9RJj6/zVemMMcjl+cWAF2A2/3 EgUR0U9XMqGnIgs1iNxeSPYDJfAiOjxBMjBaEXUePeS+akH4F3alMDuSm8nHGc/6LsB8 WZ6ebOE93ez+aUwsYysxhxn7z/ZAXq/reW/rvT0WHPmep40LEj7Bifc1Vc8JMu7rFWUX T/hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="J/WISTxI"; 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 i21si1970952edc.289.2021.05.20.04.39.50; Thu, 20 May 2021 04:40:14 -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="J/WISTxI"; 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 S241145AbhETLgT (ORCPT + 99 others); Thu, 20 May 2021 07:36:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:36532 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240106AbhETLQg (ORCPT ); Thu, 20 May 2021 07:16:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A453A61D66; Thu, 20 May 2021 10:09:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621505362; bh=sRmKbQ9M9m/KHejh45A7L4tK3TePyZsP5DOxKt3eD4s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J/WISTxIImgu98HpmPkCr6CkHzZBhH7o9vg6USyki54I3N3+WopfPs1M1ESvAbxIk wEDSp+RALQWCtKVVGPZ1SE1O22YOUdHYFsCLs++v0fanXzlE8s8BsUGG9k1pSqiqXY 94b2Z87by04JyUY2wNjlMeoxS8u/fzQsGpgd/xKg= 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.4 100/190] pata_arasan_cf: fix IRQ check Date: Thu, 20 May 2021 11:22:44 +0200 Message-Id: <20210520092105.506011713@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092102.149300807@linuxfoundation.org> References: <20210520092102.149300807@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 80fe0f6fed29..a6b1a7556d37 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