* [PATCH] thunderbolt: ACPI: Use the helper fwnode_find_reference()
@ 2022-10-19 14:28 Heikki Krogerus
2022-10-19 15:02 ` Heikki Krogerus
0 siblings, 1 reply; 2+ messages in thread
From: Heikki Krogerus @ 2022-10-19 14:28 UTC (permalink / raw)
To: Mika Westerberg
Cc: Andreas Noever, Michael Jamet, Yehezkel Bernat, linux-usb, linux-kernel
Replacing the direct fwnode_property_get_reference_args()
call will this wrapper function.
No functional changes intended.
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
drivers/thunderbolt/acpi.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/drivers/thunderbolt/acpi.c b/drivers/thunderbolt/acpi.c
index 7a8adf5ad5a09..48ac227e6d8a0 100644
--- a/drivers/thunderbolt/acpi.c
+++ b/drivers/thunderbolt/acpi.c
@@ -15,24 +15,17 @@ static acpi_status tb_acpi_add_link(acpi_handle handle, u32 level, void *data,
void **return_value)
{
struct acpi_device *adev = acpi_fetch_acpi_dev(handle);
- struct fwnode_reference_args args;
struct fwnode_handle *fwnode;
struct tb_nhi *nhi = data;
struct pci_dev *pdev;
struct device *dev;
- int ret;
-
- if (!adev)
- return AE_OK;
- fwnode = acpi_fwnode_handle(adev);
- ret = fwnode_property_get_reference_args(fwnode, "usb4-host-interface",
- NULL, 0, 0, &args);
- if (ret)
+ fwnode = fwnode_find_reference(acpi_fwnode_handle(adev), "usb4-host-interface", 0);
+ if (IS_ERR(fwnode))
return AE_OK;
/* It needs to reference this NHI */
- if (dev_fwnode(&nhi->pdev->dev) != args.fwnode)
+ if (dev_fwnode(&nhi->pdev->dev) != fwnode)
goto out_put;
/*
@@ -100,7 +93,7 @@ static acpi_status tb_acpi_add_link(acpi_handle handle, u32 level, void *data,
}
out_put:
- fwnode_handle_put(args.fwnode);
+ fwnode_handle_put(fwnode);
return AE_OK;
}
--
2.35.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] thunderbolt: ACPI: Use the helper fwnode_find_reference()
2022-10-19 14:28 [PATCH] thunderbolt: ACPI: Use the helper fwnode_find_reference() Heikki Krogerus
@ 2022-10-19 15:02 ` Heikki Krogerus
0 siblings, 0 replies; 2+ messages in thread
From: Heikki Krogerus @ 2022-10-19 15:02 UTC (permalink / raw)
To: Mika Westerberg
Cc: Andreas Noever, Michael Jamet, Yehezkel Bernat, linux-usb, linux-kernel
On Wed, Oct 19, 2022 at 05:28:54PM +0300, Heikki Krogerus wrote:
> Replacing the direct fwnode_property_get_reference_args()
> call will this wrapper function.
>
> No functional changes intended.
>
> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> drivers/thunderbolt/acpi.c | 15 ++++-----------
> 1 file changed, 4 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/thunderbolt/acpi.c b/drivers/thunderbolt/acpi.c
> index 7a8adf5ad5a09..48ac227e6d8a0 100644
> --- a/drivers/thunderbolt/acpi.c
> +++ b/drivers/thunderbolt/acpi.c
> @@ -15,24 +15,17 @@ static acpi_status tb_acpi_add_link(acpi_handle handle, u32 level, void *data,
> void **return_value)
> {
> struct acpi_device *adev = acpi_fetch_acpi_dev(handle);
> - struct fwnode_reference_args args;
> struct fwnode_handle *fwnode;
> struct tb_nhi *nhi = data;
> struct pci_dev *pdev;
> struct device *dev;
> - int ret;
> -
> - if (!adev)
> - return AE_OK;
Oh, I'm sorry, I did not mean to remove that check. I'll resend.
> - fwnode = acpi_fwnode_handle(adev);
> - ret = fwnode_property_get_reference_args(fwnode, "usb4-host-interface",
> - NULL, 0, 0, &args);
> - if (ret)
> + fwnode = fwnode_find_reference(acpi_fwnode_handle(adev), "usb4-host-interface", 0);
> + if (IS_ERR(fwnode))
> return AE_OK;
>
> /* It needs to reference this NHI */
> - if (dev_fwnode(&nhi->pdev->dev) != args.fwnode)
> + if (dev_fwnode(&nhi->pdev->dev) != fwnode)
> goto out_put;
>
> /*
> @@ -100,7 +93,7 @@ static acpi_status tb_acpi_add_link(acpi_handle handle, u32 level, void *data,
> }
>
> out_put:
> - fwnode_handle_put(args.fwnode);
> + fwnode_handle_put(fwnode);
> return AE_OK;
> }
>
thanks,
--
heikki
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-10-19 15:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-19 14:28 [PATCH] thunderbolt: ACPI: Use the helper fwnode_find_reference() Heikki Krogerus
2022-10-19 15:02 ` Heikki Krogerus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®