From patchwork Mon Dec 19 09:50:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King \(Oracle\)" X-Patchwork-Id: 635503 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 5093AC10F1B for ; Mon, 19 Dec 2022 09:50:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231261AbiLSJuf (ORCPT ); Mon, 19 Dec 2022 04:50:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231292AbiLSJua (ORCPT ); Mon, 19 Dec 2022 04:50:30 -0500 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC2ECDE93; Mon, 19 Dec 2022 01:50:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:Content-Type:MIME-Version: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Qe7yKR1ChZDZ9TsUe6VNFqq5kfeSxg/qVme0hW2SCSU=; b=Bcn8bHUumGkTbQxMhqxU0EmM+b 6HvD1SaePnHHCpWpEBEVkEbwEqVSR/0bOxJnAqhUchbOqVQr55Bqu8P48qT5dsyUEghtyx/abkUOh /4x7u077RCVfwha58wRcO2NEZg8mKWHdTVIJPcjUAqIgIEmeVdZ3ksVN7gA4YIUAIEnb4w6f2Bgqb Iv4aPjKDcNJvIHbPw5fsOXHVZLPeE2AvCdlgSM1T2C0wClniDt/Ncfh3202Bi/CcFSKEokSrcANrx MPvJ1s8G4e77oPtGmAJFmlOTBgEsoLtec6rU1iHmWqyhuorYama15jf1RxjdGeynBtaKwcf5s5ETk BonW9Jvw==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:35778) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1p7Cms-00005u-79; Mon, 19 Dec 2022 09:50:23 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1p7Cmp-0004Wu-Pw; Mon, 19 Dec 2022 09:50:19 +0000 Date: Mon, 19 Dec 2022 09:50:19 +0000 From: "Russell King (Oracle)" To: linux-acpi@vger.kernel.org, linux-i2c@vger.kernel.org, netdev@vger.kernel.org Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Heiner Kallweit , Jakub Kicinski , Mika Westerberg , Paolo Abeni , Wolfram Sang Subject: [PATCH RFC v2 0/2] Add I2C fwnode lookup/get interfaces Message-ID: MIME-Version: 1.0 Content-Disposition: inline Sender: Russell King (Oracle) Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Hi, This RFC series is intended for the next merge window, but we will need to decide how to merge it as it is split across two subsystems. These patches have been generated against the net-next, since patch 2 depends on a recently merged patch in that tree (which is now in mainline.) Currently, the SFP code attempts to work out what kind of fwnode we found when looking up the I2C bus for the SFP cage, converts the fwnode to the appropriate firmware specific representation to then call the appropriate I2C layer function. This is inefficient, since the device model provides a way to locate items on a bus_type by fwnode. In order to reduce this complexity, this series adds fwnode interfaces to the I2C subsystem to allow I2C adapters to be looked up. I also accidentally also converted the I2C clients to also be looked up, so I've left that in patch 1 if people think that could be useful - if not, I'll remove it. We could also convert the of_* functions to be inline in i2c.h and remove the stub of_* functions and exports. Do we want these to live in i2c-core-fwnode.c ? I don't see a Kconfig symbol that indicates whether we want fwnode support, and I know there are people looking to use software nodes to lookup the SFP I2C bus (which is why the manual firmware-specific code in sfp.c is a problem.) Thanks! v2: updated patch 1 with docbook comments. drivers/i2c/i2c-core-acpi.c | 13 +----- drivers/i2c/i2c-core-base.c | 98 +++++++++++++++++++++++++++++++++++++++++++++ drivers/i2c/i2c-core-of.c | 51 ++--------------------- drivers/net/phy/sfp.c | 13 +----- include/linux/i2c.h | 9 +++++ 5 files changed, 112 insertions(+), 72 deletions(-)