From patchwork Mon Mar 29 10:50:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heikki Krogerus X-Patchwork-Id: 412045 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 470C3C433DB for ; Mon, 29 Mar 2021 10:51:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0A26A61935 for ; Mon, 29 Mar 2021 10:51:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231902AbhC2Kul (ORCPT ); Mon, 29 Mar 2021 06:50:41 -0400 Received: from mga02.intel.com ([134.134.136.20]:49544 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231553AbhC2Kug (ORCPT ); Mon, 29 Mar 2021 06:50:36 -0400 IronPort-SDR: MmiJT3BxOc1FnFhBgda4WDWT6zmP9qO2TzwGB27Xdz2dQp+qwsug90cruRN+T3y2atDoacqIZ3 6hLOtkmgovlA== X-IronPort-AV: E=McAfee;i="6000,8403,9937"; a="178653628" X-IronPort-AV: E=Sophos;i="5.81,287,1610438400"; d="scan'208";a="178653628" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2021 03:50:36 -0700 IronPort-SDR: WTUskLKr5mroP36TQPg5bLgNfnLimfvrWkqWVOvx1sMG3jFjlrW8R/Cp7xA8qBPTnjan+J6Zmc qzSfBftBBMfQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,287,1610438400"; d="scan'208";a="515955825" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 29 Mar 2021 03:50:34 -0700 From: Heikki Krogerus To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 01/12] i2c: Add support for software nodes Date: Mon, 29 Mar 2021 13:50:36 +0300 Message-Id: <20210329105047.51033-2-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210329105047.51033-1-heikki.krogerus@linux.intel.com> References: <20210329105047.51033-1-heikki.krogerus@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org This makes it possible for the drivers to assign complete software fwnodes to the devices instead of only the device properties in those nodes. Signed-off-by: Heikki Krogerus --- drivers/i2c/i2c-core-base.c | 15 ++++++++++++++- include/linux/i2c.h | 4 +++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c index f21362355973e..a6a68081f54e1 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c @@ -920,15 +920,27 @@ i2c_new_client_device(struct i2c_adapter *adap, struct i2c_board_info const *inf } } + if (info->swnode) { + status = device_add_software_node(&client->dev, info->swnode); + if (status) { + dev_err(&adap->dev, + "Failed to add software node to client %s: %d\n", + client->name, status); + goto out_free_props; + } + } + status = device_register(&client->dev); if (status) - goto out_free_props; + goto out_remove_swnode; dev_dbg(&adap->dev, "client [%s] registered with bus id %s\n", client->name, dev_name(&client->dev)); return client; +out_remove_swnode: + device_remove_software_node(&client->dev); out_free_props: if (info->properties) device_remove_properties(&client->dev); @@ -961,6 +973,7 @@ void i2c_unregister_device(struct i2c_client *client) if (ACPI_COMPANION(&client->dev)) acpi_device_clear_enumerated(ACPI_COMPANION(&client->dev)); + device_remove_software_node(&client->dev); device_unregister(&client->dev); } EXPORT_SYMBOL_GPL(i2c_unregister_device); diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 56622658b2158..cb1f882a3e88e 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -391,7 +391,8 @@ static inline bool i2c_detect_slave_mode(struct device *dev) { return false; } * @platform_data: stored in i2c_client.dev.platform_data * @of_node: pointer to OpenFirmware device node * @fwnode: device node supplied by the platform firmware - * @properties: additional device properties for the device + * @properties: Deprecated - use swnode instead + * @swnode: software node for the device * @resources: resources associated with the device * @num_resources: number of resources in the @resources array * @irq: stored in i2c_client.irq @@ -416,6 +417,7 @@ struct i2c_board_info { struct device_node *of_node; struct fwnode_handle *fwnode; const struct property_entry *properties; + const struct software_node *swnode; const struct resource *resources; unsigned int num_resources; int irq; From patchwork Mon Mar 29 10:50:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heikki Krogerus X-Patchwork-Id: 411046 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE3BFC433C1 for ; Mon, 29 Mar 2021 10:51:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8F87161936 for ; Mon, 29 Mar 2021 10:51:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231806AbhC2KvO (ORCPT ); Mon, 29 Mar 2021 06:51:14 -0400 Received: from mga02.intel.com ([134.134.136.20]:49552 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231493AbhC2Kux (ORCPT ); Mon, 29 Mar 2021 06:50:53 -0400 IronPort-SDR: qbuD+4hGdLs5iZNt34LhHPSFw+1NYqOFnJaKvEYAv9NEN+KHCLVq98SKHnSZqo05kgvWXWezBw MQapzND6bHgg== X-IronPort-AV: E=McAfee;i="6000,8403,9937"; a="178653637" X-IronPort-AV: E=Sophos;i="5.81,287,1610438400"; d="scan'208";a="178653637" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2021 03:50:38 -0700 IronPort-SDR: vX1a2AQ5RnfXE6Zt00uYEGsu2SUx1wC+iirbEZ3+0pwRzK6yt8Bc99g4YPUYYM4Z/9oXEaEv6K oOcbElDOj9Sg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,287,1610438400"; d="scan'208";a="515955830" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 29 Mar 2021 03:50:36 -0700 From: Heikki Krogerus To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Sekhar Nori , Bartosz Golaszewski Subject: [PATCH 02/12] ARM: davinci: Constify the software nodes Date: Mon, 29 Mar 2021 13:50:37 +0300 Message-Id: <20210329105047.51033-3-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210329105047.51033-1-heikki.krogerus@linux.intel.com> References: <20210329105047.51033-1-heikki.krogerus@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Additional device properties are always just a part of a software fwnode. If the device properties are constant, the software node can also be constant. Signed-off-by: Heikki Krogerus Cc: Sekhar Nori Cc: Bartosz Golaszewski Acked-by: Bartosz Golaszewski --- arch/arm/mach-davinci/board-da830-evm.c | 6 +++++- arch/arm/mach-davinci/board-dm365-evm.c | 6 +++++- arch/arm/mach-davinci/board-dm644x-evm.c | 6 +++++- arch/arm/mach-davinci/board-dm646x-evm.c | 6 +++++- arch/arm/mach-davinci/board-mityomapl138.c | 6 +++++- arch/arm/mach-davinci/board-sffsdr.c | 6 +++++- 6 files changed, 30 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c index a20ba12d876c6..823c9cc98f18b 100644 --- a/arch/arm/mach-davinci/board-da830-evm.c +++ b/arch/arm/mach-davinci/board-da830-evm.c @@ -454,6 +454,10 @@ static const struct property_entry da830_evm_i2c_eeprom_properties[] = { { } }; +static const struct software_node da830_evm_i2c_eeprom_node = { + .properties = da830_evm_i2c_eeprom_properties, +}; + static int __init da830_evm_ui_expander_setup(struct i2c_client *client, int gpio, unsigned ngpio, void *context) { @@ -485,7 +489,7 @@ static struct pcf857x_platform_data __initdata da830_evm_ui_expander_info = { static struct i2c_board_info __initdata da830_evm_i2c_devices[] = { { I2C_BOARD_INFO("24c256", 0x50), - .properties = da830_evm_i2c_eeprom_properties, + .swnode = &da830_evm_i2c_eeprom_node, }, { I2C_BOARD_INFO("tlv320aic3x", 0x18), diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c index bdf31eb776204..b3bef74c982a3 100644 --- a/arch/arm/mach-davinci/board-dm365-evm.c +++ b/arch/arm/mach-davinci/board-dm365-evm.c @@ -232,10 +232,14 @@ static const struct property_entry eeprom_properties[] = { { } }; +static const struct software_node eeprom_node = { + .properties = eeprom_properties, +}; + static struct i2c_board_info i2c_info[] = { { I2C_BOARD_INFO("24c256", 0x50), - .properties = eeprom_properties, + .swnode = &eeprom_node, }, { I2C_BOARD_INFO("tlv320aic3x", 0x18), diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c index 7755cccec550c..cce3a621eb20b 100644 --- a/arch/arm/mach-davinci/board-dm644x-evm.c +++ b/arch/arm/mach-davinci/board-dm644x-evm.c @@ -541,6 +541,10 @@ static const struct property_entry eeprom_properties[] = { { } }; +static const struct software_node eeprom_node = { + .properties = eeprom_properties, +}; + /* * MSP430 supports RTC, card detection, input from IR remote, and * a bit more. It triggers interrupts on GPIO(7) from pressing @@ -647,7 +651,7 @@ static struct i2c_board_info __initdata i2c_info[] = { }, { I2C_BOARD_INFO("24c256", 0x50), - .properties = eeprom_properties, + .swnode = &eeprom_node, }, { I2C_BOARD_INFO("tlv320aic33", 0x1b), diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c index 952ddabc743e0..ee91d81ebbfdf 100644 --- a/arch/arm/mach-davinci/board-dm646x-evm.c +++ b/arch/arm/mach-davinci/board-dm646x-evm.c @@ -362,6 +362,10 @@ static const struct property_entry eeprom_properties[] = { PROPERTY_ENTRY_U32("pagesize", 64), { } }; + +static const struct software_node eeprom_node = { + .properties = eeprom_properties, +}; #endif static u8 dm646x_iis_serializer_direction[] = { @@ -430,7 +434,7 @@ static void evm_init_cpld(void) static struct i2c_board_info __initdata i2c_info[] = { { I2C_BOARD_INFO("24c256", 0x50), - .properties = eeprom_properties, + .swnode = &eeprom_node, }, { I2C_BOARD_INFO("pcf8574a", 0x38), diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c index 5205008c8061b..2127969beb965 100644 --- a/arch/arm/mach-davinci/board-mityomapl138.c +++ b/arch/arm/mach-davinci/board-mityomapl138.c @@ -197,6 +197,10 @@ static const struct property_entry mityomapl138_fd_chip_properties[] = { { } }; +static const struct software_node mityomapl138_fd_chip_node = { + .properties = mityomapl138_fd_chip_properties, +}; + static struct davinci_i2c_platform_data mityomap_i2c_0_pdata = { .bus_freq = 100, /* kHz */ .bus_delay = 0, /* usec */ @@ -323,7 +327,7 @@ static struct i2c_board_info __initdata mityomap_tps65023_info[] = { }, { I2C_BOARD_INFO("24c02", 0x50), - .properties = mityomapl138_fd_chip_properties, + .swnode = &mityomapl138_fd_chip_node, }, }; diff --git a/arch/arm/mach-davinci/board-sffsdr.c b/arch/arm/mach-davinci/board-sffsdr.c index 79b47958e9926..6930b2f485d19 100644 --- a/arch/arm/mach-davinci/board-sffsdr.c +++ b/arch/arm/mach-davinci/board-sffsdr.c @@ -84,10 +84,14 @@ static const struct property_entry eeprom_properties[] = { { } }; +static const struct software_node eeprom_node = { + .properties = eeprom_properties, +}; + static struct i2c_board_info __initdata i2c_info[] = { { I2C_BOARD_INFO("24c64", 0x50), - .properties = eeprom_properties, + .swnode = &eeprom_node, }, /* Other I2C devices: * MSP430, addr 0x23 (not used) From patchwork Mon Mar 29 10:50:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heikki Krogerus X-Patchwork-Id: 411045 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E4C2C433E0 for ; Mon, 29 Mar 2021 10:51:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4C8B36195B for ; Mon, 29 Mar 2021 10:51:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232742AbhC2KvO (ORCPT ); Mon, 29 Mar 2021 06:51:14 -0400 Received: from mga02.intel.com ([134.134.136.20]:49552 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232711AbhC2Kux (ORCPT ); Mon, 29 Mar 2021 06:50:53 -0400 IronPort-SDR: an28CXjcbwRvWmkA8ZPOTatqnC7JNdLnPkV1I6tcl/PEp06GJFJh97MgbX6ximvVSL6mJjsZEE uEamjCvE1g6w== X-IronPort-AV: E=McAfee;i="6000,8403,9937"; a="178653649" X-IronPort-AV: E=Sophos;i="5.81,287,1610438400"; d="scan'208";a="178653649" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2021 03:50:39 -0700 IronPort-SDR: OyK8IBaP138GcLAxk6LNP0ihsqSYYhTpPX2lNNTblyTO4Chg9unUYH8JUeBFH2HZ1CKCK2w84Q PjCo/eUnBjZA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,287,1610438400"; d="scan'208";a="515955840" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 29 Mar 2021 03:50:38 -0700 From: Heikki Krogerus To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Aaro Koskinen , Tony Lindgren Subject: [PATCH 03/12] ARM: omap1: osk: Constify the software node Date: Mon, 29 Mar 2021 13:50:38 +0300 Message-Id: <20210329105047.51033-4-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210329105047.51033-1-heikki.krogerus@linux.intel.com> References: <20210329105047.51033-1-heikki.krogerus@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Additional device properties are always just a part of a software fwnode. If the device properties are constant, the software node can also be constant. Signed-off-by: Heikki Krogerus Cc: Aaro Koskinen Cc: Tony Lindgren Acked-by: Tony Lindgren --- arch/arm/mach-omap1/board-osk.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c index 0a4c9b0b13b0c..e18b6f13300eb 100644 --- a/arch/arm/mach-omap1/board-osk.c +++ b/arch/arm/mach-omap1/board-osk.c @@ -332,11 +332,15 @@ static const struct property_entry mistral_at24_properties[] = { { } }; +static const struct software_node mistral_at24_node = { + .properties = mistral_at24_properties, +}; + static struct i2c_board_info __initdata mistral_i2c_board_info[] = { { /* NOTE: powered from LCD supply */ I2C_BOARD_INFO("24c04", 0x50), - .properties = mistral_at24_properties, + .swnode = &mistral_at24_node, }, /* TODO when driver support is ready: * - optionally ov9640 camera sensor at 0x30 From patchwork Mon Mar 29 10:50:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heikki Krogerus X-Patchwork-Id: 412044 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CABD4C433E3 for ; Mon, 29 Mar 2021 10:51:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7BB0861938 for ; Mon, 29 Mar 2021 10:51:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232769AbhC2KvQ (ORCPT ); Mon, 29 Mar 2021 06:51:16 -0400 Received: from mga02.intel.com ([134.134.136.20]:49554 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232718AbhC2Kuy (ORCPT ); Mon, 29 Mar 2021 06:50:54 -0400 IronPort-SDR: Cp9QTvfd9dgeyttB8KbHZMXALOCqwrOHJIc0XCYB4Xzqp5HMRro/5ov3d1dzb/vpKj+88lcJEL 6Fq6K7KBe+ow== X-IronPort-AV: E=McAfee;i="6000,8403,9937"; a="178653654" X-IronPort-AV: E=Sophos;i="5.81,287,1610438400"; d="scan'208";a="178653654" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2021 03:50:42 -0700 IronPort-SDR: TZbSW3VbsbB3RsTgWPUgwer6h2wM55cP8asShMLjlLkg69BfjRyF5y5Z8yYHITUdu6Xf8EKjsg CrO+jqXAERJQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,287,1610438400"; d="scan'208";a="515955848" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 29 Mar 2021 03:50:40 -0700 From: Heikki Krogerus To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Jonathan Cameron , Daniel Mack , Haojian Zhuang , Robert Jarzmik Subject: [PATCH 04/12] ARM: pxa: stargate2: Constify the software node Date: Mon, 29 Mar 2021 13:50:39 +0300 Message-Id: <20210329105047.51033-5-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210329105047.51033-1-heikki.krogerus@linux.intel.com> References: <20210329105047.51033-1-heikki.krogerus@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Additional device properties are always just a part of a software fwnode. If the device properties are constant, the software node can also be constant. Signed-off-by: Heikki Krogerus Cc: Jonathan Cameron Cc: Daniel Mack Cc: Haojian Zhuang Cc: Robert Jarzmik Acked-by: Robert Jarzmik --- arch/arm/mach-pxa/stargate2.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-pxa/stargate2.c b/arch/arm/mach-pxa/stargate2.c index e2353f7dcf01a..7ad6274657686 100644 --- a/arch/arm/mach-pxa/stargate2.c +++ b/arch/arm/mach-pxa/stargate2.c @@ -794,6 +794,10 @@ static const struct property_entry pca9500_eeprom_properties[] = { { } }; +static const struct software_node pca9500_eeprom_node = { + .properties = pca9500_eeprom_properties, +}; + /** * stargate2_reset_bluetooth() reset the bluecore to ensure consistent state **/ @@ -929,7 +933,7 @@ static struct i2c_board_info __initdata stargate2_i2c_board_info[] = { }, { .type = "24c02", .addr = 0x57, - .properties = pca9500_eeprom_properties, + .swnode = &pca9500_eeprom_node, }, { .type = "max1238", .addr = 0x35, From patchwork Mon Mar 29 10:50:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heikki Krogerus X-Patchwork-Id: 412043 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED01AC433E4 for ; Mon, 29 Mar 2021 10:51:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9B4B261985 for ; Mon, 29 Mar 2021 10:51:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231548AbhC2KvP (ORCPT ); Mon, 29 Mar 2021 06:51:15 -0400 Received: from mga02.intel.com ([134.134.136.20]:49552 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232728AbhC2Kuy (ORCPT ); Mon, 29 Mar 2021 06:50:54 -0400 IronPort-SDR: rFdDRE4krYhCPA7xzGpjJE6n1kIe5Aui7fyaOiZ+B976laGYHF4QE4wQi7ttuHCgfceUKOq8pl OtOprcQAc1qg== X-IronPort-AV: E=McAfee;i="6000,8403,9937"; a="178653656" X-IronPort-AV: E=Sophos;i="5.81,287,1610438400"; d="scan'208";a="178653656" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2021 03:50:44 -0700 IronPort-SDR: kBnfbWcddNVg3aFlhlrqvHddNrpMfnXtqD5knk0CXiIxvoc7oYxlU6+wIBJKND9iidYwoxvO4d 5h5pFbIMu7SQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,287,1610438400"; d="scan'208";a="515955855" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 29 Mar 2021 03:50:42 -0700 From: Heikki Krogerus To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski Subject: [PATCH 05/12] ARM: s3c: mini2440: Constify the software node Date: Mon, 29 Mar 2021 13:50:40 +0300 Message-Id: <20210329105047.51033-6-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210329105047.51033-1-heikki.krogerus@linux.intel.com> References: <20210329105047.51033-1-heikki.krogerus@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Additional device properties are always just a part of a software fwnode. If the device properties are constant, the software node can also be constant. Signed-off-by: Heikki Krogerus Cc: Krzysztof Kozlowski --- arch/arm/mach-s3c/mach-mini2440.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-s3c/mach-mini2440.c b/arch/arm/mach-s3c/mach-mini2440.c index 4100905dfbd0c..551ec660ab599 100644 --- a/arch/arm/mach-s3c/mach-mini2440.c +++ b/arch/arm/mach-s3c/mach-mini2440.c @@ -542,10 +542,14 @@ static const struct property_entry mini2440_at24_properties[] = { { } }; +static const struct software_node mini2440_at24_node = { + .properties = mini2440_at24_properties, +}; + static struct i2c_board_info mini2440_i2c_devs[] __initdata = { { I2C_BOARD_INFO("24c08", 0x50), - .properties = mini2440_at24_properties, + .swnode = &mini2440_at24_node, }, }; From patchwork Mon Mar 29 10:50:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heikki Krogerus X-Patchwork-Id: 411044 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBBC9C433E2 for ; Mon, 29 Mar 2021 10:51:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BBB106193B for ; Mon, 29 Mar 2021 10:51:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232757AbhC2KvP (ORCPT ); Mon, 29 Mar 2021 06:51:15 -0400 Received: from mga02.intel.com ([134.134.136.20]:49554 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232729AbhC2Kuz (ORCPT ); Mon, 29 Mar 2021 06:50:55 -0400 IronPort-SDR: homucKsGkFccfJenyqdo0UjIcD0QJxbH8PNCkiVevgfZAhks9v30cd2fTRMvkPp4h5dhm0QrU7 X2+ufBBXGuog== X-IronPort-AV: E=McAfee;i="6000,8403,9937"; a="178653662" X-IronPort-AV: E=Sophos;i="5.81,287,1610438400"; d="scan'208";a="178653662" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2021 03:50:46 -0700 IronPort-SDR: Ws5QOYAJ7MRHYa/KSHWooLQx04b4czjP5MK3M2eNB2Gle/ovYqGimb1ETbTDprDNx/ymvgkZqN TbZ/njwgsjpg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,287,1610438400"; d="scan'208";a="515955861" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 29 Mar 2021 03:50:44 -0700 From: Heikki Krogerus To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Hans de Goede Subject: [PATCH 06/12] platform/x86: intel_cht_int33fe_microb: Constify the software node Date: Mon, 29 Mar 2021 13:50:41 +0300 Message-Id: <20210329105047.51033-7-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210329105047.51033-1-heikki.krogerus@linux.intel.com> References: <20210329105047.51033-1-heikki.krogerus@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Additional device properties are always just a part of a software fwnode. If the device properties are constant, the software node can also be constant. Signed-off-by: Heikki Krogerus Cc: Hans de Goede --- drivers/platform/x86/intel_cht_int33fe_microb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/intel_cht_int33fe_microb.c b/drivers/platform/x86/intel_cht_int33fe_microb.c index 20b11e0d9a758..673f41cd14b52 100644 --- a/drivers/platform/x86/intel_cht_int33fe_microb.c +++ b/drivers/platform/x86/intel_cht_int33fe_microb.c @@ -35,6 +35,10 @@ static const struct property_entry bq27xxx_props[] = { { } }; +static const struct software_node bq27xxx_node = { + .properties = bq27xxx_props, +}; + int cht_int33fe_microb_probe(struct cht_int33fe_data *data) { struct device *dev = data->dev; @@ -43,7 +47,7 @@ int cht_int33fe_microb_probe(struct cht_int33fe_data *data) memset(&board_info, 0, sizeof(board_info)); strscpy(board_info.type, "bq27542", ARRAY_SIZE(board_info.type)); board_info.dev_name = "bq27542"; - board_info.properties = bq27xxx_props; + board_info.swnode = &bq27xxx_node; data->battery_fg = i2c_acpi_new_device(dev, 1, &board_info); return PTR_ERR_OR_ZERO(data->battery_fg); From patchwork Mon Mar 29 10:50:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heikki Krogerus X-Patchwork-Id: 412040 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F758C433EA for ; Mon, 29 Mar 2021 10:51:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0D5AE61997 for ; Mon, 29 Mar 2021 10:51:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232711AbhC2KvR (ORCPT ); Mon, 29 Mar 2021 06:51:17 -0400 Received: from mga02.intel.com ([134.134.136.20]:49552 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232732AbhC2Kuz (ORCPT ); Mon, 29 Mar 2021 06:50:55 -0400 IronPort-SDR: 3XgH5mpe6ZZu01l++vGnIhjecmj8trt6uwanDtxy7vrKVi6h7kfNSHP0Xu2NFGglMGvp1jgfYm KBOY5tE9KcJQ== X-IronPort-AV: E=McAfee;i="6000,8403,9937"; a="178653667" X-IronPort-AV: E=Sophos;i="5.81,287,1610438400"; d="scan'208";a="178653667" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2021 03:50:47 -0700 IronPort-SDR: JkD5Oy3hVYWfGJXOsuOTsPmBNkURB/dcSjUcUBRt+RrI9q5H8jsZw1FfjNdmH/Ilc+vmSTjUaN reprAYCtnYnw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,287,1610438400"; d="scan'208";a="515955873" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 29 Mar 2021 03:50:46 -0700 From: Heikki Krogerus To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Hans de Goede Subject: [PATCH 07/12] i2c: cht-wc: Constify the software node Date: Mon, 29 Mar 2021 13:50:42 +0300 Message-Id: <20210329105047.51033-8-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210329105047.51033-1-heikki.krogerus@linux.intel.com> References: <20210329105047.51033-1-heikki.krogerus@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Additional device properties are always just a part of a software fwnode. If the device properties are constant, the software node can also be constant. Signed-off-by: Heikki Krogerus Cc: Hans de Goede --- drivers/i2c/busses/i2c-cht-wc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-cht-wc.c b/drivers/i2c/busses/i2c-cht-wc.c index f80d79e973cd2..08f491ea21ac9 100644 --- a/drivers/i2c/busses/i2c-cht-wc.c +++ b/drivers/i2c/busses/i2c-cht-wc.c @@ -280,6 +280,10 @@ static const struct property_entry bq24190_props[] = { { } }; +static const struct software_node bq24190_node = { + .properties = bq24190_props, +}; + static struct regulator_consumer_supply fusb302_consumer = { .supply = "vbus", /* Must match fusb302 dev_name in intel_cht_int33fe.c */ @@ -308,7 +312,7 @@ static int cht_wc_i2c_adap_i2c_probe(struct platform_device *pdev) .type = "bq24190", .addr = 0x6b, .dev_name = "bq24190", - .properties = bq24190_props, + .swnode = &bq24190_node, .platform_data = &bq24190_pdata, }; int ret, reg, irq; From patchwork Mon Mar 29 10:50:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heikki Krogerus X-Patchwork-Id: 412042 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DCD2C433E8 for ; Mon, 29 Mar 2021 10:51:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D308661936 for ; Mon, 29 Mar 2021 10:51:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232779AbhC2KvR (ORCPT ); Mon, 29 Mar 2021 06:51:17 -0400 Received: from mga02.intel.com ([134.134.136.20]:49552 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232736AbhC2Kuz (ORCPT ); Mon, 29 Mar 2021 06:50:55 -0400 IronPort-SDR: KHD8/tE82Hvy0eTBQ/oh8oGBX04V5Ud0FHZOPZlaWm2hj+e9XjoQr5qgBB1toflB14F0vcx8xH knOV94FPlHkg== X-IronPort-AV: E=McAfee;i="6000,8403,9937"; a="178653672" X-IronPort-AV: E=Sophos;i="5.81,287,1610438400"; d="scan'208";a="178653672" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2021 03:50:49 -0700 IronPort-SDR: d8jSU6ix2SHelWctKpV6Ol2VhZ8u4lNQEDSRU02T3XRid2rjDdGCelVH3joOygJyO4E2z6wzea wnr71fYZaZtw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,287,1610438400"; d="scan'208";a="515955885" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 29 Mar 2021 03:50:48 -0700 From: Heikki Krogerus To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Ajay Gupta Subject: [PATCH 08/12] i2c: nvidia-gpu: Constify the software node Date: Mon, 29 Mar 2021 13:50:43 +0300 Message-Id: <20210329105047.51033-9-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210329105047.51033-1-heikki.krogerus@linux.intel.com> References: <20210329105047.51033-1-heikki.krogerus@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Additional device properties are always just a part of a software fwnode. If the device properties are constant, the software node can also be constant. Signed-off-by: Heikki Krogerus Cc: Ajay Gupta --- drivers/i2c/busses/i2c-nvidia-gpu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-nvidia-gpu.c b/drivers/i2c/busses/i2c-nvidia-gpu.c index 6b20601ffb139..b5055a3cbd935 100644 --- a/drivers/i2c/busses/i2c-nvidia-gpu.c +++ b/drivers/i2c/busses/i2c-nvidia-gpu.c @@ -262,6 +262,10 @@ static const struct property_entry ccgx_props[] = { { } }; +static const struct software_node ccgx_node = { + .properties = ccgx_props, +}; + static int gpu_populate_client(struct gpu_i2c_dev *i2cd, int irq) { i2cd->gpu_ccgx_ucsi = devm_kzalloc(i2cd->dev, @@ -274,7 +278,7 @@ static int gpu_populate_client(struct gpu_i2c_dev *i2cd, int irq) sizeof(i2cd->gpu_ccgx_ucsi->type)); i2cd->gpu_ccgx_ucsi->addr = 0x8; i2cd->gpu_ccgx_ucsi->irq = irq; - i2cd->gpu_ccgx_ucsi->properties = ccgx_props; + i2cd->gpu_ccgx_ucsi->swnode = &ccgx_node; i2cd->ccgx_client = i2c_new_client_device(&i2cd->adapter, i2cd->gpu_ccgx_ucsi); return PTR_ERR_OR_ZERO(i2cd->ccgx_client); } From patchwork Mon Mar 29 10:50:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heikki Krogerus X-Patchwork-Id: 412041 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31C65C433E9 for ; Mon, 29 Mar 2021 10:51:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1BF8961936 for ; Mon, 29 Mar 2021 10:51:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232784AbhC2KvR (ORCPT ); Mon, 29 Mar 2021 06:51:17 -0400 Received: from mga02.intel.com ([134.134.136.20]:49554 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232734AbhC2Kuz (ORCPT ); Mon, 29 Mar 2021 06:50:55 -0400 IronPort-SDR: RSxkwKRQo4IcaY2cepr49Nf+h6M2H6JQeGakm6kMFgA9lBD2JdhoL/F4KGW0+0HZfpx6U4mMGX oIb41SC54kDQ== X-IronPort-AV: E=McAfee;i="6000,8403,9937"; a="178653674" X-IronPort-AV: E=Sophos;i="5.81,287,1610438400"; d="scan'208";a="178653674" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2021 03:50:51 -0700 IronPort-SDR: 1QVmwb5KTXWYJ1FegoDIfF+bA7p+nGsfPzTTUn/xS4RiLicZ9db8HRhl+NPGyqfD/UmJvPHyGX GwmmemhOyIyg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,287,1610438400"; d="scan'208";a="515955897" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 29 Mar 2021 03:50:49 -0700 From: Heikki Krogerus To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Max Staudt Subject: [PATCH 09/12] i2c: icy: Constify the software node Date: Mon, 29 Mar 2021 13:50:44 +0300 Message-Id: <20210329105047.51033-10-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210329105047.51033-1-heikki.krogerus@linux.intel.com> References: <20210329105047.51033-1-heikki.krogerus@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Complete software node can now be supplied to the device with struct i2c_board_info. Signed-off-by: Heikki Krogerus Cc: Max Staudt --- drivers/i2c/busses/i2c-icy.c | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/drivers/i2c/busses/i2c-icy.c b/drivers/i2c/busses/i2c-icy.c index 66c9923fc7665..c8c422e9dda43 100644 --- a/drivers/i2c/busses/i2c-icy.c +++ b/drivers/i2c/busses/i2c-icy.c @@ -54,7 +54,6 @@ struct icy_i2c { void __iomem *reg_s0; void __iomem *reg_s1; - struct fwnode_handle *ltc2990_fwnode; struct i2c_client *ltc2990_client; }; @@ -115,6 +114,10 @@ static const struct property_entry icy_ltc2990_props[] = { { } }; +static const struct software_node icy_ltc2990_node = { + .properties = icy_ltc2990_props, +}; + static int icy_probe(struct zorro_dev *z, const struct zorro_device_id *ent) { @@ -123,6 +126,7 @@ static int icy_probe(struct zorro_dev *z, struct fwnode_handle *new_fwnode; struct i2c_board_info ltc2990_info = { .type = "ltc2990", + .swnode = &icy_ltc2990_node, }; i2c = devm_kzalloc(&z->dev, sizeof(*i2c), GFP_KERNEL); @@ -174,26 +178,10 @@ static int icy_probe(struct zorro_dev *z, * * See property_entry above for in1, in2, temp3. */ - new_fwnode = fwnode_create_software_node(icy_ltc2990_props, NULL); - if (IS_ERR(new_fwnode)) { - dev_info(&z->dev, "Failed to create fwnode for LTC2990, error: %ld\n", - PTR_ERR(new_fwnode)); - } else { - /* - * Store the fwnode so we can destroy it on .remove(). - * Only store it on success, as fwnode_remove_software_node() - * is NULL safe, but not PTR_ERR safe. - */ - i2c->ltc2990_fwnode = new_fwnode; - ltc2990_info.fwnode = new_fwnode; - - i2c->ltc2990_client = - i2c_new_scanned_device(&i2c->adapter, - <c2990_info, - icy_ltc2990_addresses, - NULL); - } - + i2c->ltc2990_client = i2c_new_scanned_device(&i2c->adapter, + <c2990_info, + icy_ltc2990_addresses, + NULL); return 0; } @@ -202,8 +190,6 @@ static void icy_remove(struct zorro_dev *z) struct icy_i2c *i2c = dev_get_drvdata(&z->dev); i2c_unregister_device(i2c->ltc2990_client); - fwnode_remove_software_node(i2c->ltc2990_fwnode); - i2c_del_adapter(&i2c->adapter); } From patchwork Mon Mar 29 10:50:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heikki Krogerus X-Patchwork-Id: 411043 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 015E3C433E6 for ; Mon, 29 Mar 2021 10:51:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E2A19619A0 for ; Mon, 29 Mar 2021 10:51:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232773AbhC2KvQ (ORCPT ); Mon, 29 Mar 2021 06:51:16 -0400 Received: from mga02.intel.com ([134.134.136.20]:49554 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232740AbhC2Ku4 (ORCPT ); Mon, 29 Mar 2021 06:50:56 -0400 IronPort-SDR: zqkjQR61EaA4Txk/OmetrzRPnkrNQsqb6rksShmAgHs7BT3zgqq8munhgqxMY0toqjtCTXMGkZ ARE8alZC77gg== X-IronPort-AV: E=McAfee;i="6000,8403,9937"; a="178653677" X-IronPort-AV: E=Sophos;i="5.81,287,1610438400"; d="scan'208";a="178653677" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2021 03:50:53 -0700 IronPort-SDR: pgLNzf0Ll9tkZNR+BajSQn1ede9BquWoZxmrSDHNLlwZg1+ZoWuEoUSlw1OckfLC7bTrHj9cCt yzqlWSfXTHow== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,287,1610438400"; d="scan'208";a="515955904" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 29 Mar 2021 03:50:51 -0700 From: Heikki Krogerus To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Benson Leung , Enric Balletbo i Serra Subject: [PATCH 10/12] platform/chrome: chromeos_laptop - Prepare complete software nodes Date: Mon, 29 Mar 2021 13:50:45 +0300 Message-Id: <20210329105047.51033-11-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210329105047.51033-1-heikki.krogerus@linux.intel.com> References: <20210329105047.51033-1-heikki.krogerus@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org The older device property API is going to be removed soon and that will affect also I2C subystem. Supplying complete software nodes instead of only the properties in them for the I2C devices. Signed-off-by: Heikki Krogerus Cc: Benson Leung Cc: Enric Balletbo i Serra Acked-by: Enric Balletbo i Serra --- drivers/platform/chrome/chromeos_laptop.c | 100 +++++++++++++--------- 1 file changed, 60 insertions(+), 40 deletions(-) diff --git a/drivers/platform/chrome/chromeos_laptop.c b/drivers/platform/chrome/chromeos_laptop.c index 472a03daa8693..4e14b4d6635d7 100644 --- a/drivers/platform/chrome/chromeos_laptop.c +++ b/drivers/platform/chrome/chromeos_laptop.c @@ -52,12 +52,15 @@ struct i2c_peripheral { enum i2c_adapter_type type; u32 pci_devid; + const struct property_entry *properties; + struct i2c_client *client; }; struct acpi_peripheral { char hid[ACPI_ID_LEN]; - const struct property_entry *properties; + struct software_node swnode; + struct i2c_client *client; }; struct chromeos_laptop { @@ -68,7 +71,7 @@ struct chromeos_laptop { struct i2c_peripheral *i2c_peripherals; unsigned int num_i2c_peripherals; - const struct acpi_peripheral *acpi_peripherals; + struct acpi_peripheral *acpi_peripherals; unsigned int num_acpi_peripherals; }; @@ -161,7 +164,7 @@ static void chromeos_laptop_check_adapter(struct i2c_adapter *adapter) static bool chromeos_laptop_adjust_client(struct i2c_client *client) { - const struct acpi_peripheral *acpi_dev; + struct acpi_peripheral *acpi_dev; struct acpi_device_id acpi_ids[2] = { }; int i; int error; @@ -175,8 +178,7 @@ static bool chromeos_laptop_adjust_client(struct i2c_client *client) memcpy(acpi_ids[0].id, acpi_dev->hid, ACPI_ID_LEN); if (acpi_match_device(acpi_ids, &client->dev)) { - error = device_add_properties(&client->dev, - acpi_dev->properties); + error = device_add_software_node(&client->dev, &acpi_dev->swnode); if (error) { dev_err(&client->dev, "failed to add properties: %d\n", @@ -184,6 +186,8 @@ static bool chromeos_laptop_adjust_client(struct i2c_client *client) break; } + acpi_dev->client = client; + return true; } } @@ -193,15 +197,28 @@ static bool chromeos_laptop_adjust_client(struct i2c_client *client) static void chromeos_laptop_detach_i2c_client(struct i2c_client *client) { + struct acpi_peripheral *acpi_dev; struct i2c_peripheral *i2c_dev; int i; - for (i = 0; i < cros_laptop->num_i2c_peripherals; i++) { - i2c_dev = &cros_laptop->i2c_peripherals[i]; + if (has_acpi_companion(&client->dev)) + for (i = 0; i < cros_laptop->num_acpi_peripherals; i++) { + acpi_dev = &cros_laptop->acpi_peripherals[i]; - if (i2c_dev->client == client) - i2c_dev->client = NULL; - } + if (acpi_dev->client == client) { + acpi_dev->client = NULL; + return; + } + } + else + for (i = 0; i < cros_laptop->num_i2c_peripherals; i++) { + i2c_dev = &cros_laptop->i2c_peripherals[i]; + + if (i2c_dev->client == client) { + i2c_dev->client = NULL; + return; + } + } } static int chromeos_laptop_i2c_notifier_call(struct notifier_block *nb, @@ -302,28 +319,26 @@ static struct i2c_peripheral chromebook_pixel_peripherals[] __initdata = { .board_info = { I2C_BOARD_INFO("atmel_mxt_ts", ATMEL_TS_I2C_ADDR), - .properties = - chromebook_atmel_touchscreen_props, .flags = I2C_CLIENT_WAKE, }, .dmi_name = "touchscreen", .irqflags = IRQF_TRIGGER_FALLING, .type = I2C_ADAPTER_PANEL, .alt_addr = ATMEL_TS_I2C_BL_ADDR, + .properties = chromebook_atmel_touchscreen_props, }, /* Touchpad. */ { .board_info = { I2C_BOARD_INFO("atmel_mxt_tp", ATMEL_TP_I2C_ADDR), - .properties = - chromebook_pixel_trackpad_props, .flags = I2C_CLIENT_WAKE, }, .dmi_name = "trackpad", .irqflags = IRQF_TRIGGER_FALLING, .type = I2C_ADAPTER_VGADDC, .alt_addr = ATMEL_TP_I2C_BL_ADDR, + .properties = chromebook_pixel_trackpad_props, }, /* Light Sensor. */ { @@ -414,8 +429,6 @@ static struct i2c_peripheral acer_c720_peripherals[] __initdata = { .board_info = { I2C_BOARD_INFO("atmel_mxt_ts", ATMEL_TS_I2C_ADDR), - .properties = - chromebook_atmel_touchscreen_props, .flags = I2C_CLIENT_WAKE, }, .dmi_name = "touchscreen", @@ -423,6 +436,7 @@ static struct i2c_peripheral acer_c720_peripherals[] __initdata = { .type = I2C_ADAPTER_DESIGNWARE, .pci_devid = PCI_DEVID(0, PCI_DEVFN(0x15, 0x2)), .alt_addr = ATMEL_TS_I2C_BL_ADDR, + .properties = chromebook_atmel_touchscreen_props, }, /* Touchpad. */ { @@ -498,12 +512,16 @@ static struct acpi_peripheral samus_peripherals[] __initdata = { /* Touchpad */ { .hid = "ATML0000", - .properties = samus_trackpad_props, + .swnode = { + .properties = samus_trackpad_props, + }, }, /* Touchsceen */ { .hid = "ATML0001", - .properties = chromebook_atmel_touchscreen_props, + .swnode = { + .properties = chromebook_atmel_touchscreen_props, + }, }, }; DECLARE_ACPI_CROS_LAPTOP(samus); @@ -512,12 +530,16 @@ static struct acpi_peripheral generic_atmel_peripherals[] __initdata = { /* Touchpad */ { .hid = "ATML0000", - .properties = chromebook_pixel_trackpad_props, + .swnode = { + .properties = chromebook_pixel_trackpad_props, + }, }, /* Touchsceen */ { .hid = "ATML0001", - .properties = chromebook_atmel_touchscreen_props, + .swnode = { + .properties = chromebook_atmel_touchscreen_props, + }, }, }; DECLARE_ACPI_CROS_LAPTOP(generic_atmel); @@ -743,12 +765,11 @@ chromeos_laptop_prepare_i2c_peripherals(struct chromeos_laptop *cros_laptop, if (error) goto err_out; - /* We need to deep-copy properties */ - if (info->properties) { - info->properties = - property_entries_dup(info->properties); - if (IS_ERR(info->properties)) { - error = PTR_ERR(info->properties); + /* Create primary fwnode for the device - copies everything */ + if (i2c_dev->properties) { + info->fwnode = fwnode_create_software_node(i2c_dev->properties, NULL); + if (IS_ERR(info->fwnode)) { + error = PTR_ERR(info->fwnode); goto err_out; } } @@ -760,8 +781,8 @@ chromeos_laptop_prepare_i2c_peripherals(struct chromeos_laptop *cros_laptop, while (--i >= 0) { i2c_dev = &cros_laptop->i2c_peripherals[i]; info = &i2c_dev->board_info; - if (info->properties) - property_entries_free(info->properties); + if (!IS_ERR_OR_NULL(info->fwnode)) + fwnode_remove_software_node(info->fwnode); } kfree(cros_laptop->i2c_peripherals); return error; @@ -801,11 +822,11 @@ chromeos_laptop_prepare_acpi_peripherals(struct chromeos_laptop *cros_laptop, *acpi_dev = *src_dev; /* We need to deep-copy properties */ - if (src_dev->properties) { - acpi_dev->properties = - property_entries_dup(src_dev->properties); - if (IS_ERR(acpi_dev->properties)) { - error = PTR_ERR(acpi_dev->properties); + if (src_dev->swnode.properties) { + acpi_dev->swnode.properties = + property_entries_dup(src_dev->swnode.properties); + if (IS_ERR(acpi_dev->swnode.properties)) { + error = PTR_ERR(acpi_dev->swnode.properties); goto err_out; } } @@ -821,8 +842,8 @@ chromeos_laptop_prepare_acpi_peripherals(struct chromeos_laptop *cros_laptop, err_out: while (--i >= 0) { acpi_dev = &acpi_peripherals[i]; - if (acpi_dev->properties) - property_entries_free(acpi_dev->properties); + if (!IS_ERR_OR_NULL(acpi_dev->swnode.properties)) + property_entries_free(acpi_dev->swnode.properties); } kfree(acpi_peripherals); @@ -833,21 +854,20 @@ static void chromeos_laptop_destroy(const struct chromeos_laptop *cros_laptop) { const struct acpi_peripheral *acpi_dev; struct i2c_peripheral *i2c_dev; - struct i2c_board_info *info; int i; for (i = 0; i < cros_laptop->num_i2c_peripherals; i++) { i2c_dev = &cros_laptop->i2c_peripherals[i]; - info = &i2c_dev->board_info; - i2c_unregister_device(i2c_dev->client); - property_entries_free(info->properties); } for (i = 0; i < cros_laptop->num_acpi_peripherals; i++) { acpi_dev = &cros_laptop->acpi_peripherals[i]; - property_entries_free(acpi_dev->properties); + if (acpi_dev->client) + device_remove_software_node(&acpi_dev->client->dev); + + property_entries_free(acpi_dev->swnode.properties); } kfree(cros_laptop->i2c_peripherals); From patchwork Mon Mar 29 10:50:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heikki Krogerus X-Patchwork-Id: 411042 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 120F9C433E5 for ; Mon, 29 Mar 2021 10:51:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F394B619A6 for ; Mon, 29 Mar 2021 10:51:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232770AbhC2KvQ (ORCPT ); Mon, 29 Mar 2021 06:51:16 -0400 Received: from mga02.intel.com ([134.134.136.20]:49552 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232741AbhC2Ku4 (ORCPT ); Mon, 29 Mar 2021 06:50:56 -0400 IronPort-SDR: CSLVAVjaldjfHB6cB+TfCMCQgPFVtBroqzlEfjVVDxKpIkHvYZJLGzeMW9QHtXigPVp6+tFnOp ewfC7K8f9N/w== X-IronPort-AV: E=McAfee;i="6000,8403,9937"; a="178653680" X-IronPort-AV: E=Sophos;i="5.81,287,1610438400"; d="scan'208";a="178653680" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2021 03:50:55 -0700 IronPort-SDR: MytefdG5msTQLBfkpejKuD6BpJnoEAMkY0R0BcXmGf8HwDZFb6SK8WsyIWOZApMgrH3n2ASWQ7 w35EJsvd46iQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,287,1610438400"; d="scan'208";a="515955915" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 29 Mar 2021 03:50:53 -0700 From: Heikki Krogerus To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Dmitry Torokhov Subject: [PATCH 11/12] Input: elantech - Prepare a complete software node for the device Date: Mon, 29 Mar 2021 13:50:46 +0300 Message-Id: <20210329105047.51033-12-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210329105047.51033-1-heikki.krogerus@linux.intel.com> References: <20210329105047.51033-1-heikki.krogerus@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Creating a software node and supplying that for the device instead of only the device properties in it. A software node was always created in any case to hold the additional device properties, so this change does not have any real effect. This change makes it possible to remove support for the problematic "dangling" device properties from i2c subsystem, i.e. the "properties" member from struct i2c_board_info. The problems caused by them are not related to this driver. Signed-off-by: Heikki Krogerus Cc: Dmitry Torokhov Acked-by: Dmitry Torokhov --- drivers/input/mouse/elantech.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index 97381e2e03bae..2d0bc029619ff 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c @@ -1885,8 +1885,6 @@ static int elantech_create_smbus(struct psmouse *psmouse, }; unsigned int idx = 0; - smbus_board.properties = i2c_props; - i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-size-x", info->x_max + 1); i2c_props[idx++] = PROPERTY_ENTRY_U32("touchscreen-size-y", @@ -1918,6 +1916,10 @@ static int elantech_create_smbus(struct psmouse *psmouse, if (elantech_is_buttonpad(info)) i2c_props[idx++] = PROPERTY_ENTRY_BOOL("elan,clickpad"); + smbus_board.fwnode = fwnode_create_software_node(i2c_props, NULL); + if (IS_ERR(smbus_board.fwnode)) + return PTR_ERR(smbus_board.fwnode); + return psmouse_smbus_init(psmouse, &smbus_board, NULL, 0, false, leave_breadcrumbs); }