Re: [PATCH v2 27/44] megaraid: Stop using the SCSI pointer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux