lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+U=DsqD+g5LDP0Je5WAsrKheYog--OcXNRbLZNxVJ1J6u66XA@mail.gmail.com>
Date:   Mon, 24 May 2021 11:09:21 +0300
From:   Alexandru Ardelean <ardeleanalex@...il.com>
To:     Lucas Stankus <lucas.p.stankus@...il.com>
Cc:     Lars-Peter Clausen <lars@...afoo.de>,
        "Hennerich, Michael" <Michael.Hennerich@...log.com>,
        Jonathan Cameron <jic23@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-iio <linux-iio@...r.kernel.org>,
        linux-staging@...ts.linux.dev, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 3/3] staging: iio: cdc: ad7746: extract capac setup to
 own function

On Sun, May 23, 2021 at 8:13 PM Lucas Stankus <lucas.p.stankus@...il.com> wrote:
>
> Refactor the capac register write logic to own function.

Minor typo 'capac' -> 'capdac'

Other than that:

Reviewed-by: Alexandru Ardelean <ardeleanalex@...il.com>

>
> Also fixes the following checkpatch warning:
> CHECK: Alignment should match open parenthesis
>
> Signed-off-by: Lucas Stankus <lucas.p.stankus@...il.com>
> ---
>  drivers/staging/iio/cdc/ad7746.c | 36 ++++++++++++++++----------------
>  1 file changed, 18 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/staging/iio/cdc/ad7746.c b/drivers/staging/iio/cdc/ad7746.c
> index 367a5990ae35..4221312f0a32 100644
> --- a/drivers/staging/iio/cdc/ad7746.c
> +++ b/drivers/staging/iio/cdc/ad7746.c
> @@ -209,6 +209,19 @@ static const unsigned char ad7746_cap_filter_rate_table[][2] = {
>         {16, 62 + 1}, {13, 77 + 1}, {11, 92 + 1}, {9, 110 + 1},
>  };
>
> +static int ad7746_set_capdac(struct ad7746_chip_info *chip, int channel)
> +{
> +       int ret = i2c_smbus_write_byte_data(chip->client,
> +                                           AD7746_REG_CAPDACA,
> +                                           chip->capdac[channel][0]);
> +       if (ret < 0)
> +               return ret;
> +
> +       return i2c_smbus_write_byte_data(chip->client,
> +                                         AD7746_REG_CAPDACB,
> +                                         chip->capdac[channel][1]);
> +}
> +
>  static int ad7746_select_channel(struct iio_dev *indio_dev,
>                                  struct iio_chan_spec const *chan)
>  {
> @@ -224,17 +237,11 @@ static int ad7746_select_channel(struct iio_dev *indio_dev,
>                         AD7746_CONF_CAPFS_SHIFT;
>                 delay = ad7746_cap_filter_rate_table[idx][1];
>
> +               ret = ad7746_set_capdac(chip, chan->channel);
> +               if (ret < 0)
> +                       return ret;
> +
>                 if (chip->capdac_set != chan->channel) {
> -                       ret = i2c_smbus_write_byte_data(chip->client,
> -                               AD7746_REG_CAPDACA,
> -                               chip->capdac[chan->channel][0]);
> -                       if (ret < 0)
> -                               return ret;
> -                       ret = i2c_smbus_write_byte_data(chip->client,
> -                               AD7746_REG_CAPDACB,
> -                               chip->capdac[chan->channel][1]);
> -                       if (ret < 0)
> -                               return ret;
>
>                         chip->capdac_set = chan->channel;
>                 }
> @@ -478,14 +485,7 @@ static int ad7746_write_raw(struct iio_dev *indio_dev,
>                 chip->capdac[chan->channel][chan->differential] = val > 0 ?
>                         AD7746_CAPDAC_DACP(val) | AD7746_CAPDAC_DACEN : 0;
>
> -               ret = i2c_smbus_write_byte_data(chip->client,
> -                                               AD7746_REG_CAPDACA,
> -                                               chip->capdac[chan->channel][0]);
> -               if (ret < 0)
> -                       goto out;
> -               ret = i2c_smbus_write_byte_data(chip->client,
> -                                               AD7746_REG_CAPDACB,
> -                                               chip->capdac[chan->channel][1]);
> +               ret = ad7746_set_capdac(chip, chan->channel);
>                 if (ret < 0)
>                         goto out;
>
> --
> 2.31.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