From: Cosmin Tanislav <demonsingur@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: "Nuno Sá" <nuno.sa@analog.com>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Jonathan Cameron" <jic23@kernel.org>,
"Rob Herring" <robh+dt@kernel.org>,
"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Cosmin Tanislav" <cosmin.tanislav@analog.com>
Subject: [PATCH v2 2/5] iio: temperature: ltc2983: make bulk write buffer DMA-safe
Date: Thu, 20 Oct 2022 12:02:54 +0300 [thread overview]
Message-ID: <20221020090257.1717053-3-demonsingur@gmail.com> (raw)
In-Reply-To: <20221020090257.1717053-1-demonsingur@gmail.com>
From: Cosmin Tanislav <cosmin.tanislav@analog.com>
regmap_bulk_write() does not guarantee implicit DMA-safety,
even though the current implementation duplicates the given
buffer. Do not rely on it.
Fixes: f110f3188e56 ("iio: temperature: Add support for LTC2983")
Signed-off-by: Cosmin Tanislav <cosmin.tanislav@analog.com>
---
drivers/iio/temperature/ltc2983.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/iio/temperature/ltc2983.c b/drivers/iio/temperature/ltc2983.c
index a60ccf183687..1117991ca2ab 100644
--- a/drivers/iio/temperature/ltc2983.c
+++ b/drivers/iio/temperature/ltc2983.c
@@ -209,6 +209,7 @@ struct ltc2983_data {
* Holds the converted temperature
*/
__be32 temp __aligned(IIO_DMA_MINALIGN);
+ __be32 chan_val;
};
struct ltc2983_sensor {
@@ -313,19 +314,18 @@ static int __ltc2983_fault_handler(const struct ltc2983_data *st,
return 0;
}
-static int __ltc2983_chan_assign_common(const struct ltc2983_data *st,
+static int __ltc2983_chan_assign_common(struct ltc2983_data *st,
const struct ltc2983_sensor *sensor,
u32 chan_val)
{
u32 reg = LTC2983_CHAN_START_ADDR(sensor->chan);
- __be32 __chan_val;
chan_val |= LTC2983_CHAN_TYPE(sensor->type);
dev_dbg(&st->spi->dev, "Assign reg:0x%04X, val:0x%08X\n", reg,
chan_val);
- __chan_val = cpu_to_be32(chan_val);
- return regmap_bulk_write(st->regmap, reg, &__chan_val,
- sizeof(__chan_val));
+ st->chan_val = cpu_to_be32(chan_val);
+ return regmap_bulk_write(st->regmap, reg, &st->chan_val,
+ sizeof(st->chan_val));
}
static int __ltc2983_chan_custom_sensor_assign(struct ltc2983_data *st,
--
2.38.1
next prev parent reply other threads:[~2022-10-20 9:03 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-20 9:02 [PATCH v2 0/5] Support more parts in LTC2983 Cosmin Tanislav
2022-10-20 9:02 ` [PATCH v2 1/5] iio: temperature: ltc2983: allocate iio channels once Cosmin Tanislav
2022-10-23 12:40 ` Jonathan Cameron
2022-10-20 9:02 ` Cosmin Tanislav [this message]
2022-10-23 12:42 ` [PATCH v2 2/5] iio: temperature: ltc2983: make bulk write buffer DMA-safe Jonathan Cameron
2022-10-24 6:35 ` Sa, Nuno
2022-10-20 9:02 ` [PATCH v2 3/5] dt-bindings: iio: temperature: ltc2983: refine Cosmin Tanislav
2022-10-20 12:56 ` Rob Herring
2022-10-23 12:51 ` Jonathan Cameron
2022-10-23 13:46 ` Nuno Sá
2022-10-24 16:44 ` Jonathan Cameron
2022-10-20 9:02 ` [PATCH v2 4/5] dt-bindings: iio: temperature: ltc2983: support more parts Cosmin Tanislav
2022-10-20 9:02 ` [PATCH v2 5/5] " Cosmin Tanislav
2022-10-23 12:54 ` Jonathan Cameron
2022-10-24 6:37 ` Sa, Nuno
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=20221020090257.1717053-3-demonsingur@gmail.com \
--to=demonsingur@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=cosmin.tanislav@analog.com \
--cc=devicetree@vger.kernel.org \
--cc=jic23@kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=robh+dt@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