Re: [PATCH v5 4/5] net: rnpgbe: Add basic mbx_fw support
From: Andrew Lunn <andrew@lunn.ch>
Date: 2025-08-20 20:37:37
Also in:
linux-doc, lkml
From: Andrew Lunn <andrew@lunn.ch>
Date: 2025-08-20 20:37:37
Also in:
linux-doc, lkml
+static int mucse_mbx_fw_post_req(struct mucse_hw *hw,
+ struct mbx_fw_cmd_req *req,
+ struct mbx_req_cookie *cookie)
+{
+ int len = le16_to_cpu(req->datalen);
+ int err;
+
+ cookie->errcode = 0;
+ cookie->done = 0;
+ init_waitqueue_head(&cookie->wait);
+ err = mutex_lock_interruptible(&hw->mbx.lock);
+ if (err)
+ return err;
+ err = mucse_write_mbx(hw, (u32 *)req, len);
+ if (err)
+ goto out;
+ err = wait_event_timeout(cookie->wait,
+ cookie->done == 1,
+ cookie->timeout_jiffies);
+
+ if (!err)
+ err = -ETIMEDOUT;
+ else
+ err = 0;
+ if (!err && cookie->errcode)
+ err = cookie->errcode;
+out:
+ mutex_unlock(&hw->mbx.lock);
+ return err;What is your design with respect to mutex_lock_interruptible() and then calling wait_event_timeout() which will ignore signals? Is your intention that you can always ^C the driver, and it will clean up whatever it was doing and return -EINTR? Such unwinding can be tricky and needs careful review. Before i do that, i just want to make sure this is your intention, and you yourself have carefully reviewed the code. Andrew