RE: [PATCH v6 10/11] rtc: isl1208: Add isl1208_set_xtoscb()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Geert,

Thanks for the feedback.

> Subject: Re: [PATCH v6 10/11] rtc: isl1208: Add isl1208_set_xtoscb()
> 
> Hi Biju,
> 
> On Fri, Jun 2, 2023 at 4:25 PM Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
> wrote:
> > As per the HW manual, set the XTOSCB bit as follows:
> >
> > If using an external clock signal, set the XTOSCB bit as 1 to disable
> > the crystal oscillator.
> >
> > If using an external crystal, the XTOSCB bit needs to be set at 0 to
> > enable the crystal oscillator.
> >
> > Add isl1208_set_xtoscb() to set XTOSCB bit based on the clock-names
> > property. Fallback is enabling the internal crystal oscillator.
> >
> > While at it, introduce a variable "sr" for reading the status register
> > in probe() as it is reused for writing.
> >
> > Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
> > Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
> > ---
> > v5->v6:
> >  * Added Rb tag from Geert
> >  * Replaced u8->int for xtosb_val parameter.
> >  * Introduced isl1208_clk_present() for checking the presence of "xin"
> and
> >    "clkin" for determining internal oscillator is enabled or not.
> 
> Thanks for the update!
> 
> > --- a/drivers/rtc/rtc-isl1208.c
> > +++ b/drivers/rtc/rtc-isl1208.c
> > @@ -805,12 +816,33 @@ static int isl1208_setup_irq(struct i2c_client
> *client, int irq)
> >         return rc;
> >  }
> >
> > +static int
> > +isl1208_clk_present(struct i2c_client *client, const char *name) {
> > +       struct clk *clk;
> > +       int ret;
> > +
> > +       clk = devm_clk_get_optional(&client->dev, name);
> > +       if (IS_ERR(clk)) {
> > +               ret = PTR_ERR(clk);
> > +       } else {
> > +               if (!clk)
> 
> What about "else if"? ;-)
> But in this case, you can make the code even simpler (less indented) by
> returning early after each test.
> 
> > +                       ret = 0;
> > +               else
> > +                       ret = 1;
> > +       }
> 
> if (IS_ERR(clk))
>         return PTR_ERR(clk);
> 
> return !!clk;

OK, will change to this logic.

Cheers,
Biju

> 
> > +
> > +       return ret;
> > +}
> > +
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-
> m68k.org
> 
> In personal conversations with technical people, I call myself a hacker.
> But when I'm talking to journalists I just say "programmer" or something
> like that.
>                                 -- Linus Torvalds




[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux