Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4362893ybi; Tue, 11 Jun 2019 05:33:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqwUeu5djvBQFtGW7orkFIJngacQupzdBJ5FeM4vfjrour/COxCFaf5rsovMMIWBxjkLuBuN X-Received: by 2002:aa7:914e:: with SMTP id 14mr28595036pfi.136.1560256398547; Tue, 11 Jun 2019 05:33:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560256398; cv=none; d=google.com; s=arc-20160816; b=XUdeTfgPIf8dGRVnm045Tu+ICTebucr8pFoXwX1/P86zJ3nSxV2mgzDALcyeGySjAU sed1/txLqJxtmGacykH6XwpM5RZCcLznxlkppzEH9QathrVMeUHSLgTDZSGVijiULZHE tYsrA2O9Jfj6lMEXyIld3vDkwWTQi6KuUdN0JPgaSGrqwFCmOwKl8rXs+rjqjD3n6qtP 4J/ugiPd2H4Lbe7DmIvCaTqGG8eEJHS1TWLhoQt+IhKg/OhUyrHGT7RMOkBzD6vmVWFg DJsDfHOvv57wHGh175td5UgkIxshsR6l2rN8JKFEoOnJ0TTf3Rz77JnvTAXbk7cPxCHw Tsog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=xlHr4fXur9Weuw7QMid9qS2z0IT8mSfJLKnqdbZm0Yc=; b=MRQqdqADrpyQVVxydy0Z73MA8ILSVZJ4E5iLEW11FH4LSOakh9D0kmaeih8FCQvtLC doTyme7X9Y5d78s4kM7BPZ4hHXcZhx4qeSaAmLxh+3uiOAYtU4I6eISBgIDBShUm2OvA 1Y3uRkxPbeNk9MJVXallcB+trqo+lX9rerbZiU/ZdBWlaS7ZRW/jQnDfW/gWsReHTiyQ LSOv9b5XSSFUQ28zQAsYfBJo/5/Mh/RGzYoMl5fnjvOzaOT3zNzvNNLY5BanJfcTe4i8 YHmTjADzWh/L8ft0un5hmmkrvg3qa4JW/1TD67/0oyK2aclP+832MfeeR1gvrDRKFeoO Z+gw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=opensource.cirrus.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c137si13180406pfb.185.2019.06.11.05.33.02; Tue, 11 Jun 2019 05:33:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=opensource.cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388653AbfFKMcQ (ORCPT + 99 others); Tue, 11 Jun 2019 08:32:16 -0400 Received: from mx0b-001ae601.pphosted.com ([67.231.152.168]:32914 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388433AbfFKMcP (ORCPT ); Tue, 11 Jun 2019 08:32:15 -0400 Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x5BCTio2027564; Tue, 11 Jun 2019 07:31:03 -0500 Authentication-Results: ppops.net; spf=none smtp.mailfrom=ckeepax@opensource.cirrus.com Received: from mail1.cirrus.com (mail1.cirrus.com [141.131.3.20]) by mx0b-001ae601.pphosted.com with ESMTP id 2t09ep3xqn-1; Tue, 11 Jun 2019 07:31:03 -0500 Received: from EDIEX02.ad.cirrus.com (unknown [198.61.84.81]) by mail1.cirrus.com (Postfix) with ESMTP id 51C7A611C8C1; Tue, 11 Jun 2019 07:31:03 -0500 (CDT) Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1591.10; Tue, 11 Jun 2019 13:31:01 +0100 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.1.1591.10 via Frontend Transport; Tue, 11 Jun 2019 13:31:01 +0100 Received: from algalon.ad.cirrus.com (algalon.ad.cirrus.com [198.90.251.122]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id C23652A1; Tue, 11 Jun 2019 13:31:01 +0100 (BST) From: Charles Keepax To: , CC: , , , , , , , Subject: [PATCH v4 5/7] i2c: core: Move ACPI IRQ handling to probe time Date: Tue, 11 Jun 2019 13:30:59 +0100 Message-ID: <20190611123101.25264-6-ckeepax@opensource.cirrus.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190611123101.25264-1-ckeepax@opensource.cirrus.com> References: <20190611123101.25264-1-ckeepax@opensource.cirrus.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=806 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906110085 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Bring the ACPI path in sync with the device tree path and handle all the IRQ fetching at probe time. This leaves the only IRQ handling at device registration time being that which is passed directly through the board info as either a resource or an actual IRQ number. Reviewed-by: Mika Westerberg Signed-off-by: Charles Keepax --- New since v3, but this patch and the previous one leave the code in the same state as this patch did on v3. Thanks, Charles drivers/i2c/i2c-core-acpi.c | 7 ------- drivers/i2c/i2c-core-base.c | 5 ++++- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c index 35966cc337dde..c70228f5349ef 100644 --- a/drivers/i2c/i2c-core-acpi.c +++ b/drivers/i2c/i2c-core-acpi.c @@ -171,8 +171,6 @@ int i2c_acpi_get_irq(struct i2c_client *client) return irq; } -static struct i2c_client *i2c_acpi_find_client_by_adev(struct acpi_device *adev); - static int i2c_acpi_get_info(struct acpi_device *adev, struct i2c_board_info *info, struct i2c_adapter *adapter, @@ -208,11 +206,6 @@ static int i2c_acpi_get_info(struct acpi_device *adev, if (adapter_handle) *adapter_handle = lookup.adapter_handle; - /* Then fill IRQ number if any */ - ret = i2c_acpi_get_irq(i2c_acpi_find_client_by_adev(adev)); - if (ret > 0) - info->irq = ret; - acpi_set_modalias(adev, dev_name(&adev->dev), info->type, sizeof(info->type)); diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c index 67344586de913..9520bcfc83182 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c @@ -327,7 +327,10 @@ static int i2c_device_probe(struct device *dev) if (irq == -EINVAL || irq == -ENODATA) irq = of_irq_get(dev->of_node, 0); } else if (ACPI_COMPANION(dev)) { - irq = acpi_dev_gpio_irq_get(ACPI_COMPANION(dev), 0); + irq = i2c_acpi_get_irq(client); + + if (irq == -ENOENT) + irq = acpi_dev_gpio_irq_get(ACPI_COMPANION(dev), 0); } if (irq == -EPROBE_DEFER) return irq; -- 2.11.0