Re: [PATCH v2] clk: check parent_name in clk_register to avoid confusing log_error() output

2023-12-15 Thread Sean Anderson
On Sat, 11 Nov 2023 03:19:52 +0800, Yang Xiwen wrote:
> For some gate clocks and fixed clocks without a parent, calling
> clk_register will print an useless error message indicating that parent
> is missing. Fix that by gaurding log_xxx() with an if-statement.
> 
> 

Applied, thanks!

[1/1] clk: check parent_name in clk_register to avoid confusing log_error() 
output
  https://source.denx.de/u-boot/custodians/u-boot-clk/-/commit/09844d0de555

Best regards,
-- 
Sean Anderson 


Re: [PATCH v2] clk: check parent_name in clk_register to avoid confusing log_error() output

2023-11-13 Thread Sean Anderson




On 11/10/23 14:19, Yang Xiwen via B4 Relay wrote:

From: Yang Xiwen 

For some gate clocks and fixed clocks without a parent, calling
clk_register will print an useless error message indicating that parent
is missing. Fix that by gaurding log_xxx() with an if-statement.

Signed-off-by: Yang Xiwen 
Suggested-by: Sean Anderson 
---
It's found during my development for HiSilicon clock driver.
---
Changes in v2:
- drop the commit which exports clk_mux_register.
- drop the commit which is already merged
- drop ccf enable_count fix as it'll be in another patchset
- use Anderson's patch for clk_register()
- Link to v1: 
https://lore.kernel.org/r/20230809-clk-fix-v1-0-808dbae54...@outlook.com
---
  drivers/clk/clk.c | 18 ++
  1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index a5a3461b66..6ede1b4d4d 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -18,17 +18,19 @@
  int clk_register(struct clk *clk, const char *drv_name,
 const char *name, const char *parent_name)
  {
-   struct udevice *parent;
+   struct udevice *parent = NULL;
struct driver *drv;
int ret;
  
-	ret = uclass_get_device_by_name(UCLASS_CLK, parent_name, );

-   if (ret) {
-   log_err("%s: failed to get %s device (parent of %s)\n",
-   __func__, parent_name, name);
-   } else {
-   log_debug("%s: name: %s parent: %s [0x%p]\n", __func__, name,
- parent->name, parent);
+   if (parent_name) {
+   ret = uclass_get_device_by_name(UCLASS_CLK, parent_name, 
);
+   if (ret) {
+   log_err("%s: failed to get %s device (parent of %s)\n",
+   __func__, parent_name, name);
+   } else {
+   log_debug("%s: name: %s parent: %s [0x%p]\n", __func__, 
name,
+ parent->name, parent);
+   }
}
  
  	drv = lists_driver_lookup_name(drv_name);


---
base-commit: 580eb31199be8a822e62f20965854a242f895d03
change-id: 20230807-clk-fix-17e895f79817

Best regards,



Reviewed-by: Sean Anderson 


[PATCH v2] clk: check parent_name in clk_register to avoid confusing log_error() output

2023-11-10 Thread Yang Xiwen via B4 Relay
From: Yang Xiwen 

For some gate clocks and fixed clocks without a parent, calling
clk_register will print an useless error message indicating that parent
is missing. Fix that by gaurding log_xxx() with an if-statement.

Signed-off-by: Yang Xiwen 
Suggested-by: Sean Anderson 
---
It's found during my development for HiSilicon clock driver.
---
Changes in v2:
- drop the commit which exports clk_mux_register.
- drop the commit which is already merged
- drop ccf enable_count fix as it'll be in another patchset
- use Anderson's patch for clk_register()
- Link to v1: 
https://lore.kernel.org/r/20230809-clk-fix-v1-0-808dbae54...@outlook.com
---
 drivers/clk/clk.c | 18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index a5a3461b66..6ede1b4d4d 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -18,17 +18,19 @@
 int clk_register(struct clk *clk, const char *drv_name,
 const char *name, const char *parent_name)
 {
-   struct udevice *parent;
+   struct udevice *parent = NULL;
struct driver *drv;
int ret;
 
-   ret = uclass_get_device_by_name(UCLASS_CLK, parent_name, );
-   if (ret) {
-   log_err("%s: failed to get %s device (parent of %s)\n",
-   __func__, parent_name, name);
-   } else {
-   log_debug("%s: name: %s parent: %s [0x%p]\n", __func__, name,
- parent->name, parent);
+   if (parent_name) {
+   ret = uclass_get_device_by_name(UCLASS_CLK, parent_name, 
);
+   if (ret) {
+   log_err("%s: failed to get %s device (parent of %s)\n",
+   __func__, parent_name, name);
+   } else {
+   log_debug("%s: name: %s parent: %s [0x%p]\n", __func__, 
name,
+ parent->name, parent);
+   }
}
 
drv = lists_driver_lookup_name(drv_name);

---
base-commit: 580eb31199be8a822e62f20965854a242f895d03
change-id: 20230807-clk-fix-17e895f79817

Best regards,
-- 
Yang Xiwen