linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/3] iio: imu: adis: add doc-string for 'adis' struct
@ 2020-02-25 10:33 Alexandru Ardelean
  2020-02-25 10:33 ` [PATCH v2 2/3] iio: imu: adis: update 'adis_data' struct doc-string Alexandru Ardelean
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Alexandru Ardelean @ 2020-02-25 10:33 UTC (permalink / raw)
  To: linux-iio, linux-kernel; +Cc: jic23, Alexandru Ardelean

This change adds a doc-string for the 'adis' struct. It details the fields
and their roles.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---

Changelog v1 -> v2:
* changed tx/rx descriptions to
  ```
  @tx: DMA safe TX buffer for SPI transfers
  @rx: DMA safe RX buffer for SPI transfers
  ```

 include/linux/iio/imu/adis.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h
index ac7cfd073804..63e456aa5c8a 100644
--- a/include/linux/iio/imu/adis.h
+++ b/include/linux/iio/imu/adis.h
@@ -73,6 +73,20 @@ struct adis_data {
 	bool has_paging;
 };
 
+/**
+ * struct adis - ADIS device instance data
+ * @spi: Reference to SPI device which owns this ADIS IIO device
+ * @trig: IIO trigger object data
+ * @data: ADIS chip variant specific data
+ * @burst: ADIS burst transfer information
+ * @state_lock: Lock used by the device to protect state
+ * @msg: SPI message object
+ * @xfer: SPI transfer objects to be used for a @msg
+ * @current_page: Some ADIS devices have registers, this selects current page
+ * @buffer: Data buffer for information read from the device
+ * @tx: DMA safe TX buffer for SPI transfers
+ * @rx: DMA safe RX buffer for SPI transfers
+ */
 struct adis {
 	struct spi_device	*spi;
 	struct iio_trigger	*trig;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/3] iio: imu: adis: update 'adis_data' struct doc-string
  2020-02-25 10:33 [PATCH v2 1/3] iio: imu: adis: add doc-string for 'adis' struct Alexandru Ardelean
@ 2020-02-25 10:33 ` Alexandru Ardelean
  2020-03-01 15:55   ` Jonathan Cameron
  2020-02-25 10:33 ` [PATCH v2 3/3] iio: imu: adis: add a note better explaining state_lock Alexandru Ardelean
  2020-03-01 15:54 ` [PATCH v2 1/3] iio: imu: adis: add doc-string for 'adis' struct Jonathan Cameron
  2 siblings, 1 reply; 6+ messages in thread
From: Alexandru Ardelean @ 2020-02-25 10:33 UTC (permalink / raw)
  To: linux-iio, linux-kernel; +Cc: jic23, Alexandru Ardelean

The doc-string has been neglected over time.
This change updates it with all the missing info.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
 include/linux/iio/imu/adis.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h
index 63e456aa5c8a..20339025c75f 100644
--- a/include/linux/iio/imu/adis.h
+++ b/include/linux/iio/imu/adis.h
@@ -43,10 +43,14 @@ struct adis_timeout {
  * @diag_stat_reg: Register address of the DIAG_STAT register
  * @prod_id_reg: Register address of the PROD_ID register
  * @prod_id: Product ID code that should be expected when reading @prod_id_reg
+ * @self_test_mask: Bitmask of supported self-test operations
  * @self_test_reg: Register address to request self test command
+ * @self_test_no_autoclear: True if device's self-test needs clear of ctrl reg
  * @status_error_msgs: Array of error messgaes
- * @status_error_mask:
+ * @status_error_mask: Bitmask of errors supported by the device
  * @timeouts: Chip specific delays
+ * @enable_irq: Hook for ADIS devices that have a special IRQ enable/disable
+ * @has_paging: True if ADIS device has paged registers
  */
 struct adis_data {
 	unsigned int read_delay;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 3/3] iio: imu: adis: add a note better explaining state_lock
  2020-02-25 10:33 [PATCH v2 1/3] iio: imu: adis: add doc-string for 'adis' struct Alexandru Ardelean
  2020-02-25 10:33 ` [PATCH v2 2/3] iio: imu: adis: update 'adis_data' struct doc-string Alexandru Ardelean
