Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp1063858ybm; Tue, 21 May 2019 08:07:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqxUzjBUbkF1niuX0BXG/W2ykCkV/+s3GoDTsjxuYrM6afJXZJxuqrBB6OzCiwL9I6NkRaNl X-Received: by 2002:aa7:9ab0:: with SMTP id x16mr80054054pfi.201.1558451248614; Tue, 21 May 2019 08:07:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558451248; cv=none; d=google.com; s=arc-20160816; b=f4G8bi2GZm/qtzz9nuGYU1+IQwFQUMmcOKkIP7f6dAlZ0mlBQxUHQmrrKDh67i+/SB tmfNb/3INmoFKFl2zG6L6wiiDJ6dryXP4hNseVyza8qKy/yJIfYUm68yRTHksudCKqCO +SnYoTpj3bEulBwuNykugMe/F36DK/sUOLeae77h6JLyR9Yw0gBOU9knO+I4zyrA4PH2 NC2iLotYFte14bMnQJSu36uJ6woIukFDIb32nZDy7lrsMBWHvs9t/bxX5P7exMmoHa9X 8x3nWa/j36LrJ5AmsRL6W2BGYWwE2Ng6UDbvi2j/Py0mDoEMZI06uJ9B1AHANrESRW0v h8dA== 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=FUAfuXWUbgWlahr3F09KvQLwnvrnB2bRiK0SlR70mgE2qiV/R3Wv1OpHY3Jfo4qcMC dQtev7V+tmmWrB/mMF6klyP0ryQwQJTyUB5hQhvRjSQwwBvvj5ho2BECU+zRXDoTJdcz 5piNoqngaFghjUYjPvg9IKK5H54yLKmHgPA6p2stxerEYyqG5fCMS+C1IX+/x/cVA3h8 T7Ff5NF9Vsu76/NLVJTkIkKriYs6d2KE8i7yQ+qxgu4xSHXfhd4fdMwjcqxImVd9MKQx yFLYGUshSY15pxL/152eXB8Zd3SoHBhyAd2qX+8HmGaBh1pAtDm1akzsbq+AshiYl7Ef TcAw== 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 f1si22555373pln.23.2019.05.21.08.07.02; Tue, 21 May 2019 08:07:28 -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 S1728832AbfEUPFa (ORCPT + 99 others); Tue, 21 May 2019 11:05:30 -0400 Received: from mx0a-001ae601.pphosted.com ([67.231.149.25]:49076 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728144AbfEUPF3 (ORCPT ); Tue, 21 May 2019 11:05:29 -0400 Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x4LExpLg024405; Tue, 21 May 2019 10:05:04 -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 mx0a-001ae601.pphosted.com with ESMTP id 2sjff1v7wj-1; Tue, 21 May 2019 10:05:04 -0500 Received: from EDIEX01.ad.cirrus.com (unknown [198.61.84.80]) by mail1.cirrus.com (Postfix) with ESMTP id 98DF0611C8D2; Tue, 21 May 2019 10:05:03 -0500 (CDT) Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1591.10; Tue, 21 May 2019 16:05:02 +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, 21 May 2019 16:05:02 +0100 Received: from algalon.ad.cirrus.com (algalon.ad.cirrus.com [198.90.251.122]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id A81DD2DB; Tue, 21 May 2019 16:05:02 +0100 (BST) From: Charles Keepax To: , CC: , , , , , , , Subject: [PATCH 3/5] i2c: core: Move ACPI IRQ handling to probe time Date: Tue, 21 May 2019 16:05:00 +0100 Message-ID: <20190521150502.27305-4-ckeepax@opensource.cirrus.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190521150502.27305-1-ckeepax@opensource.cirrus.com> References: <20190521150502.27305-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=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905210094 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