* [PATCH v9 05/12] mfd: nct6694: Move module type macros to shared header
[not found] <20261013063259.2734757-1-a0282524688@gmail.com>
@ 2026-10-13 6:32 ` a0282524688
2026-10-13 6:40 ` sashiko-bot
2026-10-13 6:32 ` [PATCH v9 10/12] mfd: nct6694: Introduce regmap-based transport abstraction a0282524688
1 sibling, 1 reply; 3+ messages in thread
From: a0282524688 @ 2026-10-13 6:32 UTC (permalink / raw)
To: lee, Ming Yu, Linus Walleij, Bartosz Golaszewski, Guenter Roeck,
Andi Shyti, Marc Kleine-Budde, Vincent Mailhol, Alexandre Belloni,
Wim Van Sebroeck
Cc: linux-kernel, Ming Yu, linux-gpio, linux-hwmon, linux-i2c,
linux-can, linux-rtc, linux-watchdog, mfd
From: Ming Yu <a0282524688@gmail.com>
Each sub-device driver defines the module type used by its own
commands. The upcoming HIF transport also needs to recognise
NCT6694_RPT_MOD, as report accesses are served from a separate
register space rather than through the command mailbox.
Move all module types into the shared header so that the transports
and the sub-device drivers use a single set of definitions.
No functional change.
Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Ming Yu <a0282524688@gmail.com>
---
Changes in v9:
- Added Andi's Reviewed-by.
Changes in v8:
- Reworded the commit message to explain why the transport needs the
module types.
Changes in v7:
- None.
Changes in v6:
- None.
Changes in v5:
- Split from the monolithic v4 patch to follow the single logical change
principle.
drivers/gpio/gpio-nct6694.c | 7 -------
drivers/hwmon/nct6694-hwmon.c | 21 ---------------------
drivers/i2c/busses/i2c-nct6694.c | 7 -------
drivers/net/can/usb/nct6694_canfd.c | 6 ------
drivers/rtc/rtc-nct6694.c | 7 -------
drivers/watchdog/nct6694_wdt.c | 7 -------
include/linux/mfd/nct6694.h | 9 +++++++++
7 files changed, 9 insertions(+), 55 deletions(-)
diff --git a/drivers/gpio/gpio-nct6694.c b/drivers/gpio/gpio-nct6694.c
index a8607f0d9915..53bfc5983648 100644
--- a/drivers/gpio/gpio-nct6694.c
+++ b/drivers/gpio/gpio-nct6694.c
@@ -13,13 +13,6 @@
#include <linux/module.h>
#include <linux/platform_device.h>
-/*
- * USB command module type for NCT6694 GPIO controller.
- * This defines the module type used for communication with the NCT6694
- * GPIO controller over the USB interface.
- */
-#define NCT6694_GPIO_MOD 0xFF
-
#define NCT6694_GPIO_VER 0x90
#define NCT6694_GPIO_VALID 0x110
#define NCT6694_GPI_DATA 0x120
diff --git a/drivers/hwmon/nct6694-hwmon.c b/drivers/hwmon/nct6694-hwmon.c
index 9a9a4db434c4..bd4c106305c7 100644
--- a/drivers/hwmon/nct6694-hwmon.c
+++ b/drivers/hwmon/nct6694-hwmon.c
@@ -15,13 +15,6 @@
#include <linux/platform_device.h>
#include <linux/slab.h>
-/*
- * USB command module type for NCT6694 report channel
- * This defines the module type used for communication with the NCT6694
- * report channel over the USB interface.
- */
-#define NCT6694_RPT_MOD 0xFF
-
/* Report channel */
/*
* The report channel is used to report the status of the hardware monitor
@@ -38,13 +31,6 @@
#define NCT6694_TIN_STS(x) (0x6A + (x))
#define NCT6694_FIN_STS(x) (0x6E + (x))
-/*
- * USB command module type for NCT6694 HWMON controller.
- * This defines the module type used for communication with the NCT6694
- * HWMON controller over the USB interface.
- */
-#define NCT6694_HWMON_MOD 0x00
-
/* Command 00h - Hardware Monitor Control */
#define NCT6694_HWMON_CONTROL 0x00
#define NCT6694_HWMON_CONTROL_SEL 0x00
@@ -53,13 +39,6 @@
#define NCT6694_HWMON_ALARM 0x02
#define NCT6694_HWMON_ALARM_SEL 0x00
-/*
- * USB command module type for NCT6694 PWM controller.
- * This defines the module type used for communication with the NCT6694
- * PWM controller over the USB interface.
- */
-#define NCT6694_PWM_MOD 0x01
-
/* PWM Command - Manual Control */
#define NCT6694_PWM_CONTROL 0x01
#define NCT6694_PWM_CONTROL_SEL 0x00
diff --git a/drivers/i2c/busses/i2c-nct6694.c b/drivers/i2c/busses/i2c-nct6694.c
index 1413ab6f9462..ef3329f34246 100644
--- a/drivers/i2c/busses/i2c-nct6694.c
+++ b/drivers/i2c/busses/i2c-nct6694.c
@@ -12,13 +12,6 @@
#include <linux/module.h>
#include <linux/platform_device.h>
-/*
- * USB command module type for NCT6694 I2C controller.
- * This defines the module type used for communication with the NCT6694
- * I2C controller over the USB interface.
- */
-#define NCT6694_I2C_MOD 0x03
-
/* Command 00h - I2C Deliver */
#define NCT6694_I2C_DELIVER 0x00
#define NCT6694_I2C_DELIVER_SEL 0x00
diff --git a/drivers/net/can/usb/nct6694_canfd.c b/drivers/net/can/usb/nct6694_canfd.c
index e5f7f8849a73..262b4c26c9d4 100644
--- a/drivers/net/can/usb/nct6694_canfd.c
+++ b/drivers/net/can/usb/nct6694_canfd.c
@@ -18,12 +18,6 @@
#define DEVICE_NAME "nct6694-canfd"
-/* USB command module type for NCT6694 CANfd controller.
- * This defines the module type used for communication with the NCT6694
- * CANfd controller over the USB interface.
- */
-#define NCT6694_CANFD_MOD 0x05
-
/* Command 00h - CAN Setting and Initialization */
#define NCT6694_CANFD_SETTING 0x00
#define NCT6694_CANFD_SETTING_ACTIVE_CTRL1 BIT(0)
diff --git a/drivers/rtc/rtc-nct6694.c b/drivers/rtc/rtc-nct6694.c
index 35401a0d9cf5..c06902f150c9 100644
--- a/drivers/rtc/rtc-nct6694.c
+++ b/drivers/rtc/rtc-nct6694.c
@@ -14,13 +14,6 @@
#include <linux/rtc.h>
#include <linux/slab.h>
-/*
- * USB command module type for NCT6694 RTC controller.
- * This defines the module type used for communication with the NCT6694
- * RTC controller over the USB interface.
- */
-#define NCT6694_RTC_MOD 0x08
-
/* Command 00h - RTC Time */
#define NCT6694_RTC_TIME 0x0000
#define NCT6694_RTC_TIME_SEL 0x00
diff --git a/drivers/watchdog/nct6694_wdt.c b/drivers/watchdog/nct6694_wdt.c
index bc3689bd4b6b..4c06ac105562 100644
--- a/drivers/watchdog/nct6694_wdt.c
+++ b/drivers/watchdog/nct6694_wdt.c
@@ -20,13 +20,6 @@
#define NCT6694_WDT_MAX_DEVS 2
-/*
- * USB command module type for NCT6694 WDT controller.
- * This defines the module type used for communication with the NCT6694
- * WDT controller over the USB interface.
- */
-#define NCT6694_WDT_MOD 0x07
-
/* Command 00h - WDT Setup */
#define NCT6694_WDT_SETUP 0x00
#define NCT6694_WDT_SETUP_SEL(idx) (idx ? 0x01 : 0x00)
diff --git a/include/linux/mfd/nct6694.h b/include/linux/mfd/nct6694.h
index 69e4652cf16c..d46ae34a497e 100644
--- a/include/linux/mfd/nct6694.h
+++ b/include/linux/mfd/nct6694.h
@@ -8,6 +8,15 @@
#ifndef __MFD_NCT6694_H
#define __MFD_NCT6694_H
+#define NCT6694_HWMON_MOD 0x00
+#define NCT6694_PWM_MOD 0x01
+#define NCT6694_I2C_MOD 0x03
+#define NCT6694_CANFD_MOD 0x05
+#define NCT6694_WDT_MOD 0x07
+#define NCT6694_RTC_MOD 0x08
+#define NCT6694_RPT_MOD 0xFF
+#define NCT6694_GPIO_MOD NCT6694_RPT_MOD
+
#define NCT6694_VENDOR_ID 0x0416
#define NCT6694_PRODUCT_ID 0x200B
#define NCT6694_INT_IN_EP 0x01
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v9 10/12] mfd: nct6694: Introduce regmap-based transport abstraction
[not found] <20261013063259.2734757-1-a0282524688@gmail.com>
2026-10-13 6:32 ` [PATCH v9 05/12] mfd: nct6694: Move module type macros to shared header a0282524688
@ 2026-10-13 6:32 ` a0282524688
1 sibling, 0 replies; 3+ messages in thread
From: a0282524688 @ 2026-10-13 6:32 UTC (permalink / raw)
To: lee, Ming Yu, Andi Shyti; +Cc: linux-kernel, Ming Yu, linux-i2c, mfd
From: Ming Yu <a0282524688@gmail.com>
Sub-device drivers call into the USB transport directly, so a second
transport cannot be added without touching all of them.
Wrap the transport behind a regmap bus. The command header is mapped
onto a single 32-bit register by packing the host control byte, the
module id and the 16-bit offset, so that the sub-device drivers can use
the regmap bulk accessors. The access_lock is dropped as regmap already
serialises the bus accesses. Transfers larger than the transport buffer
are rejected, as the length field of the command header is 16 bits wide.
Add nct6694_write_read_msg() for the commands that send a request and
read the reply back in the same firmware message, and use it for the
I2C deliver command.
Acked-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Ming Yu <a0282524688@gmail.com>
---
Changes in v9:
- Rejected transfers larger than NCT6694_MAX_DATA_LEN in the regmap bus
callbacks, as the length field of the command header is 16 bits wide.
- Added Andi's Acked-by.
Changes in v8:
- Renamed the transport buffer arguments to tx_buf/rx_buf.
- Dropped max_raw_read/max_raw_write from the regmap_config, as they
are ignored when a regmap_bus is provided.
Changes in v7:
- Made the USB transport helpers static and gave nct6694_usb_write_msg()
separate @tx/@rx buffers, so a SET command only copies the firmware
reply back when the caller asks for it.
- Documented in the shared header why nct6694_write_read_msg() is
expressed as a read of a SET register.
Changes in v6:
- New patch. Replaces the v5 function-pointer abstraction with a
regmap_bus based transport: the firmware command header is packed into
a single 32-bit regmap register and sub-device drivers use the regmap
bulk accessors. Adds nct6694_write_read_msg() for request/response
commands and drops the per-transport access_lock (regmap already
serialises bus accesses).
drivers/i2c/busses/i2c-nct6694.c | 2 +-
drivers/mfd/Kconfig | 1 +
drivers/mfd/nct6694-usb.c | 108 +++++++++++++++++++------------
include/linux/mfd/nct6694.h | 53 ++++++++++++---
4 files changed, 114 insertions(+), 50 deletions(-)
diff --git a/drivers/i2c/busses/i2c-nct6694.c b/drivers/i2c/busses/i2c-nct6694.c
index ef3329f34246..7e32dab6e759 100644
--- a/drivers/i2c/busses/i2c-nct6694.c
+++ b/drivers/i2c/busses/i2c-nct6694.c
@@ -77,7 +77,7 @@ static int nct6694_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int
deliver->addr = i2c_8bit_addr_from_msg(msg_temp);
if (msg_temp->flags & I2C_M_RD) {
deliver->r_cnt = msg_temp->len;
- ret = nct6694_write_msg(data->nct6694, &cmd_hd, deliver);
+ ret = nct6694_write_read_msg(data->nct6694, &cmd_hd, deliver);
if (ret < 0)
return ret;
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index e4fd4572472f..a0d9d6ccfb0c 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1166,6 +1166,7 @@ config MFD_MENF21BMC
config MFD_NCT6694
tristate "Nuvoton NCT6694 support"
select MFD_CORE
+ select REGMAP
depends on USB
help
This enables support for the Nuvoton USB device NCT6694, which shares
diff --git a/drivers/mfd/nct6694-usb.c b/drivers/mfd/nct6694-usb.c
index 455eeed62dce..c2443cd1278a 100644
--- a/drivers/mfd/nct6694-usb.c
+++ b/drivers/mfd/nct6694-usb.c
@@ -9,6 +9,7 @@
* CAN, WDT, HWMON and RTC management.
*/
+#include <linux/bitfield.h>
#include <linux/bits.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
@@ -17,7 +18,9 @@
#include <linux/mfd/core.h>
#include <linux/mfd/nct6694.h>
#include <linux/module.h>
+#include <linux/regmap.h>
#include <linux/slab.h>
+#include <linux/unaligned.h>
#include <linux/usb.h>
#define NCT6694_VENDOR_ID 0x0416
@@ -35,7 +38,6 @@ union __packed nct6694_usb_hdr {
struct nct6694_usb_data {
struct nct6694 core;
- struct mutex access_lock;
struct usb_device *usb_dev;
struct urb *int_urb;
union nct6694_usb_hdr *hdr_buf;
@@ -108,21 +110,9 @@ static int nct6694_usb_err_handling(struct nct6694 *ddata, unsigned char err_sta
return -EIO;
}
-/**
- * nct6694_usb_read_msg() - Read message from NCT6694 device
- * @ddata: NCT6694 device pointer
- * @cmd_hd: command header structure
- * @buf: buffer to store the response data
- *
- * Sends a command to the NCT6694 device and reads the response.
- * The command header is specified in @cmd_hd, and the response
- * data is stored in @buf.
- *
- * Return: Negative value on error or 0 on success.
- */
-int nct6694_usb_read_msg(struct nct6694 *ddata,
- const struct nct6694_cmd_header *cmd_hd,
- void *buf)
+static int nct6694_usb_read_msg(struct nct6694 *ddata,
+ const struct nct6694_cmd_header *cmd_hd,
+ void *rx_buf)
{
struct nct6694_usb_data *usb_data = to_nct6694_usb_data(ddata);
union nct6694_usb_hdr *hdr = usb_data->hdr_buf;
@@ -133,8 +123,6 @@ int nct6694_usb_read_msg(struct nct6694 *ddata,
if (data_len > NCT6694_MAX_DATA_LEN)
return -EINVAL;
- guard(mutex)(&usb_data->access_lock);
-
memcpy(&hdr->cmd_header, cmd_hd, sizeof(*cmd_hd));
hdr->cmd_header.hctrl = NCT6694_HCTRL_GET;
@@ -168,26 +156,15 @@ int nct6694_usb_read_msg(struct nct6694 *ddata,
return -EIO;
}
- memcpy(buf, usb_data->data_buf, data_len);
+ memcpy(rx_buf, usb_data->data_buf, data_len);
return nct6694_usb_err_handling(ddata, hdr->response_header.sts);
}
-EXPORT_SYMBOL_GPL(nct6694_usb_read_msg);
-/**
- * nct6694_usb_write_msg() - Write message to NCT6694 device
- * @ddata: NCT6694 device pointer
- * @cmd_hd: command header structure
- * @buf: buffer containing the data to be sent
- *
- * Sends a command to the NCT6694 device and writes the data
- * from @buf. The command header is specified in @cmd_hd.
- *
- * Return: Negative value on error or 0 on success.
- */
-int nct6694_usb_write_msg(struct nct6694 *ddata,
- const struct nct6694_cmd_header *cmd_hd,
- void *buf)
+/* @rx_buf may be NULL when the reply to the SET command is not needed */
+static int nct6694_usb_write_msg(struct nct6694 *ddata,
+ const struct nct6694_cmd_header *cmd_hd,
+ const void *tx_buf, void *rx_buf)
{
struct nct6694_usb_data *usb_data = to_nct6694_usb_data(ddata);
union nct6694_usb_hdr *hdr = usb_data->hdr_buf;
@@ -198,11 +175,9 @@ int nct6694_usb_write_msg(struct nct6694 *ddata,
if (data_len > NCT6694_MAX_DATA_LEN)
return -EINVAL;
- guard(mutex)(&usb_data->access_lock);
-
memcpy(&hdr->cmd_header, cmd_hd, sizeof(*cmd_hd));
hdr->cmd_header.hctrl = NCT6694_HCTRL_SET;
- memcpy(usb_data->data_buf, buf, data_len);
+ memcpy(usb_data->data_buf, tx_buf, data_len);
/* Send command packet to USB device */
ret = usb_bulk_msg(usb_dev, usb_sndbulkpipe(usb_dev, NCT6694_BULK_OUT_EP),
@@ -240,11 +215,59 @@ int nct6694_usb_write_msg(struct nct6694 *ddata,
return -EIO;
}
- memcpy(buf, usb_data->data_buf, data_len);
+ if (rx_buf)
+ memcpy(rx_buf, usb_data->data_buf, data_len);
return nct6694_usb_err_handling(ddata, hdr->response_header.sts);
}
-EXPORT_SYMBOL_GPL(nct6694_usb_write_msg);
+
+static int nct6694_usb_regmap_read(void *context, const void *reg_buf,
+ size_t reg_size, void *val_buf,
+ size_t val_size)
+{
+ struct nct6694 *ddata = context;
+ u32 reg = get_unaligned_be32(reg_buf);
+ const struct nct6694_cmd_header cmd_hd = {
+ .mod = FIELD_GET(NCT6694_REG_MOD, reg),
+ .offset = cpu_to_le16(FIELD_GET(NCT6694_REG_OFFSET, reg)),
+ .len = cpu_to_le16(val_size),
+ };
+
+ if (val_size > NCT6694_MAX_DATA_LEN)
+ return -EINVAL;
+
+ if (FIELD_GET(NCT6694_REG_HCTRL, reg) == NCT6694_HCTRL_SET)
+ return nct6694_usb_write_msg(ddata, &cmd_hd, val_buf, val_buf);
+
+ return nct6694_usb_read_msg(ddata, &cmd_hd, val_buf);
+}
+
+static int nct6694_usb_regmap_write(void *context, const void *data,
+ size_t count)
+{
+ struct nct6694 *ddata = context;
+ u32 reg = get_unaligned_be32(data);
+ const struct nct6694_cmd_header cmd_hd = {
+ .mod = FIELD_GET(NCT6694_REG_MOD, reg),
+ .offset = cpu_to_le16(FIELD_GET(NCT6694_REG_OFFSET, reg)),
+ .len = cpu_to_le16(count - sizeof(reg)),
+ };
+
+ if (count - sizeof(reg) > NCT6694_MAX_DATA_LEN)
+ return -EINVAL;
+
+ return nct6694_usb_write_msg(ddata, &cmd_hd, data + sizeof(reg), NULL);
+}
+
+static const struct regmap_bus nct6694_usb_regmap_bus = {
+ .read = nct6694_usb_regmap_read,
+ .write = nct6694_usb_regmap_write,
+};
+
+static const struct regmap_config nct6694_usb_regmap_config = {
+ .reg_bits = 32,
+ .val_bits = 8,
+};
static void nct6694_usb_int_callback(struct urb *urb)
{
@@ -329,9 +352,12 @@ static int nct6694_usb_probe(struct usb_interface *iface,
ddata->dev = dev;
usb_data->usb_dev = usb_dev;
- ret = devm_mutex_init(dev, &usb_data->access_lock);
- if (ret)
+ ddata->regmap = devm_regmap_init(dev, &nct6694_usb_regmap_bus, ddata,
+ &nct6694_usb_regmap_config);
+ if (IS_ERR(ddata->regmap)) {
+ ret = PTR_ERR(ddata->regmap);
goto err_free_urb;
+ }
int_pipe = usb_rcvintpipe(usb_dev, NCT6694_INT_IN_EP);
usb_fill_int_urb(usb_data->int_urb, usb_dev, int_pipe,
diff --git a/include/linux/mfd/nct6694.h b/include/linux/mfd/nct6694.h
index 03296132ad34..1593806d34fd 100644
--- a/include/linux/mfd/nct6694.h
+++ b/include/linux/mfd/nct6694.h
@@ -9,6 +9,9 @@
#ifndef __MFD_NCT6694_H
#define __MFD_NCT6694_H
+#include <linux/bitfield.h>
+#include <linux/regmap.h>
+
#define NCT6694_HWMON_MOD 0x00
#define NCT6694_PWM_MOD 0x01
#define NCT6694_I2C_MOD 0x03
@@ -82,6 +85,7 @@ struct __packed nct6694_response_header {
struct nct6694 {
struct device *dev;
+ struct regmap *regmap;
struct ida gpio_ida;
struct ida i2c_ida;
struct ida canfd_ida;
@@ -94,25 +98,58 @@ struct nct6694 {
int nct6694_device_init(struct device *dev);
void nct6694_device_exit(struct device *dev);
-int nct6694_usb_read_msg(struct nct6694 *ddata,
- const struct nct6694_cmd_header *cmd_hd,
- void *buf);
-int nct6694_usb_write_msg(struct nct6694 *ddata,
- const struct nct6694_cmd_header *cmd_hd,
- void *buf);
+/*
+ * Each firmware command is mapped to a single 32-bit regmap register, so that
+ * the sub-device drivers use the regmap bulk accessors and each transport only
+ * implements a regmap bus:
+ *
+ * bits [31:24] host control (NCT6694_HCTRL_GET / NCT6694_HCTRL_SET)
+ * bits [23:16] module id
+ * bits [15:0] offset (low byte = command, high byte = selector)
+ */
+#define NCT6694_REG_HCTRL GENMASK(31, 24)
+#define NCT6694_REG_MOD GENMASK(23, 16)
+#define NCT6694_REG_OFFSET GENMASK(15, 0)
+
+static inline u32 nct6694_cmd_to_reg(const struct nct6694_cmd_header *cmd_hd,
+ u8 hctrl)
+{
+ return FIELD_PREP(NCT6694_REG_HCTRL, hctrl) |
+ FIELD_PREP(NCT6694_REG_MOD, cmd_hd->mod) |
+ FIELD_PREP(NCT6694_REG_OFFSET, le16_to_cpu(cmd_hd->offset));
+}
static inline int nct6694_read_msg(struct nct6694 *ddata,
const struct nct6694_cmd_header *cmd_hd,
void *buf)
{
- return nct6694_usb_read_msg(ddata, cmd_hd, buf);
+ return regmap_bulk_read(ddata->regmap,
+ nct6694_cmd_to_reg(cmd_hd, NCT6694_HCTRL_GET),
+ buf, le16_to_cpu(cmd_hd->len));
}
static inline int nct6694_write_msg(struct nct6694 *ddata,
const struct nct6694_cmd_header *cmd_hd,
void *buf)
{
- return nct6694_usb_write_msg(ddata, cmd_hd, buf);
+ return regmap_bulk_write(ddata->regmap,
+ nct6694_cmd_to_reg(cmd_hd, NCT6694_HCTRL_SET),
+ buf, le16_to_cpu(cmd_hd->len));
+}
+
+/*
+ * Some commands, such as the I2C deliver, send a request and read the reply
+ * back in the same firmware message. Express this as a read of a SET register:
+ * @buf holds the request on entry and the reply on return. This relies on the
+ * regmap being uncached and byte sized, so that @buf reaches the bus as is.
+ */
+static inline int nct6694_write_read_msg(struct nct6694 *ddata,
+ const struct nct6694_cmd_header *cmd_hd,
+ void *buf)
+{
+ return regmap_bulk_read(ddata->regmap,
+ nct6694_cmd_to_reg(cmd_hd, NCT6694_HCTRL_SET),
+ buf, le16_to_cpu(cmd_hd->len));
}
#endif
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v9 05/12] mfd: nct6694: Move module type macros to shared header
2026-10-13 6:32 ` [PATCH v9 05/12] mfd: nct6694: Move module type macros to shared header a0282524688
@ 2026-10-13 6:40 ` sashiko-bot
0 siblings, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-10-13 6:40 UTC (permalink / raw)
To: a0282524688
Cc: linux-gpio, linux-hwmon, linux-can, linux-rtc, linux-watchdog,
mfd, Marc Kleine-Budde, Oliver Hartkopp, Vincent Mailhol,
Oleksij Rempel, Alexandre Belloni, lee
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] mfd: driver-specific header modified in global include/linux/mfd/
--
commit d639c18480f1ac35c44ced9c53986d041709e15f
Author: Ming Yu <a0282524688@gmail.com>
mfd: nct6694: Move module type macros to shared header
This commit moves module type macros from individual sub-device drivers into a
shared header include/linux/mfd/nct6694.h. The rationale is that the upcoming
HIF transport needs to recognise these module types. The change centralizes
definitions previously spread across several subsystems.
> diff --git a/include/linux/mfd/nct6694.h b/include/linux/mfd/nct6694.h
> index 69e4652cf16c4..d46ae34a497e1 100644
> --- a/include/linux/mfd/nct6694.h
> +++ b/include/linux/mfd/nct6694.h
> @@ -8,6 +8,15 @@
> #ifndef __MFD_NCT6694_H
> #define __MFD_NCT6694_H
>
> +#define NCT6694_HWMON_MOD 0x00
> +#define NCT6694_PWM_MOD 0x01
> +#define NCT6694_I2C_MOD 0x03
> +#define NCT6694_CANFD_MOD 0x05
> +#define NCT6694_WDT_MOD 0x07
> +#define NCT6694_RTC_MOD 0x08
> +#define NCT6694_RPT_MOD 0xFF
> +#define NCT6694_GPIO_MOD NCT6694_RPT_MOD
> +
[Severity: Low]
Are these driver-specific module type macros only used by the parent and its
immediate children?
According to MFD subsystem guidelines, driver-specific header files should not
be placed in the global include/linux/mfd/ directory if they are only used
by the parent and its immediate children. They should be kept local to
drivers/mfd/ instead.
Does this addition of driver-specific macros to the global header violate
the subsystem architecture guidelines?
> #define NCT6694_VENDOR_ID 0x0416
> #define NCT6694_PRODUCT_ID 0x200B
> #define NCT6694_INT_IN_EP 0x01
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261013063259.2734757-1-a0282524688@gmail.com?part=5
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-13 6:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20261013063259.2734757-1-a0282524688@gmail.com>
2026-10-13 6:32 ` [PATCH v9 05/12] mfd: nct6694: Move module type macros to shared header a0282524688
2026-10-13 6:40 ` sashiko-bot
2026-10-13 6:32 ` [PATCH v9 10/12] mfd: nct6694: Introduce regmap-based transport abstraction a0282524688
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.