From: Jonathan Cameron <jic23@kernel.org>
To: linux-iio@vger.kernel.org
Cc: "Andy Shevchenko" <andy@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
"Frank Li" <Frank.Li@nxp.com>,
"Jonathan Cameron" <Jonathan.Cameron@huawei.com>,
"kernel test robot" <lkp@intel.com>
Subject: [PATCH 2/2] iio: magn: mmc5633: Add some ifdef / __maybe_unused until stubs available
Date: Mon, 19 Jan 2026 22:17:36 +0000 [thread overview]
Message-ID: <20260119221736.804825-3-jic23@kernel.org> (raw)
In-Reply-To: <20260119221736.804825-1-jic23@kernel.org>
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The I3C tree has Frank Li's fix for the case of I3C not being built
https://lore.kernel.org/all/20251230145718.4088694-1-Frank.Li@nxp.com/
Given those will only be available upstream at the next merge window
and the ordering of merge of I3C vs IIO is uncertain, apply some temporary
stubs in the driver to avoid build issues.
This can be reverted next cycle.
Fixes: 6e5f6bf2e3f0 ("iio: magnetometer: Add mmc5633 sensor")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202512280443.lOhY75Df-lkp@intel.com/
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
drivers/iio/magnetometer/mmc5633.c | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/magnetometer/mmc5633.c b/drivers/iio/magnetometer/mmc5633.c
index 9d8e27486963..37f46fe5e9e4 100644
--- a/drivers/iio/magnetometer/mmc5633.c
+++ b/drivers/iio/magnetometer/mmc5633.c
@@ -190,32 +190,37 @@ static bool mmc5633_is_support_hdr(struct mmc5633_data *data)
if (!data->i3cdev)
return false;
+#ifdef CONFIG_I3C
return i3c_device_get_supported_xfer_mode(data->i3cdev) & BIT(I3C_HDR_DDR);
+#else
+ return false;
+#endif
}
static int mmc5633_read_measurement(struct mmc5633_data *data, int address, void *buf, size_t sz)
{
struct device *dev = regmap_get_device(data->regmap);
u8 data_cmd[2], status[2];
- unsigned int val, ready;
+ unsigned int val;
+ unsigned int ready __maybe_unused;
int ret;
if (mmc5633_is_support_hdr(data)) {
- struct i3c_xfer xfers_wr_cmd[] = {
+ struct i3c_xfer xfers_wr_cmd[] __maybe_unused = {
{
.cmd = 0x3b,
.len = 2,
.data.out = data_cmd,
}
};
- struct i3c_xfer xfers_rd_sta_cmd[] = {
+ struct i3c_xfer xfers_rd_sta_cmd[] __maybe_unused = {
{
.cmd = 0x23 | BIT(7), /* RDSTA CMD */
.len = 2,
.data.in = status,
},
};
- struct i3c_xfer xfers_rd_data_cmd[] = {
+ struct i3c_xfer xfers_rd_data_cmd[] __maybe_unused = {
{
.cmd = 0x22 | BIT(7), /* RDLONG CMD */
.len = sz,
@@ -227,19 +232,27 @@ static int mmc5633_read_measurement(struct mmc5633_data *data, int address, void
data_cmd[1] = (address == MMC5633_TEMPERATURE) ?
MMC5633_HDR_CTRL0_MEAS_T : MMC5633_HDR_CTRL0_MEAS_M;
+#ifdef CONFIG_I3C
ret = i3c_device_do_xfers(data->i3cdev, xfers_wr_cmd,
ARRAY_SIZE(xfers_wr_cmd), I3C_HDR_DDR);
+#else
+ return -EOPNOTSUPP;
+#endif
if (ret < 0)
return ret;
ready = (address == MMC5633_TEMPERATURE) ?
MMC5633_STATUS1_MEAS_T_DONE_BIT : MMC5633_STATUS1_MEAS_M_DONE_BIT;
+#ifdef CONFIG_I3C
ret = read_poll_timeout(i3c_device_do_xfers, val,
val || (status[0] & ready),
10 * USEC_PER_MSEC,
100 * 10 * USEC_PER_MSEC, 0,
data->i3cdev, xfers_rd_sta_cmd,
ARRAY_SIZE(xfers_rd_sta_cmd), I3C_HDR_DDR);
+#else
+ ret = -EOPNOTSUPP;
+#endif
if (ret) {
dev_err(dev, "data not ready\n");
return ret;
@@ -248,8 +261,12 @@ static int mmc5633_read_measurement(struct mmc5633_data *data, int address, void
dev_err(dev, "i3c transfer error\n");
return val;
}
+#ifdef CONFIG_I3C
return i3c_device_do_xfers(data->i3cdev, xfers_rd_data_cmd,
ARRAY_SIZE(xfers_rd_data_cmd), I3C_HDR_DDR);
+#else
+ return -EOPNOTSUPP;
+#endif
}
/* Fallback to use SDR/I2C mode */
--
2.52.0
next prev parent reply other threads:[~2026-01-19 22:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-19 22:17 [PATCH 0/2] iio: magn: mmc5633: Fix two build issues Jonathan Cameron
2026-01-19 22:17 ` [PATCH 1/2] iio: magn: mmc5633: Ensure REGMAP_I2C / I3C not build if I2C / I3C is not Jonathan Cameron
2026-01-20 7:23 ` Andy Shevchenko
2026-01-31 12:18 ` Jonathan Cameron
2026-01-19 22:17 ` Jonathan Cameron [this message]
2026-01-20 7:23 ` [PATCH 2/2] iio: magn: mmc5633: Add some ifdef / __maybe_unused until stubs available Andy Shevchenko
2026-01-20 21:56 ` Jonathan Cameron
2026-01-20 22:03 ` Jonathan Cameron
2026-01-21 20:01 ` Jonathan Cameron
2026-01-19 23:00 ` [PATCH 0/2] iio: magn: mmc5633: Fix two build issues Frank Li
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=20260119221736.804825-3-jic23@kernel.org \
--to=jic23@kernel.org \
--cc=Frank.Li@nxp.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=alexandre.belloni@bootlin.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=linux-iio@vger.kernel.org \
--cc=lkp@intel.com \
--cc=nuno.sa@analog.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