Message ID | 20250403211937.2225615-3-bvanassche@acm.org |
---|---|
State | New |
Headers | show |
Series | Optimize the hot path in the UFS driver | expand |
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 154fbb39ca0c..09176b07e891 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -154,10 +154,10 @@ struct scsi_cmnd { * Return the driver private allocation behind the command. * Only works if cmd_size is set in the host template. */ -static inline void *scsi_cmd_priv(struct scsi_cmnd *cmd) -{ - return cmd + 1; -} +#define scsi_cmd_priv(cmd) \ + _Generic(cmd, \ + const struct scsi_cmnd *: (const void *)(cmd + 1), \ + struct scsi_cmnd *: (void *)(cmd + 1)) void scsi_done(struct scsi_cmnd *cmd); void scsi_done_direct(struct scsi_cmnd *cmd);
Instead of requiring the caller to cast away constness, make scsi_cmd_priv() accept const arguments. Cc: Hannes Reinecke <hare@suse.de> Cc: John Garry <john.g.garry@oracle.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- include/scsi/scsi_cmnd.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)