@ 2020-02-25 10:33 ` Alexandru Ardelean
  2020-03-01 15:56   ` Jonathan Cameron
  2020-03-01 15:54 ` [PATCH v2 1/3] iio: imu: adis: add doc-string for 'adis' struct Jonathan Cameron
  2 siblings, 1 reply; 6+ messages in thread
From: Alexandru Ardelean @ 2020-02-25 10:33 UTC (permalink / raw)
  To: linux-iio, linux-kernel; +Cc: jic23, Alexandru Ardelean

The 'state_lock' mutex was renamed from 'txrx_lock' in a previous patch and
is intended to be used by ADIS drivers to protect the state of devices
during consecutive R/W ops.
The initial patch that introduced this change did not do a good [well, any]
job at explaining this. This patch adds a comment to the 'state_lock'
better explaining it's use.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
 include/linux/iio/imu/adis.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h
index 20339025c75f..dd8219138c2e 100644
--- a/include/linux/iio/imu/adis.h
+++ b/include/linux/iio/imu/adis.h
@@ -98,6 +98,17 @@ struct adis {
 	const struct adis_data	*data;
 	struct adis_burst	*burst;
 
+	/**
+	 * The state_lock is meant to be used during operations that require
+	 * a sequence of SPI R/W in order to protect the SPI transfer
+	 * information (fields 'xfer', 'msg' & 'current_page') between
+	 * potential concurrent accesses.
+	 * This lock is used by all "adis_{functions}" that have to read/write
+	 * registers. These functions also have unlocked variants
+	 * (see "__adis_{functions}"), which don't hold this lock.
+	 * This allows users of the ADIS library to group SPI R/W into
+	 * the drivers, but they also must manage this lock themselves.
+	 */
 	struct mutex		state_lock;
 	struct spi_message	msg;
 	struct spi_transfer	*xfer;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/3] iio: imu: adis: add doc-string for 'adis' struct
  2020-02-25 10:33 [PATCH v2 1/3] iio: imu: adis: add doc-string for 'adis' struct Alexandru Ardelean
  2020-02-25 10:33 ` [PATCH v2 2/3] iio: imu: adis: update 'adis_data' struct doc-string Alexandru Ardelean
  2020-02-25 10:33 ` [PATCH v2 3/3] iio: imu: adis: add a note better explaining state_lock Alexandru Ardelean
@ 2020-03-01 15:54 ` Jonathan Cameron
  2 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2020-03-01 15:54 UTC (permalink / raw)
  To: Alexandru Ardelean; +Cc: linux-iio, linux-kernel

On Tue, 25 Feb 2020 12:33:17 +0200
Alexandru Ardelean <alexandru.ardelean@analog.com> wrote:

> This change adds a doc-string for the 'adis' struct. It details the fields
> and their roles.
> 
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to poke at it.

Thanks,

Jonathan

> ---
> 
> Changelog v1 -> v2:
> * changed tx/rx descriptions to
>   ```
>   @tx: DMA safe TX buffer for SPI transfers
>   @rx: DMA safe RX buffer for SPI transfers
>   ```
> 
>  include/linux/iio/imu/adis.h | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h
> index ac7cfd073804..63e456aa5c8a 100644
> --- a/include/linux/iio/imu/adis.h
> +++ b/include/linux/iio/imu/adis.h
> @@ -73,6 +73,20 @@ struct adis_data {
>  	bool has_paging;
>  };
>  
> +/**
> + * struct adis - ADIS device instance data
> + * @spi: Reference to SPI device which owns this ADIS IIO device
> + * @trig: IIO trigger object data
> + * @data: ADIS chip variant specific data
> + * @burst: ADIS burst transfer information
> + * @state_lock: Lock used by the device to protect state
> + * @msg: SPI message object
> + * @xfer: SPI transfer objects to be used for a @msg
> + * @current_page: Some ADIS devices have registers, this selects current page
> + * @buffer: Data buffer for information read from the device
> + * @tx: DMA safe TX buffer for SPI transfers
> + * @rx: DMA safe RX buffer for SPI transfers
> + */
>  struct adis {
>  	struct spi_device	*spi;
>  	struct iio_trigger	*trig;


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/3] iio: imu: adis: update 'adis_data' struct doc-string
  2020-02-25 10:33 ` [PATCH v2 2/3] iio: imu: adis: update 'adis_data' struct doc-string Alexandru Ardelean
@ 2020-03-01 15:55   ` Jonathan Cameron
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2020-03-01 15:55 UTC (permalink / raw)
  To: Alexandru Ardelean; +Cc: linux-iio, linux-kernel

