From patchwork Tue Feb 2 12:50:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heikki Krogerus X-Patchwork-Id: 375776 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.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 C27E3C433E0 for ; Tue, 2 Feb 2021 12:52:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8FA4D64F45 for ; Tue, 2 Feb 2021 12:52:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232134AbhBBMwa (ORCPT ); Tue, 2 Feb 2021 07:52:30 -0500 Received: from mga14.intel.com ([192.55.52.115]:18026 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232133AbhBBMwZ (ORCPT ); Tue, 2 Feb 2021 07:52:25 -0500 IronPort-SDR: QPhL7bdh7xTS6EpN2Eee8a8LK9mi0z2MuqLGyr3qA1AjDGXtvvZJ7CwpLMziy8Ap63Pm6tJrC6 V+XLNuyDCk1Q== X-IronPort-AV: E=McAfee;i="6000,8403,9882"; a="180070656" X-IronPort-AV: E=Sophos;i="5.79,395,1602572400"; d="scan'208";a="180070656" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2021 04:50:37 -0800 IronPort-SDR: mT6eI8bgTqiEvwycKBdfQdtywqNAynLF8MMx1xmJt++Di4/U3y1pQH3yl5eV1LbsxD2n8YW48R /uVwKnQBPwsg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,395,1602572400"; d="scan'208";a="479741013" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 02 Feb 2021 04:50:35 -0800 From: Heikki Krogerus To: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" , Andy Shevchenko , Felipe Balbi , Mathias Nyman , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: [PATCH 1/6] software node: Provide replacement for device_add_properties() Date: Tue, 2 Feb 2021 15:50:27 +0300 Message-Id: <20210202125032.64982-2-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210202125032.64982-1-heikki.krogerus@linux.intel.com> References: <20210202125032.64982-1-heikki.krogerus@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Adding function device_create_managed_software_node() that is designed to work as a drop-in replacement for device_add_properties(). The function has one additional feature compared to device_add_properties(). It takes also an optional parent node as parameter, and that way allow the nodes created with it to be part of a node hierarchy. The lifetime of the software nodes created with this function will be tied to the device they are assigned to. The function will therefore behave exactly the same way as device_add_properties() is expected to behave, except that it does not simply assume that the nodes attached to the device are always destroyed in device_del() unconditionally. The nodes created with this function are guaranteed to be removed when the device is removed even after device_del() stops calling device_remove_properties() unconditionally. Signed-off-by: Heikki Krogerus --- drivers/base/swnode.c | 43 ++++++++++++++++++++++++++++++++++++++++ include/linux/property.h | 4 ++++ 2 files changed, 47 insertions(+) diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c index 20faa9f4f5ed2..37179a8b1ceba 100644 --- a/drivers/base/swnode.c +++ b/drivers/base/swnode.c @@ -24,6 +24,7 @@ struct swnode { struct swnode *parent; unsigned int allocated:1; + unsigned int managed:1; }; static DEFINE_IDA(swnode_root_ids); @@ -1045,6 +1046,43 @@ void device_remove_software_node(struct device *dev) } EXPORT_SYMBOL_GPL(device_remove_software_node); +/** + * device_create_managed_software_node - Create a software node for a device + * @dev: The device the software node is assigned to. + * @properties: Device properties for the software node. + * @parent: Parent of the software node. + * + * Creates a software node as a managed resource for @dev, which means the + * lifetime of the newly created software node is tied to the lifetime of @dev. + * Software nodes created with this function should not be reused or shared + * because of that. The function takes a deep copy of @properties for the + * software node. + * + * Since the new software node is assigned directly to @dev, and since it should + * not be shared, it is not returned to the caller. The function returns 0 on + * success, and errno in case of an error. + */ +int device_create_managed_software_node(struct device *dev, + const struct property_entry *properties, + const struct software_node *parent) +{ + struct fwnode_handle *p = software_node_fwnode(parent); + struct fwnode_handle *fwnode; + + if (parent && !p) + return -EINVAL; + + fwnode = fwnode_create_software_node(properties, p); + if (IS_ERR(fwnode)) + return PTR_ERR(fwnode); + + to_swnode(fwnode)->managed = true; + set_secondary_fwnode(dev, fwnode); + + return 0; +} +EXPORT_SYMBOL_GPL(device_create_managed_software_node); + int software_node_notify(struct device *dev, unsigned long action) { struct swnode *swnode; @@ -1073,6 +1111,11 @@ int software_node_notify(struct device *dev, unsigned long action) sysfs_remove_link(&swnode->kobj, dev_name(dev)); sysfs_remove_link(&dev->kobj, "software_node"); kobject_put(&swnode->kobj); + + if (swnode->managed) { + set_secondary_fwnode(dev, NULL); + kobject_put(&swnode->kobj); + } break; default: break; diff --git a/include/linux/property.h b/include/linux/property.h index b0e413dc59271..dafccfce02624 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -491,4 +491,8 @@ void fwnode_remove_software_node(struct fwnode_handle *fwnode); int device_add_software_node(struct device *dev, const struct software_node *swnode); void device_remove_software_node(struct device *dev); +int device_create_managed_software_node(struct device *dev, + const struct property_entry *properties, + const struct software_node *parent); + #endif /* _LINUX_PROPERTY_H_ */ From patchwork Tue Feb 2 12:50:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heikki Krogerus X-Patchwork-Id: 374939 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.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 162B9C433DB for ; Tue, 2 Feb 2021 12:52:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CF8C064D5D for ; Tue, 2 Feb 2021 12:52:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231904AbhBBMwh (ORCPT ); Tue, 2 Feb 2021 07:52:37 -0500 Received: from mga14.intel.com ([192.55.52.115]:18029 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231871AbhBBMw2 (ORCPT ); Tue, 2 Feb 2021 07:52:28 -0500 IronPort-SDR: /wswufZ2c1E86tjlDoaYKyr86mf10L/1VVlD9oKDGqZeKgfSJuWqmQp8qVukF1EWYFjpKM5s42 SrubWY/dg6mQ== X-IronPort-AV: E=McAfee;i="6000,8403,9882"; a="180070661" X-IronPort-AV: E=Sophos;i="5.79,395,1602572400"; d="scan'208";a="180070661" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2021 04:50:40 -0800 IronPort-SDR: agwwjJf6t0BxqDb2VbgzURav+FfrROhLcSIy6nswAi2QwtP62RqJIhnV0uIzHw50ruplkL2Wew y3XByFX9NYDQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,395,1602572400"; d="scan'208";a="479741030" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 02 Feb 2021 04:50:37 -0800 From: Heikki Krogerus To: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" , Andy Shevchenko , Felipe Balbi , Mathias Nyman , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Minas Harutyunyan Subject: [PATCH 2/6] usb: dwc2: pci: Drop the empty quirk function Date: Tue, 2 Feb 2021 15:50:28 +0300 Message-Id: <20210202125032.64982-3-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210202125032.64982-1-heikki.krogerus@linux.intel.com> References: <20210202125032.64982-1-heikki.krogerus@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The function dwc2_pci_quirks() does nothing. Removing. Signed-off-by: Heikki Krogerus Cc: Minas Harutyunyan --- drivers/usb/dwc2/pci.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/drivers/usb/dwc2/pci.c b/drivers/usb/dwc2/pci.c index 7afc10872f1f0..0000151e3ca96 100644 --- a/drivers/usb/dwc2/pci.c +++ b/drivers/usb/dwc2/pci.c @@ -63,20 +63,6 @@ struct dwc2_pci_glue { struct platform_device *phy; }; -static int dwc2_pci_quirks(struct pci_dev *pdev, struct platform_device *dwc2) -{ - if (pdev->vendor == PCI_VENDOR_ID_SYNOPSYS && - pdev->device == PCI_PRODUCT_ID_HAPS_HSOTG) { - struct property_entry properties[] = { - { }, - }; - - return platform_device_add_properties(dwc2, properties); - } - - return 0; -} - /** * dwc2_pci_probe() - Provides the cleanup entry points for the DWC_otg PCI * driver @@ -143,10 +129,6 @@ static int dwc2_pci_probe(struct pci_dev *pci, dwc2->dev.parent = dev; - ret = dwc2_pci_quirks(pci, dwc2); - if (ret) - goto err; - glue = devm_kzalloc(dev, sizeof(*glue), GFP_KERNEL); if (!glue) { ret = -ENOMEM; From patchwork Tue Feb 2 12:50:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heikki Krogerus X-Patchwork-Id: 375775 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.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, 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 0E8CAC433DB for ; Tue, 2 Feb 2021 12:53:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D429F64F4E for ; Tue, 2 Feb 2021 12:53:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231812AbhBBMxr (ORCPT ); Tue, 2 Feb 2021 07:53:47 -0500 Received: from mga14.intel.com ([192.55.52.115]:18020 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230499AbhBBMxm (ORCPT ); Tue, 2 Feb 2021 07:53:42 -0500 IronPort-SDR: XSPcDy+VFKmjoVfF4hmNjDn8Q1ZyUXwHKqGcw+pPq1xAm2jMnGW6WvFl1dmeDFllDzNdbk0FE0 3m8aI9aOk6UQ== X-IronPort-AV: E=McAfee;i="6000,8403,9882"; a="180070665" X-IronPort-AV: E=Sophos;i="5.79,395,1602572400"; d="scan'208";a="180070665" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2021 04:50:42 -0800 IronPort-SDR: 4C25tBqAZLmxJskvaOnYxprVRBMu06DXhiX1RIG9KjYQXMWYvz/uah29/LE84XffqDjQf8jJ8v ow/G/KYLR0iw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,395,1602572400"; d="scan'208";a="479741040" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 02 Feb 2021 04:50:40 -0800 From: Heikki Krogerus To: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" , Andy Shevchenko , Felipe Balbi , Mathias Nyman , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: [PATCH 3/6] usb: dwc3: haps: Constify the software node Date: Tue, 2 Feb 2021 15:50:29 +0300 Message-Id: <20210202125032.64982-4-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210202125032.64982-1-heikki.krogerus@linux.intel.com> References: <20210202125032.64982-1-heikki.krogerus@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org What platform_device_add_properties() does is it allocates dynamically a software node that will contain the device properties supplied to it, and then couples that node with the device. Since that node is always created, it might as well be constant. Signed-off-by: Heikki Krogerus --- drivers/usb/dwc3/dwc3-haps.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/dwc3-haps.c b/drivers/usb/dwc3/dwc3-haps.c index 55b4a901168e8..a0f046855a233 100644 --- a/drivers/usb/dwc3/dwc3-haps.c +++ b/drivers/usb/dwc3/dwc3-haps.c @@ -33,6 +33,10 @@ static const struct property_entry initial_properties[] = { { }, }; +static const struct software_node dwc3_haps_swnode = { + .properties = initial_properties, +}; + static int dwc3_haps_probe(struct pci_dev *pci, const struct pci_device_id *id) { @@ -77,7 +81,7 @@ static int dwc3_haps_probe(struct pci_dev *pci, dwc->pci = pci; dwc->dwc3->dev.parent = dev; - ret = platform_device_add_properties(dwc->dwc3, initial_properties); + ret = device_add_software_node(&dwc->dwc3->dev, dwc3_haps_swnode); if (ret) goto err; @@ -91,6 +95,7 @@ static int dwc3_haps_probe(struct pci_dev *pci, return 0; err: + device_remove_software_node(&dwc->dwc3->dev); platform_device_put(dwc->dwc3); return ret; } @@ -99,6 +104,7 @@ static void dwc3_haps_remove(struct pci_dev *pci) { struct dwc3_haps *dwc = pci_get_drvdata(pci); + device_remove_software_node(&dwc->dwc3->dev); platform_device_unregister(dwc->dwc3); } From patchwork Tue Feb 2 12:50:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heikki Krogerus X-Patchwork-Id: 375774 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.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, 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 CC690C433DB for ; Tue, 2 Feb 2021 12:54:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 94CD864F49 for ; Tue, 2 Feb 2021 12:54:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232007AbhBBMxv (ORCPT ); Tue, 2 Feb 2021 07:53:51 -0500 Received: from mga14.intel.com ([192.55.52.115]:18026 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231837AbhBBMxs (ORCPT ); Tue, 2 Feb 2021 07:53:48 -0500 IronPort-SDR: 3BNRDMbW8RAdWlqEpL40uy5BgycRDlMxbhtFCinkUgZj/oqJia5uOSmlz/n3+S8u+CXKKoypah CbOc8c8B9gRA== X-IronPort-AV: E=McAfee;i="6000,8403,9882"; a="180070672" X-IronPort-AV: E=Sophos;i="5.79,395,1602572400"; d="scan'208";a="180070672" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2021 04:50:44 -0800 IronPort-SDR: mZQQ5GpJPX1pPXqnd9J1UPb4fM5//lPFCsG8eKuJ0SMvnsn9Cgf8jQ7KQ2BYD+LEPPEcBl14aP yXWrfTKd64yg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,395,1602572400"; d="scan'208";a="479741051" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 02 Feb 2021 04:50:42 -0800 From: Heikki Krogerus To: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" , Andy Shevchenko , Felipe Balbi , Mathias Nyman , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: [PATCH 4/6] usb: dwc3: qcom: Constify the software node Date: Tue, 2 Feb 2021 15:50:30 +0300 Message-Id: <20210202125032.64982-5-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210202125032.64982-1-heikki.krogerus@linux.intel.com> References: <20210202125032.64982-1-heikki.krogerus@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org What platform_device_add_properties() does is it allocates dynamically a software node that will contain the device properties supplied to it, and then couples that node with the device. If the properties are constant, the node can be constant as well. Signed-off-by: Heikki Krogerus --- drivers/usb/dwc3/dwc3-qcom.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c index d803ee98c628e..d857d6c160a66 100644 --- a/drivers/usb/dwc3/dwc3-qcom.c +++ b/drivers/usb/dwc3/dwc3-qcom.c @@ -567,6 +567,10 @@ static const struct property_entry dwc3_qcom_acpi_properties[] = { {} }; +static const struct software_node dwc3_qcom_swnode = { + .properties = dwc3_qcom_acpi_properties, +}; + static int dwc3_qcom_acpi_register_core(struct platform_device *pdev) { struct dwc3_qcom *qcom = platform_get_drvdata(pdev); @@ -613,16 +617,17 @@ static int dwc3_qcom_acpi_register_core(struct platform_device *pdev) goto out; } - ret = platform_device_add_properties(qcom->dwc3, - dwc3_qcom_acpi_properties); + ret = device_add_software_node(&qcom->dwc3->dev, dwc3_qcom_swnode); if (ret < 0) { dev_err(&pdev->dev, "failed to add properties\n"); goto out; } ret = platform_device_add(qcom->dwc3); - if (ret) + if (ret) { dev_err(&pdev->dev, "failed to add device\n"); + device_remove_software_node(&qcom->dwc3->dev); + } out: kfree(child_res); @@ -837,6 +842,7 @@ static int dwc3_qcom_remove(struct platform_device *pdev) struct device *dev = &pdev->dev; int i; + device_remove_software_node(&qcom->dwc3->dev); of_platform_depopulate(dev); for (i = qcom->num_clocks - 1; i >= 0; i--) { From patchwork Tue Feb 2 12:50:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heikki Krogerus X-Patchwork-Id: 374938 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.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, 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 AE17BC433E0 for ; Tue, 2 Feb 2021 12:54:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7A1DA64D5D for ; Tue, 2 Feb 2021 12:54:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231682AbhBBMx5 (ORCPT ); Tue, 2 Feb 2021 07:53:57 -0500 Received: from mga14.intel.com ([192.55.52.115]:18029 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232020AbhBBMxv (ORCPT ); Tue, 2 Feb 2021 07:53:51 -0500 IronPort-SDR: DABEPmuPdakQ1XFd+KhttUfrTSKt8PinbbfU+qGZpQLA41NRWAjQUoV6igO9gyzQD6WYSqqaJF JY/8VrPA5q3A== X-IronPort-AV: E=McAfee;i="6000,8403,9882"; a="180070676" X-IronPort-AV: E=Sophos;i="5.79,395,1602572400"; d="scan'208";a="180070676" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2021 04:50:46 -0800 IronPort-SDR: 2eEglJnb8wDHlnYhhDR0k0yjMX0lopiO2Fj6taPtdPz74MsolW2dNLFnlufZVNvvT6cm9hYoxD 9r9o74M0cuDw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,395,1602572400"; d="scan'208";a="479741067" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 02 Feb 2021 04:50:44 -0800 From: Heikki Krogerus To: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" , Andy Shevchenko , Felipe Balbi , Mathias Nyman , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: [PATCH 5/6] usb: dwc3: host: Use software node API with the properties Date: Tue, 2 Feb 2021 15:50:31 +0300 Message-Id: <20210202125032.64982-6-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210202125032.64982-1-heikki.krogerus@linux.intel.com> References: <20210202125032.64982-1-heikki.krogerus@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org This replaces the platform_device_add_properties() call with the safer device_create_managed_software_node() that does exactly the same, but can also guarantee that the lifetime of the node that is created for the device is tied to the lifetime of device itself. Signed-off-by: Heikki Krogerus --- drivers/usb/dwc3/host.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c index e195176580de1..f29a264635aa1 100644 --- a/drivers/usb/dwc3/host.c +++ b/drivers/usb/dwc3/host.c @@ -108,7 +108,7 @@ int dwc3_host_init(struct dwc3 *dwc) props[prop_idx++] = PROPERTY_ENTRY_BOOL("quirk-broken-port-ped"); if (prop_idx) { - ret = platform_device_add_properties(xhci, props); + ret = device_create_managed_software_node(&xhci->dev, props, NULL); if (ret) { dev_err(dwc->dev, "failed to add properties to xHCI\n"); goto err; From patchwork Tue Feb 2 12:50:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heikki Krogerus X-Patchwork-Id: 374937 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.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, 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 4DE3CC433E0 for ; Tue, 2 Feb 2021 12:55:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0C43064D5D for ; Tue, 2 Feb 2021 12:55:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232085AbhBBMzJ (ORCPT ); Tue, 2 Feb 2021 07:55:09 -0500 Received: from mga14.intel.com ([192.55.52.115]:18020 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231440AbhBBMzE (ORCPT ); Tue, 2 Feb 2021 07:55:04 -0500 IronPort-SDR: SmiV3Ato3TEnSWhLuFBrbIo3ihCta/3CsGHmJIRH7fQVhsZrzDCuNuE67TESwzjPWiDN/5fOlW E/WVzD8U0cXg== X-IronPort-AV: E=McAfee;i="6000,8403,9882"; a="180070681" X-IronPort-AV: E=Sophos;i="5.79,395,1602572400"; d="scan'208";a="180070681" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2021 04:50:49 -0800 IronPort-SDR: mGQ99TRADPBJKpiD16D4D0VC5YbOwjnlFe1yUNcWUTJGmLb0Wg+P/8QezN5fD5k+5CU0Tm+s3Z 7D08CJ86D3fA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,395,1602572400"; d="scan'208";a="479741082" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 02 Feb 2021 04:50:47 -0800 From: Heikki Krogerus To: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" , Andy Shevchenko , Felipe Balbi , Mathias Nyman , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Hans de Goede Subject: [PATCH 6/6] xhci: ext-caps: Use software node API with the properties Date: Tue, 2 Feb 2021 15:50:32 +0300 Message-Id: <20210202125032.64982-7-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210202125032.64982-1-heikki.krogerus@linux.intel.com> References: <20210202125032.64982-1-heikki.krogerus@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org This replaces the platform_device_add_properties() call with the safer device_create_managed_software_node() that does exactly the same, but can also guarantee that the lifetime of the node that is created for the device is tied to the lifetime of device itself. Signed-off-by: Heikki Krogerus Cc: Hans de Goede Reviewed-by: Hans de Goede --- drivers/usb/host/xhci-ext-caps.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-ext-caps.c b/drivers/usb/host/xhci-ext-caps.c index 3351d07c431f1..7a4c2c4ad50e8 100644 --- a/drivers/usb/host/xhci-ext-caps.c +++ b/drivers/usb/host/xhci-ext-caps.c @@ -54,7 +54,8 @@ static int xhci_create_intel_xhci_sw_pdev(struct xhci_hcd *xhci, u32 cap_offset) } if (pci->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI) { - ret = platform_device_add_properties(pdev, role_switch_props); + ret = device_create_managed_software_node(&pdev->dev, role_switch_props, + NULL); if (ret) { dev_err(dev, "failed to register device properties\n"); platform_device_put(pdev);