From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Angel Iglesias <ang.iglesiasg@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
Dan Carpenter <dan.carpenter@oracle.com>,
kernel test robot <lkp@intel.com>,
"Lars-Peter Clausen" <lars@metafoo.de>,
Ulf Hansson <ulf.hansson@linaro.org>,
"Paul Cercueil" <paul@crapouillou.net>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
<linux-iio@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 4/5] iio: pressure: bmp280: Add support for BMP380 sensor family
Date: Tue, 19 Jul 2022 10:20:55 +0100 [thread overview]
Message-ID: <20220719102055.00000315@Huawei.com> (raw)
In-Reply-To: <4ffb757f64fdc2412af37a17242e3bac766aba94.camel@gmail.com>
> > > +
> > > +static int bmp380_read_calib(struct bmp280_data *data, unsigned int chip)
> > > +{
> > > + int ret;
> > > + struct bmp380_calib *calib = &data->calib.bmp380;
> > > + u8 buf[BMP380_CALIB_REG_COUNT];
> >
> > I'd missed this previously but for SPI drivers, we should be providing
> > regmap_bulk accesses with DMA safe buffers. That means they can't be on the
> > stack and need to be appropriately aligned IIO_DMA_MINALIGN as part of
> > the *data structure.
> >
> > Last time I checked the SPI regmap implementation doesn't currently use
> > the buffers directly but it has in the past and may do again in the future
> > - hence we should be careful to allow for that.
> >
>
> As we only use this buffer once to store temporally the calibration data to
> parse, I would like to avoid adding extra overhead to the device data struct.
> I've been consulting on DMA rules and safety, and if I understood correctly
> (listed the sources below), it should be safe to use a buffer allocated at
> runtime with kmalloc, right?
Yes. That works too.
> * https://elinux.org/images/0/03/20181023-Wolfram-Sang-ELCE18-
> safe_dma_buffers.pdf
> * https://linux-arm-kernel.infradead.narkive.com/vyJqy0RQ/question-devm-
> kmalloc-for-dma
>
> Thanks in advance,
> Angel
prev parent reply other threads:[~2022-07-19 9:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-10 9:18 [PATCH v3 4/5] iio: pressure: bmp280: Add support for BMP380 sensor family Angel Iglesias
2022-07-17 15:08 ` Jonathan Cameron
2022-07-19 9:16 ` Angel Iglesias
2022-07-19 9:20 ` 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=20220719102055.00000315@Huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=ang.iglesiasg@gmail.com \
--cc=dan.carpenter@oracle.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=paul@crapouillou.net \
--cc=rafael.j.wysocki@intel.com \
--cc=ulf.hansson@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.