Thread (19 messages) 19 messages, 5 authors, 2025-02-06

Re: [PATCH v6 4/7] can: Add Nuvoton NCT6694 CANFD support

From: Ming Yu <hidden>
Date: 2025-02-04 03:24:50
Also in: linux-can, linux-gpio, linux-hwmon, linux-i2c, linux-rtc, linux-usb, linux-watchdog, lkml

Dear Vincent,

Thank you for reviewing,
I will address the issues you mentioned in the next patch.

Vincent Mailhol [off-list ref] 於 2025年1月26日 週日 下午4:47寫道:
...
quoted
+static int nct6694_can_get_clock(struct nct6694_can_priv *priv)
+{
+     struct nct6694_can_information *info;
+     struct nct6694_cmd_header cmd_hd = {
If the variable only has constant initializer, make it static const:

        static const struct nct6694_cmd_header cmd_hd = {

Apply this at other locations in your different modules.
quoted
+             .mod = NCT6694_CAN_MOD,
+             .cmd = NCT6694_CAN_INFORMATION,
+             .sel = NCT6694_CAN_INFORMATION_SEL,
+             .len = cpu_to_le16(sizeof(*info))
+     };
+     int ret, can_clk;
+
+     info = kzalloc(sizeof(*info), GFP_KERNEL);
+     if (!info)
+             return -ENOMEM;
+
Excuse me, I would like to confirm, if the variable is constant
initializer, should the declaration be written as:
static const struct nct6694_cmd_header cmd_hd = {
    .mod = NCT6694_CAN_MOD,
    .cmd = NCT6694_CAN_INFORMATION,
    .sel = NCT6694_CAN_INFORMATION_SEL,
    .len = cpu_to_le16(sizeof(struct nct6694_can_information))
};
instead of:
static const struct nct6694_cmd_header cmd_hd = {
    .mod = NCT6694_CAN_MOD,
    .cmd = NCT6694_CAN_INFORMATION,
    .sel = NCT6694_CAN_INFORMATION_SEL,
    .len = cpu_to_le16(sizeof(*info))
};
, correct?

In addition, does this mean that the parameter in nct6694_read_msg()
and nct6694_write_msg() should be changed to const struct
nct6694_cmd_header *cmd_hd?


Best regards,
Ming
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help