Thread (39 messages) 39 messages, 12 authors, 2024-12-26

Re: [PATCH v3 1/7] mfd: Add core driver for Nuvoton NCT6694

From: Christophe JAILLET <hidden>
Date: 2024-12-12 07:13:55
Also in: linux-can, linux-gpio, linux-hwmon, linux-i2c, linux-rtc, linux-watchdog, lkml

Le 12/12/2024 à 08:01, Ming Yu a écrit :
Dear Christophe,

Thank you for your comments,

Christophe JAILLET [off-list ref] 於 2024年12月12日 週四 上午12:44寫道:
quoted
quoted
+int nct6694_read_msg(struct nct6694 *nct6694, u8 mod, u16 offset,
+                  u16 length, void *buf)
+{
+     struct nct6694_cmd_header *cmd_header = nct6694->cmd_header;
+     struct nct6694_response_header *response_header = nct6694->response_header;
+     struct usb_device *udev = nct6694->udev;
+     int tx_len, rx_len, ret;
+
+     guard(mutex)(&nct6694->access_lock);
Nitpick: This could be moved a few lines below, should it still comply
with your coding style.
I think the lock should be placed here to prevent the cmd_header from
being overwritten by another caller.
Could you share your perspective on this?
You are right, I misread the code :(
(I though cmd_header was a local structure)
quoted
quoted
+
+     /* Send command packet to USB device */
+     cmd_header->mod = mod;
+     cmd_header->cmd = offset & 0xFF;
+     cmd_header->sel = (offset >> 8) & 0xFF;
+     cmd_header->hctrl = NCT6694_HCTRL_GET;
+     cmd_header->len = length;
CJ
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help