From patchwork Wed Nov 25 17:20:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 332382 Delivered-To: patch@linaro.org Received: by 2002:a92:5e16:0:0:0:0:0 with SMTP id s22csp622937ilb; Wed, 25 Nov 2020 09:25:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJyOantGvnVZBdpIr2sGkJ8OSYBMwZlbgpks/BCeEACaOiPn5kP90GM/A74YGvx7sE59nJzZ X-Received: by 2002:a17:906:f744:: with SMTP id jp4mr4188011ejb.122.1606325109300; Wed, 25 Nov 2020 09:25:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606325109; cv=none; d=google.com; s=arc-20160816; b=WsV7BQPrfdBoW0+coPOJGIRuMraHDpefDCU/jfFbDuR4B2gqy4JWVNYlpbpy+sHrL+ ASQsbsqkcuGVjSLCqDYJf891clkQ2iVgbyjW8peKDwUqL2ai08163VRiRiWujsBYkzVo 2eBL3oyW/8OcN3qCtBpvZJOqvgquZECYNuA2tMOFf4lptk7GexN0cSAxOlswPypwGSCc lJH+TuvQbU68y1iTjqntRC3l4d501MlxhHkPP0u0XMYjMY3Hg2Ane4xBfIeQrSGxb+Fx gKuJIgq7QXqTee/ahoqcxMVBQ7uHH1E11pdkspTGcvJS5fkEPU9VB3haHXal+Z/Id/k1 ZsOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=FT8kpJdpX9o68giOqPnVPkI3/gJCcePn8D8B33EYOTg=; b=oXPnl9IPNbKj5bUF+yrnOa/1qklhsyOB4gezNuNQz8bEXv/7kmTB8m0UszXpAsWVlY OCHbhIh34HwE6bEPUDYINm56jfcvUcCeBjcN4MrqpIhl+n1rKMrOfQeX82QsqgPvf6ko SIuszxrgWY2Caq9jYeTwSwDFSrUrhEiMfvneH2cNtyZsifaWVicRkBwtFleBEBkH1YuU nAcbfm+5eTt4r5hsSCURPrhR/UxIK02Sjcngg/2GXBComsFsOkw0huJOm48KViTFwymC cdRxaknuhxaWeEXIur7bJnmovyvbU550cQThdlZmweJ2fP3bqGVXmRhB3AqAvL5XSuod YcnA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k22si2164875edj.571.2020.11.25.09.25.09 for ; Wed, 25 Nov 2020 09:25:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732721AbgKYRZB (ORCPT ); Wed, 25 Nov 2020 12:25:01 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:8037 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731631AbgKYRYx (ORCPT ); Wed, 25 Nov 2020 12:24:53 -0500 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Ch76f5frfzhf7m; Thu, 26 Nov 2020 01:24:26 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.487.0; Thu, 26 Nov 2020 01:24:38 +0800 From: John Garry To: , , , , , CC: , , , , , "John Garry" Subject: [PATCH v3 3/5] driver core: platform: Add platform_put_irq() Date: Thu, 26 Nov 2020 01:20:39 +0800 Message-ID: <1606324841-217570-4-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1606324841-217570-1-git-send-email-john.garry@huawei.com> References: <1606324841-217570-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Add a function to tear down the work which was done in platform_get_irq() for when the device driver is done with the irq. For ACPI companion devices the irq resource is set as disabled, as this resource is configured from platform_get_irq()->acpi_irq_get() and requires resetting. Signed-off-by: John Garry --- drivers/base/platform.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) -- 2.26.2 diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 88aef93eb4dd..3eeda3746701 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -289,6 +289,20 @@ int platform_irq_count(struct platform_device *dev) } EXPORT_SYMBOL_GPL(platform_irq_count); +void platform_put_irq(struct platform_device *dev, unsigned int num) +{ + unsigned int virq = platform_get_irq(dev, num); + + irq_dispose_mapping(virq); + if (has_acpi_companion(&dev->dev)) { + struct resource *r = platform_get_resource(dev, IORESOURCE_IRQ, + num); + + if (r) + acpi_dev_irqresource_disabled(r, 0); + } +} + /** * platform_get_resource_byname - get a resource for a device by name * @dev: platform device