lkml.org 
[lkml]   [2024]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 3/5] iio: amplifiers: hmc425a: move conversion logic
On Tue, 20 Feb 2024 17:34:49 +0200
Dumitru Ceclan <mitrutzceclan@gmail.com> wrote:

> Move gain-dB<->code conversion logic from read_raw and write_raw to
> chip_info callbacks.
>
> Signed-off-by: Dumitru Ceclan <mitrutzceclan@gmail.com>

I've made a small tweak whilst applying this one.

> @@ -100,36 +155,15 @@ static int hmc425a_write_raw(struct iio_dev *indio_dev,
> int val2, long mask)
> {

> mutex_lock(&st->lock);
> switch (mask) {
> case IIO_CHAN_INFO_HARDWAREGAIN:
> + ret = gain_dB_to_code(st, val, val2, &code);
> + if (ret)
> + break;
> st->gain = code;
> -
Check your patches for unrelated white space changes.
They make things a little less reviewable and they create
noise in the history etc.

If you want to tidy up whitespace, a single patch just doing that
is the way to go.

> ret = hmc425a_write(indio_dev, st->gain);
> break;
> default:
> @@ -189,6 +223,8 @@ static struct hmc425a_chip_info hmc425a_chip_info_tbl[] = {
> .gain_min = -31500,
> .gain_max = 0,
> .default_gain = -0x40, /* set default gain -31.5db*/

\
 
 \ /
  Last update: 2024-05-27 15:20    [W:0.127 / U:0.252 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site