From patchwork Thu Dec 16 13:13:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akhil R X-Patchwork-Id: 524788 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3C39C433FE for ; Thu, 16 Dec 2021 13:14:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237357AbhLPNOe (ORCPT ); Thu, 16 Dec 2021 08:14:34 -0500 Received: from mail-mw2nam12on2053.outbound.protection.outlook.com ([40.107.244.53]:16545 "EHLO NAM12-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S237354AbhLPNOd (ORCPT ); Thu, 16 Dec 2021 08:14:33 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y5GoIGsvKSuVCpADHUIZy5oKywtAfeYU/cDtdkGfCutQgXFRr91xILttXwJ2Dar7E2ySZ5sJ6+75j3cpRK3mT5ZUHnL+47x9v27v6A4IkiAzZ7Ycxle2rh6P8g/BEN2pj1mvCdxDn39Ga9JM//5Rpmlxq1ONec5eMqQtJpCYRXNrRd04LUtL9FXlFg1K82ilc76T2GRMYjPgUtFr5yInzaYgIU2lEVVVmjlDq4pw7gsTnUDUEwfB6FhnRgBaaR3nQiNfS3RrSLjMjxXf/DX95+Ol1vji0g4+teDFK1fbEW8QYIl8NI5gUM/VFp4+3+QpPh+FN4Diw+t+DKqVJjeo5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mWE0tW8jo35j2HBYSx4glzTxE/OmkUGhDXjuxovpbN8=; b=ORP3jqTYqhf6QkG1MChOug6iWRZ64CYcgapvETV5yB5rs/MuPkF5eue3e2eoCeIQTaHpY6PJyGlu4bjsnxDaGrJD7/0Mc76L3HNvct254H6qePgK1LYkYiv75hQG7CaTBJ60v6LSIO9AeZUicljQX57sGz394N6NiBTY6UQ6VfzTQ/ttLnR+z0KxdYRCYYo59hkwpW/eNdOQmbhOE5UeHw6md5uQLuYKGwBsoHZ1mPxVyzBamrZuI2ehf8DdGVVCcylsgFsJhfOBnCPr0KqdgN1cUE5oy75sfGkVSLolq2e8v0q30FXKV6Tz1iDHCmgLUZ984n2sihJZ8Tx0mC0h0A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.234) smtp.rcpttodomain=linuxfoundation.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mWE0tW8jo35j2HBYSx4glzTxE/OmkUGhDXjuxovpbN8=; b=WSVmWiKOg1Ks6KR8ATrkRjj+Ah8E5nAylYvcJQcy25i0Erl8lIUSypG4L2zDOFb7e/qZkXoy7cGvDuQfIPSFeQ/AxN7sj4vgQ8gw24UKiE3XwqDWBYsMUQmR741OqOwdPmT852pkVe7tIyl37PPokgFgVBvkeQq0yl+ifFTKVIH95HNbxBfXLx7AmBM6Akq5oWisaSpcKPDBP1YF2+2jzMivqXs+LBEzkCgWDStA6tOv3TWzQO1LUePSusnieC5hIGon+ZybhD4xIVb8/bzzymElZrNZ0rJHEPs8VctHj4b9ccRuaS42z+bBJJO4FZnJP1aH3Nj4J1mwNaux+5aV5Q== Received: from BN0PR03CA0011.namprd03.prod.outlook.com (2603:10b6:408:e6::16) by DM5PR12MB1228.namprd12.prod.outlook.com (2603:10b6:3:74::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Thu, 16 Dec 2021 13:14:32 +0000 Received: from BN8NAM11FT022.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e6:cafe::2f) by BN0PR03CA0011.outlook.office365.com (2603:10b6:408:e6::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14 via Frontend Transport; Thu, 16 Dec 2021 13:14:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.234) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.234 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.234; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.234) by BN8NAM11FT022.mail.protection.outlook.com (10.13.176.112) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4801.14 via Frontend Transport; Thu, 16 Dec 2021 13:14:31 +0000 Received: from HQMAIL101.nvidia.com (172.20.187.10) by DRHQMAIL101.nvidia.com (10.27.9.10) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 16 Dec 2021 13:14:30 +0000 Received: from HQMAIL107.nvidia.com (172.20.187.13) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 16 Dec 2021 13:14:28 +0000 Received: from kyarlagadda-linux.nvidia.com (172.20.187.5) by mail.nvidia.com (172.20.187.13) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 16 Dec 2021 13:14:24 +0000 From: Akhil R To: , , , , , , , , , , , , CC: Akhil R Subject: [PATCH 1/2] device property: Add device_irq_get_byname Date: Thu, 16 Dec 2021 18:43:21 +0530 Message-ID: <1639660402-31207-2-git-send-email-akhilrajeev@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1639660402-31207-1-git-send-email-akhilrajeev@nvidia.com> References: <1639660402-31207-1-git-send-email-akhilrajeev@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ccd6d01e-8bc2-43d8-e51d-08d9c095ff6c X-MS-TrafficTypeDiagnostic: DM5PR12MB1228:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YNCdlq1KZ4OA1PZdw1U4PNeDXD11PUwt2inuCbhRM5LN9HGfMmEbVcjDG3lm2aAjXKmPqyz+ZtOIEh+PPU3wXrDK9iqjc7yd6sN2DskUDxXd00/MQie4O1xJyVFKFj0YzUVb3WEJ8HY2/HJp2yl2ug3MpY/0fSsP+RAsM3JzxjlLZG1rNjOZfy6fhSkNWxo42bqtWDda3z45tN15GtpIv/IrZr7MVbpoPfB6LN1OvcIYFXpdQ9u73NgZKDiHGfajfBUG9v0C2xAHQeUh0bZT3Q27exMHc0a4FmCl5OvPFS5EOo5bBzJGRXy5JQbYFOJP4/nzQB2exkfB2atzKtQbFdjj/WKhi8zD4T1or5d1ky90zG7PgteUFnVEMQW58si1TkwKkYAPWbg7K4x2nxc1N9BY6LebPZKzy89mbQlfthKExUDeMwN3i4eJ3rbWvKBprzThXNWBPPT0Ok7k5IqTlRQBrYAML6TeXzqINA1Jaze+FVTnmTL2DtssVNKgZSQ5z8IEfqx3rjTn2StPPYlHxNkq9ovUL++RwrZMk++swJ5bJrUE3D9Q7KnPAgeoLSi7T4HIMq4B3/fhBBktg5if6VusfMdic2yM2jDRbzz/ImLpmnRKLzSsVs7OFf9+vlUGQSUmXL/6YdUzXOji20sLvcj8ZYzy+VqZsqoAnb7tJqniDqWVtCvDoXMPo6wWwjqBsc4pCiGTa85VzpXLL/t8S82Dm8PvtfFWj0zgdRQb4cy54iiNELyAfH2tFHqDH2iiwHmo4PTPagIlnPgkAFCkIGkOdH9o7I2TqA6bfmbNHmLqkZMtW+C3BHFqJLagJWb/LEKmcYMmXRxAYXqt1dap/40Ogif7e22hjuOfW0seOE8= X-Forefront-Antispam-Report: CIP:12.22.5.234; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(40470700001)(336012)(82310400004)(36860700001)(81166007)(4326008)(47076005)(6666004)(40460700001)(70206006)(70586007)(86362001)(921005)(7696005)(7416002)(110136005)(316002)(34020700004)(107886003)(26005)(2616005)(508600001)(2906002)(5660300002)(8936002)(426003)(8676002)(186003)(356005)(36756003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Dec 2021 13:14:31.5925 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ccd6d01e-8bc2-43d8-e51d-08d9c095ff6c X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.234]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT022.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1228 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Get interrupt by name from ACPI table as well. Add option to use 'interrupt-names' in _DSD which can map to interrupt by index. The implementation is similar to 'interrupt-names' in devicetree. Also add a common routine to get irq by name from devicetree and ACPI table. Signed-off-by: Akhil R --- drivers/base/property.c | 35 +++++++++++++++++++++++++++++++++++ include/linux/property.h | 3 +++ 2 files changed, 38 insertions(+) diff --git a/drivers/base/property.c b/drivers/base/property.c index cbe4fa2..7acf4fc 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -920,6 +920,41 @@ int fwnode_irq_get(const struct fwnode_handle *fwnode, unsigned int index) EXPORT_SYMBOL(fwnode_irq_get); /** + * fwnode_irq_get_byname - Get IRQ from a fwnode using its name + * @fwnode: Pointer to the firmware node + * @index: IRQ name + * + * Returns Linux IRQ number on success, errno otherwise. + */ +int fwnode_irq_get_byname(const struct fwnode_handle *fwnode, const char *name) +{ + int index; + + if (unlikely(!name)) + return -EINVAL; + + index = fwnode_property_match_string(fwnode, "interrupt-names", name); + if (index < 0) + return index; + + return fwnode_irq_get(fwnode, index); +} +EXPORT_SYMBOL(fwnode_irq_get_byname); + +/** + * device_irq_get_byname - Get IRQ of a device using interrupt name + * @dev: Device to get the interrupt + * @index: IRQ name + * + * Returns Linux IRQ number on success, errno otherwise. + */ +int device_irq_get_byname(struct device *dev, const char *name) +{ + return fwnode_irq_get_byname(dev_fwnode(dev), name); +} +EXPORT_SYMBOL_GPL(device_irq_get_byname); + +/** * fwnode_graph_get_next_endpoint - Get next endpoint firmware node * @fwnode: Pointer to the parent firmware node * @prev: Previous endpoint node or %NULL to get the first diff --git a/include/linux/property.h b/include/linux/property.h index 16f736c..bc49350 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -121,6 +121,9 @@ struct fwnode_handle *fwnode_handle_get(struct fwnode_handle *fwnode); void fwnode_handle_put(struct fwnode_handle *fwnode); int fwnode_irq_get(const struct fwnode_handle *fwnode, unsigned int index); +int fwnode_irq_get_byname(const struct fwnode_handle *fwnode, const char *name); + +int device_irq_get_byname(struct device *dev, const char *name); unsigned int device_get_child_node_count(struct device *dev); From patchwork Thu Dec 16 13:13:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akhil R X-Patchwork-Id: 525630 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB521C433FE for ; Thu, 16 Dec 2021 13:14:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237365AbhLPNOr (ORCPT ); Thu, 16 Dec 2021 08:14:47 -0500 Received: from mail-co1nam11on2071.outbound.protection.outlook.com ([40.107.220.71]:36390 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S237350AbhLPNOq (ORCPT ); Thu, 16 Dec 2021 08:14:46 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oAmv8TDTxgAJQ3kl9IWT8fQEWKIkkdUtsKFBXdmbmLgD7F87IyLZjtBy+5QBRyqRNTOaFvyizA2blzuFiiPtmASSOWjVJVIiqis7JPfvXFoydwprLhcXKzT/zz7pjzKP3c2VmrK4zxLz/PeXjdoNIe1ZVU/l64Ui2LvbzsDqfYKV9cBkj1K9V0HYLMP1jFJkywMq/aCFi7cAeCwjHmcs/T9VlvacqcXRa43zAH3kkhqKOMFcWTzPXeVC2OGPHTior/yTda77R8NPHkKBYHTKW7rGi52SBY+TEOjPqQ486tmJY3x7pWL4iRWMZ/5UaMiWzVHX+D/hgxyRHVRoY2Tp8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5+TmBSQuBqsuAJqzXfGABA0B+aPrMwjDPBkKxTtX/hY=; b=TWr3xlsdHWE4p3PmRNs1pyB1pYScdOO6sXnG4J3a/mplHqKsuZu+R/NJ1bZQW10aMM2aBCq5iyHVwCxVd5DY4dGIrjyVAVD09uG3y0ZE8fvdJelY55WAuJJmTnIrkaeGaW+31lT7jEhS6eTAY6IuekIsMvNpCcEMbLq2eRQTILp8dNVU4Ouy43rLyqCV2qLsDfN42cMSxBswV1W5TXHFk4UdlGVWImOmHoD0UezQA1Usve9VGVr+1VYzebobf4tHx4p3cHenL8xB1bZVjaWbcwX61VrNPbStzb0Szrmy1VfoIflsAJKZJVRTq8BCCvoBKO9+IIgMU57i22jzkQ0mZQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) smtp.rcpttodomain=linuxfoundation.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5+TmBSQuBqsuAJqzXfGABA0B+aPrMwjDPBkKxTtX/hY=; b=sEm40swkP0gRGJIjJuDRkqEdXzszabvo4OiWu6mOSLTclhXjPX9B6wv9d83shxINszlUfSrj4BDE8Zn8rlPpX0Sdrlx+nsZWPipLTNqn78gM/NKgCPrTR+A7OyEhZtPnWXYF+h7axNPqnNhgeJRFM4zqoijjd2YGNK0HCELaRW3eqlAjJPO5sEKu09JH9CvKWOs/STFA1EUr6jP4PgVr1REDn2a4elYCKKNeRfqpCEYupyyPEvGEDb+036a55PWaehjXw3d4CLues0a6w57qwAsoEwV9q5BK3/Hy8j+3t5p8N/kmuZOEiHyQFtjSGq2FAKxQi5saoYK2VzGSiN6Pqg== Received: from DS7PR05CA0046.namprd05.prod.outlook.com (2603:10b6:8:2f::14) by BN8PR12MB3586.namprd12.prod.outlook.com (2603:10b6:408:47::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Thu, 16 Dec 2021 13:14:43 +0000 Received: from DM6NAM11FT068.eop-nam11.prod.protection.outlook.com (2603:10b6:8:2f:cafe::40) by DS7PR05CA0046.outlook.office365.com (2603:10b6:8:2f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4823.8 via Frontend Transport; Thu, 16 Dec 2021 13:14:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.235) by DM6NAM11FT068.mail.protection.outlook.com (10.13.173.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4801.14 via Frontend Transport; Thu, 16 Dec 2021 13:14:43 +0000 Received: from HQMAIL105.nvidia.com (172.20.187.12) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 16 Dec 2021 13:14:41 +0000 Received: from HQMAIL107.nvidia.com (172.20.187.13) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 16 Dec 2021 13:14:41 +0000 Received: from kyarlagadda-linux.nvidia.com (172.20.187.5) by mail.nvidia.com (172.20.187.13) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 16 Dec 2021 13:14:37 +0000 From: Akhil R To: , , , , , , , , , , , , CC: Akhil R Subject: [PATCH 2/2] i2c: smbus: Use device_ functions instead of of_ Date: Thu, 16 Dec 2021 18:43:22 +0530 Message-ID: <1639660402-31207-3-git-send-email-akhilrajeev@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1639660402-31207-1-git-send-email-akhilrajeev@nvidia.com> References: <1639660402-31207-1-git-send-email-akhilrajeev@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a79bea25-8ed5-4510-15e1-08d9c0960649 X-MS-TrafficTypeDiagnostic: BN8PR12MB3586:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wmbrwwa1egUFfaGOpuhphMG2v7sPjeGw5NMRGgXKz9XsuZUZQnRisw2qjqIyuMYnwLO/CHxwEMuB6QCdOBw5d3MCUXRG2Q1aAllLhN7lE/eFntW7YzSlKP3qPB9ZMhmUUjL5gT5b33gTVJUaEzHkYHszCHWYUSl8qOFyXYJOF2hAhNTfrcvMyyZ76TjYcqKbgY8Eoz1IDufLLlpXmXfcYh70Z7TxWC0DG33VWmP7BpwsTr5CsIlPaqXFy3IAaBjtnra5i4wgLolaKH1y2uK7rPR8rwsWexcm36wlHvdPNpZngLowm+HSOOfULErPXIgnwToQRsCvYfsZqcfLWzhtlqi9GYzHQSOdDTA9rNlG1DwuaVBP6TjsSr2knjTh3kuPrMjg9k8eG3ab5D48UhwJrEfbK2aeQsTLH76Gg01T7Pbyj9F9SJBLyl8QIgw1yFuZKuZzKU/ejB1+zYLHyrIw0JKwUCY4kEm8DNkPeWzUhCn3bfbQVYD8//jtT+iY/Mswn4iF9zCcsYTaQ0P5ptFF2i+m5/Bmxi4MXcWjjDrOmr7Se6uqfJ+6b7edJwRUMhE0xLGNvQt6q3IuMtZnTewnCotJxIBNy5Jdkou4HMhtI7VKvsd1M6fSP2mrtROMHvWEqIQftMqxiSFxteectWWcqevQspOpe7EXGTQ8agE4b3ws4RhLyV5AHCmG7eMyQWDBna9XiyrkGbrSshM5EgjqUI2jOwakQ0WRCktzZ2BKOvCQVcqYjtvKlQqDZdcq3dHr6/jO2NpqFvkU6yUwn4yya0+ixIdlH0SOKPVpBEIo5xI9wUTsuEwqLQXAh8OSvTv0t85xa/5iTuw+BU4GtE/LPDTy3+IEQ9PIuCxSskM3Ngg= X-Forefront-Antispam-Report: CIP:12.22.5.235; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(40470700001)(186003)(34020700004)(8936002)(336012)(6666004)(82310400004)(426003)(26005)(40460700001)(86362001)(36756003)(81166007)(70586007)(7696005)(316002)(5660300002)(2906002)(4326008)(8676002)(7416002)(83380400001)(70206006)(508600001)(47076005)(107886003)(921005)(36860700001)(356005)(110136005)(2616005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Dec 2021 13:14:43.1466 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a79bea25-8ed5-4510-15e1-08d9c0960649 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.235]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT068.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB3586 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Change of_ functions to device_ for firmware agnostic usage. This allows to have smbus_alert interrupt without any changes in the controller drivers using ACPI table. Signed-off-by: Akhil R --- drivers/i2c/i2c-core-base.c | 2 +- drivers/i2c/i2c-core-smbus.c | 10 +++++----- drivers/i2c/i2c-smbus.c | 2 +- include/linux/i2c-smbus.h | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c index 1072a47..8e6c7a1 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c @@ -1574,7 +1574,7 @@ static int i2c_register_adapter(struct i2c_adapter *adap) goto out_list; } - res = of_i2c_setup_smbus_alert(adap); + res = i2c_setup_smbus_alert(adap); if (res) goto out_reg; diff --git a/drivers/i2c/i2c-core-smbus.c b/drivers/i2c/i2c-core-smbus.c index e5b2d14..4c24c84 100644 --- a/drivers/i2c/i2c-core-smbus.c +++ b/drivers/i2c/i2c-core-smbus.c @@ -701,13 +701,13 @@ struct i2c_client *i2c_new_smbus_alert_device(struct i2c_adapter *adapter, } EXPORT_SYMBOL_GPL(i2c_new_smbus_alert_device); -#if IS_ENABLED(CONFIG_I2C_SMBUS) && IS_ENABLED(CONFIG_OF) -int of_i2c_setup_smbus_alert(struct i2c_adapter *adapter) +#if IS_ENABLED(CONFIG_I2C_SMBUS) +int i2c_setup_smbus_alert(struct i2c_adapter *adapter) { int irq; - irq = of_property_match_string(adapter->dev.of_node, "interrupt-names", - "smbus_alert"); + irq = device_property_match_string(adapter->dev.parent, "interrupt-names", + "smbus_alert"); if (irq == -EINVAL || irq == -ENODATA) return 0; else if (irq < 0) @@ -715,5 +715,5 @@ int of_i2c_setup_smbus_alert(struct i2c_adapter *adapter) return PTR_ERR_OR_ZERO(i2c_new_smbus_alert_device(adapter, NULL)); } -EXPORT_SYMBOL_GPL(of_i2c_setup_smbus_alert); +EXPORT_SYMBOL_GPL(i2c_setup_smbus_alert); #endif diff --git a/drivers/i2c/i2c-smbus.c b/drivers/i2c/i2c-smbus.c index d3d06e3..fdd6d97 100644 --- a/drivers/i2c/i2c-smbus.c +++ b/drivers/i2c/i2c-smbus.c @@ -128,7 +128,7 @@ static int smbalert_probe(struct i2c_client *ara, if (setup) { irq = setup->irq; } else { - irq = of_irq_get_byname(adapter->dev.of_node, "smbus_alert"); + irq = device_irq_get_byname(adapter->dev.parent, "smbus_alert"); if (irq <= 0) return irq; } diff --git a/include/linux/i2c-smbus.h b/include/linux/i2c-smbus.h index 1ef4218..95cf902 100644 --- a/include/linux/i2c-smbus.h +++ b/include/linux/i2c-smbus.h @@ -30,10 +30,10 @@ struct i2c_client *i2c_new_smbus_alert_device(struct i2c_adapter *adapter, struct i2c_smbus_alert_setup *setup); int i2c_handle_smbus_alert(struct i2c_client *ara); -#if IS_ENABLED(CONFIG_I2C_SMBUS) && IS_ENABLED(CONFIG_OF) -int of_i2c_setup_smbus_alert(struct i2c_adapter *adap); +#if IS_ENABLED(CONFIG_I2C_SMBUS) +int i2c_setup_smbus_alert(struct i2c_adapter *adap); #else -static inline int of_i2c_setup_smbus_alert(struct i2c_adapter *adap) +static inline int i2c_setup_smbus_alert(struct i2c_adapter *adap) { return 0; }