On Tue, 25 Feb 2020 12:33:18 +0200
Alexandru Ardelean <alexandru.ardelean@analog.com> wrote:

> The doc-string has been neglected over time.
> This change updates it with all the missing info.
> 
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Applied.

Thanks

Jonathan

> ---
>  include/linux/iio/imu/adis.h | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h
> index 63e456aa5c8a..20339025c75f 100644
> --- a/include/linux/iio/imu/adis.h
> +++ b/include/linux/iio/imu/adis.h
> @@ -43,10 +43,14 @@ struct adis_timeout {
>   * @diag_stat_reg: Register address of the DIAG_STAT register
>   * @prod_id_reg: Register address of the PROD_ID register
>   * @prod_id: Product ID code that should be expected when reading @prod_id_reg
> + * @self_test_mask: Bitmask of supported self-test operations
>   * @self_test_reg: Register address to request self test command
> + * @self_test_no_autoclear: True if device's self-test needs clear of ctrl reg
>   * @status_error_msgs: Array of error messgaes
> - * @status_error_mask:
> + * @status_error_mask: Bitmask of errors supported by the device
>   * @timeouts: Chip specific delays
> + * @enable_irq: Hook for ADIS devices that have a special IRQ enable/disable
> + * @has_paging: True if ADIS device has paged registers
>   */
>  struct adis_data {
>  	unsigned int read_delay;


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 3/3] iio: imu: adis: add a note better explaining state_lock
  2020-02-25 10:33 ` [PATCH v2 3/3] iio: imu: adis: add a note better explaining state_lock Alexandru Ardelean
@ 2020-03-01 15:56   ` Jonathan Cameron
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2020-03-01 15:56 UTC (permalink / raw)
  To: Alexandru Ardelean; +Cc: linux-iio, linux-kernel

On Tue, 25 Feb 2020 12:33:19 +0200
Alexandru Ardelean <alexandru.ardelean@analog.com> wrote:

> The 'state_lock' mutex was renamed from 'txrx_lock' in a previous patch and
> is intended to be used by ADIS drivers to protect the state of devices
> during consecutive R/W ops.
> The initial patch that introduced this change did not do a good [well, any]
> job at explaining this. This patch adds a comment to the 'state_lock'
> better explaining it's use.
> 
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Applied.

Thanks,

Jonathan

> ---
>  include/linux/iio/imu/adis.h | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h
> index 20339025c75f..dd8219138c2e 100644
> --- a/include/linux/iio/imu/adis.h
> +++ b/include/linux/iio/imu/adis.h
> @@ -98,6 +98,17 @@ struct adis {
>  	const struct adis_data	*data;
>  	struct adis_burst	*burst;
>  
> +	/**
> +	 * The state_lock is meant to be used during operations that require
> +	 * a sequence of SPI R/W in order to protect the SPI transfer
> +	 * information (fields 'xfer', 'msg' & 'current_page') between
> +	 * potential concurrent accesses.
> +	 * This lock is used by all "adis_{functions}" that have to read/write
> +	 * registers. These functions also have unlocked variants
> +	 * (see "__adis_{functions}"), which don't hold this lock.
> +	 * This allows users of the ADIS library to group SPI R/W into
> +	 * the drivers, but they also must manage this lock themselves.
> +	 */
>  	struct mutex		state_lock;
>  	struct spi_message	msg;
>  	struct spi_transfer	*xfer;


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-03-01 15:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-25 10:33 [PATCH v2 1/3] iio: imu: adis: add doc-string for 'adis' struct Alexandru Ardelean
2020-02-25 10:33 ` [PATCH v2 2/3] iio: imu: adis: update 'adis_data' struct doc-string Alexandru Ardelean
2020-03-01 15:55   ` Jonathan Cameron
2020-02-25 10:33 ` [PATCH v2 3/3] iio: imu: adis: add a note better explaining state_lock Alexandru Ardelean
2020-03-01 15:56   ` Jonathan Cameron
2020-03-01 15:54 ` [PATCH v2 1/3] iio: imu: adis: add doc-string for 'adis' struct Jonathan Cameron

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 NNTP newsgroup(s).