diff mbox series

[v2,16/44] esp_scsi: Stop using the SCSI pointer

Message ID 20220208172514.3481-17-bvanassche@acm.org
State Superseded
Headers show
Series Remove the SCSI pointer from struct scsi_cmnd | expand

Commit Message

Bart Van Assche Feb. 8, 2022, 5:24 p.m. UTC
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.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/esp_scsi.c | 4 +---
 drivers/scsi/esp_scsi.h | 3 ++-
 2 files changed, 3 insertions(+), 4 deletions(-)

Comments

Hannes Reinecke Feb. 9, 2022, 7:45 a.m. UTC | #1
On 2/8/22 18:24, 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.
> 
> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>   drivers/scsi/esp_scsi.c | 4 +---
>   drivers/scsi/esp_scsi.h | 3 ++-
>   2 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c
> index 57787537285a..64ec6bb84550 100644
> --- a/drivers/scsi/esp_scsi.c
> +++ b/drivers/scsi/esp_scsi.c
> @@ -2678,6 +2678,7 @@ struct scsi_host_template scsi_esp_template = {
>   	.sg_tablesize		= SG_ALL,
>   	.max_sectors		= 0xffff,
>   	.skip_settle_delay	= 1,
> +	.cmd_size		= sizeof(struct esp_cmd_priv),
>   };
>   EXPORT_SYMBOL(scsi_esp_template);
>   
> @@ -2739,9 +2740,6 @@ static struct spi_function_template esp_transport_ops = {
>   
>   static int __init esp_init(void)
>   {
> -	BUILD_BUG_ON(sizeof(struct scsi_pointer) <
> -		     sizeof(struct esp_cmd_priv));
> -
>   	esp_transport_template = spi_attach_transport(&esp_transport_ops);
>   	if (!esp_transport_template)
>   		return -ENODEV;
> diff --git a/drivers/scsi/esp_scsi.h b/drivers/scsi/esp_scsi.h
> index 446a3d18c022..c73760d3cf83 100644
> --- a/drivers/scsi/esp_scsi.h
> +++ b/drivers/scsi/esp_scsi.h
> @@ -262,7 +262,8 @@ struct esp_cmd_priv {
>   	struct scatterlist	*cur_sg;
>   	int			tot_residue;
>   };
> -#define ESP_CMD_PRIV(CMD)	((struct esp_cmd_priv *)(&(CMD)->SCp))
> +
> +#define ESP_CMD_PRIV(cmd)	((struct esp_cmd_priv *)scsi_cmd_priv(cmd))
>   
>   /* NOTE: this enum is ordered based on chip features! */
>   enum esp_rev {

Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
Himanshu Madhani Feb. 9, 2022, 6:04 p.m. UTC | #2
> On Feb 8, 2022, at 9:24 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.
> 
> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> drivers/scsi/esp_scsi.c | 4 +---
> drivers/scsi/esp_scsi.h | 3 ++-
> 2 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c
> index 57787537285a..64ec6bb84550 100644
> --- a/drivers/scsi/esp_scsi.c
> +++ b/drivers/scsi/esp_scsi.c
> @@ -2678,6 +2678,7 @@ struct scsi_host_template scsi_esp_template = {
> 	.sg_tablesize		= SG_ALL,
> 	.max_sectors		= 0xffff,
> 	.skip_settle_delay	= 1,
> +	.cmd_size		= sizeof(struct esp_cmd_priv),
> };
> EXPORT_SYMBOL(scsi_esp_template);
> 
> @@ -2739,9 +2740,6 @@ static struct spi_function_template esp_transport_ops = {
> 
> static int __init esp_init(void)
> {
> -	BUILD_BUG_ON(sizeof(struct scsi_pointer) <
> -		     sizeof(struct esp_cmd_priv));
> -
> 	esp_transport_template = spi_attach_transport(&esp_transport_ops);
> 	if (!esp_transport_template)
> 		return -ENODEV;
> diff --git a/drivers/scsi/esp_scsi.h b/drivers/scsi/esp_scsi.h
> index 446a3d18c022..c73760d3cf83 100644
> --- a/drivers/scsi/esp_scsi.h
> +++ b/drivers/scsi/esp_scsi.h
> @@ -262,7 +262,8 @@ struct esp_cmd_priv {
> 	struct scatterlist	*cur_sg;
> 	int			tot_residue;
> };
> -#define ESP_CMD_PRIV(CMD)	((struct esp_cmd_priv *)(&(CMD)->SCp))
> +
> +#define ESP_CMD_PRIV(cmd)	((struct esp_cmd_priv *)scsi_cmd_priv(cmd))
> 
> /* NOTE: this enum is ordered based on chip features! */
> enum esp_rev {

Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>

--
Himanshu Madhani	 Oracle Linux Engineering
diff mbox series

Patch

diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c
index 57787537285a..64ec6bb84550 100644
--- a/drivers/scsi/esp_scsi.c
+++ b/drivers/scsi/esp_scsi.c
@@ -2678,6 +2678,7 @@  struct scsi_host_template scsi_esp_template = {
 	.sg_tablesize		= SG_ALL,
 	.max_sectors		= 0xffff,
 	.skip_settle_delay	= 1,
+	.cmd_size		= sizeof(struct esp_cmd_priv),
 };
 EXPORT_SYMBOL(scsi_esp_template);
 
@@ -2739,9 +2740,6 @@  static struct spi_function_template esp_transport_ops = {
 
 static int __init esp_init(void)
 {
-	BUILD_BUG_ON(sizeof(struct scsi_pointer) <
-		     sizeof(struct esp_cmd_priv));
-
 	esp_transport_template = spi_attach_transport(&esp_transport_ops);
 	if (!esp_transport_template)
 		return -ENODEV;
diff --git a/drivers/scsi/esp_scsi.h b/drivers/scsi/esp_scsi.h
index 446a3d18c022..c73760d3cf83 100644
--- a/drivers/scsi/esp_scsi.h
+++ b/drivers/scsi/esp_scsi.h
@@ -262,7 +262,8 @@  struct esp_cmd_priv {
 	struct scatterlist	*cur_sg;
 	int			tot_residue;
 };
-#define ESP_CMD_PRIV(CMD)	((struct esp_cmd_priv *)(&(CMD)->SCp))
+
+#define ESP_CMD_PRIV(cmd)	((struct esp_cmd_priv *)scsi_cmd_priv(cmd))
 
 /* NOTE: this enum is ordered based on chip features! */
 enum esp_rev {