diff mbox series

[2/3] iio: adc: ad7192: Fix internal/external clock selection

Message ID CAPJMGm4YhDNOLku_vWUJA8cYbUinoVoP+NmP4Te+fpa-bjfHfQ@mail.gmail.com (mailing list archive)
State Changes Requested
Headers show
Series iio: adc: ad7192: Functional fixes | expand

Commit Message

Fabrizio Lamarque April 13, 2023, 8:33 a.m. UTC
Fixed wrong selection of internal clock when mclk is defined.

Resolved a logical inversion introduced in c9ec2cb328e3.

Fixes: c9ec2cb328e3 iio: adc: ad7192: use devm_clk_get_optional() for mclk
Signed-off-by: Fabrizio Lamarque <fl.scratchpad@gmail.com>
---
 drivers/iio/adc/ad7192.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Nuno Sá April 13, 2023, 10:04 a.m. UTC | #1
On Thu, 2023-04-13 at 10:33 +0200, Fabrizio Lamarque wrote:
> Fixed wrong selection of internal clock when mclk is defined.
> 
> Resolved a logical inversion introduced in c9ec2cb328e3.
> 
> Fixes: c9ec2cb328e3 iio: adc: ad7192: use devm_clk_get_optional() for mclk

ditto...

> Signed-off-by: Fabrizio Lamarque <fl.scratchpad@gmail.com>
> ---

Reviewed-by: Nuno Sa <nuno.sa@analog.com>
> 
>  drivers/iio/adc/ad7192.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c
> index 94a9cf34a255..5a9c8898f8af 100644
> --- a/drivers/iio/adc/ad7192.c
> +++ b/drivers/iio/adc/ad7192.c
> @@ -367,7 +367,7 @@ static int ad7192_of_clock_select(struct ad7192_state *st)
>      clock_sel = AD7192_CLK_INT;
> 
>      /* use internal clock */
> -    if (st->mclk) {
> +    if (!st->mclk) {
>          if (of_property_read_bool(np, "adi,int-clock-output-enable"))
>              clock_sel = AD7192_CLK_INT_CO;
>      } else {
Jonathan Cameron April 15, 2023, 4:39 p.m. UTC | #2
On Thu, 13 Apr 2023 10:33:32 +0200
Fabrizio Lamarque <fl.scratchpad@gmail.com> wrote:

> Fixed wrong selection of internal clock when mclk is defined.
> 
> Resolved a logical inversion introduced in c9ec2cb328e3.
> 
> Fixes: c9ec2cb328e3 iio: adc: ad7192: use devm_clk_get_optional() for mclk
> Signed-off-by: Fabrizio Lamarque <fl.scratchpad@gmail.com>

Version should apply to whole series.

git format-patch -v2 
is a good way to get this right automatically.

Patch is fine subject to the fixes tag fix that Nuno pointed out.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/ad7192.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c
> index 94a9cf34a255..5a9c8898f8af 100644
> --- a/drivers/iio/adc/ad7192.c
> +++ b/drivers/iio/adc/ad7192.c
> @@ -367,7 +367,7 @@ static int ad7192_of_clock_select(struct ad7192_state *st)
>      clock_sel = AD7192_CLK_INT;
> 
>      /* use internal clock */
> -    if (st->mclk) {
> +    if (!st->mclk) {
>          if (of_property_read_bool(np, "adi,int-clock-output-enable"))
>              clock_sel = AD7192_CLK_INT_CO;
>      } else {
diff mbox series

Patch

diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c
index 94a9cf34a255..5a9c8898f8af 100644
--- a/drivers/iio/adc/ad7192.c
+++ b/drivers/iio/adc/ad7192.c
@@ -367,7 +367,7 @@  static int ad7192_of_clock_select(struct ad7192_state *st)
     clock_sel = AD7192_CLK_INT;

     /* use internal clock */
-    if (st->mclk) {
+    if (!st->mclk) {
         if (of_property_read_bool(np, "adi,int-clock-output-enable"))
             clock_sel = AD7192_CLK_INT_CO;
     } else {