net: wan: framer: Simplify API framer_provider_simple_of_xlate() implementation
Subsystems (3)
PATCH v2 1/1 net: wan: framer: Simplify API framer_provider_simple_of_xlate() implementation
From: Zijun Hu <[email protected]>
Simplify framer_provider_simple_of_xlate() implementation by API class_find_device_by_of_node().
Also correct comments to mark its parameter @dev as unused instead of @args in passing.
---
Changes in v2:
- Use non-error path solution suggested by Simon Horman
- Link to v1: https://lore.kernel.org/r/[email protected]
--- drivers/net/wan/framer/framer-core.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-)
drivers/net/wan/framer/framer-core.c +8 -15
@@ -732,8 +732,8 @@ EXPORT_SYMBOL_GPL(devm_framer_create);/** * framer_provider_simple_of_xlate() - returns the framer instance from framer provider -* @dev: the framer provider device -* @args: of_phandle_args (not used here) +* @dev: the framer provider device (not used here) +* @args: of_phandle_args * * Intended to be used by framer provider for the common case where #framer-cells is * 0. For other cases where #framer-cells is greater than '0', the framer provider
@@ -743,21 +743,14 @@ EXPORT_SYMBOL_GPL(devm_framer_create);struct framer *framer_provider_simple_of_xlate (struct device *dev,const struct of_phandle_args *args) { -struct class_dev_iter iter; -struct framer *framer; - -class_dev_iter_init (&iter, &framer_class,NULL ,NULL ); -while ((dev =class_dev_iter_next (&iter))) { - framer =dev_to_framer (dev); -if (args->np != framer->dev.of_node) -continue ; +struct device *target_dev; -class_dev_iter_exit (&iter); -return framer; - } + target_dev =class_find_device_by_of_node (&framer_class, args->np); +if (!target_dev) +return ERR_PTR (-ENODEV ); -class_dev_iter_exit (&iter); -return ERR_PTR (-ENODEV ); +put_device (target_dev); +return dev_to_framer (target_dev); }EXPORT_SYMBOL_GPL (framer_provider_simple_of_xlate);
---
base-commit: 2c27c7663390d28bc71e97500eb68e0ce2a7223f
change-id: 20241213-net_fix-5c580d48c39c
Best regards,
Signature · 1 line
Zijun Hu <[email protected]>
Quoted 8 lines · Zijun Hu
From: Zijun Hu <[email protected]>
Simplify
framer_provider_simple_of_xlate()implementation by APIclass_find_device_by_of_node().Also correct comments to mark its parameter @dev as unused instead of @args in passing.
Quoted 6 lines
Cc Greg Kroah-Hartman <[email protected]>Signed-off-by Zijun Hu <[email protected]>---
Changes in v2:
- Use non-error path solution suggested by Simon Horman
- Link to v1: https://lore.kernel.org/r/[email protected]
Thanks for the update.
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Fri, 13 Dec 2024 20:09:11 +0800 you wrote:
From: Zijun Hu <[email protected]>
Simplify
framer_provider_simple_of_xlate()implementation by APIclass_find_device_by_of_node().Also correct comments to mark its parameter @dev as unused instead of @args in passing.
[...]
Here is the summary with links:
- [net-next,v2] net: wan: framer: Simplify API framer_provider_simple_of_xlate() implementation
https://git.kernel.org/netdev/net-next/c/dcacb364772e
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html