diff mbox series

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

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

Commit Message

J. 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).

Fixes: 631c53478973d ("clk: Add CLPS711X clk driver")
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
---

v3:
- no changes

v2:
- Add Fixes tag
---
 drivers/clk/clk-clps711x.c | 2 ++
 1 file changed, 2 insertions(+)

--
2.34.1

Comments

Philippe Mathieu-Daudé Feb. 5, 2022, 12:13 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).
> 
> Fixes: 631c53478973d ("clk: Add CLPS711X clk driver")
> Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
> ---
> 
> v3:
> - no changes
> 
> v2:
> - Add Fixes tag
> ---
>   drivers/clk/clk-clps711x.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/clk/clk-clps711x.c b/drivers/clk/clk-clps711x.c
> index a2c6486ef1708..d96d96c8752c7 100644
> --- a/drivers/clk/clk-clps711x.c
> +++ b/drivers/clk/clk-clps711x.c
> @@ -28,11 +28,13 @@ static const struct clk_div_table spi_div_table[] = {
>   	{ .val = 1, .div = 8, },
>   	{ .val = 2, .div = 2, },
>   	{ .val = 3, .div = 1, },
> +	{}

Why not use the same style on all patches? Others developers looking
at this code will directly grab this is a sentinel section, instead of
wondering why this empty section is here.

         { /* sentinel */ }

Anyhow the patch logic is correct, so:
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

>   };
> 
>   static const struct clk_div_table timer_div_table[] = {
>   	{ .val = 0, .div = 256, },
>   	{ .val = 1, .div = 1, },
> +	{}

(same comment)

>   };
> 
>   struct clps711x_clk {
> --
> 2.34.1
>
J. Neuschäfer Feb. 5, 2022, 1:07 p.m. UTC | #2
On Sat, Feb 05, 2022 at 01:13:00PM +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).
> > 
> > Fixes: 631c53478973d ("clk: Add CLPS711X clk driver")
> > Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
> > ---
> > 
> > v3:
> > - no changes
> > 
> > v2:
> > - Add Fixes tag
> > ---
> >   drivers/clk/clk-clps711x.c | 2 ++
> >   1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/clk/clk-clps711x.c b/drivers/clk/clk-clps711x.c
> > index a2c6486ef1708..d96d96c8752c7 100644
> > --- a/drivers/clk/clk-clps711x.c
> > +++ b/drivers/clk/clk-clps711x.c
> > @@ -28,11 +28,13 @@ static const struct clk_div_table spi_div_table[] = {
> >   	{ .val = 1, .div = 8, },
> >   	{ .val = 2, .div = 2, },
> >   	{ .val = 3, .div = 1, },
> > +	{}
> 
> Why not use the same style on all patches? Others developers looking
> at this code will directly grab this is a sentinel section, instead of
> wondering why this empty section is here.
> 
>         { /* sentinel */ }

I found the {} style sufficient.
But ok, I'll go with { /* sentinel */ } now.

> 
> Anyhow the patch logic is correct, so:
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Thanks!

Jonathan
diff mbox series

Patch

diff --git a/drivers/clk/clk-clps711x.c b/drivers/clk/clk-clps711x.c
index a2c6486ef1708..d96d96c8752c7 100644
--- a/drivers/clk/clk-clps711x.c
+++ b/drivers/clk/clk-clps711x.c
@@ -28,11 +28,13 @@  static const struct clk_div_table spi_div_table[] = {
 	{ .val = 1, .div = 8, },
 	{ .val = 2, .div = 2, },
 	{ .val = 3, .div = 1, },
+	{}
 };

 static const struct clk_div_table timer_div_table[] = {
 	{ .val = 0, .div = 256, },
 	{ .val = 1, .div = 1, },
+	{}
 };

 struct clps711x_clk {