Message ID | 20220208172514.3481-40-bvanassche@acm.org |
---|---|
State | Superseded |
Headers | show |
Series | Remove the SCSI pointer from struct scsi_cmnd | expand |
On 2/8/22 18:25, Bart Van Assche wrote: > Set .cmd_size in the SCSI host template instead of using the SCSI pointer > from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer > from struct scsi_cmnd. > > Cc: Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> > Signed-off-by: Bart Van Assche <bvanassche@acm.org> > --- > drivers/scsi/sym53c8xx_2/sym_glue.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c > index b04bfde65e3f..2e2852bd5860 100644 > --- a/drivers/scsi/sym53c8xx_2/sym_glue.c > +++ b/drivers/scsi/sym53c8xx_2/sym_glue.c > @@ -118,7 +118,7 @@ struct sym_ucmd { /* Override the SCSI pointer structure */ > struct completion *eh_done; /* SCSI error handling */ > }; > > -#define SYM_UCMD_PTR(cmd) ((struct sym_ucmd *)(&(cmd)->SCp)) > +#define SYM_UCMD_PTR(cmd) ((struct sym_ucmd *)scsi_cmd_priv(cmd)) > #define SYM_SOFTC_PTR(cmd) sym_get_hcb(cmd->device->host) > > /* > @@ -127,7 +127,6 @@ struct sym_ucmd { /* Override the SCSI pointer structure */ > void sym_xpt_done(struct sym_hcb *np, struct scsi_cmnd *cmd) > { > struct sym_ucmd *ucmd = SYM_UCMD_PTR(cmd); > - BUILD_BUG_ON(sizeof(struct scsi_pointer) < sizeof(struct sym_ucmd)); > > if (ucmd->eh_done) > complete(ucmd->eh_done); > @@ -1630,6 +1629,7 @@ static struct scsi_host_template sym2_template = { > .module = THIS_MODULE, > .name = "sym53c8xx", > .info = sym53c8xx_info, > + .cmd_size = sizeof(struct sym_ucmd), > .queuecommand = sym53c8xx_queue_command, > .slave_alloc = sym53c8xx_slave_alloc, > .slave_configure = sym53c8xx_slave_configure, Reviewed-by: Hannes Reinecke <hare@suse.de> Cheers, Hannes
> On Feb 8, 2022, at 9:25 AM, Bart Van Assche <bvanassche@acm.org> wrote: > > Set .cmd_size in the SCSI host template instead of using the SCSI pointer > from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer > from struct scsi_cmnd. > > Cc: Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> > Signed-off-by: Bart Van Assche <bvanassche@acm.org> > --- > drivers/scsi/sym53c8xx_2/sym_glue.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c > index b04bfde65e3f..2e2852bd5860 100644 > --- a/drivers/scsi/sym53c8xx_2/sym_glue.c > +++ b/drivers/scsi/sym53c8xx_2/sym_glue.c > @@ -118,7 +118,7 @@ struct sym_ucmd { /* Override the SCSI pointer structure */ > struct completion *eh_done; /* SCSI error handling */ > }; > > -#define SYM_UCMD_PTR(cmd) ((struct sym_ucmd *)(&(cmd)->SCp)) > +#define SYM_UCMD_PTR(cmd) ((struct sym_ucmd *)scsi_cmd_priv(cmd)) > #define SYM_SOFTC_PTR(cmd) sym_get_hcb(cmd->device->host) > > /* > @@ -127,7 +127,6 @@ struct sym_ucmd { /* Override the SCSI pointer structure */ > void sym_xpt_done(struct sym_hcb *np, struct scsi_cmnd *cmd) > { > struct sym_ucmd *ucmd = SYM_UCMD_PTR(cmd); > - BUILD_BUG_ON(sizeof(struct scsi_pointer) < sizeof(struct sym_ucmd)); > > if (ucmd->eh_done) > complete(ucmd->eh_done); > @@ -1630,6 +1629,7 @@ static struct scsi_host_template sym2_template = { > .module = THIS_MODULE, > .name = "sym53c8xx", > .info = sym53c8xx_info, > + .cmd_size = sizeof(struct sym_ucmd), > .queuecommand = sym53c8xx_queue_command, > .slave_alloc = sym53c8xx_slave_alloc, > .slave_configure = sym53c8xx_slave_configure, Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> -- Himanshu Madhani Oracle Linux Engineering
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c index b04bfde65e3f..2e2852bd5860 100644 --- a/drivers/scsi/sym53c8xx_2/sym_glue.c +++ b/drivers/scsi/sym53c8xx_2/sym_glue.c @@ -118,7 +118,7 @@ struct sym_ucmd { /* Override the SCSI pointer structure */ struct completion *eh_done; /* SCSI error handling */ }; -#define SYM_UCMD_PTR(cmd) ((struct sym_ucmd *)(&(cmd)->SCp)) +#define SYM_UCMD_PTR(cmd) ((struct sym_ucmd *)scsi_cmd_priv(cmd)) #define SYM_SOFTC_PTR(cmd) sym_get_hcb(cmd->device->host) /* @@ -127,7 +127,6 @@ struct sym_ucmd { /* Override the SCSI pointer structure */ void sym_xpt_done(struct sym_hcb *np, struct scsi_cmnd *cmd) { struct sym_ucmd *ucmd = SYM_UCMD_PTR(cmd); - BUILD_BUG_ON(sizeof(struct scsi_pointer) < sizeof(struct sym_ucmd)); if (ucmd->eh_done) complete(ucmd->eh_done); @@ -1630,6 +1629,7 @@ static struct scsi_host_template sym2_template = { .module = THIS_MODULE, .name = "sym53c8xx", .info = sym53c8xx_info, + .cmd_size = sizeof(struct sym_ucmd), .queuecommand = sym53c8xx_queue_command, .slave_alloc = sym53c8xx_slave_alloc, .slave_configure = sym53c8xx_slave_configure,
Set .cmd_size in the SCSI host template instead of using the SCSI pointer from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer from struct scsi_cmnd. Cc: Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- drivers/scsi/sym53c8xx_2/sym_glue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)