From: Lars-Peter Clausen <lars@metafoo.de>
To: Denis CIOCCA <denis.ciocca@st.com>
Cc: Jonathan Cameron <jic23@kernel.org>, linux-iio@vger.kernel.org
Subject: Re: [PATCH] iio:common: Add STMicroelectronics common driver
Date: Wed, 05 Dec 2012 18:46:29 +0100 [thread overview]
Message-ID: <50BF8875.3080108@metafoo.de> (raw)
In-Reply-To: <1354623414-10742-2-git-send-email-denis.ciocca@st.com>
On 12/04/2012 01:16 PM, Denis CIOCCA wrote:
> +
> +/**
> + * struct st_sensors_data - ST sensors device status
> + * @dev: Pointer to instance of struct device (I2C or SPI).
> + * @trig: The trigger in use by the core driver.
> + * @enabled: Status of the sensor (false->off, true->on).
> + * @multiread_bit: Use or not particular bit for [I2C/SPI] multiread.
> + * @index: Number used to point the sensor being used in the
> + * st_sensors_sensors struct.
> + * @buffer_data: Data used by buffer part.
> + * @fullscale: Maximum range of measure by the sensor.
> + * @gain: Sensitivity of the sensor [m/s^2/LSB].
> + * @odr: Output data rate of the sensor [Hz].
> + * @buf_lock: Mutex to protect rx and tx buffers.
> + * @tx_buf: Buffer used by SPI transfer function to send data to the sensors.
> + * This buffer is used to avoid DMA not-aligned issue.
> + * @rx_buf: Buffer used by SPI transfer to receive data from sensors.
> + * This buffer is used to avoid DMA not-aligned issue.
> + * @read_byte: Function used to read one byte.
> + * @write_byte: Function used to write one byte.
> + * @read_multiple_byte: Function used to read multiple byte.
> + */
> +
> +struct st_sensors_data {
[...]
> +
> + struct mutex buf_lock;
> + u8 tx_buf[ST_SENSORS_TX_MAX_LENGHT] ____cacheline_aligned;
> + u8 rx_buf[ST_SENSORS_RX_MAX_LENGHT] ____cacheline_aligned;
The point of making the buffers cacheline aligned is that they get their own
cacheline. By putting elements in the struct after the buffer these will end
up on the same cacheline as the buffer. So move the callbacks above the
buffers. As far as I know it is ok, if the tx and rx buffer are on the same
cacheline so you just need to have ____cacheline_aligned on the tx_buf.
> +
> + int (*read_byte) (struct st_sensors_data *adata, u8 reg_addr,
> + u8 *res_byte);
> + int (*write_byte) (struct st_sensors_data *adata, u8 reg_addr, u8 data);
> + int (*read_multiple_byte) (struct st_sensors_data *adata, u8 reg_addr,
> + int len, u8 *data);
> +};
next prev parent reply other threads:[~2012-12-05 17:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-04 12:16 [PATCH] iio:common: Add STMicroelectronics common driver summary Denis CIOCCA
2012-12-04 12:16 ` [PATCH] iio:common: Add STMicroelectronics common driver Denis CIOCCA
2012-12-04 19:19 ` Jonathan Cameron
2012-12-05 17:46 ` Lars-Peter Clausen [this message]
2012-12-05 18:32 ` Jonathan Cameron
2013-01-25 18:05 ` Guenter Roeck
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=50BF8875.3080108@metafoo.de \
--to=lars@metafoo.de \
--cc=denis.ciocca@st.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.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 NNTP newsgroup(s).