From patchwork Thu Feb 4 14:17:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heikki Krogerus X-Patchwork-Id: 377392 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 86B88C433DB for ; Thu, 4 Feb 2021 14:33:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5972F64EE2 for ; Thu, 4 Feb 2021 14:33:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236782AbhBDOdR (ORCPT ); Thu, 4 Feb 2021 09:33:17 -0500 Received: from mga12.intel.com ([192.55.52.136]:58192 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236325AbhBDOTD (ORCPT ); Thu, 4 Feb 2021 09:19:03 -0500 IronPort-SDR: cfwwAo2DB4TAIOk7dlxkHe2bUND38S+alK4PFmJfLZTyYKapoql0lHK9bY57DrFTu9+UBiM0ij PV8O6uCqeYLQ== X-IronPort-AV: E=McAfee;i="6000,8403,9884"; a="160410019" X-IronPort-AV: E=Sophos;i="5.79,401,1602572400"; d="scan'208";a="160410019" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2021 06:17:16 -0800 IronPort-SDR: FBT2e1cjyNUYtzsMdvbXqjXXDbVdJwDTEYfDHzvFnIpLlMsSKEGXf3oPffZRPGNRUb92y755oJ Eds9lUBiK60Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,401,1602572400"; d="scan'208";a="483254611" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 04 Feb 2021 06:17:14 -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 v2 1/6] software node: Provide replacement for device_add_properties() Date: Thu, 4 Feb 2021 17:17:06 +0300 Message-Id: <20210204141711.53775-2-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210204141711.53775-1-heikki.krogerus@linux.intel.com> References: <20210204141711.53775-1-heikki.krogerus@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org At the moment the function device_del() is calling device_remove_properties() unconditionally. That will result into the reference count of the software node attached to the device being decremented, and in most cases it will hit 0 at that point. So in practice device_del() will unregister the software node attached to the device, even if that was not the intention of the caller. Right now software nodes can not be reused or shared because of that. So device_del() can not unregister the software nodes unconditionally like that. Unfortunately some of the users of device_add_properties() are now relying on this behaviour. Because of that, and also in general, we do need a function that can offer similar behaviour where the lifetime of the software node is bound to the lifetime of the device. But it just has to be a separate function so the behaviour is optional. We can not remove the device_remove_properties() call from device_del() before we have that new function, and before we have replaced device_add_properties() calls with it in all the places that require that behaviour. This adds function device_create_managed_software_node() that can be used for exactly that purpose. Software nodes created with it are declared "managed", and separate handling for those nodes is added to the software node code. The reference count of the "managed" nodes is decremented when the device they are attached to is removed. This will not affect the other nodes that are not declared "managed". The function device_create_managed_software_node() has also one additional feature that device_add_properties() does not have. It allows the software nodes created with it to be part of a node hierarchy by taking also an optional parent node as parameter. 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 Thu Feb 4 14:17:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heikki Krogerus X-Patchwork-Id: 376677 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 6660DC433DB for ; Thu, 4 Feb 2021 14:32:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 30BB864EE2 for ; Thu, 4 Feb 2021 14:32:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236681AbhBDOcj (ORCPT ); Thu, 4 Feb 2021 09:32:39 -0500 Received: from mga12.intel.com ([192.55.52.136]:58197 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236503AbhBDOTF (ORCPT ); Thu, 4 Feb 2021 09:19:05 -0500 IronPort-SDR: hUpb46HXQQ8Gk+FlZO7PhCMVG/P1vJCe6NubodeqxTZGFyvFlgPJT/TuF6zakesP9uQb3B4f+s ZfdGgf6hoCOQ== X-IronPort-AV: E=McAfee;i="6000,8403,9884"; a="160410025" X-IronPort-AV: E=Sophos;i="5.79,401,1602572400"; d="scan'208";a="160410025" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2021 06:17:18 -0800 IronPort-SDR: 6b6M6f2dibT7wAlXrbOBoJ5nyiOv6umLWdcRaoKfVZXMvdIe4Tjkwr9Hlenka1B+ycaEj9dEnf VVUKxdZ5eQEQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,401,1602572400"; d="scan'208";a="483254618" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 04 Feb 2021 06:17:16 -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 v2 2/6] usb: dwc2: pci: Drop the empty quirk function Date: Thu, 4 Feb 2021 17:17:07 +0300 Message-Id: <20210204141711.53775-3-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210204141711.53775-1-heikki.krogerus@linux.intel.com> References: <20210204141711.53775-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 Thu Feb 4 14:17:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heikki Krogerus X-Patchwork-Id: 377394 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 7C4A5C433E0 for ; Thu, 4 Feb 2021 14:21:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3DBF264F5C for ; Thu, 4 Feb 2021 14:21:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236602AbhBDOUo (ORCPT ); Thu, 4 Feb 2021 09:20:44 -0500 Received: from mga12.intel.com ([192.55.52.136]:58183 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236541AbhBDOUg (ORCPT ); Thu, 4 Feb 2021 09:20:36 -0500 IronPort-SDR: WUA5WBzdYJDNJFKV02UR2m6s8b6hvjbVjw9iIYjaX0/Jewsa4CJ5GItw951qYCxugH2ll6VDKP Efc+HWJfx+VQ== X-IronPort-AV: E=McAfee;i="6000,8403,9884"; a="160410033" X-IronPort-AV: E=Sophos;i="5.79,401,1602572400"; d="scan'208";a="160410033" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2021 06:17:21 -0800 IronPort-SDR: 20PnZ1QU9rRWt9o6zjlZPxy3eeKvzTTwj60c1HUnIINbmtRAre1cshHfUOTQU/U2WU2vxiLOQG L+IBIYzZW+Pg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,401,1602572400"; d="scan'208";a="483254624" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 04 Feb 2021 06:17:18 -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 v2 3/6] usb: dwc3: haps: Constify the software node Date: Thu, 4 Feb 2021 17:17:08 +0300 Message-Id: <20210204141711.53775-4-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210204141711.53775-1-heikki.krogerus@linux.intel.com> References: <20210204141711.53775-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..f6e3817fa7af0 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 Thu Feb 4 14:17:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heikki Krogerus X-Patchwork-Id: 376678 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 97AFBC433E0 for ; Thu, 4 Feb 2021 14:22:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 48EAE64F53 for ; Thu, 4 Feb 2021 14:22:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236660AbhBDOVp (ORCPT ); Thu, 4 Feb 2021 09:21:45 -0500 Received: from mga12.intel.com ([192.55.52.136]:58192 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236527AbhBDOUg (ORCPT ); Thu, 4 Feb 2021 09:20:36 -0500 IronPort-SDR: CpAWxiDkv7AsBmkKjXLEt/8LsUErvqQE7FTbt5N03GEgvOilg/D+cDjneCAMV3w01uJpdDU8+r 8G9b/3u2XvjQ== X-IronPort-AV: E=McAfee;i="6000,8403,9884"; a="160410042" X-IronPort-AV: E=Sophos;i="5.79,401,1602572400"; d="scan'208";a="160410042" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2021 06:17:23 -0800 IronPort-SDR: LR+cMIbx3SmKhSOf4nSNDThOetdVRbcRxUutbrGUBal39uMrfSyJsn4FYd4Bq6Lc8/BvIgFrm4 dCdJvjAso7XQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,401,1602572400"; d="scan'208";a="483254635" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 04 Feb 2021 06:17:21 -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 v2 4/6] usb: dwc3: qcom: Constify the software node Date: Thu, 4 Feb 2021 17:17:09 +0300 Message-Id: <20210204141711.53775-5-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210204141711.53775-1-heikki.krogerus@linux.intel.com> References: <20210204141711.53775-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..846a47be6df7f 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 Thu Feb 4 14:17:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heikki Krogerus X-Patchwork-Id: 376679 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 A619FC433E6 for ; Thu, 4 Feb 2021 14:21:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 57F8864F51 for ; Thu, 4 Feb 2021 14:21:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236626AbhBDOUt (ORCPT ); Thu, 4 Feb 2021 09:20:49 -0500 Received: from mga12.intel.com ([192.55.52.136]:58197 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236545AbhBDOUi (ORCPT ); Thu, 4 Feb 2021 09:20:38 -0500 IronPort-SDR: oMr2BQ4GiffFp3tD82B8MF2LThK7gZ29p28w1K9XKwCGXpWXXyiJn9psQgjzekFDD2Rq1Zg60r lJlawmuwQ6NA== X-IronPort-AV: E=McAfee;i="6000,8403,9884"; a="160410051" X-IronPort-AV: E=Sophos;i="5.79,401,1602572400"; d="scan'208";a="160410051" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2021 06:17:25 -0800 IronPort-SDR: 1oU18j337v1WVmIOAE2WNvfzpIT/G4aftdmIpYAds+5OUcbs7B8mE5iA+Hg2k7L5SJg7xUXX0F Gn5qESGBYbdQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,401,1602572400"; d="scan'208";a="483254639" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 04 Feb 2021 06:17:23 -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 v2 5/6] usb: dwc3: host: Use software node API with the properties Date: Thu, 4 Feb 2021 17:17:10 +0300 Message-Id: <20210204141711.53775-6-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210204141711.53775-1-heikki.krogerus@linux.intel.com> References: <20210204141711.53775-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 Thu Feb 4 14:17:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heikki Krogerus X-Patchwork-Id: 377393 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 4BA18C433E0 for ; Thu, 4 Feb 2021 14:23:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0A03964E4A for ; Thu, 4 Feb 2021 14:23:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236532AbhBDOW2 (ORCPT ); Thu, 4 Feb 2021 09:22:28 -0500 Received: from mga12.intel.com ([192.55.52.136]:58183 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236678AbhBDOWA (ORCPT ); Thu, 4 Feb 2021 09:22:00 -0500 IronPort-SDR: ROWpQx2NDfP1pKgf4WBxwXEdyXCr/URNQ+Z992m6vzplAREUrTC1KRlvotu4A7MUduzLnbyqoC AAO/MzNeW6hA== X-IronPort-AV: E=McAfee;i="6000,8403,9884"; a="160410070" X-IronPort-AV: E=Sophos;i="5.79,401,1602572400"; d="scan'208";a="160410070" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2021 06:17:27 -0800 IronPort-SDR: wbn8oW9ljhi3GNHscqDpHK/2X4DTPFc3AhM9TopNZT0zlR7XleMXKcYF83OnRKSPXkYDZbH+14 XY3EYnowlEjA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,401,1602572400"; d="scan'208";a="483254647" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 04 Feb 2021 06:17:25 -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 v2 6/6] xhci: ext-caps: Use software node API with the properties Date: Thu, 4 Feb 2021 17:17:11 +0300 Message-Id: <20210204141711.53775-7-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210204141711.53775-1-heikki.krogerus@linux.intel.com> References: <20210204141711.53775-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 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);