On 2/9/22 00:14, Hannes Reinecke wrote:
On 2/8/22 18:24, Bart Van Assche wrote:
+static inline struct scsi_cmnd *
+megaraid_to_scsi_cmd(struct megaraid_cmd_priv *cmd_priv)
+{
+ struct scsi_cmnd *cmd = (void *)cmd_priv;
-#define SCSI_LIST(scp) ((struct list_head *)(&(scp)->SCp))
+ return cmd - 1;
+}
cmd - 1? Seriously?
If you need this you'd better introduce a helper
(eg scsi_cmd_from_priv()).
The megaraid driver is the only driver in which I could not find an
alternative for converting a private command data pointer into a SCSI
command pointer. How about defining a data structure in the megaraid
driver that has two members, a struct scsi_cmnd and a struct
megaraid_cmd_priv and using container_of() to do the pointer conversion?
Thanks,
Bart.