From: Jonathan Cameron <jic23@kernel.org>
To: David Lechner <dlechner@baylibre.com>
Cc: Brajesh Patil <brajeshpatil11@gmail.com>,
lars@metafoo.de, linux-iio@vger.kernel.org,
linux-kernel@vger.kernel.org, marcelo.schmitt1@gmail.com
Subject: Re: [PATCH v2 3/5] iio: magnetometer: qmc5883l: Add initial driver support
Date: Sun, 11 May 2025 16:26:18 +0100 [thread overview]
Message-ID: <20250511162618.34883bcb@jic23-huawei> (raw)
In-Reply-To: <297ec0b1-d6a4-4fc9-95c7-e7f3bef53d97@baylibre.com>
On Thu, 8 May 2025 11:03:51 -0500
David Lechner <dlechner@baylibre.com> wrote:
> On 5/8/25 7:08 AM, Brajesh Patil wrote:
>
> This needs a description that explains why we would want to add this to the
> kernel.
>
> > Signed-off-by: Brajesh Patil <brajeshpatil11@gmail.com>
A jumped on top of David's review (note I cropped lots of good feedback so do
look at his reply!) and added a few things.
J
> > diff --git a/drivers/iio/magnetometer/qmc5883l.c b/drivers/iio/magnetometer/qmc5883l.c
> > new file mode 100644
> > index 000000000000..68597cdd0ca8
> > --- /dev/null
> > +++ b/drivers/iio/magnetometer/qmc5883l.c
> > @@ -0,0 +1,471 @@
> > + case IIO_CHAN_INFO_SAMP_FREQ:
> > + ret = regmap_read(data->regmap, QMC5883L_CONTROL_REG_1, &rval);
> > + if (ret < 0)
> > + return ret;
> > +
> > + rval = (rval & QMC5883L_ODR_MASK) >> QMC5883L_ODR_SHIFT;
> > +
> > + if (rval >= ARRAY_SIZE(qmc5883l_odr_map) || !qmc5883l_odr_map[rval])
> > + return -EINVAL;
> > +
> > + *val = qmc5883l_odr_map[rval];
> > + *val2 = 0;
> > + return IIO_VAL_INT;
> > + }
> > + return -EINVAL;
Probably can't get here - which is good, but if you can't drop this line.
> > +}
> > +static const struct iio_info qmc5883l_info = {
> > + .read_raw = &qmc5883l_read_raw,
> > +};
> > +
> > +static const unsigned long qmc5883l_scan_masks[] = {0x7, 0};
static const unsigned long qmc5883l_scan_masks[] = { 0x7, 0 };
> > +
> > +static int qmc5883l_probe(struct i2c_client *client)
> > +{
...
> > +
> > + data = iio_priv(indio_dev);
> > + data->client = client;
> > + data->regmap = regmap;
> > + mutex_init(&data->lock);
> > +
ret = devm_mutex_init(&data->lock);
if (ret)
return ret;
Cleaning up mutexes only does stuff in debug modes, so traditionally we didn't
bother but now we have devm_ handling it is a nice to have thing.
prev parent reply other threads:[~2025-05-11 15:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-08 12:08 [PATCH v2 3/5] iio: magnetometer: qmc5883l: Add initial driver support Brajesh Patil
2025-05-08 12:08 ` [PATCH v2 4/5] iio: magnetometer: qmc5883l: add extended sysfs attributes and configuration options Brajesh Patil
2025-05-08 16:18 ` David Lechner
2025-05-11 15:33 ` Jonathan Cameron
2025-05-08 12:09 ` [PATCH v2 5/5] iio: magnetometer: qmc5883l: add mount matrix, control features and power management Brajesh Patil
2025-05-08 16:24 ` David Lechner
2025-05-08 16:03 ` [PATCH v2 3/5] iio: magnetometer: qmc5883l: Add initial driver support David Lechner
2025-05-11 15:26 ` 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=20250511162618.34883bcb@jic23-huawei \
--to=jic23@kernel.org \
--cc=brajeshpatil11@gmail.com \
--cc=dlechner@baylibre.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.schmitt1@gmail.com \
/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