Linux-Devicetree Archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Ramona Gradinariu <ramona.bolboaca13@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
	devicetree@vger.kernel.org, conor+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, robh@kernel.org,
	nuno.sa@analog.com
Subject: Re: [PATCH 7/7] drivers: iio: imu: Add support for adis1657x family
Date: Sat, 11 May 2024 12:27:08 +0100	[thread overview]
Message-ID: <20240511122708.68fac075@jic23-huawei> (raw)
In-Reply-To: <9f0a8fdb-dd34-4a53-948d-d4ed0410de6f@gmail.com>

On Wed, 8 May 2024 17:32:34 +0300
Ramona Gradinariu <ramona.bolboaca13@gmail.com> wrote:

> Hello Jonathan,
> 
> Some explanations from my side.
> 
> >> @@ -437,6 +467,130 @@ static int adis16475_set_filter(struct adis16475 *st, const u32 filter)
> >>  	return 0;
> >>  }
> >>  
> >> +static ssize_t adis16475_get_fifo_enabled(struct device *dev,
> >> +					  struct device_attribute *attr,
> >> +					  char *buf)
> >> +{
> >> +	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
> >> +	struct adis16475 *st = iio_priv(indio_dev);
> >> +	int ret;
> >> +	u16 val;
> >> +
> >> +	ret = adis_read_reg_16(&st->adis, ADIS16475_REG_FIFO_CTRL, &val);
> >> +	if (ret)
> >> +		return ret;
> >> +	val = FIELD_GET(ADIS16475_FIFO_EN_MASK, val);
> >> +
> >> +	return sysfs_emit(buf, "%d\n", val);  
> > As below, might as well put the FIELD_GET() in the sysfs_emit rather than
> > writing the local parameter.  
> 
> In all instances where I did, I did it to avoid casting. v2 inlines the values and
> the cast is needed to avoid compilation errors.

I'd guess that is because the type in the sysfs_emit isn't the same as FIELD_GET()
returns?  That will correspond to the type of the ADIS16475_FIFO_EN_MASK
which is defined as UL I think. So just use %lu here instead and need to cast goes
away. 

> 
> > 	  
> >> +	if (adis->data->burst_max_len)
> >> +		burst_max_length = adis->data->burst_max_len;
> >> +	else
> >> +		burst_max_length = burst_length;
> >> +
> >> +	tx = adis->buffer + burst_max_length;
> >> +	tx[0] = ADIS_READ_REG(burst_req);
> >> +
> >> +	if (burst_req)  
> > If !burst_req does the rest of this do anything at all?
> > If so flip the logic as
> > 	if (!burst_req)
> > 		return adis16475_push_single_sample(pf);
> >
> > 	the rest...
> > 	return spi_sync(adis->spi, &adis->msg);  
> 
> The update is needed even if burst_req is false. The adis message has to be updated
> based on the burst request value, which is then used either in 
> adis16475_push_single_sample or in spi_sync call.

Which update?  The content of tx[0]?  If so that is non obvious so definitely
need a comment. Perhaps even wrap up the update in a function with a name
that makes it clear it's changing the adis->msg.

adis_update_msg_burst() or something like that.
> 
> > 		
> >  
> >> +		return spi_sync(adis->spi, &adis->msg);
> >> +
> >> +	return adis16475_push_single_sample(pf);
> >> +}
> >> +

Jonathan

      reply	other threads:[~2024-05-11 11:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-26 13:53 [PATCH 0/7] adis16501 and adis1657x support Ramona Gradinariu
2024-04-26 13:53 ` [PATCH 1/7] dt-bindings: iio: imu: Add ADIS16501 compatibles Ramona Gradinariu
2024-04-26 16:36   ` Conor Dooley
2024-04-26 13:53 ` [PATCH 2/7] drivers: iio: imu: Add support for ADIS16501 Ramona Gradinariu
2024-04-26 13:53 ` [PATCH 3/7] iio: imu: adis16475: Re-define ADIS16475_DATA Ramona Gradinariu
2024-04-27  2:00   ` kernel test robot
2024-04-28 13:49     ` Jonathan Cameron
2024-04-27  2:43   ` kernel test robot
2024-04-26 13:53 ` [PATCH 4/7] iio: imu: adis_buffer: Add buffer setup API with buffer attributes Ramona Gradinariu
2024-04-27  3:05   ` kernel test robot
2024-04-26 13:53 ` [PATCH 5/7] iio: imu: adis16475: Create push single sample API Ramona Gradinariu
2024-04-26 13:53 ` [PATCH 6/7] dt-bindings: iio: imu: Add ADIS1657X family devices compatibles Ramona Gradinariu
2024-04-26 16:38   ` Conor Dooley
2024-04-26 13:53 ` [PATCH 7/7] drivers: iio: imu: Add support for adis1657x family Ramona Gradinariu
2024-04-28 14:45   ` Jonathan Cameron
2024-05-08 14:32     ` Ramona Gradinariu
2024-05-11 11:27       ` Jonathan Cameron [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240511122708.68fac075@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=ramona.bolboaca13@gmail.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).