diff mbox series

[v3,1/4] clk: actions: Terminate clk_div_table with sentinel element

Message ID 20220205005232.772726-2-j.neuschaefer@gmx.net (mailing list archive)
State New, archived
Headers show
Series clk drivers: Terminate clk_div_table with sentinel element | expand

Commit Message

Jonathan Neuschäfer Feb. 5, 2022, 12:52 a.m. UTC
In order that the end of a clk_div_table can be detected, it must be
terminated with a sentinel element (.div = 0).

In owl-s900.s, the { 0, 8 } element was probably meant to be just that,
so this patch changes { 0, 8 } to { 0, 0 }.

Fixes: d47317ca4ade1 ("clk: actions: Add S700 SoC clock support")
Fixes: d85d20053e195 ("clk: actions: Add S900 SoC clock support")
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
---

v3:
- Interpret { 0, 8 } as a typo of { 0, 0 }, the sentinel element
- Add R-b tag

v2:
- Add Fixes tags
---
 drivers/clk/actions/owl-s700.c | 1 +
 drivers/clk/actions/owl-s900.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

--
2.34.1

Comments

Philippe Mathieu-Daudé Feb. 5, 2022, 12:15 p.m. UTC | #1
On 5/2/22 01:52, Jonathan Neuschäfer wrote:
> In order that the end of a clk_div_table can be detected, it must be
> terminated with a sentinel element (.div = 0).
> 
> In owl-s900.s, the { 0, 8 } element was probably meant to be just that,
> so this patch changes { 0, 8 } to { 0, 0 }.
> 
> Fixes: d47317ca4ade1 ("clk: actions: Add S700 SoC clock support")
> Fixes: d85d20053e195 ("clk: actions: Add S900 SoC clock support")
> Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
> Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
> ---
> 
> v3:
> - Interpret { 0, 8 } as a typo of { 0, 0 }, the sentinel element
> - Add R-b tag
> 
> v2:
> - Add Fixes tags
> ---
>   drivers/clk/actions/owl-s700.c | 1 +
>   drivers/clk/actions/owl-s900.c | 2 +-
>   2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/actions/owl-s700.c b/drivers/clk/actions/owl-s700.c
> index a2f34d13fb543..617174644f728 100644
> --- a/drivers/clk/actions/owl-s700.c
> +++ b/drivers/clk/actions/owl-s700.c
> @@ -162,6 +162,7 @@ static struct clk_div_table hdmia_div_table[] = {
> 
>   static struct clk_div_table rmii_div_table[] = {
>   	{0, 4},   {1, 10},
> +	{0, 0},

Again, clearer to use:

         { /* sentinel */ }

(without the trailing comma, to enforce this is the last entry).

>   };
> 
>   /* divider clocks */
> diff --git a/drivers/clk/actions/owl-s900.c b/drivers/clk/actions/owl-s900.c
> index 790890978424a..63c4097c07ac7 100644
> --- a/drivers/clk/actions/owl-s900.c
> +++ b/drivers/clk/actions/owl-s900.c
> @@ -140,7 +140,7 @@ static struct clk_div_table rmii_ref_div_table[] = {
> 
>   static struct clk_div_table usb3_mac_div_table[] = {
>   	{ 1, 2 }, { 2, 3 }, { 3, 4 },
> -	{ 0, 8 },
> +	{ 0, 0 },
>   };
> 
>   static struct clk_div_table i2s_div_table[] = {
> --
> 2.34.1
>
Jonathan Neuschäfer Feb. 5, 2022, 12:58 p.m. UTC | #2
On Sat, Feb 05, 2022 at 01:15:46PM +0100, Philippe Mathieu-Daudé wrote:
> On 5/2/22 01:52, Jonathan Neuschäfer wrote:
> > In order that the end of a clk_div_table can be detected, it must be
> > terminated with a sentinel element (.div = 0).
> > 
> > In owl-s900.s, the { 0, 8 } element was probably meant to be just that,
> > so this patch changes { 0, 8 } to { 0, 0 }.
> > 
> > Fixes: d47317ca4ade1 ("clk: actions: Add S700 SoC clock support")
> > Fixes: d85d20053e195 ("clk: actions: Add S900 SoC clock support")
> > Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
> > Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
> > ---
[...]
> >   static struct clk_div_table rmii_div_table[] = {
> >   	{0, 4},   {1, 10},
> > +	{0, 0},
> 
> Again, clearer to use:
> 
>         { /* sentinel */ }
> 
> (without the trailing comma, to enforce this is the last entry).

This style is locally consistent in the file, so anyone who reads the
file will encounter { 0, 0 } elements anyway.

So, I think it makes sense to:

- Keep this patch as is (except for the trailing comma, I'll remove that)
- Add a second patch that replaces all the sentinel elements with
  { /* sentinel */ }

This patch can go into stable branches, and the style cleanup doesn't
have to.


Best regards,
Jonathan
diff mbox series

Patch

diff --git a/drivers/clk/actions/owl-s700.c b/drivers/clk/actions/owl-s700.c
index a2f34d13fb543..617174644f728 100644
--- a/drivers/clk/actions/owl-s700.c
+++ b/drivers/clk/actions/owl-s700.c
@@ -162,6 +162,7 @@  static struct clk_div_table hdmia_div_table[] = {

 static struct clk_div_table rmii_div_table[] = {
 	{0, 4},   {1, 10},
+	{0, 0},
 };

 /* divider clocks */
diff --git a/drivers/clk/actions/owl-s900.c b/drivers/clk/actions/owl-s900.c
index 790890978424a..63c4097c07ac7 100644
--- a/drivers/clk/actions/owl-s900.c
+++ b/drivers/clk/actions/owl-s900.c
@@ -140,7 +140,7 @@  static struct clk_div_table rmii_ref_div_table[] = {

 static struct clk_div_table usb3_mac_div_table[] = {
 	{ 1, 2 }, { 2, 3 }, { 3, 4 },
-	{ 0, 8 },
+	{ 0, 0 },
 };

 static struct clk_div_table i2s_div_table[] = {