clk: tegra: Support unique names for multi-socket platforms
Subsystems (3)
Jon Hunter
maintainerPATCH 1/1 clk: tegra: Support unique names for multi-socket platforms
On multi-socket platforms each socket has its own BPMP which exposes the same clock names. Fix this by appending the NUMA ID as suffix to the clock names for multi-socket platforms.
Use 'sizeof(info->name)' in the strscpy() and snprintf() functions to future proof against anyone changing the size of the 'name' array.
--- drivers/clk/tegra/clk-bpmp.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/clk/tegra/clk-bpmp.c +9 -1
@@ -367,7 +367,15 @@ static int tegra_bpmp_clk_get_info(struct tegra_bpmp *bpmp, unsigned int id,if (err <0 )return err; -strscpy (info->name, response.name,MRQ_CLK_NAME_MAXLEN ); +if (dev_to_node (bpmp->dev) ==NUMA_NO_NODE ) { +strscpy (info->name, response.name,sizeof (info->name)); + }else { + err =snprintf (info->name,sizeof (info->name),"%s.%d" , + response.name,dev_to_node (bpmp->dev)); +if (WARN_ON (err >=sizeof (info->name))) +return -E2BIG ; + } + info->num_parents = response.num_parents;for (i =0 ; i < info->num_parents; i++)
Signature · 1 line
2.43.0
Quoted 10 lines · Jon Hunter
On multi-socket platforms each socket has its own BPMP which exposes the same clock names. Fix this by appending the NUMA ID as suffix to the clock names for multi-socket platforms.
Use '
sizeof(info->name)' in thestrscpy()andsnprintf()functions to future proof against anyone changing the size of the 'name' array.Co-developed-by Timo Alho <[email protected]>Signed-off-by Timo Alho <[email protected]>Signed-off-by Jon Hunter <[email protected]>
Jon Hunter
maintainerQuoted 25 lines · Jon Hunter
On multi-socket platforms each socket has its own BPMP which exposes the same clock names. Fix this by appending the NUMA ID as suffix to the clock names for multi-socket platforms.
Use '
sizeof(info->name)' in thestrscpy()andsnprintf()functions to future proof against anyone changing the size of the 'name' array.Co-developed-by Timo Alho <[email protected]>Signed-off-by Timo Alho <[email protected]>Signed-off-by Jon Hunter <[email protected]>--- drivers/clk/tegra/clk-bpmp.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)drivers/clk/tegra/clk-bpmp.c +2
-1@@ -367,7 +367,15 @@ static int tegra_bpmp_clk_get_info(struct tegra_bpmp *bpmp, unsigned int id,if (err <0 )return err; -strscpy (info->name, response.name,MRQ_CLK_NAME_MAXLEN ); +if (dev_to_node (bpmp->dev) ==NUMA_NO_NODE ) { +strscpy (info->name, response.name,sizeof (info->name));
drivers/clk/tegra/clk-bpmp.c static int tegra_bpmp_clk_get_info(struct tegra_bpmp *bpmp, unsigned int id, · line 381
Quoted 10 lines
drivers/clk/tegra/clk-bpmp.c +7
-0+ }else { + err =snprintf (info->name,sizeof (info->name),"%s.%d" , + response.name,dev_to_node (bpmp->dev)); +if (WARN_ON (err >=sizeof (info->name))) +return -E2BIG ; + } + info->num_parents = response.num_parents;for (i =0 ; i < info->num_parents; i++)
Thierry commented on a similar patch [0] that his preference is to prefix the NUMA ID rather than append because this is more hierarchical. We agreed that we should be consistent in our approach and do the same here. I will send a V2 with this change.
Jon
[0] https://lore.kernel.org/linux-tegra/ahmsDANt8D7RSYdK@orome/T/#t
Signature · 1 line
nvpublic