From: Ivan Mikhaylov <i.mikhaylov@yadro.com>
To: Jonathan Cameron <jic23@kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Cc: Ivan Mikhaylov <i.mikhaylov@yadro.com>,
<linux-kernel@vger.kernel.org>, <linux-iio@vger.kernel.org>
Subject: [PATCH v5 1/3] iio: proximity: vcnl3020: add DMA safe buffer
Date: Thu, 22 Jul 2021 18:44:18 +0300 [thread overview]
Message-ID: <20210722154420.915082-2-i.mikhaylov@yadro.com> (raw)
In-Reply-To: <20210722154420.915082-1-i.mikhaylov@yadro.com>
Add DMA safe buffer for bulk transfers.
Signed-off-by: Ivan Mikhaylov <i.mikhaylov@yadro.com>
---
drivers/iio/proximity/vcnl3020.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/proximity/vcnl3020.c b/drivers/iio/proximity/vcnl3020.c
index 43817f6b3086..c90f9c6e9e97 100644
--- a/drivers/iio/proximity/vcnl3020.c
+++ b/drivers/iio/proximity/vcnl3020.c
@@ -57,12 +57,14 @@ static const int vcnl3020_prox_sampling_frequency[][2] = {
* @dev: vcnl3020 device.
* @rev: revision id.
* @lock: lock for protecting access to device hardware registers.
+ * @buf: DMA safe __be16 buffer.
*/
struct vcnl3020_data {
struct regmap *regmap;
struct device *dev;
u8 rev;
struct mutex lock;
+ __be16 buf ____cacheline_aligned;
};
/**
@@ -144,7 +146,6 @@ static int vcnl3020_measure_proximity(struct vcnl3020_data *data, int *val)
{
int rc;
unsigned int reg;
- __be16 res;
mutex_lock(&data->lock);
@@ -163,12 +164,12 @@ static int vcnl3020_measure_proximity(struct vcnl3020_data *data, int *val)
}
/* high & low result bytes read */
- rc = regmap_bulk_read(data->regmap, VCNL_PS_RESULT_HI, &res,
- sizeof(res));
+ rc = regmap_bulk_read(data->regmap, VCNL_PS_RESULT_HI, &data->buf,
+ sizeof(data->buf));
if (rc)
goto err_unlock;
- *val = be16_to_cpu(res);
+ *val = be16_to_cpu(data->buf);
err_unlock:
mutex_unlock(&data->lock);
--
2.31.1
next prev parent reply other threads:[~2021-07-22 15:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-22 15:44 [PATCH v5 0/3] iio: vcnl3020: add periodic mode, threshold options Ivan Mikhaylov
2021-07-22 15:44 ` Ivan Mikhaylov [this message]
2021-07-22 15:44 ` [PATCH v5 2/3] iio: proximity: vcnl3020: add periodic mode Ivan Mikhaylov
2021-07-24 15:07 ` Jonathan Cameron
2021-07-22 15:44 ` [PATCH v5 3/3] iio: proximity: vcnl3020: remove iio_claim/release_direct Ivan Mikhaylov
2021-07-24 15:09 ` [PATCH v5 0/3] iio: vcnl3020: add periodic mode, threshold options Jonathan Cameron
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=20210722154420.915082-2-i.mikhaylov@yadro.com \
--to=i.mikhaylov@yadro.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/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).