diff mbox series

[6/6] xhci: ext-caps: Use software node API with the properties

Message ID 20210202125032.64982-7-heikki.krogerus@linux.intel.com
State Superseded
Headers show
Series usb: Handle device properties with software node API | expand

Commit Message

Heikki Krogerus Feb. 2, 2021, 12:50 p.m. UTC
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 <heikki.krogerus@linux.intel.com>
Cc: Hans de Goede <hdegoede@redhat.com>
---
 drivers/usb/host/xhci-ext-caps.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Hans de Goede Feb. 2, 2021, 1:53 p.m. UTC | #1
Hi,

On 2/2/21 1:50 PM, Heikki Krogerus wrote:
> 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 <heikki.krogerus@linux.intel.com>
> Cc: Hans de Goede <hdegoede@redhat.com>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans



> ---
>  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);
>
diff mbox series

Patch

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);