Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp25258yba; Mon, 20 May 2019 04:20:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqwbgNsFPHdCnI2kASdYlONG46onr6mKUbIxrF7Yfy1CKjodkYQ2j7xYTmSbQvTgMRtUa5Sr X-Received: by 2002:a17:902:bc42:: with SMTP id t2mr23775488plz.55.1558351224641; Mon, 20 May 2019 04:20:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558351224; cv=none; d=google.com; s=arc-20160816; b=08y/JQDjANeJ+EeQBcnmTiiM6gZ8VXJcpWRxiJpADuQFm354EogVbxR3Sob0CA/Kmf y4e5vQ8mm2e5U0z9Q+D4Ok+fwCYoqh+jeQlFBI0Od8dyOTco0BHIIy4Fer2d+btt1qs+ AFFMSw0/ALaL7r0dgz6pPy6ISCkPfYSJyxD0nPdnBJ9zL9u4KdJ3+xb+agkRzWNVfjok paCXWMNvEGj9Z6hej2kq8TEdlpVQrFZETYVpGBvnKoRPHXFSp4GiIHf1Je445yfxCRKm dssng/AF4F50FQWQtbskYuK2uMZ/MtTBddigc0Z/fPb4nWW7ZFTgdLF7lP3AVAK12Y9d X7DA== 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=5vhNsCvlLYVB7YnjpT8ROOX2ldWY+PTUz2YBtQP94a0=; b=HB9UqG5rDt1mSP+8bgDshfU1HBCJpjtqBxLBdjuO6bXdMkNz/LyhSBVtnRsZqkE3iL a6jw6dU3GYqAO5iRPWWTa8BKXuoI+RT8HrNxdBDy6L8mbWL2/XPAe2zUMAUEJT9CW3d1 t4iEx1zhpskELzM/z0igsVXYUTI13KQQg18EAaBfsm3pqsqCmEduLcaEpbljEZ/3aped kkVkOeLPCC+5Ad0S1rVweGjX+U1mrpeOI3FKl5s3H0RYq7UeCjr/Hov4xDR0DGa5PiyI UgydmadwWJq4DErJUf5hqEMi2+yojq2HTSnPMquS9xn3hklvqI0Z9dMjcsD9+mvqslYa rCOw== 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 b186si3073433pfa.255.2019.05.20.04.20.07; Mon, 20 May 2019 04:20:24 -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 S1731493AbfETItv (ORCPT + 99 others); Mon, 20 May 2019 04:49:51 -0400 Received: from mx0b-001ae601.pphosted.com ([67.231.152.168]:44192 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731338AbfETItq (ORCPT ); Mon, 20 May 2019 04:49:46 -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 x4K8i3sk030392; Mon, 20 May 2019 03:49:38 -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 2sjefmt3en-1; Mon, 20 May 2019 03:49:38 -0500 Received: from EDIEX02.ad.cirrus.com (unknown [198.61.84.81]) by mail1.cirrus.com (Postfix) with ESMTP id E4AB4611C8B9; Mon, 20 May 2019 03:49:37 -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; Mon, 20 May 2019 09:49:36 +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; Mon, 20 May 2019 09:49:36 +0100 Received: from algalon.ad.cirrus.com (algalon.ad.cirrus.com [198.90.251.122]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 8BFFB2DD; Mon, 20 May 2019 09:49:36 +0100 (BST) From: Charles Keepax To: , CC: , , , , , Subject: [PATCH 3/5] i2c: core: Move ACPI IRQ handling to probe time Date: Mon, 20 May 2019 09:49:34 +0100 Message-ID: <20190520084936.10590-4-ckeepax@opensource.cirrus.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190520084936.10590-1-ckeepax@opensource.cirrus.com> References: <20190520084936.10590-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=985 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905200064 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. Signed-off-by: Charles Keepax --- drivers/i2c/i2c-core-acpi.c | 6 ++---- drivers/i2c/i2c-core-base.c | 6 +++++- drivers/i2c/i2c-core.h | 7 +++++++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c index 764cd10420a74..e332760bf9ebc 100644 --- a/drivers/i2c/i2c-core-acpi.c +++ b/drivers/i2c/i2c-core-acpi.c @@ -148,8 +148,9 @@ static int i2c_acpi_add_resource(struct acpi_resource *ares, void *data) return 1; /* No need to add resource to the list */ } -static int i2c_acpi_get_irq(struct acpi_device *adev, int *irq) +int i2c_acpi_get_irq(struct i2c_client *client, int *irq) { + struct acpi_device *adev = ACPI_COMPANION(&client->adapter->dev); struct list_head resource_list; int ret; @@ -201,9 +202,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 */ - i2c_acpi_get_irq(adev, &info->irq); - 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 84bf11b25a120..c1afa17a76bfc 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c @@ -335,7 +335,11 @@ 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); + i2c_acpi_get_irq(client, &irq); + + if (irq == -ENOENT) + irq = acpi_dev_gpio_irq_get(ACPI_COMPANION(dev), + 0); } if (irq == -EPROBE_DEFER) return irq; diff --git a/drivers/i2c/i2c-core.h b/drivers/i2c/i2c-core.h index 8f3a08dc73a25..6bec145ab7d74 100644 --- a/drivers/i2c/i2c-core.h +++ b/drivers/i2c/i2c-core.h @@ -72,6 +72,8 @@ const struct acpi_device_id * i2c_acpi_match_device(const struct acpi_device_id *matches, struct i2c_client *client); void i2c_acpi_register_devices(struct i2c_adapter *adap); + +int i2c_acpi_get_irq(struct i2c_client *client, int *irq); #else /* CONFIG_ACPI */ static inline void i2c_acpi_register_devices(struct i2c_adapter *adap) { } static inline const struct acpi_device_id * @@ -80,6 +82,11 @@ i2c_acpi_match_device(const struct acpi_device_id *matches, { return NULL; } + +static inline int i2c_acpi_get_irq(struct i2c_client *client, int *irq) +{ + return 0; +} #endif /* CONFIG_ACPI */ extern struct notifier_block i2c_acpi_notifier; -- 2.11.0