Remove the SCSI pointer from struct scsi_cmnd
Subsystems (39)
Re: [PATCH v2 25/44] mac53c94: Fix a set-but-not-used compiler warning
In reply to Bart Van AsscheQuoted 26 lines · Bart Van Assche
Fix the following compiler warning:
drivers/scsi/mac53c94.c: In function 'mac53c94_init': drivers/scsi/mac53c94.c:128:13: warning: variable 'x' set but not used [-Wunused-but-set-variable] 128 | int x;Cc Benjamin Herrenschmidt <[email protected]>Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/mac53c94.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/scsi/mac53c94.c +0
-1@@ -125,7 +125,6 @@ static void mac53c94_init(struct fsc_state *state) {struct mac53c94_regs __iomem *regs = state->regs;struct dbdma_regs __iomem *dma = state->dma; -int x;writeb (state->host->this_id |CF1_PAR_ENABLE , ®s->config1);writeb (TIMO_VAL (250 ), ®s->sel_timeout);/* 250ms */
drivers/scsi/mac53c94.c static void mac53c94_init(struct fsc_state *state) · line 139
Quoted 8 lines
drivers/scsi/mac53c94.c +1
-1@@ -134,7 +133,7 @@ static void mac53c94_init(struct fsc_state *state)writeb (0 , ®s->config3);writeb (0 , ®s->sync_period);writeb (0 , ®s->sync_offset); - x =readb (®s->interrupt); + (void )readb (®s->interrupt);writel ((RUN |PAUSE |FLUSH |WAKE ) <<16 , &dma->control); }
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 25/44] mac53c94: Fix a set-but-not-used compiler warning
In reply to Bart Van AsscheQuoted 30 lines · Bart Van Assche
Fix the following compiler warning:
drivers/scsi/mac53c94.c: In function 'mac53c94_init':
drivers/scsi/mac53c94.c:128:13: warning: variable 'x' set but not used [-Wunused-but-set-variable]128 | int x;Cc Benjamin Herrenschmidt <[email protected]>Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/mac53c94.c| 3 +--1 file changed, 1 insertion(+), 2 deletions(-)drivers/scsi/mac53c94.c +0
-1@@ -125,7 +125,6 @@ static void mac53c94_init(struct fsc_state *state) {struct mac53c94_regs __iomem *regs = state->regs;struct dbdma_regs __iomem *dma = state->dma; -int x;writeb (state->host->this_id |CF1_PAR_ENABLE , ®s->config1);writeb (TIMO_VAL (250 ), ®s->sel_timeout);/* 250ms */
drivers/scsi/mac53c94.c static void mac53c94_init(struct fsc_state *state) · line 139
Quoted 8 lines
drivers/scsi/mac53c94.c +1
-1@@ -134,7 +133,7 @@ static void mac53c94_init(struct fsc_state *state)writeb (0 , ®s->config3);writeb (0 , ®s->sync_period);writeb (0 , ®s->sync_offset); - x =readb (®s->interrupt); + (void )readb (®s->interrupt);writel ((RUN |PAUSE |FLUSH |WAKE ) <<16 , &dma->control); }
--
Himanshu Madhani Oracle Linux Engineering
PATCH v2 26/44 mac53c94: Move the SCSI pointer to private command data
In reply to Bart Van AsscheSet .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.
--- drivers/scsi/mac53c94.c | 24 +++++++++++++----------- drivers/scsi/mac53c94.h | 11 +++++++++++ 2 files changed, 24 insertions(+), 11 deletions(-)
drivers/scsi/mac53c94.c +13 -11
@@ -193,7 +193,8 @@ static void mac53c94_interrupt(int irq, void *dev_id)struct fsc_state *state = (struct fsc_state *) dev_id;struct mac53c94_regs __iomem *regs = state->regs;struct dbdma_regs __iomem *dma = state->dma; -struct scsi_cmnd *cmd = state->current_req; +struct scsi_cmnd *const cmd = state->current_req; +struct scsi_pointer *const scsi_pointer =mac53c94_scsi_pointer (cmd);int nb, stat, seq, intr;static int mac53c94_errors;
@@ -263,10 +264,10 @@ static void mac53c94_interrupt(int irq, void *dev_id)/* set DMA controller going if any data to transfer */ if ((stat & (STAT_MSG |STAT_CD )) ==0 && (scsi_sg_count (cmd) >0 ||scsi_bufflen (cmd))) { - nb = cmd->SCp.this_residual; + nb = scsi_pointer->this_residual;if (nb >0xfff0 ) nb =0xfff0 ; - cmd->SCp.this_residual -= nb; + scsi_pointer->this_residual -= nb;writeb (nb, ®s->count_lo);writeb (nb >>8 , ®s->count_mid);writeb (CMD_DMA_MODE +CMD_NOP , ®s->command);
@@ -293,13 +294,13 @@ static void mac53c94_interrupt(int irq, void *dev_id)cmd_done (state,DID_ERROR <<16 );return ; } -if (cmd->SCp.this_residual !=0 +if (scsi_pointer->this_residual !=0 && (stat & (STAT_MSG |STAT_CD )) ==0 ) {/* Set up the count regs to transfer more */ - nb = cmd->SCp.this_residual; + nb = scsi_pointer->this_residual;if (nb >0xfff0 ) nb =0xfff0 ; - cmd->SCp.this_residual -= nb; + scsi_pointer->this_residual -= nb;writeb (nb, ®s->count_lo);writeb (nb >>8 , ®s->count_mid);writeb (CMD_DMA_MODE +CMD_NOP , ®s->command);
@@ -321,8 +322,8 @@ static void mac53c94_interrupt(int irq, void *dev_id)cmd_done (state,DID_ERROR <<16 );return ; } - cmd->SCp.Status =readb (®s->fifo); - cmd->SCp.Message =readb (®s->fifo); + scsi_pointer->Status =readb (®s->fifo); + scsi_pointer->Message =readb (®s->fifo);writeb (CMD_ACCEPT_MSG , ®s->command); state->phase = busfreeing;break ;
@@ -330,8 +331,8 @@ static void mac53c94_interrupt(int irq, void *dev_id)if (intr !=INTR_DISCONNECT ) {printk (KERN_DEBUG "got intr %x when expected disconnect\n" , intr); } -cmd_done (state, (DID_OK <<16 ) + (cmd->SCp.Message <<8 ) - + cmd->SCp.Status); +cmd_done (state, (DID_OK <<16 ) + (scsi_pointer->Message <<8 ) + + scsi_pointer->Status);break ;default :printk (KERN_DEBUG "don't know about phase %d\n" , state->phase);
@@ -389,7 +390,7 @@ static void set_dma_cmds(struct fsc_state *state, struct scsi_cmnd *cmd) dma_cmd +=OUTPUT_LAST -OUTPUT_MORE ; dcmds[-1 ].command =cpu_to_le16 (dma_cmd); dcmds->command =cpu_to_le16 (DBDMA_STOP ); - cmd->SCp.this_residual = total; +mac53c94_scsi_pointer (cmd)->this_residual = total; }static struct scsi_host_template mac53c94_template = {
@@ -401,6 +402,7 @@ static struct scsi_host_template mac53c94_template = { .this_id = 7, .sg_tablesize = SG_ALL, .max_segment_size = 65535, + .cmd_size = sizeof(struct mac53c94_cmd_priv), };static int mac53c94_probe (struct macio_dev *mdev,const struct of_device_id *match)
drivers/scsi/mac53c94.h +11 -0
@@ -212,4 +212,15 @@ struct mac53c94_regs {#define CF4_TEST 0x02#define CF4_BBTE 0x01 +struct mac53c94_cmd_priv { +struct scsi_pointer scsi_pointer; +}; + +static inline struct scsi_pointer *mac53c94_scsi_pointer (struct scsi_cmnd *cmd) +{ +struct mac53c94_cmd_priv *mcmd =scsi_cmd_priv (cmd); + +return &mcmd->scsi_pointer; +} +#endif /* _MAC53C94_H */
Hannes Reinecke
maintainerRe: [PATCH v2 26/44] mac53c94: Move the SCSI pointer to private command data
Quoted 104 lines · Bart Van Assche
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 structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/mac53c94.c | 24 +++++++++++++----------- drivers/scsi/mac53c94.h | 11 +++++++++++ 2 files changed, 24 insertions(+), 11 deletions(-)drivers/scsi/mac53c94.c +13
-11@@ -193,7 +193,8 @@ static void mac53c94_interrupt(int irq, void *dev_id)struct fsc_state *state = (struct fsc_state *) dev_id;struct mac53c94_regs __iomem *regs = state->regs;struct dbdma_regs __iomem *dma = state->dma; -struct scsi_cmnd *cmd = state->current_req; +struct scsi_cmnd *const cmd = state->current_req; +struct scsi_pointer *const scsi_pointer =mac53c94_scsi_pointer (cmd);int nb, stat, seq, intr;static int mac53c94_errors;@@ -263,10 +264,10 @@ static void mac53c94_interrupt(int irq, void *dev_id)/* set DMA controller going if any data to transfer */ if ((stat & (STAT_MSG |STAT_CD )) ==0 && (scsi_sg_count (cmd) >0 ||scsi_bufflen (cmd))) { - nb = cmd->SCp.this_residual; + nb = scsi_pointer->this_residual;if (nb >0xfff0 ) nb =0xfff0 ; - cmd->SCp.this_residual -= nb; + scsi_pointer->this_residual -= nb;writeb (nb, ®s->count_lo);writeb (nb >>8 , ®s->count_mid);writeb (CMD_DMA_MODE +CMD_NOP , ®s->command);@@ -293,13 +294,13 @@ static void mac53c94_interrupt(int irq, void *dev_id)cmd_done (state,DID_ERROR <<16 );return ; } -if (cmd->SCp.this_residual !=0 +if (scsi_pointer->this_residual !=0 && (stat & (STAT_MSG |STAT_CD )) ==0 ) {/* Set up the count regs to transfer more */ - nb = cmd->SCp.this_residual; + nb = scsi_pointer->this_residual;if (nb >0xfff0 ) nb =0xfff0 ; - cmd->SCp.this_residual -= nb; + scsi_pointer->this_residual -= nb;writeb (nb, ®s->count_lo);writeb (nb >>8 , ®s->count_mid);writeb (CMD_DMA_MODE +CMD_NOP , ®s->command);@@ -321,8 +322,8 @@ static void mac53c94_interrupt(int irq, void *dev_id)cmd_done (state,DID_ERROR <<16 );return ; } - cmd->SCp.Status =readb (®s->fifo); - cmd->SCp.Message =readb (®s->fifo); + scsi_pointer->Status =readb (®s->fifo); + scsi_pointer->Message =readb (®s->fifo);writeb (CMD_ACCEPT_MSG , ®s->command); state->phase = busfreeing;break ;@@ -330,8 +331,8 @@ static void mac53c94_interrupt(int irq, void *dev_id)if (intr !=INTR_DISCONNECT ) {printk (KERN_DEBUG "got intr %x when expected disconnect\n" , intr); } -cmd_done (state, (DID_OK <<16 ) + (cmd->SCp.Message <<8 ) - + cmd->SCp.Status); +cmd_done (state, (DID_OK <<16 ) + (scsi_pointer->Message <<8 ) + + scsi_pointer->Status);break ;default :printk (KERN_DEBUG "don't know about phase %d\n" , state->phase);@@ -389,7 +390,7 @@ static void set_dma_cmds(struct fsc_state *state, struct scsi_cmnd *cmd) dma_cmd +=OUTPUT_LAST -OUTPUT_MORE ; dcmds[-1 ].command =cpu_to_le16 (dma_cmd); dcmds->command =cpu_to_le16 (DBDMA_STOP ); - cmd->SCp.this_residual = total; +mac53c94_scsi_pointer (cmd)->this_residual = total; }static struct scsi_host_template mac53c94_template = {@@ -401,6 +402,7 @@ static struct scsi_host_template mac53c94_template = { .this_id = 7, .sg_tablesize = SG_ALL, .max_segment_size = 65535, + .cmd_size = sizeof(struct mac53c94_cmd_priv), };static int mac53c94_probe (struct macio_dev *mdev,const struct of_device_id *match)drivers/scsi/mac53c94.h +2
-0@@ -212,4 +212,15 @@ struct mac53c94_regs {#define CF4_TEST 0x02#define CF4_BBTE 0x01 +struct mac53c94_cmd_priv { +struct scsi_pointer scsi_pointer;
drivers/scsi/mac53c94.h struct mac53c94_regs { · line 226
Quoted 10 lines
drivers/scsi/mac53c94.h +9
-0+}; + +static inline struct scsi_pointer *mac53c94_scsi_pointer (struct scsi_cmnd *cmd) +{ +struct mac53c94_cmd_priv *mcmd =scsi_cmd_priv (cmd); + +return &mcmd->scsi_pointer; +} +#endif /* _MAC53C94_H */
Also here: Why not use 'struct scsi_pointer' directly as command payload?
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 26/44] mac53c94: Move the SCSI pointer to private command data
Quoted 12 lines · Hannes Reinecke
Quoted 9 lines · Bart Van Assche
+static inline struct
scsi_pointer*mac53c94_scsi_pointer(structscsi_cmnd*cmd)drivers/scsi/mac53c94.h +6
-0+{ + struct mac53c94_cmd_priv *mcmd = scsi_cmd_priv(cmd); + + return &mcmd->scsi_pointer; +} +#endif /*
_MAC53C94_H*/Also here: Why not use 'struct
scsi_pointer' directly as command payload?
To make it easier to add more private command data in the future. Do you perhaps want me to use struct scsi_pointer directly?
Thanks,
Bart.
Re: [PATCH v2 26/44] mac53c94: Move the SCSI pointer to private command data
Quoted 14 lines · Bart Van Assche
Quoted 12 lines · Hannes Reinecke
Quoted 9 lines · Bart Van Assche
+static inline struct
scsi_pointer*mac53c94_scsi_pointer(structscsi_cmnd*cmd)drivers/scsi/mac53c94.h +6
-0+{ + struct mac53c94_cmd_priv *mcmd = scsi_cmd_priv(cmd); + + return &mcmd->scsi_pointer; +} +#endif /*
_MAC53C94_H*/Also here: Why not use 'struct
scsi_pointer' directly as command payload?
Quoted 2 lines
To make it easier to add more private command data in the future. Do you perhaps want me to use struct
scsi_pointerdirectly?
As indicated in my previous comment: in principle, yes.
But this driver is using 'host_scribble', too, which should be moved into the command payload, too. So this patch is fine.
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 26/44] mac53c94: Move the SCSI pointer to private command data
In reply to Bart Van AsscheQuoted 108 lines · Bart Van Assche
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 structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/mac53c94.c| 24 +++++++++++++-----------drivers/scsi/mac53c94.h| 11 +++++++++++2 files changed, 24 insertions(+), 11 deletions(-)drivers/scsi/mac53c94.c +13
-11@@ -193,7 +193,8 @@ static void mac53c94_interrupt(int irq, void *dev_id)struct fsc_state *state = (struct fsc_state *) dev_id;struct mac53c94_regs __iomem *regs = state->regs;struct dbdma_regs __iomem *dma = state->dma; -struct scsi_cmnd *cmd = state->current_req; +struct scsi_cmnd *const cmd = state->current_req; +struct scsi_pointer *const scsi_pointer =mac53c94_scsi_pointer (cmd);int nb, stat, seq, intr;static int mac53c94_errors;@@ -263,10 +264,10 @@ static void mac53c94_interrupt(int irq, void *dev_id)/* set DMA controller going if any data to transfer */ if ((stat & (STAT_MSG |STAT_CD )) ==0 && (scsi_sg_count (cmd) >0 ||scsi_bufflen (cmd))) { - nb = cmd->SCp.this_residual; + nb = scsi_pointer->this_residual;if (nb >0xfff0 ) nb =0xfff0 ; - cmd->SCp.this_residual -= nb; + scsi_pointer->this_residual -= nb;writeb (nb, ®s->count_lo);writeb (nb >>8 , ®s->count_mid);writeb (CMD_DMA_MODE +CMD_NOP , ®s->command);@@ -293,13 +294,13 @@ static void mac53c94_interrupt(int irq, void *dev_id)cmd_done (state,DID_ERROR <<16 );return ; } -if (cmd->SCp.this_residual !=0 +if (scsi_pointer->this_residual !=0 && (stat & (STAT_MSG |STAT_CD )) ==0 ) {/* Set up the count regs to transfer more */ - nb = cmd->SCp.this_residual; + nb = scsi_pointer->this_residual;if (nb >0xfff0 ) nb =0xfff0 ; - cmd->SCp.this_residual -= nb; + scsi_pointer->this_residual -= nb;writeb (nb, ®s->count_lo);writeb (nb >>8 , ®s->count_mid);writeb (CMD_DMA_MODE +CMD_NOP , ®s->command);@@ -321,8 +322,8 @@ static void mac53c94_interrupt(int irq, void *dev_id)cmd_done (state,DID_ERROR <<16 );return ; } - cmd->SCp.Status =readb (®s->fifo); - cmd->SCp.Message =readb (®s->fifo); + scsi_pointer->Status =readb (®s->fifo); + scsi_pointer->Message =readb (®s->fifo);writeb (CMD_ACCEPT_MSG , ®s->command); state->phase = busfreeing;break ;@@ -330,8 +331,8 @@ static void mac53c94_interrupt(int irq, void *dev_id)if (intr !=INTR_DISCONNECT ) {printk (KERN_DEBUG "got intr %x when expected disconnect\n" , intr); } -cmd_done (state, (DID_OK <<16 ) + (cmd->SCp.Message <<8 ) - + cmd->SCp.Status); +cmd_done (state, (DID_OK <<16 ) + (scsi_pointer->Message <<8 ) + + scsi_pointer->Status);break ;default :printk (KERN_DEBUG "don't know about phase %d\n" , state->phase);@@ -389,7 +390,7 @@ static void set_dma_cmds(struct fsc_state *state, struct scsi_cmnd *cmd) dma_cmd +=OUTPUT_LAST -OUTPUT_MORE ; dcmds[-1 ].command =cpu_to_le16 (dma_cmd); dcmds->command =cpu_to_le16 (DBDMA_STOP ); - cmd->SCp.this_residual = total; +mac53c94_scsi_pointer (cmd)->this_residual = total; }static struct scsi_host_template mac53c94_template = {@@ -401,6 +402,7 @@ static struct scsi_host_template mac53c94_template = { .this_id = 7, .sg_tablesize = SG_ALL, .max_segment_size = 65535, + .cmd_size = sizeof(struct mac53c94_cmd_priv), };static int mac53c94_probe (struct macio_dev *mdev,const struct of_device_id *match)drivers/scsi/mac53c94.h +2
-0@@ -212,4 +212,15 @@ struct mac53c94_regs {#define CF4_TEST 0x02#define CF4_BBTE 0x01 +struct mac53c94_cmd_priv { +struct scsi_pointer scsi_pointer;
drivers/scsi/mac53c94.h struct mac53c94_regs { · line 226
Quoted 10 lines
drivers/scsi/mac53c94.h +9
-0+}; + +static inline struct scsi_pointer *mac53c94_scsi_pointer (struct scsi_cmnd *cmd) +{ +struct mac53c94_cmd_priv *mcmd =scsi_cmd_priv (cmd); + +return &mcmd->scsi_pointer; +} +#endif /* _MAC53C94_H */
--
Himanshu Madhani Oracle Linux Engineering
PATCH v2 27/44 megaraid: Stop using the SCSI pointer
In reply to Bart Van AsscheSet .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.
--- drivers/scsi/megaraid.c | 13 ++++--------- drivers/scsi/megaraid.h | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 10 deletions(-)
drivers/scsi/megaraid.c +4 -9
@@ -1644,16 +1644,10 @@ mega_cmd_done(adapter_t *adapter, u8 completed[], int nstatus, int status)static void mega_rundoneq (adapter_t *adapter) { -struct scsi_cmnd *cmd; -struct list_head *pos; +struct megaraid_cmd_priv *cmd_priv; -list_for_each (pos, &adapter->completed_list) { - -struct scsi_pointer * spos = (struct scsi_pointer *)pos; - - cmd = list_entry(spos, struct scsi_cmnd, SCp); -scsi_done (cmd); - } +list_for_each_entry (cmd_priv, &adapter->completed_list, entry) +scsi_done (megaraid_to_scsi_cmd (cmd_priv));INIT_LIST_HEAD (&adapter->completed_list); }
@@ -4123,6 +4117,7 @@ static struct scsi_host_template megaraid_template = { .eh_bus_reset_handler = megaraid_reset, .eh_host_reset_handler = megaraid_reset, .no_write_same = 1, + .cmd_size = sizeof(struct megaraid_cmd_priv), }; static int
drivers/scsi/megaraid.h +14 -1
@@ -4,6 +4,7 @@#include <linux/spinlock.h> #include <linux/mutex.h> +#include <scsi/scsi_cmnd.h> #define MEGARAID_VERSION \ "v2.00.4 (Release Date: Thu Feb 9 08:51:30 EST 2006)\n"
@@ -756,8 +757,20 @@ struct private_bios_data {#define CACHED_IO 0#define DIRECT_IO 1 +struct megaraid_cmd_priv { +struct list_head entry; +}; + +#define SCSI_LIST (scp) \ + (&((struct megaraid_cmd_priv *)scsi_cmd_priv(scp))->entry) + +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 ; +}/* * Each controller's soft state
Hannes Reinecke
maintainerRe: [PATCH v2 27/44] megaraid: Stop using the SCSI pointer
Quoted 64 lines · Bart Van Assche
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 structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/megaraid.c | 13 ++++--------- drivers/scsi/megaraid.h | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 10 deletions(-)drivers/scsi/megaraid.c +4
-9@@ -1644,16 +1644,10 @@ mega_cmd_done(adapter_t *adapter, u8 completed[], int nstatus, int status)static void mega_rundoneq (adapter_t *adapter) { -struct scsi_cmnd *cmd; -struct list_head *pos; +struct megaraid_cmd_priv *cmd_priv; -list_for_each (pos, &adapter->completed_list) { - -struct scsi_pointer * spos = (struct scsi_pointer *)pos; - - cmd = list_entry(spos, struct scsi_cmnd, SCp); -scsi_done (cmd); - } +list_for_each_entry (cmd_priv, &adapter->completed_list, entry) +scsi_done (megaraid_to_scsi_cmd (cmd_priv));INIT_LIST_HEAD (&adapter->completed_list); }@@ -4123,6 +4117,7 @@ static struct scsi_host_template megaraid_template = { .eh_bus_reset_handler = megaraid_reset, .eh_host_reset_handler = megaraid_reset, .no_write_same = 1, + .cmd_size = sizeof(struct megaraid_cmd_priv), }; static intdrivers/scsi/megaraid.h +6
-0@@ -4,6 +4,7 @@#include <linux/spinlock.h> #include <linux/mutex.h> +#include <scsi/scsi_cmnd.h> #define MEGARAID_VERSION \ "v2.00.4 (Release Date: Thu Feb 9 08:51:30 EST 2006)\n"@@ -756,8 +757,20 @@ struct private_bios_data {#define CACHED_IO 0#define DIRECT_IO 1 +struct megaraid_cmd_priv { +struct list_head entry; +}; + +#define SCSI_LIST (scp) \
drivers/scsi/megaraid.h struct private_bios_data { · line 773
Quoted 10 lines
drivers/scsi/megaraid.h +8
-1+ (&((struct megaraid_cmd_priv *)scsi_cmd_priv(scp))->entry) + +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()).
drivers/scsi/megaraid.h struct private_bios_data { · line 776
Quoted 3 lines
drivers/scsi/megaraid.h +0
-0/* * Each controller's soft state
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 27/44] megaraid: Stop using the SCSI pointer
Quoted 11 lines · Hannes Reinecke
drivers/scsi/megaraid.h struct private_bios_data { · line 773
Quoted 7 lines · Bart Van Assche
drivers/scsi/megaraid.h +6
-1+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?
Quoted 2 lines
If you need this you'd better introduce a helper
(egscsi_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.
Re: [PATCH v2 27/44] megaraid: Stop using the SCSI pointer
In reply to Bart Van AsscheQuoted 71 lines · Bart Van Assche
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 structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/megaraid.c| 13 ++++---------drivers/scsi/megaraid.h| 15 ++++++++++++++-2 files changed, 18 insertions(+), 10 deletions(-)drivers/scsi/megaraid.c +0
-0@@ -1644,16 +1644,10 @@ mega_cmd_done(adapter_t *adapter, u8 completed[], int nstatus, int status)static void
mega_rundoneq(adapter_t*adapter)
{drivers/scsi/megaraid.c +3
-9-struct scsi_cmnd *cmd; -struct list_head *pos; +struct megaraid_cmd_priv *cmd_priv; -list_for_each (pos, &adapter->completed_list) { - -struct scsi_pointer * spos = (struct scsi_pointer *)pos; - - cmd = list_entry(spos, struct scsi_cmnd, SCp); -scsi_done (cmd); - } +list_for_each_entry (cmd_priv, &adapter->completed_list, entry) +scsi_done (megaraid_to_scsi_cmd (cmd_priv));INIT_LIST_HEAD(&adapter->completed_list); }drivers/scsi/megaraid.c +1
-0@@ -4123,6 +4117,7 @@ static struct scsi_host_template megaraid_template = { .eh_bus_reset_handler = megaraid_reset, .eh_host_reset_handler = megaraid_reset, .no_write_same = 1, + .cmd_size = sizeof(struct megaraid_cmd_priv), };static int
drivers/scsi/megaraid.h +9
-0@@ -4,6 +4,7 @@#include <linux/spinlock.h> #include <linux/mutex.h> +#include <scsi/scsi_cmnd.h> #define MEGARAID_VERSION \ "v2.00.4 (Release Date: Thu Feb 9 08:51:30 EST 2006)\n"@@ -756,8 +757,20 @@ struct private_bios_data {#define CACHED_IO 0#define DIRECT_IO 1 +struct megaraid_cmd_priv { +struct list_head entry; +}; + +#define SCSI_LIST (scp) \ + (&((struct megaraid_cmd_priv *)scsi_cmd_priv(scp))->entry) + +static inline struct scsi_cmnd *
drivers/scsi/megaraid.h struct private_bios_data { · line 776
Quoted 10 lines
drivers/scsi/megaraid.h +5
-1+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 ; +}/* * Each controller's soft state
--
Himanshu Madhani Oracle Linux Engineering
PATCH v2 28/44 megasas: Stop using the SCSI pointer
In reply to Bart Van AsscheSet .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.
--- drivers/scsi/megaraid/megaraid_sas.h | 12 ++++++++++++ drivers/scsi/megaraid/megaraid_sas_base.c | 8 ++++---- drivers/scsi/megaraid/megaraid_sas_fusion.c | 15 ++++++++------- 3 files changed, 24 insertions(+), 11 deletions(-)
drivers/scsi/megaraid/megaraid_sas.h +12 -0
@@ -18,6 +18,8 @@#ifndef LSI_MEGARAID_SAS_H #define LSI_MEGARAID_SAS_H +#include <scsi/scsi_cmnd.h> +/* * MegaRAID SAS Driver meta data */
@@ -2594,6 +2596,16 @@ struct megasas_cmd { }; }; +struct megasas_cmd_priv { +void *cmd_priv; +u8 status; +}; + +static inline struct megasas_cmd_priv *megasas_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +} +#define MAX_MGMT_ADAPTERS 1024#define MAX_IOCTL_SGE 16
drivers/scsi/megaraid/megaraid_sas_base.c +4 -4
@@ -1760,7 +1760,7 @@ megasas_build_and_issue_cmd(struct megasas_instance *instance, goto out_return_cmd; cmd->scmd = scmd; - scmd->SCp.ptr = (char *)cmd; +megasas_priv (scmd)->cmd_priv = cmd;/* * Issue the command to the FW
@@ -2992,11 +2992,10 @@ megasas_dump_reg_set(void __iomem *reg_set)void megasas_dump_fusion_io (struct scsi_cmnd *scmd) { -struct megasas_cmd_fusion *cmd; +struct megasas_cmd_fusion *cmd =megasas_priv (scmd)->cmd_priv;union MEGASAS_REQUEST_DESCRIPTOR_UNION *req_desc;struct megasas_instance *instance; - cmd = (struct megasas_cmd_fusion *)scmd->SCp.ptr; instance = (struct megasas_instance *)scmd->device->host->hostdata; scmd_printk(KERN_INFO, scmd,
@@ -3518,6 +3517,7 @@ static struct scsi_host_template megasas_template = { .mq_poll = megasas_blk_mq_poll, .change_queue_depth = scsi_change_queue_depth, .max_segment_size = 0xffffffff, + .cmd_size = sizeof(struct megasas_cmd_priv), };/**
@@ -3601,7 +3601,7 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd, cmd->retry_for_fw_reset =0 ;if (cmd->scmd) - cmd->scmd->SCp.ptr =NULL ; +megasas_priv (cmd->scmd)->cmd_priv =NULL ;switch (hdr->cmd) {case MFI_CMD_INVALID :
drivers/scsi/megaraid/megaraid_sas_fusion.c +8 -7
@@ -2915,7 +2915,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance,get_updated_dev_handle (instance, &fusion->load_balance_info[device_id], &io_info, local_map_ptr); - scp->SCp.Status |=MEGASAS_LOAD_BALANCE_FLAG ; +megasas_priv (scp)->status |=MEGASAS_LOAD_BALANCE_FLAG ; cmd->pd_r1_lb = io_info.pd_after_lb;if (instance->adapter_type >=VENTURA_SERIES ) rctx_g35->span_arm = io_info.span_arm;
@@ -2923,7 +2923,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, rctx->span_arm = io_info.span_arm; }else - scp->SCp.Status &= ~MEGASAS_LOAD_BALANCE_FLAG ; +megasas_priv (scp)->status &= ~MEGASAS_LOAD_BALANCE_FLAG ;if (instance->adapter_type >=VENTURA_SERIES ) cmd->r1_alt_dev_handle = io_info.r1_alt_dev_handle;
@@ -3293,7 +3293,7 @@ megasas_build_io_fusion(struct megasas_instance *instance, io_request->SenseBufferLength =SCSI_SENSE_BUFFERSIZE ; cmd->scmd = scp; - scp->SCp.ptr = (char *)cmd; +megasas_priv (scp)->cmd_priv = cmd;return 0 ; }
@@ -3489,7 +3489,7 @@ megasas_complete_r1_command(struct megasas_instance *instance,if (instance->ldio_threshold &&megasas_cmd_type (scmd_local) ==READ_WRITE_LDIO )atomic_dec (&instance->ldio_outstanding); - scmd_local->SCp.ptr =NULL ; +megasas_priv (scmd_local)->cmd_priv =NULL ;megasas_return_cmd_fusion (instance, cmd);scsi_dma_unmap (scmd_local);megasas_sdev_busy_dec (instance, scmd_local);
@@ -3613,12 +3613,13 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex,case MPI2_FUNCTION_SCSI_IO_REQUEST :/*Fast Path IO.*/ /* Update load balancing info */ if (fusion->load_balance_info && - (cmd_fusion->scmd->SCp.Status & + (megasas_priv (cmd_fusion->scmd)->status &MEGASAS_LOAD_BALANCE_FLAG )) { device_id =MEGASAS_DEV_INDEX (scmd_local); lbinfo = &fusion->load_balance_info[device_id];atomic_dec (&lbinfo->scsi_pending_cmds[cmd_fusion->pd_r1_lb]); - cmd_fusion->scmd->SCp.Status &= ~MEGASAS_LOAD_BALANCE_FLAG ; +megasas_priv (cmd_fusion->scmd)->status &= + ~MEGASAS_LOAD_BALANCE_FLAG ; } fallthrough;/* and complete IO */ case MEGASAS_MPI2_FUNCTION_LD_IO_REQUEST :/* LD-IO Path */
@@ -3630,7 +3631,7 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex,if (instance->ldio_threshold && (megasas_cmd_type (scmd_local) ==READ_WRITE_LDIO ))atomic_dec (&instance->ldio_outstanding); - scmd_local->SCp.ptr =NULL ; +megasas_priv (scmd_local)->cmd_priv =NULL ;megasas_return_cmd_fusion (instance, cmd_fusion);scsi_dma_unmap (scmd_local);megasas_sdev_busy_dec (instance, scmd_local);
Re: [PATCH v2 28/44] megasas: Stop using the SCSI pointer
Quoted 142 lines · Bart Van Assche
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 structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/megaraid/megaraid_sas.h | 12 ++++++++++++ drivers/scsi/megaraid/megaraid_sas_base.c | 8 ++++---- drivers/scsi/megaraid/megaraid_sas_fusion.c | 15 ++++++++------- 3 files changed, 24 insertions(+), 11 deletions(-)drivers/scsi/megaraid/megaraid_sas.h +12
-0@@ -18,6 +18,8 @@#ifndef LSI_MEGARAID_SAS_H #define LSI_MEGARAID_SAS_H +#include <scsi/scsi_cmnd.h> +/* * MegaRAID SAS Driver meta data */ @@ -2594,6 +2596,16 @@ struct megasas_cmd { }; }; +struct megasas_cmd_priv { +void *cmd_priv; +u8 status; +}; + +static inline struct megasas_cmd_priv *megasas_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +} +#define MAX_MGMT_ADAPTERS 1024#define MAX_IOCTL_SGE 16drivers/scsi/megaraid/megaraid_sas_base.c +4
-4@@ -1760,7 +1760,7 @@ megasas_build_and_issue_cmd(struct megasas_instance *instance, goto out_return_cmd; cmd->scmd = scmd; - scmd->SCp.ptr = (char *)cmd; +megasas_priv (scmd)->cmd_priv = cmd;/* * Issue the command to the FW @@ -2992,11 +2992,10 @@ megasas_dump_reg_set(void __iomem *reg_set)void megasas_dump_fusion_io (struct scsi_cmnd *scmd) { -struct megasas_cmd_fusion *cmd; +struct megasas_cmd_fusion *cmd =megasas_priv (scmd)->cmd_priv;union MEGASAS_REQUEST_DESCRIPTOR_UNION *req_desc;struct megasas_instance *instance; - cmd = (struct megasas_cmd_fusion *)scmd->SCp.ptr; instance = (struct megasas_instance *)scmd->device->host->hostdata; scmd_printk(KERN_INFO, scmd,@@ -3518,6 +3517,7 @@ static struct scsi_host_template megasas_template = { .mq_poll = megasas_blk_mq_poll, .change_queue_depth = scsi_change_queue_depth, .max_segment_size = 0xffffffff, + .cmd_size = sizeof(struct megasas_cmd_priv), };/** @@ -3601,7 +3601,7 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd, cmd->retry_for_fw_reset =0 ;if (cmd->scmd) - cmd->scmd->SCp.ptr =NULL ; +megasas_priv (cmd->scmd)->cmd_priv =NULL ;switch (hdr->cmd) {case MFI_CMD_INVALID :drivers/scsi/megaraid/megaraid_sas_fusion.c +7
-6@@ -2915,7 +2915,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance,get_updated_dev_handle (instance, &fusion->load_balance_info[device_id], &io_info, local_map_ptr); - scp->SCp.Status |=MEGASAS_LOAD_BALANCE_FLAG ; +megasas_priv (scp)->status |=MEGASAS_LOAD_BALANCE_FLAG ; cmd->pd_r1_lb = io_info.pd_after_lb;if (instance->adapter_type >=VENTURA_SERIES ) rctx_g35->span_arm = io_info.span_arm;@@ -2923,7 +2923,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, rctx->span_arm = io_info.span_arm; }else - scp->SCp.Status &= ~MEGASAS_LOAD_BALANCE_FLAG ; +megasas_priv (scp)->status &= ~MEGASAS_LOAD_BALANCE_FLAG ;if (instance->adapter_type >=VENTURA_SERIES ) cmd->r1_alt_dev_handle = io_info.r1_alt_dev_handle;@@ -3293,7 +3293,7 @@ megasas_build_io_fusion(struct megasas_instance *instance, io_request->SenseBufferLength =SCSI_SENSE_BUFFERSIZE ; cmd->scmd = scp; - scp->SCp.ptr = (char *)cmd; +megasas_priv (scp)->cmd_priv = cmd;return 0 ; }@@ -3489,7 +3489,7 @@ megasas_complete_r1_command(struct megasas_instance *instance,if (instance->ldio_threshold &&megasas_cmd_type (scmd_local) ==READ_WRITE_LDIO )atomic_dec (&instance->ldio_outstanding); - scmd_local->SCp.ptr =NULL ; +megasas_priv (scmd_local)->cmd_priv =NULL ;megasas_return_cmd_fusion (instance, cmd);scsi_dma_unmap (scmd_local);megasas_sdev_busy_dec (instance, scmd_local);@@ -3613,12 +3613,13 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex,case MPI2_FUNCTION_SCSI_IO_REQUEST :/*Fast Path IO.*/ /* Update load balancing info */ if (fusion->load_balance_info && - (cmd_fusion->scmd->SCp.Status & + (megasas_priv (cmd_fusion->scmd)->status &MEGASAS_LOAD_BALANCE_FLAG )) { device_id =MEGASAS_DEV_INDEX (scmd_local); lbinfo = &fusion->load_balance_info[device_id];atomic_dec (&lbinfo->scsi_pending_cmds[cmd_fusion->pd_r1_lb]); - cmd_fusion->scmd->SCp.Status &= ~MEGASAS_LOAD_BALANCE_FLAG ; +megasas_priv (cmd_fusion->scmd)->status &= + ~MEGASAS_LOAD_BALANCE_FLAG ; } fallthrough;/* and complete IO */ case MEGASAS_MPI2_FUNCTION_LD_IO_REQUEST :/* LD-IO Path */
drivers/scsi/megaraid/megaraid_sas_fusion.c complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex, · line 3637
Quoted 8 lines
drivers/scsi/megaraid/megaraid_sas_fusion.c +1
-1@@ -3630,7 +3631,7 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex,if (instance->ldio_threshold && (megasas_cmd_type (scmd_local) ==READ_WRITE_LDIO ))atomic_dec (&instance->ldio_outstanding); - scmd_local->SCp.ptr =NULL ; +megasas_priv (scmd_local)->cmd_priv =NULL ;megasas_return_cmd_fusion (instance, cmd_fusion);scsi_dma_unmap (scmd_local);megasas_sdev_busy_dec (instance, scmd_local);
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 28/44] megasas: Stop using the SCSI pointer
In reply to Bart Van AsscheQuoted 146 lines · Bart Van Assche
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 structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/megaraid/megaraid_sas.h | 12 ++++++++++++ drivers/scsi/megaraid/megaraid_sas_base.c | 8 ++++---- drivers/scsi/megaraid/megaraid_sas_fusion.c | 15 ++++++++------- 3 files changed, 24 insertions(+), 11 deletions(-)drivers/scsi/megaraid/megaraid_sas.h +12
-0@@ -18,6 +18,8 @@#ifndef LSI_MEGARAID_SAS_H #define LSI_MEGARAID_SAS_H +#include <scsi/scsi_cmnd.h> +/* * MegaRAID SAS Driver meta data */ @@ -2594,6 +2596,16 @@ struct megasas_cmd { }; }; +struct megasas_cmd_priv { +void *cmd_priv; +u8 status; +}; + +static inline struct megasas_cmd_priv *megasas_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +} +#define MAX_MGMT_ADAPTERS 1024#define MAX_IOCTL_SGE 16drivers/scsi/megaraid/megaraid_sas_base.c +1
-1@@ -1760,7 +1760,7 @@ megasas_build_and_issue_cmd(struct megasas_instance *instance, goto out_return_cmd; cmd->scmd = scmd; - scmd->SCp.ptr = (char *)cmd; +megasas_priv (scmd)->cmd_priv = cmd;/* * Issue the command to the FW @@ -2992,11 +2992,10 @@ megasas_dump_reg_set(void __iomem *reg_set)void
megasas_dump_fusion_io(struct scsi_cmnd *scmd)
{drivers/scsi/megaraid/megaraid_sas_base.c +1
-1-struct megasas_cmd_fusion *cmd; +struct megasas_cmd_fusion *cmd =megasas_priv (scmd)->cmd_priv;union MEGASAS_REQUEST_DESCRIPTOR_UNION *req_desc; struct megasas_instance *instance;drivers/scsi/megaraid/megaraid_sas_base.c +0
-1- cmd = (struct megasas_cmd_fusion *)scmd->SCp.ptr;instance = (struct megasas_instance *)scmd->device->host->hostdata; scmd_printk(KERN_INFO, scmd,drivers/scsi/megaraid/megaraid_sas_base.c +2
-1@@ -3518,6 +3517,7 @@ static struct scsi_host_template megasas_template = { .mq_poll = megasas_blk_mq_poll, .change_queue_depth = scsi_change_queue_depth, .max_segment_size = 0xffffffff, + .cmd_size = sizeof(struct megasas_cmd_priv), };/** @@ -3601,7 +3601,7 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd, cmd->retry_for_fw_reset =0 ;if (cmd->scmd) - cmd->scmd->SCp.ptr =NULL ; +megasas_priv (cmd->scmd)->cmd_priv =NULL ;switch (hdr->cmd) {case MFI_CMD_INVALID :drivers/scsi/megaraid/megaraid_sas_fusion.c +7
-6@@ -2915,7 +2915,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance,get_updated_dev_handle (instance, &fusion->load_balance_info[device_id], &io_info, local_map_ptr); - scp->SCp.Status |=MEGASAS_LOAD_BALANCE_FLAG ; +megasas_priv (scp)->status |=MEGASAS_LOAD_BALANCE_FLAG ; cmd->pd_r1_lb = io_info.pd_after_lb;if (instance->adapter_type >=VENTURA_SERIES ) rctx_g35->span_arm = io_info.span_arm;@@ -2923,7 +2923,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, rctx->span_arm = io_info.span_arm; }else - scp->SCp.Status &= ~MEGASAS_LOAD_BALANCE_FLAG ; +megasas_priv (scp)->status &= ~MEGASAS_LOAD_BALANCE_FLAG ;if (instance->adapter_type >=VENTURA_SERIES ) cmd->r1_alt_dev_handle = io_info.r1_alt_dev_handle;@@ -3293,7 +3293,7 @@ megasas_build_io_fusion(struct megasas_instance *instance, io_request->SenseBufferLength =SCSI_SENSE_BUFFERSIZE ; cmd->scmd = scp; - scp->SCp.ptr = (char *)cmd; +megasas_priv (scp)->cmd_priv = cmd;return 0 ; }@@ -3489,7 +3489,7 @@ megasas_complete_r1_command(struct megasas_instance *instance,if (instance->ldio_threshold &&megasas_cmd_type (scmd_local) ==READ_WRITE_LDIO )atomic_dec (&instance->ldio_outstanding); - scmd_local->SCp.ptr =NULL ; +megasas_priv (scmd_local)->cmd_priv =NULL ;megasas_return_cmd_fusion (instance, cmd);scsi_dma_unmap (scmd_local);megasas_sdev_busy_dec (instance, scmd_local);@@ -3613,12 +3613,13 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex,case MPI2_FUNCTION_SCSI_IO_REQUEST :/*Fast Path IO.*/ /* Update load balancing info */ if (fusion->load_balance_info && - (cmd_fusion->scmd->SCp.Status & + (megasas_priv (cmd_fusion->scmd)->status &MEGASAS_LOAD_BALANCE_FLAG )) { device_id =MEGASAS_DEV_INDEX (scmd_local); lbinfo = &fusion->load_balance_info[device_id];atomic_dec (&lbinfo->scsi_pending_cmds[cmd_fusion->pd_r1_lb]); - cmd_fusion->scmd->SCp.Status &= ~MEGASAS_LOAD_BALANCE_FLAG ; +megasas_priv (cmd_fusion->scmd)->status &= + ~MEGASAS_LOAD_BALANCE_FLAG ; } fallthrough;/* and complete IO */ case MEGASAS_MPI2_FUNCTION_LD_IO_REQUEST :/* LD-IO Path */
drivers/scsi/megaraid/megaraid_sas_fusion.c complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex, · line 3637
Quoted 8 lines
drivers/scsi/megaraid/megaraid_sas_fusion.c +1
-1@@ -3630,7 +3631,7 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex,if (instance->ldio_threshold && (megasas_cmd_type (scmd_local) ==READ_WRITE_LDIO ))atomic_dec (&instance->ldio_outstanding); - scmd_local->SCp.ptr =NULL ; +megasas_priv (scmd_local)->cmd_priv =NULL ;megasas_return_cmd_fusion (instance, cmd_fusion);scsi_dma_unmap (scmd_local);megasas_sdev_busy_dec (instance, scmd_local);
--
Himanshu Madhani Oracle Linux Engineering
PATCH v2 29/44 mesh: Move the SCSI pointer to private command data
In reply to Bart Van AsscheSet .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.
--- drivers/scsi/mesh.c | 20 +++++++++++++------- drivers/scsi/mesh.h | 11 +++++++++++ 2 files changed, 24 insertions(+), 7 deletions(-)
drivers/scsi/mesh.c +13 -7
@@ -586,10 +586,12 @@ static void mesh_done(struct mesh_state *ms, int start_next) ms->current_req =NULL ; tp->current_req =NULL ;if (cmd) { +struct scsi_pointer *scsi_pointer =mesh_scsi_pointer (cmd); +set_host_byte (cmd, ms->stat); -set_status_byte (cmd, cmd->SCp.Status); +set_status_byte (cmd, scsi_pointer->Status);if (ms->stat ==DID_OK ) -scsi_msg_to_host_byte (cmd, cmd->SCp.Message); +scsi_msg_to_host_byte (cmd, scsi_pointer->Message);if (DEBUG_TARGET (cmd)) {printk (KERN_DEBUG "mesh_done: result = %x, data_ptr=%d, buflen=%d\n" , cmd->result, ms->data_ptr,scsi_bufflen (cmd));
@@ -603,7 +605,7 @@ static void mesh_done(struct mesh_state *ms, int start_next) }#endif } - cmd->SCp.this_residual -= ms->data_ptr; + scsi_pointer->this_residual -= ms->data_ptr;scsi_done (cmd); }if (start_next) {
@@ -1171,7 +1173,7 @@ static void handle_msgin(struct mesh_state *ms)if (ms->n_msgin <msgin_length (ms)) goto reject;if (cmd) - cmd->SCp.Message = code; +mesh_scsi_pointer (cmd)->Message = code;switch (code) {case COMMAND_COMPLETE :break ;
@@ -1262,7 +1264,7 @@ static void set_dma_cmds(struct mesh_state *ms, struct scsi_cmnd *cmd)if (cmd) {int nseg; - cmd->SCp.this_residual =scsi_bufflen (cmd); +mesh_scsi_pointer (cmd)->this_residual =scsi_bufflen (cmd); nseg =scsi_dma_map (cmd);BUG_ON (nseg <0 );
@@ -1592,10 +1594,13 @@ static void cmd_complete(struct mesh_state *ms)break ;case statusing:if (cmd) { - cmd->SCp.Status = mr->fifo; +struct scsi_pointer *scsi_pointer = +mesh_scsi_pointer (cmd); + + scsi_pointer->Status = mr->fifo;if (DEBUG_TARGET (cmd))printk (KERN_DEBUG "mesh: status is %x\n" , - cmd->SCp.Status); + scsi_pointer->Status); } ms->msgphase = msg_in;break ;
@@ -1837,6 +1842,7 @@ static struct scsi_host_template mesh_template = { .sg_tablesize = SG_ALL, .cmd_per_lun = 2, .max_segment_size = 65535, + .cmd_size = sizeof(struct mesh_cmd_priv), };static int mesh_probe (struct macio_dev *mdev,const struct of_device_id *match)
drivers/scsi/mesh.h +11 -0
@@ -8,6 +8,17 @@#ifndef _MESH_H#define _MESH_H +struct mesh_cmd_priv { +struct scsi_pointer scsi_pointer; +}; + +static inline struct scsi_pointer *mesh_scsi_pointer (struct scsi_cmnd *cmd) +{ +struct mesh_cmd_priv *mcmd =scsi_cmd_priv (cmd); + +return &mcmd->scsi_pointer; +} +/* * Registers in the MESH controller. */
Hannes Reinecke
maintainerRe: [PATCH v2 29/44] mesh: Move the SCSI pointer to private command data
Quoted 93 lines · Bart Van Assche
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 structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/mesh.c | 20 +++++++++++++------- drivers/scsi/mesh.h | 11 +++++++++++ 2 files changed, 24 insertions(+), 7 deletions(-)drivers/scsi/mesh.c +13
-7@@ -586,10 +586,12 @@ static void mesh_done(struct mesh_state *ms, int start_next) ms->current_req =NULL ; tp->current_req =NULL ;if (cmd) { +struct scsi_pointer *scsi_pointer =mesh_scsi_pointer (cmd); +set_host_byte (cmd, ms->stat); -set_status_byte (cmd, cmd->SCp.Status); +set_status_byte (cmd, scsi_pointer->Status);if (ms->stat ==DID_OK ) -scsi_msg_to_host_byte (cmd, cmd->SCp.Message); +scsi_msg_to_host_byte (cmd, scsi_pointer->Message);if (DEBUG_TARGET (cmd)) {printk (KERN_DEBUG "mesh_done: result = %x, data_ptr=%d, buflen=%d\n" , cmd->result, ms->data_ptr,scsi_bufflen (cmd));@@ -603,7 +605,7 @@ static void mesh_done(struct mesh_state *ms, int start_next) }#endif } - cmd->SCp.this_residual -= ms->data_ptr; + scsi_pointer->this_residual -= ms->data_ptr;scsi_done (cmd); }if (start_next) {@@ -1171,7 +1173,7 @@ static void handle_msgin(struct mesh_state *ms)if (ms->n_msgin <msgin_length (ms)) goto reject;if (cmd) - cmd->SCp.Message = code; +mesh_scsi_pointer (cmd)->Message = code;switch (code) {case COMMAND_COMPLETE :break ;@@ -1262,7 +1264,7 @@ static void set_dma_cmds(struct mesh_state *ms, struct scsi_cmnd *cmd)if (cmd) {int nseg; - cmd->SCp.this_residual =scsi_bufflen (cmd); +mesh_scsi_pointer (cmd)->this_residual =scsi_bufflen (cmd); nseg =scsi_dma_map (cmd);BUG_ON (nseg <0 );@@ -1592,10 +1594,13 @@ static void cmd_complete(struct mesh_state *ms)break ;case statusing:if (cmd) { - cmd->SCp.Status = mr->fifo; +struct scsi_pointer *scsi_pointer = +mesh_scsi_pointer (cmd); + + scsi_pointer->Status = mr->fifo;if (DEBUG_TARGET (cmd))printk (KERN_DEBUG "mesh: status is %x\n" , - cmd->SCp.Status); + scsi_pointer->Status); } ms->msgphase = msg_in;break ;@@ -1837,6 +1842,7 @@ static struct scsi_host_template mesh_template = { .sg_tablesize = SG_ALL, .cmd_per_lun = 2, .max_segment_size = 65535, + .cmd_size = sizeof(struct mesh_cmd_priv), };static int mesh_probe (struct macio_dev *mdev,const struct of_device_id *match)drivers/scsi/mesh.h +4
-0@@ -8,6 +8,17 @@#ifndef _MESH_H#define _MESH_H +struct mesh_cmd_priv { +struct scsi_pointer scsi_pointer; +}; +
drivers/scsi/mesh.h line 24
Quoted 10 lines
drivers/scsi/mesh.h +7
-0+static inline struct scsi_pointer *mesh_scsi_pointer (struct scsi_cmnd *cmd) +{ +struct mesh_cmd_priv *mcmd =scsi_cmd_priv (cmd); + +return &mcmd->scsi_pointer; +} +/* * Registers in the MESH controller. */
Also here, please use 'struct scsi_pointer' directly.
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 29/44] mesh: Move the SCSI pointer to private command data
In reply to Bart Van AsscheQuoted 97 lines · Bart Van Assche
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 structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/mesh.c| 20 +++++++++++++-------drivers/scsi/mesh.h| 11 +++++++++++2 files changed, 24 insertions(+), 7 deletions(-)drivers/scsi/mesh.c +13
-7@@ -586,10 +586,12 @@ static void mesh_done(struct mesh_state *ms, int start_next) ms->current_req =NULL ; tp->current_req =NULL ;if (cmd) { +struct scsi_pointer *scsi_pointer =mesh_scsi_pointer (cmd); +set_host_byte (cmd, ms->stat); -set_status_byte (cmd, cmd->SCp.Status); +set_status_byte (cmd, scsi_pointer->Status);if (ms->stat ==DID_OK ) -scsi_msg_to_host_byte (cmd, cmd->SCp.Message); +scsi_msg_to_host_byte (cmd, scsi_pointer->Message);if (DEBUG_TARGET (cmd)) {printk (KERN_DEBUG "mesh_done: result = %x, data_ptr=%d, buflen=%d\n" , cmd->result, ms->data_ptr,scsi_bufflen (cmd));@@ -603,7 +605,7 @@ static void mesh_done(struct mesh_state *ms, int start_next) }#endif } - cmd->SCp.this_residual -= ms->data_ptr; + scsi_pointer->this_residual -= ms->data_ptr;scsi_done (cmd); }if (start_next) {@@ -1171,7 +1173,7 @@ static void handle_msgin(struct mesh_state *ms)if (ms->n_msgin <msgin_length (ms)) goto reject;if (cmd) - cmd->SCp.Message = code; +mesh_scsi_pointer (cmd)->Message = code;switch (code) {case COMMAND_COMPLETE :break ;@@ -1262,7 +1264,7 @@ static void set_dma_cmds(struct mesh_state *ms, struct scsi_cmnd *cmd)if (cmd) {int nseg; - cmd->SCp.this_residual =scsi_bufflen (cmd); +mesh_scsi_pointer (cmd)->this_residual =scsi_bufflen (cmd); nseg =scsi_dma_map (cmd);BUG_ON (nseg <0 );@@ -1592,10 +1594,13 @@ static void cmd_complete(struct mesh_state *ms)break ;case statusing:if (cmd) { - cmd->SCp.Status = mr->fifo; +struct scsi_pointer *scsi_pointer = +mesh_scsi_pointer (cmd); + + scsi_pointer->Status = mr->fifo;if (DEBUG_TARGET (cmd))printk (KERN_DEBUG "mesh: status is %x\n" , - cmd->SCp.Status); + scsi_pointer->Status); } ms->msgphase = msg_in;break ;@@ -1837,6 +1842,7 @@ static struct scsi_host_template mesh_template = { .sg_tablesize = SG_ALL, .cmd_per_lun = 2, .max_segment_size = 65535, + .cmd_size = sizeof(struct mesh_cmd_priv), };static int mesh_probe (struct macio_dev *mdev,const struct of_device_id *match)drivers/scsi/mesh.h +4
-0@@ -8,6 +8,17 @@#ifndef _MESH_H#define _MESH_H +struct mesh_cmd_priv { +struct scsi_pointer scsi_pointer; +}; +
drivers/scsi/mesh.h line 24
Quoted 10 lines
drivers/scsi/mesh.h +7
-0+static inline struct scsi_pointer *mesh_scsi_pointer (struct scsi_cmnd *cmd) +{ +struct mesh_cmd_priv *mcmd =scsi_cmd_priv (cmd); + +return &mcmd->scsi_pointer; +} +/* * Registers in the MESH controller. */
--
Himanshu Madhani Oracle Linux Engineering
PATCH v2 30/44 mvsas: Fix a set-but-not-used warning
In reply to Bart Van AsscheThis patch fixes the following compiler warning:
drivers/scsi/mvsas/mv_init.c: In function ‘mvs_pci_init’:drivers/scsi/mvsas/mv_init.c:497:30: warning: variable ‘mpi’ set but not used [-Wunused-but-set-variable]
497 | struct mvs_prv_info *mpi;
| ^~~
--- drivers/scsi/mvsas/mv_init.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/scsi/mvsas/mv_init.c +5 -2
@@ -494,7 +494,6 @@ static int mvs_pci_init(struct pci_dev *pdev, const struct pci_device_id *ent) {unsigned int rc, nhost =0 ;struct mvs_info *mvi; -struct mvs_prv_info *mpi;irq_handler_t irq_handler = mvs_interrupt;struct Scsi_Host *shost =NULL ;const struct mvs_chip_info *chip;
@@ -559,10 +558,14 @@ static int mvs_pci_init(struct pci_dev *pdev, const struct pci_device_id *ent) } nhost++; }while (nhost < chip->n_host); - mpi = (struct mvs_prv_info *)(SHOST_TO_SAS_HA (shost)->lldd_ha);#ifdef CONFIG_SCSI_MVSAS_TASKLET + { +struct mvs_prv_info *mpi; + + mpi = (struct mvs_prv_info *)(SHOST_TO_SAS_HA (shost)->lldd_ha);tasklet_init (&(mpi->mv_tasklet), mvs_tasklet, (unsigned long )SHOST_TO_SAS_HA (shost)); + }#endif mvs_post_sas_ha_init (shost, chip);
Re: [PATCH v2 30/44] mvsas: Fix a set-but-not-used warning
Quoted 9 lines · Bart Van Assche
This patch fixes the following compiler warning:
drivers/scsi/mvsas/mv_init.c: In function ‘mvs_pci_init’:drivers/scsi/mvsas/mv_init.c:497:30: warning: variable ‘mpi’ set but not used [-Wunused-but-set-variable]
497 | structmvs_prv_info*mpi;
| ^~~Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>
Regardless of a somewhat useful comment, below (2nd), feel free to add:
Quoted 17 lines
--- drivers/scsi/mvsas/mv_init.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)drivers/scsi/mvsas/mv_init.c +0
-1@@ -494,7 +494,6 @@ static int mvs_pci_init(struct pci_dev *pdev, const struct pci_device_id *ent) {unsigned int rc, nhost =0 ;struct mvs_info *mvi; -struct mvs_prv_info *mpi;irq_handler_t irq_handler = mvs_interrupt;struct Scsi_Host *shost =NULL ;const struct mvs_chip_info *chip;
drivers/scsi/mvsas/mv_init.c static int mvs_pci_init(struct pci_dev *pdev, const struct pci_device_id *ent) · line 561
Quoted 5 lines
drivers/scsi/mvsas/mv_init.c +0
-1@@ -559,10 +558,14 @@ static int mvs_pci_init(struct pci_dev *pdev, const struct pci_device_id *ent) } nhost++; }while (nhost < chip->n_host); - mpi = (struct mvs_prv_info *)(SHOST_TO_SAS_HA (shost)->lldd_ha);#ifdef CONFIG_SCSI_MVSAS_TASKLET
I really doubt the value such config options
drivers/scsi/mvsas/mv_init.c static int mvs_pci_init(struct pci_dev *pdev, const struct pci_device_id *ent) · line 565
Quoted 4 lines
drivers/scsi/mvsas/mv_init.c +4
-0+ { +struct mvs_prv_info *mpi; + + mpi = (struct mvs_prv_info *)(SHOST_TO_SAS_HA (shost)->lldd_ha);
nit: I don't think that we require the cast to struct mvs_prv_info *
Quoted 7 lines
drivers/scsi/mvsas/mv_init.c +1
-0tasklet_init (&(mpi->mv_tasklet), mvs_tasklet, (unsigned long)SHOST_TO_SAS_HA(shost)); + }#endif mvs_post_sas_ha_init (shost, chip);.
Re: [PATCH v2 30/44] mvsas: Fix a set-but-not-used warning
Quoted 10 lines · John Garry
drivers/scsi/mvsas/mv_init.c static int mvs_pci_init(struct pci_dev *pdev, · line 562
Quoted 7 lines · Bart Van Assche
drivers/scsi/mvsas/mv_init.c +0
-1@@ -559,10 +558,14 @@ static int mvs_pci_init(struct pci_dev *pdev, const struct pci_device_id *ent) } nhost++; } while (nhost < chip->n_host); - mpi = (struct mvs_prv_info *)(SHOST_TO_SAS_HA(shost)->lldd_ha); #ifdef CONFIG_SCSI_MVSAS_TASKLETI really doubt the value such config options
So do I, but removing that config option falls outside the scope of this patch series.
Quoted 6 lines
drivers/scsi/mvsas/mv_init.c static int mvs_pci_init(struct pci_dev *pdev, const struct pci_device_id *ent) · line 565
Quoted 4 lines
drivers/scsi/mvsas/mv_init.c +4
-0+ { + struct mvs_prv_info *mpi; + + mpi = (struct mvs_prv_info *)(SHOST_TO_SAS_HA(shost)->lldd_ha);nit: I don't think that we require the cast to struct
mvs_prv_info*
Agreed, no explicit cast is required since lldd_ha has type 'void *'.
I will remove the cast.
Thanks,
Bart.
Re: [PATCH v2 30/44] mvsas: Fix a set-but-not-used warning
In reply to Bart Van AsscheQuoted 31 lines · Bart Van Assche
This patch fixes the following compiler warning:
drivers/scsi/mvsas/mv_init.c: In function ‘mvs_pci_init’:drivers/scsi/mvsas/mv_init.c:497:30: warning: variable ‘mpi’ set but not used [-Wunused-but-set-variable]
497 | structmvs_prv_info*mpi;
| ^~~Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/mvsas/mv_init.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)drivers/scsi/mvsas/mv_init.c +0
-2@@ -494,7 +494,6 @@ static int mvs_pci_init(struct pci_dev *pdev, const struct pci_device_id *ent) {unsigned int rc, nhost =0 ;struct mvs_info *mvi; -struct mvs_prv_info *mpi;irq_handler_t irq_handler = mvs_interrupt;struct Scsi_Host *shost =NULL ;const struct mvs_chip_info *chip;@@ -559,10 +558,14 @@ static int mvs_pci_init(struct pci_dev *pdev, const struct pci_device_id *ent) } nhost++; }while (nhost < chip->n_host); - mpi = (struct mvs_prv_info *)(SHOST_TO_SAS_HA (shost)->lldd_ha);#ifdef CONFIG_SCSI_MVSAS_TASKLET
drivers/scsi/mvsas/mv_init.c static int mvs_pci_init(struct pci_dev *pdev, const struct pci_device_id *ent) · line 571
Quoted 10 lines
drivers/scsi/mvsas/mv_init.c +5
-0+ { +struct mvs_prv_info *mpi; + + mpi = (struct mvs_prv_info *)(SHOST_TO_SAS_HA (shost)->lldd_ha);tasklet_init (&(mpi->mv_tasklet), mvs_tasklet, (unsigned long )SHOST_TO_SAS_HA (shost)); + }#endif mvs_post_sas_ha_init (shost, chip);
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 30/44] mvsas: Fix a set-but-not-used warning
In reply to Bart Van AsscheQuoted 35 lines · Bart Van Assche
This patch fixes the following compiler warning:
drivers/scsi/mvsas/mv_init.c: In function ‘mvs_pci_init’:drivers/scsi/mvsas/mv_init.c:497:30: warning: variable ‘mpi’ set but not used [-Wunused-but-set-variable]
497 | structmvs_prv_info*mpi;
| ^~~Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/mvsas/mv_init.c| 7 +++++--1 file changed, 5 insertions(+), 2 deletions(-)drivers/scsi/mvsas/mv_init.c +0
-2@@ -494,7 +494,6 @@ static int mvs_pci_init(struct pci_dev *pdev, const struct pci_device_id *ent) {unsigned int rc, nhost =0 ;struct mvs_info *mvi; -struct mvs_prv_info *mpi;irq_handler_t irq_handler = mvs_interrupt;struct Scsi_Host *shost =NULL ;const struct mvs_chip_info *chip;@@ -559,10 +558,14 @@ static int mvs_pci_init(struct pci_dev *pdev, const struct pci_device_id *ent) } nhost++; }while (nhost < chip->n_host); - mpi = (struct mvs_prv_info *)(SHOST_TO_SAS_HA (shost)->lldd_ha);#ifdef CONFIG_SCSI_MVSAS_TASKLET
drivers/scsi/mvsas/mv_init.c static int mvs_pci_init(struct pci_dev *pdev, const struct pci_device_id *ent) · line 571
Quoted 10 lines
drivers/scsi/mvsas/mv_init.c +5
-0+ { +struct mvs_prv_info *mpi; + + mpi = (struct mvs_prv_info *)(SHOST_TO_SAS_HA (shost)->lldd_ha);tasklet_init (&(mpi->mv_tasklet), mvs_tasklet, (unsigned long )SHOST_TO_SAS_HA (shost)); + }#endif mvs_post_sas_ha_init (shost, chip);
--
Himanshu Madhani Oracle Linux Engineering
PATCH v2 31/44 mvumi: Stop using the SCSI pointer
In reply to Bart Van AsscheSet .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.
--- drivers/scsi/mvumi.c | 9 +++++---- drivers/scsi/mvumi.h | 9 +++++++++ 2 files changed, 14 insertions(+), 4 deletions(-)
drivers/scsi/mvumi.c +5 -4
@@ -1302,7 +1302,7 @@ static void mvumi_complete_cmd(struct mvumi_hba *mhba, struct mvumi_cmd *cmd, {struct scsi_cmnd *scmd = cmd->scmd; - cmd->scmd->SCp.ptr =NULL ; +mvumi_priv (cmd->scmd)->cmd_priv =NULL ; scmd->result = ob_frame->req_status;switch (ob_frame->req_status) {
@@ -2097,7 +2097,7 @@ static int mvumi_queue_command(struct Scsi_Host *shost, goto out_return_cmd; cmd->scmd = scmd; - scmd->SCp.ptr = (char *) cmd; +mvumi_priv (scmd)->cmd_priv = cmd; mhba->instancet->fire_cmd (mhba, cmd);spin_unlock_irqrestore (shost->host_lock, irq_flags);return 0 ;
@@ -2111,7 +2111,7 @@ static int mvumi_queue_command(struct Scsi_Host *shost,static enum blk_eh_timer_return mvumi_timed_out (struct scsi_cmnd *scmd) { -struct mvumi_cmd *cmd = (struct mvumi_cmd *) scmd->SCp.ptr; +struct mvumi_cmd *cmd =mvumi_priv (scmd)->cmd_priv;struct Scsi_Host *host = scmd->device->host;struct mvumi_hba *mhba =shost_priv (host);unsigned long flags;
@@ -2128,7 +2128,7 @@ static enum blk_eh_timer_return mvumi_timed_out(struct scsi_cmnd *scmd)atomic_dec (&mhba->fw_outstanding); scmd->result = (DID_ABORT <<16 ); - scmd->SCp.ptr =NULL ; +mvumi_priv (scmd)->cmd_priv =NULL ;if (scsi_bufflen (scmd)) { dma_unmap_sg(&mhba->pdev->dev, scsi_sglist(scmd), scsi_sg_count(scmd),
@@ -2179,6 +2179,7 @@ static struct scsi_host_template mvumi_template = { .bios_param = mvumi_bios_param, .dma_boundary = PAGE_SIZE - 1, .this_id = -1, + .cmd_size = sizeof(struct mvumi_cmd_priv), };static int mvumi_cfg_hw_reg (struct mvumi_hba *mhba)
drivers/scsi/mvumi.h +9 -0
@@ -254,6 +254,15 @@ struct mvumi_cmd {unsigned char cmd_status; }; +struct mvumi_cmd_priv { +struct mvumi_cmd *cmd_priv; +}; + +static inline struct mvumi_cmd_priv *mvumi_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +} +/* * the function type of the in bound frame */
Re: [PATCH v2 31/44] mvumi: Stop using the SCSI pointer
Quoted 69 lines · Bart Van Assche
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 structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/mvumi.c | 9 +++++---- drivers/scsi/mvumi.h | 9 +++++++++ 2 files changed, 14 insertions(+), 4 deletions(-)drivers/scsi/mvumi.c +5
-4@@ -1302,7 +1302,7 @@ static void mvumi_complete_cmd(struct mvumi_hba *mhba, struct mvumi_cmd *cmd, {struct scsi_cmnd *scmd = cmd->scmd; - cmd->scmd->SCp.ptr =NULL ; +mvumi_priv (cmd->scmd)->cmd_priv =NULL ; scmd->result = ob_frame->req_status;switch (ob_frame->req_status) {@@ -2097,7 +2097,7 @@ static int mvumi_queue_command(struct Scsi_Host *shost, goto out_return_cmd; cmd->scmd = scmd; - scmd->SCp.ptr = (char *) cmd; +mvumi_priv (scmd)->cmd_priv = cmd; mhba->instancet->fire_cmd (mhba, cmd);spin_unlock_irqrestore (shost->host_lock, irq_flags);return 0 ;@@ -2111,7 +2111,7 @@ static int mvumi_queue_command(struct Scsi_Host *shost,static enum blk_eh_timer_return mvumi_timed_out (struct scsi_cmnd *scmd) { -struct mvumi_cmd *cmd = (struct mvumi_cmd *) scmd->SCp.ptr; +struct mvumi_cmd *cmd =mvumi_priv (scmd)->cmd_priv;struct Scsi_Host *host = scmd->device->host;struct mvumi_hba *mhba =shost_priv (host);unsigned long flags;@@ -2128,7 +2128,7 @@ static enum blk_eh_timer_return mvumi_timed_out(struct scsi_cmnd *scmd)atomic_dec (&mhba->fw_outstanding); scmd->result = (DID_ABORT <<16 ); - scmd->SCp.ptr =NULL ; +mvumi_priv (scmd)->cmd_priv =NULL ;if (scsi_bufflen (scmd)) { dma_unmap_sg(&mhba->pdev->dev, scsi_sglist(scmd), scsi_sg_count(scmd),@@ -2179,6 +2179,7 @@ static struct scsi_host_template mvumi_template = { .bios_param = mvumi_bios_param, .dma_boundary = PAGE_SIZE - 1, .this_id = -1, + .cmd_size = sizeof(struct mvumi_cmd_priv), };static int mvumi_cfg_hw_reg (struct mvumi_hba *mhba)drivers/scsi/mvumi.h +2
-0@@ -254,6 +254,15 @@ struct mvumi_cmd {unsigned char cmd_status; }; +struct mvumi_cmd_priv { +struct mvumi_cmd *cmd_priv;
drivers/scsi/mvumi.h struct mvumi_cmd { · line 268
Quoted 10 lines
drivers/scsi/mvumi.h +7
-0+}; + +static inline struct mvumi_cmd_priv *mvumi_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +} +/* * the function type of the in bound frame */
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 31/44] mvumi: Stop using the SCSI pointer
In reply to Bart Van AsscheQuoted 73 lines · Bart Van Assche
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 structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/mvumi.c| 9 +++++----drivers/scsi/mvumi.h| 9 +++++++++2 files changed, 14 insertions(+), 4 deletions(-)drivers/scsi/mvumi.c +5
-4@@ -1302,7 +1302,7 @@ static void mvumi_complete_cmd(struct mvumi_hba *mhba, struct mvumi_cmd *cmd, {struct scsi_cmnd *scmd = cmd->scmd; - cmd->scmd->SCp.ptr =NULL ; +mvumi_priv (cmd->scmd)->cmd_priv =NULL ; scmd->result = ob_frame->req_status;switch (ob_frame->req_status) {@@ -2097,7 +2097,7 @@ static int mvumi_queue_command(struct Scsi_Host *shost, goto out_return_cmd; cmd->scmd = scmd; - scmd->SCp.ptr = (char *) cmd; +mvumi_priv (scmd)->cmd_priv = cmd; mhba->instancet->fire_cmd (mhba, cmd);spin_unlock_irqrestore (shost->host_lock, irq_flags);return 0 ;@@ -2111,7 +2111,7 @@ static int mvumi_queue_command(struct Scsi_Host *shost,static enum blk_eh_timer_return mvumi_timed_out (struct scsi_cmnd *scmd) { -struct mvumi_cmd *cmd = (struct mvumi_cmd *) scmd->SCp.ptr; +struct mvumi_cmd *cmd =mvumi_priv (scmd)->cmd_priv;struct Scsi_Host *host = scmd->device->host;struct mvumi_hba *mhba =shost_priv (host);unsigned long flags;@@ -2128,7 +2128,7 @@ static enum blk_eh_timer_return mvumi_timed_out(struct scsi_cmnd *scmd)atomic_dec (&mhba->fw_outstanding); scmd->result = (DID_ABORT <<16 ); - scmd->SCp.ptr =NULL ; +mvumi_priv (scmd)->cmd_priv =NULL ;if (scsi_bufflen (scmd)) { dma_unmap_sg(&mhba->pdev->dev, scsi_sglist(scmd), scsi_sg_count(scmd),@@ -2179,6 +2179,7 @@ static struct scsi_host_template mvumi_template = { .bios_param = mvumi_bios_param, .dma_boundary = PAGE_SIZE - 1, .this_id = -1, + .cmd_size = sizeof(struct mvumi_cmd_priv), };static int mvumi_cfg_hw_reg (struct mvumi_hba *mhba)drivers/scsi/mvumi.h +2
-0@@ -254,6 +254,15 @@ struct mvumi_cmd {unsigned char cmd_status; }; +struct mvumi_cmd_priv { +struct mvumi_cmd *cmd_priv;
drivers/scsi/mvumi.h struct mvumi_cmd { · line 268
Quoted 10 lines
drivers/scsi/mvumi.h +7
-0+}; + +static inline struct mvumi_cmd_priv *mvumi_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +} +/* * the function type of the in bound frame */
--
Himanshu Madhani Oracle Linux Engineering
PATCH v2 32/44 nsp32: Stop using the SCSI pointer
In reply to Bart Van AsscheMove the SCSI status field to private data. Stop setting the .ptr, .this_residual, .buffer and .buffer_residual SCSI pointer members since no code in this driver reads these members.
This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.
--- drivers/scsi/nsp32.c | 20 +++++++------------- drivers/scsi/nsp32.h | 9 +++++++++ 2 files changed, 16 insertions(+), 13 deletions(-)
drivers/scsi/nsp32.c +7 -13
@@ -273,6 +273,7 @@ static struct scsi_host_template nsp32_template = { .eh_abort_handler = nsp32_eh_abort, .eh_host_reset_handler = nsp32_eh_host_reset, /* .highmem_io = 1, */ + .cmd_size = sizeof(struct nsp32_cmd_priv), };#include "nsp32_io.h"
@@ -946,14 +947,9 @@ static int nsp32_queuecommand_lck(struct scsi_cmnd *SCpnt)show_command (SCpnt); data->CurrentSC = SCpnt; - SCpnt->SCp.Status =SAM_STAT_CHECK_CONDITION ; +nsp32_priv (SCpnt)->status =SAM_STAT_CHECK_CONDITION ;scsi_set_resid (SCpnt,scsi_bufflen (SCpnt)); - SCpnt->SCp.ptr = (char *)scsi_sglist (SCpnt); - SCpnt->SCp.this_residual =scsi_bufflen (SCpnt); - SCpnt->SCp.buffer =NULL ; - SCpnt->SCp.buffers_residual =0 ; -/* initialize data */ data->msgout_len =0 ; data->msgin_len =0 ;
@@ -1376,7 +1372,7 @@ static irqreturn_t do_nsp32_isr(int irq, void *dev_id)case BUSPHASE_STATUS :nsp32_dbg (NSP32_DEBUG_INTR ,"fifo/status" ); - SCpnt->SCp.Status =nsp32_read1 (base,SCSI_CSB_IN ); +nsp32_priv (SCpnt)->status =nsp32_read1 (base,SCSI_CSB_IN );break ;default :
@@ -1687,18 +1683,18 @@ static int nsp32_busfree_occur(struct scsi_cmnd *SCpnt, unsigned short execph)/* MsgIn 00: Command Complete */ nsp32_dbg (NSP32_DEBUG_BUSFREE ,"command complete" ); - SCpnt->SCp.Status =nsp32_read1 (base,SCSI_CSB_IN ); +nsp32_priv (SCpnt)->status =nsp32_read1 (base,SCSI_CSB_IN );nsp32_dbg (NSP32_DEBUG_BUSFREE ,"normal end stat=0x%x resid=0x%x\n" , - SCpnt->SCp.Status,scsi_get_resid (SCpnt)); +nsp32_priv (SCpnt)->status,scsi_get_resid (SCpnt)); SCpnt->result = (DID_OK <<16 ) | - (SCpnt->SCp.Status <<0 ); + (nsp32_priv (SCpnt)->status <<0 );nsp32_scsi_done (SCpnt);/* All operation is done */ return TRUE; }else if (execph &MSGIN_04_VALID ) {/* MsgIn 04: Disconnect */ - SCpnt->SCp.Status =nsp32_read1 (base,SCSI_CSB_IN ); +nsp32_priv (SCpnt)->status =nsp32_read1 (base,SCSI_CSB_IN );nsp32_dbg (NSP32_DEBUG_BUSFREE ,"disconnect" );return TRUE;
@@ -1706,8 +1702,6 @@ static int nsp32_busfree_occur(struct scsi_cmnd *SCpnt, unsigned short execph)/* Unexpected bus free */ nsp32_msg (KERN_WARNING ,"unexpected bus free occurred" ); -/* DID_ERROR? */ -//SCpnt->result = (DID_OK << 16) | (SCpnt->SCp.Status << 0); SCpnt->result =DID_ERROR <<16 ;nsp32_scsi_done (SCpnt);return TRUE;
drivers/scsi/nsp32.h +9 -0
@@ -534,6 +534,15 @@ typedef struct _nsp32_sync_table {---PERIOD-- ---OFFSET-- */ #define TO_SYNCREG (period, offset) (((period) & 0x0f) << 4 | ((offset) & 0x0f)) +struct nsp32_cmd_priv { +enum sam_status status; +}; + +static inline struct nsp32_cmd_priv *nsp32_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +} + typedef struct _nsp32_target { unsigned char syncreg; /* value for SYNCREG */ unsigned char ackwidth; /* value for ACKWIDTH */
Re: [PATCH v2 32/44] nsp32: Stop using the SCSI pointer
Quoted 91 lines · Bart Van Assche
Move the SCSI status field to private data. Stop setting the .ptr, .this_residual, .buffer and .buffer_residual SCSI pointer members since no code in this driver reads these members.
This patch prepares for removal of the SCSI pointer from struct
scsi_cmnd.Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/nsp32.c | 20 +++++++------------- drivers/scsi/nsp32.h | 9 +++++++++ 2 files changed, 16 insertions(+), 13 deletions(-)drivers/scsi/nsp32.c +7
-13@@ -273,6 +273,7 @@ static struct scsi_host_template nsp32_template = { .eh_abort_handler = nsp32_eh_abort, .eh_host_reset_handler = nsp32_eh_host_reset, /* .highmem_io = 1, */ + .cmd_size = sizeof(struct nsp32_cmd_priv), };#include "nsp32_io.h" @@ -946,14 +947,9 @@ static int nsp32_queuecommand_lck(struct scsi_cmnd *SCpnt)show_command (SCpnt); data->CurrentSC = SCpnt; - SCpnt->SCp.Status =SAM_STAT_CHECK_CONDITION ; +nsp32_priv (SCpnt)->status =SAM_STAT_CHECK_CONDITION ;scsi_set_resid (SCpnt,scsi_bufflen (SCpnt)); - SCpnt->SCp.ptr = (char *)scsi_sglist (SCpnt); - SCpnt->SCp.this_residual =scsi_bufflen (SCpnt); - SCpnt->SCp.buffer =NULL ; - SCpnt->SCp.buffers_residual =0 ; -/* initialize data */ data->msgout_len =0 ; data->msgin_len =0 ;@@ -1376,7 +1372,7 @@ static irqreturn_t do_nsp32_isr(int irq, void *dev_id)case BUSPHASE_STATUS :nsp32_dbg (NSP32_DEBUG_INTR ,"fifo/status" ); - SCpnt->SCp.Status =nsp32_read1 (base,SCSI_CSB_IN ); +nsp32_priv (SCpnt)->status =nsp32_read1 (base,SCSI_CSB_IN );break ;default :@@ -1687,18 +1683,18 @@ static int nsp32_busfree_occur(struct scsi_cmnd *SCpnt, unsigned short execph)/* MsgIn 00: Command Complete */ nsp32_dbg (NSP32_DEBUG_BUSFREE ,"command complete" ); - SCpnt->SCp.Status =nsp32_read1 (base,SCSI_CSB_IN ); +nsp32_priv (SCpnt)->status =nsp32_read1 (base,SCSI_CSB_IN );nsp32_dbg (NSP32_DEBUG_BUSFREE ,"normal end stat=0x%x resid=0x%x\n" , - SCpnt->SCp.Status,scsi_get_resid (SCpnt)); +nsp32_priv (SCpnt)->status,scsi_get_resid (SCpnt)); SCpnt->result = (DID_OK <<16 ) | - (SCpnt->SCp.Status <<0 ); + (nsp32_priv (SCpnt)->status <<0 );nsp32_scsi_done (SCpnt);/* All operation is done */ return TRUE; }else if (execph &MSGIN_04_VALID ) {/* MsgIn 04: Disconnect */ - SCpnt->SCp.Status =nsp32_read1 (base,SCSI_CSB_IN ); +nsp32_priv (SCpnt)->status =nsp32_read1 (base,SCSI_CSB_IN );nsp32_dbg (NSP32_DEBUG_BUSFREE ,"disconnect" );return TRUE;@@ -1706,8 +1702,6 @@ static int nsp32_busfree_occur(struct scsi_cmnd *SCpnt, unsigned short execph)/* Unexpected bus free */ nsp32_msg (KERN_WARNING ,"unexpected bus free occurred" ); -/* DID_ERROR? */ -//SCpnt->result = (DID_OK << 16) | (SCpnt->SCp.Status << 0); SCpnt->result =DID_ERROR <<16 ;nsp32_scsi_done (SCpnt);return TRUE;drivers/scsi/nsp32.h +2
-0@@ -534,6 +534,15 @@ typedef struct _nsp32_sync_table {---PERIOD-- ---OFFSET-- */ #define TO_SYNCREG (period, offset) (((period) & 0x0f) << 4 | ((offset) & 0x0f)) +struct nsp32_cmd_priv { +enum sam_status status;
drivers/scsi/nsp32.h typedef struct _nsp32_sync_table { · line 548
Quoted 10 lines
drivers/scsi/nsp32.h +7
-0+}; + +static inline struct nsp32_cmd_priv *nsp32_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +} + typedef struct _nsp32_target { unsigned char syncreg; /* value for SYNCREG */ unsigned char ackwidth; /* value for ACKWIDTH */
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 32/44] nsp32: Stop using the SCSI pointer
In reply to Bart Van AsscheQuoted 91 lines · Bart Van Assche
Move the SCSI status field to private data. Stop setting the .ptr, .this_residual, .buffer and .buffer_residual SCSI pointer members since no code in this driver reads these members.
This patch prepares for removal of the SCSI pointer from struct
scsi_cmnd.Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/nsp32.c | 20 +++++++------------- drivers/scsi/nsp32.h | 9 +++++++++ 2 files changed, 16 insertions(+), 13 deletions(-)drivers/scsi/nsp32.c +7
-13@@ -273,6 +273,7 @@ static struct scsi_host_template nsp32_template = { .eh_abort_handler = nsp32_eh_abort, .eh_host_reset_handler = nsp32_eh_host_reset, /* .highmem_io = 1, */ + .cmd_size = sizeof(struct nsp32_cmd_priv), };#include "nsp32_io.h" @@ -946,14 +947,9 @@ static int nsp32_queuecommand_lck(struct scsi_cmnd *SCpnt)show_command (SCpnt); data->CurrentSC = SCpnt; - SCpnt->SCp.Status =SAM_STAT_CHECK_CONDITION ; +nsp32_priv (SCpnt)->status =SAM_STAT_CHECK_CONDITION ;scsi_set_resid (SCpnt,scsi_bufflen (SCpnt)); - SCpnt->SCp.ptr = (char *)scsi_sglist (SCpnt); - SCpnt->SCp.this_residual =scsi_bufflen (SCpnt); - SCpnt->SCp.buffer =NULL ; - SCpnt->SCp.buffers_residual =0 ; -/* initialize data */ data->msgout_len =0 ; data->msgin_len =0 ;@@ -1376,7 +1372,7 @@ static irqreturn_t do_nsp32_isr(int irq, void *dev_id)case BUSPHASE_STATUS :nsp32_dbg (NSP32_DEBUG_INTR ,"fifo/status" ); - SCpnt->SCp.Status =nsp32_read1 (base,SCSI_CSB_IN ); +nsp32_priv (SCpnt)->status =nsp32_read1 (base,SCSI_CSB_IN );break ;default :@@ -1687,18 +1683,18 @@ static int nsp32_busfree_occur(struct scsi_cmnd *SCpnt, unsigned short execph)/* MsgIn 00: Command Complete */ nsp32_dbg (NSP32_DEBUG_BUSFREE ,"command complete" ); - SCpnt->SCp.Status =nsp32_read1 (base,SCSI_CSB_IN ); +nsp32_priv (SCpnt)->status =nsp32_read1 (base,SCSI_CSB_IN );nsp32_dbg (NSP32_DEBUG_BUSFREE ,"normal end stat=0x%x resid=0x%x\n" , - SCpnt->SCp.Status,scsi_get_resid (SCpnt)); +nsp32_priv (SCpnt)->status,scsi_get_resid (SCpnt)); SCpnt->result = (DID_OK <<16 ) | - (SCpnt->SCp.Status <<0 ); + (nsp32_priv (SCpnt)->status <<0 );nsp32_scsi_done (SCpnt);/* All operation is done */ return TRUE; }else if (execph &MSGIN_04_VALID ) {/* MsgIn 04: Disconnect */ - SCpnt->SCp.Status =nsp32_read1 (base,SCSI_CSB_IN ); +nsp32_priv (SCpnt)->status =nsp32_read1 (base,SCSI_CSB_IN );nsp32_dbg (NSP32_DEBUG_BUSFREE ,"disconnect" );return TRUE;@@ -1706,8 +1702,6 @@ static int nsp32_busfree_occur(struct scsi_cmnd *SCpnt, unsigned short execph)/* Unexpected bus free */ nsp32_msg (KERN_WARNING ,"unexpected bus free occurred" ); -/* DID_ERROR? */ -//SCpnt->result = (DID_OK << 16) | (SCpnt->SCp.Status << 0); SCpnt->result =DID_ERROR <<16 ;nsp32_scsi_done (SCpnt);return TRUE;drivers/scsi/nsp32.h +2
-0@@ -534,6 +534,15 @@ typedef struct _nsp32_sync_table {---PERIOD-- ---OFFSET-- */ #define TO_SYNCREG (period, offset) (((period) & 0x0f) << 4 | ((offset) & 0x0f)) +struct nsp32_cmd_priv { +enum sam_status status;
drivers/scsi/nsp32.h typedef struct _nsp32_sync_table { · line 548
Quoted 10 lines
drivers/scsi/nsp32.h +7
-0+}; + +static inline struct nsp32_cmd_priv *nsp32_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +} + typedef struct _nsp32_target { unsigned char syncreg; /* value for SYNCREG */ unsigned char ackwidth; /* value for ACKWIDTH */
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 32/44] nsp32: Stop using the SCSI pointer
In reply to Bart Van AsscheQuoted 95 lines · Bart Van Assche
Move the SCSI status field to private data. Stop setting the .ptr, .this_residual, .buffer and .buffer_residual SCSI pointer members since no code in this driver reads these members.
This patch prepares for removal of the SCSI pointer from struct
scsi_cmnd.Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/nsp32.c| 20 +++++++-------------drivers/scsi/nsp32.h| 9 +++++++++2 files changed, 16 insertions(+), 13 deletions(-)drivers/scsi/nsp32.c +7
-13@@ -273,6 +273,7 @@ static struct scsi_host_template nsp32_template = { .eh_abort_handler = nsp32_eh_abort, .eh_host_reset_handler = nsp32_eh_host_reset, /* .highmem_io = 1, */ + .cmd_size = sizeof(struct nsp32_cmd_priv), };#include "nsp32_io.h" @@ -946,14 +947,9 @@ static int nsp32_queuecommand_lck(struct scsi_cmnd *SCpnt)show_command (SCpnt); data->CurrentSC = SCpnt; - SCpnt->SCp.Status =SAM_STAT_CHECK_CONDITION ; +nsp32_priv (SCpnt)->status =SAM_STAT_CHECK_CONDITION ;scsi_set_resid (SCpnt,scsi_bufflen (SCpnt)); - SCpnt->SCp.ptr = (char *)scsi_sglist (SCpnt); - SCpnt->SCp.this_residual =scsi_bufflen (SCpnt); - SCpnt->SCp.buffer =NULL ; - SCpnt->SCp.buffers_residual =0 ; -/* initialize data */ data->msgout_len =0 ; data->msgin_len =0 ;@@ -1376,7 +1372,7 @@ static irqreturn_t do_nsp32_isr(int irq, void *dev_id)case BUSPHASE_STATUS :nsp32_dbg (NSP32_DEBUG_INTR ,"fifo/status" ); - SCpnt->SCp.Status =nsp32_read1 (base,SCSI_CSB_IN ); +nsp32_priv (SCpnt)->status =nsp32_read1 (base,SCSI_CSB_IN );break ;default :@@ -1687,18 +1683,18 @@ static int nsp32_busfree_occur(struct scsi_cmnd *SCpnt, unsigned short execph)/* MsgIn 00: Command Complete */ nsp32_dbg (NSP32_DEBUG_BUSFREE ,"command complete" ); - SCpnt->SCp.Status =nsp32_read1 (base,SCSI_CSB_IN ); +nsp32_priv (SCpnt)->status =nsp32_read1 (base,SCSI_CSB_IN );nsp32_dbg (NSP32_DEBUG_BUSFREE ,"normal end stat=0x%x resid=0x%x\n" , - SCpnt->SCp.Status,scsi_get_resid (SCpnt)); +nsp32_priv (SCpnt)->status,scsi_get_resid (SCpnt)); SCpnt->result = (DID_OK <<16 ) | - (SCpnt->SCp.Status <<0 ); + (nsp32_priv (SCpnt)->status <<0 );nsp32_scsi_done (SCpnt);/* All operation is done */ return TRUE; }else if (execph &MSGIN_04_VALID ) {/* MsgIn 04: Disconnect */ - SCpnt->SCp.Status =nsp32_read1 (base,SCSI_CSB_IN ); +nsp32_priv (SCpnt)->status =nsp32_read1 (base,SCSI_CSB_IN );nsp32_dbg (NSP32_DEBUG_BUSFREE ,"disconnect" );return TRUE;@@ -1706,8 +1702,6 @@ static int nsp32_busfree_occur(struct scsi_cmnd *SCpnt, unsigned short execph)/* Unexpected bus free */ nsp32_msg (KERN_WARNING ,"unexpected bus free occurred" ); -/* DID_ERROR? */ -//SCpnt->result = (DID_OK << 16) | (SCpnt->SCp.Status << 0); SCpnt->result =DID_ERROR <<16 ;nsp32_scsi_done (SCpnt);return TRUE;drivers/scsi/nsp32.h +2
-0@@ -534,6 +534,15 @@ typedef struct _nsp32_sync_table {---PERIOD-- ---OFFSET-- */ #define TO_SYNCREG (period, offset) (((period) & 0x0f) << 4 | ((offset) & 0x0f)) +struct nsp32_cmd_priv { +enum sam_status status;
drivers/scsi/nsp32.h typedef struct _nsp32_sync_table { · line 548
Quoted 10 lines
drivers/scsi/nsp32.h +7
-0+}; + +static inline struct nsp32_cmd_priv *nsp32_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +} + typedef struct _nsp32_target { unsigned char syncreg; /* value for SYNCREG */ unsigned char ackwidth; /* value for ACKWIDTH */
--
Himanshu Madhani Oracle Linux Engineering
PATCH v2 33/44 nsp_cs: Move the SCSI pointer to private command data
In reply to Bart Van AsscheSet .cmd_size in the SCSI host template instead of using the SCSI pointer in struct scsi_cmnd.
This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.
--- drivers/scsi/pcmcia/nsp_cs.c | 206 ++++++++++++++++++-------------- drivers/scsi/pcmcia/nsp_cs.h | 2 +- drivers/scsi/pcmcia/nsp_debug.c | 2 +- 3 files changed, 120 insertions(+), 90 deletions(-)
drivers/scsi/pcmcia/nsp_cs.c +118 -88
@@ -70,6 +70,17 @@ static bool free_ports = 0;module_param (free_ports, bool,0 );MODULE_PARM_DESC (free_ports,"Release IO ports after configuration? (default: 0 (=no))" ); +struct nsp_cmd_priv { +struct scsi_pointer scsi_pointer; +}; + +static struct scsi_pointer *nsp_priv (struct scsi_cmnd *cmd) +{ +struct nsp_cmd_priv *ncmd =scsi_cmd_priv (cmd); + +return &ncmd->scsi_pointer; +} +static struct scsi_host_template nsp_driver_template = { .proc_name ="nsp_cs" , .show_info = nsp_show_info,
@@ -83,6 +94,7 @@ static struct scsi_host_template nsp_driver_template = { .this_id = NSP_INITIATOR_ID, .sg_tablesize = SG_ALL, .dma_boundary = PAGE_SIZE - 1, + .cmd_size = sizeof(struct nsp_cmd_priv), };static nsp_hw_data nsp_data_base;/* attach <-> detect glue */
@@ -180,8 +192,9 @@ static void nsp_scsi_done(struct scsi_cmnd *SCpnt)scsi_done (SCpnt); } -static int nsp_queuecommand_lck (struct scsi_cmnd *SCpnt) +static int nsp_queuecommand_lck (struct scsi_cmnd *const SCpnt) { +struct scsi_pointer *scsi_pointer =nsp_priv (SCpnt);#ifdef NSP_DEBUG /*unsigned int host_id = SCpnt->device->host->this_id;*/ /*unsigned int base = SCpnt->device->host->io_port;*/
@@ -217,11 +230,11 @@ static int nsp_queuecommand_lck(struct scsi_cmnd *SCpnt) data->CurrentSC = SCpnt; - SCpnt->SCp.Status =SAM_STAT_CHECK_CONDITION ; - SCpnt->SCp.Message =0 ; - SCpnt->SCp.have_data_in =IO_UNKNOWN ; - SCpnt->SCp.sent_command =0 ; - SCpnt->SCp.phase =PH_UNDETERMINED ; + scsi_pointer->Status =SAM_STAT_CHECK_CONDITION ; + scsi_pointer->Message =0 ; + scsi_pointer->have_data_in =IO_UNKNOWN ; + scsi_pointer->sent_command =0 ; + scsi_pointer->phase =PH_UNDETERMINED ;scsi_set_resid (SCpnt,scsi_bufflen (SCpnt));/* setup scratch area
@@ -231,15 +244,15 @@ static int nsp_queuecommand_lck(struct scsi_cmnd *SCpnt)SCp.buffers_residual : left buffers in list SCp.phase : current state of the command */ if (scsi_bufflen (SCpnt)) { - SCpnt->SCp.buffer =scsi_sglist (SCpnt); - SCpnt->SCp.ptr =BUFFER_ADDR ; - SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; - SCpnt->SCp.buffers_residual =scsi_sg_count (SCpnt) -1 ; + scsi_pointer->buffer =scsi_sglist (SCpnt); + scsi_pointer->ptr =BUFFER_ADDR (SCpnt); + scsi_pointer->this_residual = scsi_pointer->buffer->length; + scsi_pointer->buffers_residual =scsi_sg_count (SCpnt) -1 ; }else { - SCpnt->SCp.ptr =NULL ; - SCpnt->SCp.this_residual =0 ; - SCpnt->SCp.buffer =NULL ; - SCpnt->SCp.buffers_residual =0 ; + scsi_pointer->ptr =NULL ; + scsi_pointer->this_residual =0 ; + scsi_pointer->buffer =NULL ; + scsi_pointer->buffers_residual =0 ; }if (!nsphw_start_selection (SCpnt)) {
@@ -353,8 +366,9 @@ static void nsphw_init(nsp_hw_data *data)/* * Start selection phase */ -static bool nsphw_start_selection (struct scsi_cmnd *SCpnt) +static bool nsphw_start_selection (struct scsi_cmnd *const SCpnt) { +struct scsi_pointer *scsi_pointer =nsp_priv (SCpnt);unsigned int host_id = SCpnt->device->host->this_id;unsigned int base = SCpnt->device->host->io_port;unsigned char target =scmd_id (SCpnt);
@@ -372,7 +386,7 @@ static bool nsphw_start_selection(struct scsi_cmnd *SCpnt)/* start arbitration */ //nsp_dbg(NSP_DEBUG_RESELECTION, "start arbit"); - SCpnt->SCp.phase =PH_ARBSTART ; + scsi_pointer->phase =PH_ARBSTART ;nsp_index_write (base,SETARBIT ,ARBIT_GO ); time_out =1000 ;
@@ -392,7 +406,7 @@ static bool nsphw_start_selection(struct scsi_cmnd *SCpnt)/* assert select line */ //nsp_dbg(NSP_DEBUG_RESELECTION, "assert SEL line"); - SCpnt->SCp.phase =PH_SELSTART ; + scsi_pointer->phase =PH_SELSTART ;udelay (3 );/* wait 2.4us */ nsp_index_write (base,SCSIDATALATCH ,BIT (host_id) |BIT (target));nsp_index_write (base,SCSIBUSCTRL ,SCSI_SEL |SCSI_BSY |SCSI_ATN );
@@ -568,8 +582,9 @@ static int nsp_expect_signal(struct scsi_cmnd *SCpnt,/* * transfer SCSI message */ -static int nsp_xfer (struct scsi_cmnd *SCpnt,int phase) +static int nsp_xfer (struct scsi_cmnd *const SCpnt,int phase) { +struct scsi_pointer *scsi_pointer =nsp_priv (SCpnt);unsigned int base = SCpnt->device->host->io_port;nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;char *buf = data->MsgBuffer;
@@ -587,7 +602,7 @@ static int nsp_xfer(struct scsi_cmnd *SCpnt, int phase) }/* if last byte, negate ATN */ -if (len ==1 && SCpnt->SCp.phase ==PH_MSG_OUT ) { +if (len ==1 && scsi_pointer->phase ==PH_MSG_OUT ) {nsp_index_write (base,SCSIBUSCTRL ,AUTODIRECTION |ACKENB ); }
@@ -608,14 +623,15 @@ static int nsp_xfer(struct scsi_cmnd *SCpnt, int phase)/* * get extra SCSI data from fifo */ -static int nsp_dataphase_bypass (struct scsi_cmnd *SCpnt) +static int nsp_dataphase_bypass (struct scsi_cmnd *const SCpnt) { +struct scsi_pointer *scsi_pointer =nsp_priv (SCpnt);nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;unsigned int count;//nsp_dbg(NSP_DEBUG_DATA_IO, "in"); -if (SCpnt->SCp.have_data_in !=IO_IN ) { +if (scsi_pointer->have_data_in !=IO_IN ) {return 0 ; }
@@ -630,7 +646,7 @@ static int nsp_dataphase_bypass(struct scsi_cmnd *SCpnt)* data phase skip only occures in case of SCSI_LOW_READ */ nsp_dbg (NSP_DEBUG_DATA_IO ,"use bypass quirk" ); - SCpnt->SCp.phase =PH_DATA ; + scsi_pointer->phase =PH_DATA ;nsp_pio_read (SCpnt);nsp_setup_fifo (data, false);
@@ -704,8 +720,9 @@ static int nsp_fifo_count(struct scsi_cmnd *SCpnt)/* * read data in DATA IN phase */ -static void nsp_pio_read (struct scsi_cmnd *SCpnt) +static void nsp_pio_read (struct scsi_cmnd *const SCpnt) { +struct scsi_pointer *scsi_pointer =nsp_priv (SCpnt);unsigned int base = SCpnt->device->host->io_port;unsigned long mmio_base = SCpnt->device->host->base;nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
@@ -716,24 +733,25 @@ static void nsp_pio_read(struct scsi_cmnd *SCpnt) ocount = data->FifoCount;nsp_dbg (NSP_DEBUG_DATA_IO ,"in SCpnt=0x%p resid=%d ocount=%d ptr=0x%p this_residual=%d buffers=0x%p nbuf=%d" , - SCpnt,scsi_get_resid (SCpnt), ocount, SCpnt->SCp.ptr, - SCpnt->SCp.this_residual, SCpnt->SCp.buffer, - SCpnt->SCp.buffers_residual); + SCpnt,scsi_get_resid (SCpnt), ocount, scsi_pointer->ptr, + scsi_pointer->this_residual, scsi_pointer->buffer, + scsi_pointer->buffers_residual); time_out =1000 ;while ((time_out-- !=0 ) && - (SCpnt->SCp.this_residual >0 || SCpnt->SCp.buffers_residual >0 ) ) { + (scsi_pointer->this_residual >0 || + scsi_pointer->buffers_residual >0 )) { stat =nsp_index_read (base,SCSIBUSMON ); stat &=BUSMON_PHASE_MASK ; res =nsp_fifo_count (SCpnt) - ocount; -//nsp_dbg(NSP_DEBUG_DATA_IO, "ptr=0x%p this=0x%x ocount=0x%x res=0x%x", SCpnt->SCp.ptr, SCpnt->SCp.this_residual, ocount, res); +//nsp_dbg(NSP_DEBUG_DATA_IO, "ptr=0x%p this=0x%x ocount=0x%x res=0x%x", scsi_pointer->ptr, scsi_pointer->this_residual, ocount, res); if (res ==0 ) {/* if some data available ? */ if (stat ==BUSPHASE_DATA_IN ) {/* phase changed? */ -//nsp_dbg(NSP_DEBUG_DATA_IO, " wait for data this=%d", SCpnt->SCp.this_residual); +//nsp_dbg(NSP_DEBUG_DATA_IO, " wait for data this=%d", scsi_pointer->this_residual); continue ; }else {nsp_dbg (NSP_DEBUG_DATA_IO ,"phase changed stat=0x%x" , stat);
@@ -747,20 +765,21 @@ static void nsp_pio_read(struct scsi_cmnd *SCpnt)continue ; } - res =min (res, SCpnt->SCp.this_residual); + res =min (res, scsi_pointer->this_residual);switch (data->TransferMode) {case MODE_IO32 : res &= ~(BIT (1 )|BIT (0 ));/* align 4 */ -nsp_fifo32_read (base, SCpnt->SCp.ptr, res >>2 ); +nsp_fifo32_read (base, scsi_pointer->ptr, res >>2 );break ;case MODE_IO8 : -nsp_fifo8_read (base, SCpnt->SCp.ptr, res ); +nsp_fifo8_read (base, scsi_pointer->ptr, res);break ;case MODE_MEM32 : res &= ~(BIT (1 )|BIT (0 ));/* align 4 */ -nsp_mmio_fifo32_read (mmio_base, SCpnt->SCp.ptr, res >>2 ); +nsp_mmio_fifo32_read (mmio_base, scsi_pointer->ptr, + res >>2 );break ;default :
@@ -769,22 +788,23 @@ static void nsp_pio_read(struct scsi_cmnd *SCpnt) }nsp_inc_resid (SCpnt, -res); - SCpnt->SCp.ptr += res; - SCpnt->SCp.this_residual -= res; + scsi_pointer->ptr += res; + scsi_pointer->this_residual -= res; ocount += res; -//nsp_dbg(NSP_DEBUG_DATA_IO, "ptr=0x%p this_residual=0x%x ocount=0x%x", SCpnt->SCp.ptr, SCpnt->SCp.this_residual, ocount); +//nsp_dbg(NSP_DEBUG_DATA_IO, "ptr=0x%p this_residual=0x%x ocount=0x%x", scsi_pointer->ptr, scsi_pointer->this_residual, ocount); /* go to next scatter list if available */ -if (SCpnt->SCp.this_residual ==0 && - SCpnt->SCp.buffers_residual !=0 ) { +if (scsi_pointer->this_residual ==0 && + scsi_pointer->buffers_residual !=0 ) {//nsp_dbg(NSP_DEBUG_DATA_IO, "scatterlist next timeout=%d", time_out); - SCpnt->SCp.buffers_residual--; - SCpnt->SCp.buffer =sg_next (SCpnt->SCp.buffer); - SCpnt->SCp.ptr =BUFFER_ADDR ; - SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; + scsi_pointer->buffers_residual--; + scsi_pointer->buffer =sg_next (scsi_pointer->buffer); + scsi_pointer->ptr =BUFFER_ADDR (SCpnt); + scsi_pointer->this_residual = + scsi_pointer->buffer->length; time_out =1000 ; -//nsp_dbg(NSP_DEBUG_DATA_IO, "page: 0x%p, off: 0x%x", SCpnt->SCp.buffer->page, SCpnt->SCp.buffer->offset); +//nsp_dbg(NSP_DEBUG_DATA_IO, "page: 0x%p, off: 0x%x", scsi_pointer->buffer->page, scsi_pointer->buffer->offset); } }
@@ -792,8 +812,8 @@ static void nsp_pio_read(struct scsi_cmnd *SCpnt)if (time_out <0 ) {nsp_msg (KERN_DEBUG ,"pio read timeout resid=%d this_residual=%d buffers_residual=%d" , -scsi_get_resid (SCpnt), SCpnt->SCp.this_residual, - SCpnt->SCp.buffers_residual); +scsi_get_resid (SCpnt), scsi_pointer->this_residual, + scsi_pointer->buffers_residual); }nsp_dbg (NSP_DEBUG_DATA_IO ,"read ocount=0x%x" , ocount); nsp_dbg(NSP_DEBUG_DATA_IO, "r cmd=%d resid=0x%x\n", data->CmdId,
@@ -805,6 +825,7 @@ static void nsp_pio_read(struct scsi_cmnd *SCpnt)*/ static void nsp_pio_write (struct scsi_cmnd *SCpnt) { +struct scsi_pointer *scsi_pointer =nsp_priv (SCpnt);unsigned int base = SCpnt->device->host->io_port;unsigned long mmio_base = SCpnt->device->host->base;nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
@@ -815,14 +836,15 @@ static void nsp_pio_write(struct scsi_cmnd *SCpnt) ocount = data->FifoCount;nsp_dbg (NSP_DEBUG_DATA_IO ,"in fifocount=%d ptr=0x%p this_residual=%d buffers=0x%p nbuf=%d resid=0x%x" , - data->FifoCount, SCpnt->SCp.ptr, SCpnt->SCp.this_residual, - SCpnt->SCp.buffer, SCpnt->SCp.buffers_residual, + data->FifoCount, scsi_pointer->ptr, scsi_pointer->this_residual, + scsi_pointer->buffer, scsi_pointer->buffers_residual,scsi_get_resid (SCpnt)); time_out =1000 ;while ((time_out-- !=0 ) && - (SCpnt->SCp.this_residual >0 || SCpnt->SCp.buffers_residual >0 )) { + (scsi_pointer->this_residual >0 || + scsi_pointer->buffers_residual >0 )) { stat =nsp_index_read (base,SCSIBUSMON ); stat &=BUSMON_PHASE_MASK ;
@@ -832,9 +854,9 @@ static void nsp_pio_write(struct scsi_cmnd *SCpnt)nsp_dbg (NSP_DEBUG_DATA_IO ,"phase changed stat=0x%x, res=%d\n" , stat, res);/* Put back pointer */ nsp_inc_resid (SCpnt, res); - SCpnt->SCp.ptr -= res; - SCpnt->SCp.this_residual += res; - ocount -= res; + scsi_pointer->ptr -= res; + scsi_pointer->this_residual += res; + ocount -= res;break ; }
@@ -845,21 +867,22 @@ static void nsp_pio_write(struct scsi_cmnd *SCpnt)continue ; } - res =min (SCpnt->SCp.this_residual,WFIFO_CRIT ); + res =min (scsi_pointer->this_residual,WFIFO_CRIT ); -//nsp_dbg(NSP_DEBUG_DATA_IO, "ptr=0x%p this=0x%x res=0x%x", SCpnt->SCp.ptr, SCpnt->SCp.this_residual, res); +//nsp_dbg(NSP_DEBUG_DATA_IO, "ptr=0x%p this=0x%x res=0x%x", scsi_pointer->ptr, scsi_pointer->this_residual, res); switch (data->TransferMode) {case MODE_IO32 : res &= ~(BIT (1 )|BIT (0 ));/* align 4 */ -nsp_fifo32_write (base, SCpnt->SCp.ptr, res >>2 ); +nsp_fifo32_write (base, scsi_pointer->ptr, res >>2 );break ;case MODE_IO8 : -nsp_fifo8_write (base, SCpnt->SCp.ptr, res ); +nsp_fifo8_write (base, scsi_pointer->ptr, res);break ;case MODE_MEM32 : res &= ~(BIT (1 )|BIT (0 ));/* align 4 */ -nsp_mmio_fifo32_write (mmio_base, SCpnt->SCp.ptr, res >>2 ); +nsp_mmio_fifo32_write (mmio_base, scsi_pointer->ptr, + res >>2 );break ;default :
@@ -868,18 +891,19 @@ static void nsp_pio_write(struct scsi_cmnd *SCpnt) }nsp_inc_resid (SCpnt, -res); - SCpnt->SCp.ptr += res; - SCpnt->SCp.this_residual -= res; - ocount += res; + scsi_pointer->ptr += res; + scsi_pointer->this_residual -= res; + ocount += res;/* go to next scatter list if available */ -if (SCpnt->SCp.this_residual ==0 && - SCpnt->SCp.buffers_residual !=0 ) { +if (scsi_pointer->this_residual ==0 && + scsi_pointer->buffers_residual !=0 ) {//nsp_dbg(NSP_DEBUG_DATA_IO, "scatterlist next"); - SCpnt->SCp.buffers_residual--; - SCpnt->SCp.buffer =sg_next (SCpnt->SCp.buffer); - SCpnt->SCp.ptr =BUFFER_ADDR ; - SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; + scsi_pointer->buffers_residual--; + scsi_pointer->buffer =sg_next (scsi_pointer->buffer); + scsi_pointer->ptr =BUFFER_ADDR (SCpnt); + scsi_pointer->this_residual = + scsi_pointer->buffer->length; time_out =1000 ; } }
@@ -947,6 +971,7 @@ static irqreturn_t nspintr(int irq, void *dev_id)unsigned int base;unsigned char irq_status, irq_phase, phase;struct scsi_cmnd *tmpSC; +struct scsi_pointer *scsi_pointer;unsigned char target, lun;unsigned int *sync_neg;int i, tmp;
@@ -1025,9 +1050,10 @@ static irqreturn_t nspintr(int irq, void *dev_id)if (data->CurrentSC !=NULL ) { tmpSC = data->CurrentSC; - tmpSC->result = (DID_RESET <<16 ) | - ((tmpSC->SCp.Message &0xff ) <<8 ) | - ((tmpSC->SCp.Status &0xff ) <<0 ); + scsi_pointer =nsp_priv (tmpSC); + tmpSC->result = (DID_RESET <<16 ) | + ((scsi_pointer->Message &0xff ) <<8 ) | + ((scsi_pointer->Status &0xff ) <<0 );nsp_scsi_done (tmpSC); }return IRQ_HANDLED ;
@@ -1041,6 +1067,7 @@ static irqreturn_t nspintr(int irq, void *dev_id) } tmpSC = data->CurrentSC; + scsi_pointer =nsp_priv (tmpSC); target = tmpSC->device->id; lun = tmpSC->device->lun; sync_neg = &(data->Sync[target].SyncNegotiation);
@@ -1063,7 +1090,7 @@ static irqreturn_t nspintr(int irq, void *dev_id)//show_phase(tmpSC); -switch (tmpSC->SCp.phase) { +switch (scsi_pointer->phase) {case PH_SELSTART :// *sync_neg = SYNC_NOT_YET; if ((phase &BUSMON_BSY ) ==0 ) {
@@ -1086,7 +1113,7 @@ static irqreturn_t nspintr(int irq, void *dev_id)/* attention assert */ //nsp_dbg(NSP_DEBUG_INTR, "attention assert"); data->SelectionTimeOut =0 ; - tmpSC->SCp.phase =PH_SELECTED ; + scsi_pointer->phase =PH_SELECTED ;nsp_index_write (base,SCSIBUSCTRL ,SCSI_ATN );udelay (1 );nsp_index_write (base,SCSIBUSCTRL ,SCSI_ATN |AUTODIRECTION |ACKENB );
@@ -1115,17 +1142,18 @@ static irqreturn_t nspintr(int irq, void *dev_id)//nsp_dbg(NSP_DEBUG_INTR, "start scsi seq"); /* normal disconnect */ -if (((tmpSC->SCp.phase ==PH_MSG_IN ) || (tmpSC->SCp.phase ==PH_MSG_OUT )) && - (irq_phase &LATCHED_BUS_FREE ) !=0 ) { +if ((scsi_pointer->phase ==PH_MSG_IN || + scsi_pointer->phase ==PH_MSG_OUT ) && + (irq_phase &LATCHED_BUS_FREE ) !=0 ) {nsp_dbg (NSP_DEBUG_INTR ,"normal disconnect irq_status=0x%x, phase=0x%x, irq_phase=0x%x" , irq_status, phase, irq_phase);//*sync_neg = SYNC_NOT_YET; /* all command complete and return status */ -if (tmpSC->SCp.Message ==COMMAND_COMPLETE ) { - tmpSC->result = (DID_OK <<16 ) | - ((tmpSC->SCp.Message &0xff ) <<8 ) | - ((tmpSC->SCp.Status &0xff ) <<0 ); +if (scsi_pointer->Message ==COMMAND_COMPLETE ) { + tmpSC->result = (DID_OK <<16 ) | + ((scsi_pointer->Message &0xff ) <<8 ) | + ((scsi_pointer->Status &0xff ) <<0 );nsp_dbg (NSP_DEBUG_INTR ,"command complete result=0x%x" , tmpSC->result);nsp_scsi_done (tmpSC);
@@ -1154,7 +1182,7 @@ static irqreturn_t nspintr(int irq, void *dev_id)return IRQ_HANDLED ; } - tmpSC->SCp.phase =PH_COMMAND ; + scsi_pointer->phase =PH_COMMAND ;nsp_nexus (tmpSC);
@@ -1170,8 +1198,8 @@ static irqreturn_t nspintr(int irq, void *dev_id)case BUSPHASE_DATA_OUT :nsp_dbg (NSP_DEBUG_INTR ,"BUSPHASE_DATA_OUT" ); - tmpSC->SCp.phase =PH_DATA ; - tmpSC->SCp.have_data_in =IO_OUT ; + scsi_pointer->phase =PH_DATA ; + scsi_pointer->have_data_in =IO_OUT ;nsp_pio_write (tmpSC);
@@ -1180,8 +1208,8 @@ static irqreturn_t nspintr(int irq, void *dev_id)case BUSPHASE_DATA_IN :nsp_dbg (NSP_DEBUG_INTR ,"BUSPHASE_DATA_IN" ); - tmpSC->SCp.phase =PH_DATA ; - tmpSC->SCp.have_data_in =IO_IN ; + scsi_pointer->phase =PH_DATA ; + scsi_pointer->have_data_in =IO_IN ;nsp_pio_read (tmpSC);
@@ -1191,10 +1219,11 @@ static irqreturn_t nspintr(int irq, void *dev_id)nsp_dataphase_bypass (tmpSC);nsp_dbg (NSP_DEBUG_INTR ,"BUSPHASE_STATUS" ); - tmpSC->SCp.phase =PH_STATUS ; + scsi_pointer->phase =PH_STATUS ; - tmpSC->SCp.Status =nsp_index_read (base,SCSIDATAWITHACK ); -nsp_dbg (NSP_DEBUG_INTR ,"message=0x%x status=0x%x" , tmpSC->SCp.Message, tmpSC->SCp.Status); + scsi_pointer->Status =nsp_index_read (base,SCSIDATAWITHACK ); +nsp_dbg (NSP_DEBUG_INTR ,"message=0x%x status=0x%x" , + scsi_pointer->Message, scsi_pointer->Status);break ;
@@ -1204,7 +1233,7 @@ static irqreturn_t nspintr(int irq, void *dev_id) goto timer_out; } - tmpSC->SCp.phase =PH_MSG_OUT ; + scsi_pointer->phase =PH_MSG_OUT ;//*sync_neg = SYNC_NOT_YET;
@@ -1237,7 +1266,7 @@ static irqreturn_t nspintr(int irq, void *dev_id) goto timer_out; } - tmpSC->SCp.phase =PH_MSG_IN ; + scsi_pointer->phase =PH_MSG_IN ;nsp_message_in (tmpSC);/**/
@@ -1269,9 +1298,10 @@ static irqreturn_t nspintr(int irq, void *dev_id) i += (1 + data->MsgBuffer[i+1 ]); } } - tmpSC->SCp.Message = tmp; + scsi_pointer->Message = tmp; -nsp_dbg (NSP_DEBUG_INTR ,"message=0x%x len=%d" , tmpSC->SCp.Message, data->MsgLen); +nsp_dbg (NSP_DEBUG_INTR ,"message=0x%x len=%d" , + scsi_pointer->Message, data->MsgLen);show_message (data);break ;
drivers/scsi/pcmcia/nsp_cs.h +1 -1
@@ -371,7 +371,7 @@ enum _burst_mode { };/* scatter-gather table */ -# define BUFFER_ADDR ((char *)((sg_virt(SCpnt->SCp.buffer)))) +#define BUFFER_ADDR (SCpnt) ((char *)(sg_virt(nsp_priv(SCpnt)->buffer)))#endif /*__nsp_cs__*/ /* end */
drivers/scsi/pcmcia/nsp_debug.c +1 -1
@@ -145,7 +145,7 @@ static void show_command(struct scsi_cmnd *SCpnt)static void show_phase (struct scsi_cmnd *SCpnt) { -int i = SCpnt->SCp.phase; +int i =nsp_scsi_pointer (SCpnt)->phase;char *ph[] = {"PH_UNDETERMINED" ,
Hannes Reinecke
maintainerRe: [PATCH v2 33/44] nsp_cs: Move the SCSI pointer to private command data
Quoted 20 lines · Bart Van Assche
Set .cmd_size in the SCSI host template instead of using the SCSI pointer in struct
scsi_cmnd.
This patch prepares for removal of the SCSI pointer from structscsi_cmnd.Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/pcmcia/nsp_cs.c | 206 ++++++++++++++++++-------------- drivers/scsi/pcmcia/nsp_cs.h | 2 +- drivers/scsi/pcmcia/nsp_debug.c | 2 +- 3 files changed, 120 insertions(+), 90 deletions(-)drivers/scsi/pcmcia/nsp_cs.c +1
-0@@ -70,6 +70,17 @@ static bool free_ports = 0;module_param (free_ports, bool,0 );MODULE_PARM_DESC (free_ports,"Release IO ports after configuration? (default: 0 (=no))" ); +struct nsp_cmd_priv {
drivers/scsi/pcmcia/nsp_cs.c static bool free_ports = 0; · line 83
Quoted 10 lines
drivers/scsi/pcmcia/nsp_cs.c +10
-0+struct scsi_pointer scsi_pointer; +}; + +static struct scsi_pointer *nsp_priv (struct scsi_cmnd *cmd) +{ +struct nsp_cmd_priv *ncmd =scsi_cmd_priv (cmd); + +return &ncmd->scsi_pointer; +} +
Same here: please use 'struct scsi_pointer' directly.
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 33/44] nsp_cs: Move the SCSI pointer to private command data
In reply to Bart Van AsscheQuoted 552 lines · Bart Van Assche
Set .cmd_size in the SCSI host template instead of using the SCSI pointer in struct
scsi_cmnd.
This patch prepares for removal of the SCSI pointer from structscsi_cmnd.Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/pcmcia/nsp_cs.c | 206 ++++++++++++++++++-------------- drivers/scsi/pcmcia/nsp_cs.h | 2 +- drivers/scsi/pcmcia/nsp_debug.c | 2 +- 3 files changed, 120 insertions(+), 90 deletions(-)drivers/scsi/pcmcia/nsp_cs.c +12
-0@@ -70,6 +70,17 @@ static bool free_ports = 0;module_param (free_ports, bool,0 );MODULE_PARM_DESC (free_ports,"Release IO ports after configuration? (default: 0 (=no))" ); +struct nsp_cmd_priv { +struct scsi_pointer scsi_pointer; +}; + +static struct scsi_pointer *nsp_priv (struct scsi_cmnd *cmd) +{ +struct nsp_cmd_priv *ncmd =scsi_cmd_priv (cmd); + +return &ncmd->scsi_pointer; +} +static struct scsi_host_template nsp_driver_template = { .proc_name ="nsp_cs" , .show_info = nsp_show_info,@@ -83,6 +94,7 @@ static struct scsi_host_template nsp_driver_template = { .this_id = NSP_INITIATOR_ID, .sg_tablesize = SG_ALL, .dma_boundary = PAGE_SIZE - 1, + .cmd_size = sizeof(struct nsp_cmd_priv), };static
nsp_hw_datansp_data_base; /* attach <-> detect glue */drivers/scsi/pcmcia/nsp_cs.c +106
-88@@ -180,8 +192,9 @@ static void nsp_scsi_done(struct scsi_cmnd *SCpnt)scsi_done (SCpnt); } -static int nsp_queuecommand_lck (struct scsi_cmnd *SCpnt) +static int nsp_queuecommand_lck (struct scsi_cmnd *const SCpnt) { +struct scsi_pointer *scsi_pointer =nsp_priv (SCpnt);#ifdef NSP_DEBUG /*unsigned int host_id = SCpnt->device->host->this_id;*/ /*unsigned int base = SCpnt->device->host->io_port;*/ @@ -217,11 +230,11 @@ static int nsp_queuecommand_lck(struct scsi_cmnd *SCpnt) data->CurrentSC = SCpnt; - SCpnt->SCp.Status =SAM_STAT_CHECK_CONDITION ; - SCpnt->SCp.Message =0 ; - SCpnt->SCp.have_data_in =IO_UNKNOWN ; - SCpnt->SCp.sent_command =0 ; - SCpnt->SCp.phase =PH_UNDETERMINED ; + scsi_pointer->Status =SAM_STAT_CHECK_CONDITION ; + scsi_pointer->Message =0 ; + scsi_pointer->have_data_in =IO_UNKNOWN ; + scsi_pointer->sent_command =0 ; + scsi_pointer->phase =PH_UNDETERMINED ;scsi_set_resid (SCpnt,scsi_bufflen (SCpnt));/* setup scratch area @@ -231,15 +244,15 @@ static int nsp_queuecommand_lck(struct scsi_cmnd *SCpnt)SCp.buffers_residual : left buffers in list SCp.phase : current state of the command */ if (scsi_bufflen (SCpnt)) { - SCpnt->SCp.buffer =scsi_sglist (SCpnt); - SCpnt->SCp.ptr =BUFFER_ADDR ; - SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; - SCpnt->SCp.buffers_residual =scsi_sg_count (SCpnt) -1 ; + scsi_pointer->buffer =scsi_sglist (SCpnt); + scsi_pointer->ptr =BUFFER_ADDR (SCpnt); + scsi_pointer->this_residual = scsi_pointer->buffer->length; + scsi_pointer->buffers_residual =scsi_sg_count (SCpnt) -1 ; }else { - SCpnt->SCp.ptr =NULL ; - SCpnt->SCp.this_residual =0 ; - SCpnt->SCp.buffer =NULL ; - SCpnt->SCp.buffers_residual =0 ; + scsi_pointer->ptr =NULL ; + scsi_pointer->this_residual =0 ; + scsi_pointer->buffer =NULL ; + scsi_pointer->buffers_residual =0 ; }if (!nsphw_start_selection (SCpnt)) {@@ -353,8 +366,9 @@ static void nsphw_init(nsp_hw_data *data)/* * Start selection phase */ -static bool nsphw_start_selection (struct scsi_cmnd *SCpnt) +static bool nsphw_start_selection (struct scsi_cmnd *const SCpnt) { +struct scsi_pointer *scsi_pointer =nsp_priv (SCpnt);unsigned int host_id = SCpnt->device->host->this_id;unsigned int base = SCpnt->device->host->io_port;unsigned char target =scmd_id (SCpnt);@@ -372,7 +386,7 @@ static bool nsphw_start_selection(struct scsi_cmnd *SCpnt)/* start arbitration */ //nsp_dbg(NSP_DEBUG_RESELECTION, "start arbit"); - SCpnt->SCp.phase =PH_ARBSTART ; + scsi_pointer->phase =PH_ARBSTART ;nsp_index_write (base,SETARBIT ,ARBIT_GO ); time_out =1000 ;@@ -392,7 +406,7 @@ static bool nsphw_start_selection(struct scsi_cmnd *SCpnt)/* assert select line */ //nsp_dbg(NSP_DEBUG_RESELECTION, "assert SEL line"); - SCpnt->SCp.phase =PH_SELSTART ; + scsi_pointer->phase =PH_SELSTART ;udelay (3 );/* wait 2.4us */ nsp_index_write (base,SCSIDATALATCH ,BIT (host_id) |BIT (target));nsp_index_write (base,SCSIBUSCTRL ,SCSI_SEL |SCSI_BSY |SCSI_ATN );@@ -568,8 +582,9 @@ static int nsp_expect_signal(struct scsi_cmnd *SCpnt,/* * transfer SCSI message */ -static int nsp_xfer (struct scsi_cmnd *SCpnt,int phase) +static int nsp_xfer (struct scsi_cmnd *const SCpnt,int phase) { +struct scsi_pointer *scsi_pointer =nsp_priv (SCpnt);unsigned int base = SCpnt->device->host->io_port;nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;char *buf = data->MsgBuffer;@@ -587,7 +602,7 @@ static int nsp_xfer(struct scsi_cmnd *SCpnt, int phase) }/* if last byte, negate ATN */ -if (len ==1 && SCpnt->SCp.phase ==PH_MSG_OUT ) { +if (len ==1 && scsi_pointer->phase ==PH_MSG_OUT ) {nsp_index_write (base,SCSIBUSCTRL ,AUTODIRECTION |ACKENB ); }@@ -608,14 +623,15 @@ static int nsp_xfer(struct scsi_cmnd *SCpnt, int phase)/* * get extra SCSI data from fifo */ -static int nsp_dataphase_bypass (struct scsi_cmnd *SCpnt) +static int nsp_dataphase_bypass (struct scsi_cmnd *const SCpnt) { +struct scsi_pointer *scsi_pointer =nsp_priv (SCpnt);nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;unsigned int count;//nsp_dbg(NSP_DEBUG_DATA_IO, "in"); -if (SCpnt->SCp.have_data_in !=IO_IN ) { +if (scsi_pointer->have_data_in !=IO_IN ) {return 0 ; }@@ -630,7 +646,7 @@ static int nsp_dataphase_bypass(struct scsi_cmnd *SCpnt)* data phase skip only occures in case of SCSI_LOW_READ */ nsp_dbg (NSP_DEBUG_DATA_IO ,"use bypass quirk" ); - SCpnt->SCp.phase =PH_DATA ; + scsi_pointer->phase =PH_DATA ;nsp_pio_read (SCpnt);nsp_setup_fifo (data, false);@@ -704,8 +720,9 @@ static int nsp_fifo_count(struct scsi_cmnd *SCpnt)/* * read data in DATA IN phase */ -static void nsp_pio_read (struct scsi_cmnd *SCpnt) +static void nsp_pio_read (struct scsi_cmnd *const SCpnt) { +struct scsi_pointer *scsi_pointer =nsp_priv (SCpnt);unsigned int base = SCpnt->device->host->io_port;unsigned long mmio_base = SCpnt->device->host->base;nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;@@ -716,24 +733,25 @@ static void nsp_pio_read(struct scsi_cmnd *SCpnt) ocount = data->FifoCount;nsp_dbg (NSP_DEBUG_DATA_IO ,"in SCpnt=0x%p resid=%d ocount=%d ptr=0x%p this_residual=%d buffers=0x%p nbuf=%d" , - SCpnt,scsi_get_resid (SCpnt), ocount, SCpnt->SCp.ptr, - SCpnt->SCp.this_residual, SCpnt->SCp.buffer, - SCpnt->SCp.buffers_residual); + SCpnt,scsi_get_resid (SCpnt), ocount, scsi_pointer->ptr, + scsi_pointer->this_residual, scsi_pointer->buffer, + scsi_pointer->buffers_residual); time_out =1000 ;while ((time_out-- !=0 ) && - (SCpnt->SCp.this_residual >0 || SCpnt->SCp.buffers_residual >0 ) ) { + (scsi_pointer->this_residual >0 || + scsi_pointer->buffers_residual >0 )) { stat =nsp_index_read (base,SCSIBUSMON ); stat &=BUSMON_PHASE_MASK ; res =nsp_fifo_count (SCpnt) - ocount; -//nsp_dbg(NSP_DEBUG_DATA_IO, "ptr=0x%p this=0x%x ocount=0x%x res=0x%x", SCpnt->SCp.ptr, SCpnt->SCp.this_residual, ocount, res); +//nsp_dbg(NSP_DEBUG_DATA_IO, "ptr=0x%p this=0x%x ocount=0x%x res=0x%x", scsi_pointer->ptr, scsi_pointer->this_residual, ocount, res); if (res ==0 ) {/* if some data available ? */ if (stat ==BUSPHASE_DATA_IN ) {/* phase changed? */ -//nsp_dbg(NSP_DEBUG_DATA_IO, " wait for data this=%d", SCpnt->SCp.this_residual); +//nsp_dbg(NSP_DEBUG_DATA_IO, " wait for data this=%d", scsi_pointer->this_residual); continue ; }else {nsp_dbg (NSP_DEBUG_DATA_IO ,"phase changed stat=0x%x" , stat);@@ -747,20 +765,21 @@ static void nsp_pio_read(struct scsi_cmnd *SCpnt)continue ; } - res =min (res, SCpnt->SCp.this_residual); + res =min (res, scsi_pointer->this_residual);switch (data->TransferMode) {case MODE_IO32 : res &= ~(BIT (1 )|BIT (0 ));/* align 4 */ -nsp_fifo32_read (base, SCpnt->SCp.ptr, res >>2 ); +nsp_fifo32_read (base, scsi_pointer->ptr, res >>2 );break ;case MODE_IO8 : -nsp_fifo8_read (base, SCpnt->SCp.ptr, res ); +nsp_fifo8_read (base, scsi_pointer->ptr, res);break ;case MODE_MEM32 : res &= ~(BIT (1 )|BIT (0 ));/* align 4 */ -nsp_mmio_fifo32_read (mmio_base, SCpnt->SCp.ptr, res >>2 ); +nsp_mmio_fifo32_read (mmio_base, scsi_pointer->ptr, + res >>2 );break ;default :@@ -769,22 +788,23 @@ static void nsp_pio_read(struct scsi_cmnd *SCpnt) }nsp_inc_resid (SCpnt, -res); - SCpnt->SCp.ptr += res; - SCpnt->SCp.this_residual -= res; + scsi_pointer->ptr += res; + scsi_pointer->this_residual -= res; ocount += res; -//nsp_dbg(NSP_DEBUG_DATA_IO, "ptr=0x%p this_residual=0x%x ocount=0x%x", SCpnt->SCp.ptr, SCpnt->SCp.this_residual, ocount); +//nsp_dbg(NSP_DEBUG_DATA_IO, "ptr=0x%p this_residual=0x%x ocount=0x%x", scsi_pointer->ptr, scsi_pointer->this_residual, ocount); /* go to next scatter list if available */ -if (SCpnt->SCp.this_residual ==0 && - SCpnt->SCp.buffers_residual !=0 ) { +if (scsi_pointer->this_residual ==0 && + scsi_pointer->buffers_residual !=0 ) {//nsp_dbg(NSP_DEBUG_DATA_IO, "scatterlist next timeout=%d", time_out); - SCpnt->SCp.buffers_residual--; - SCpnt->SCp.buffer =sg_next (SCpnt->SCp.buffer); - SCpnt->SCp.ptr =BUFFER_ADDR ; - SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; + scsi_pointer->buffers_residual--; + scsi_pointer->buffer =sg_next (scsi_pointer->buffer); + scsi_pointer->ptr =BUFFER_ADDR (SCpnt); + scsi_pointer->this_residual = + scsi_pointer->buffer->length; time_out =1000 ; -//nsp_dbg(NSP_DEBUG_DATA_IO, "page: 0x%p, off: 0x%x", SCpnt->SCp.buffer->page, SCpnt->SCp.buffer->offset); +//nsp_dbg(NSP_DEBUG_DATA_IO, "page: 0x%p, off: 0x%x", scsi_pointer->buffer->page, scsi_pointer->buffer->offset); } }@@ -792,8 +812,8 @@ static void nsp_pio_read(struct scsi_cmnd *SCpnt)if (time_out <0 ) {nsp_msg (KERN_DEBUG ,"pio read timeout resid=%d this_residual=%d buffers_residual=%d" , -scsi_get_resid (SCpnt), SCpnt->SCp.this_residual, - SCpnt->SCp.buffers_residual); +scsi_get_resid (SCpnt), scsi_pointer->this_residual, + scsi_pointer->buffers_residual); }nsp_dbg (NSP_DEBUG_DATA_IO ,"read ocount=0x%x" , ocount); nsp_dbg(NSP_DEBUG_DATA_IO, "r cmd=%d resid=0x%x\n", data->CmdId,@@ -805,6 +825,7 @@ static void nsp_pio_read(struct scsi_cmnd *SCpnt)*/ static void nsp_pio_write (struct scsi_cmnd *SCpnt) { +struct scsi_pointer *scsi_pointer =nsp_priv (SCpnt);unsigned int base = SCpnt->device->host->io_port;unsigned long mmio_base = SCpnt->device->host->base;nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;@@ -815,14 +836,15 @@ static void nsp_pio_write(struct scsi_cmnd *SCpnt) ocount = data->FifoCount;nsp_dbg (NSP_DEBUG_DATA_IO ,"in fifocount=%d ptr=0x%p this_residual=%d buffers=0x%p nbuf=%d resid=0x%x" , - data->FifoCount, SCpnt->SCp.ptr, SCpnt->SCp.this_residual, - SCpnt->SCp.buffer, SCpnt->SCp.buffers_residual, + data->FifoCount, scsi_pointer->ptr, scsi_pointer->this_residual, + scsi_pointer->buffer, scsi_pointer->buffers_residual,scsi_get_resid (SCpnt)); time_out =1000 ;while ((time_out-- !=0 ) && - (SCpnt->SCp.this_residual >0 || SCpnt->SCp.buffers_residual >0 )) { + (scsi_pointer->this_residual >0 || + scsi_pointer->buffers_residual >0 )) { stat =nsp_index_read (base,SCSIBUSMON ); stat &=BUSMON_PHASE_MASK ;@@ -832,9 +854,9 @@ static void nsp_pio_write(struct scsi_cmnd *SCpnt)nsp_dbg (NSP_DEBUG_DATA_IO ,"phase changed stat=0x%x, res=%d\n" , stat, res);/* Put back pointer */ nsp_inc_resid (SCpnt, res); - SCpnt->SCp.ptr -= res; - SCpnt->SCp.this_residual += res; - ocount -= res; + scsi_pointer->ptr -= res; + scsi_pointer->this_residual += res; + ocount -= res;break ; }@@ -845,21 +867,22 @@ static void nsp_pio_write(struct scsi_cmnd *SCpnt)continue ; } - res =min (SCpnt->SCp.this_residual,WFIFO_CRIT ); + res =min (scsi_pointer->this_residual,WFIFO_CRIT ); -//nsp_dbg(NSP_DEBUG_DATA_IO, "ptr=0x%p this=0x%x res=0x%x", SCpnt->SCp.ptr, SCpnt->SCp.this_residual, res); +//nsp_dbg(NSP_DEBUG_DATA_IO, "ptr=0x%p this=0x%x res=0x%x", scsi_pointer->ptr, scsi_pointer->this_residual, res); switch (data->TransferMode) {case MODE_IO32 : res &= ~(BIT (1 )|BIT (0 ));/* align 4 */ -nsp_fifo32_write (base, SCpnt->SCp.ptr, res >>2 ); +nsp_fifo32_write (base, scsi_pointer->ptr, res >>2 );break ;case MODE_IO8 : -nsp_fifo8_write (base, SCpnt->SCp.ptr, res ); +nsp_fifo8_write (base, scsi_pointer->ptr, res);break ;case MODE_MEM32 : res &= ~(BIT (1 )|BIT (0 ));/* align 4 */ -nsp_mmio_fifo32_write (mmio_base, SCpnt->SCp.ptr, res >>2 ); +nsp_mmio_fifo32_write (mmio_base, scsi_pointer->ptr, + res >>2 );break ;default :@@ -868,18 +891,19 @@ static void nsp_pio_write(struct scsi_cmnd *SCpnt) }nsp_inc_resid (SCpnt, -res); - SCpnt->SCp.ptr += res; - SCpnt->SCp.this_residual -= res; - ocount += res; + scsi_pointer->ptr += res; + scsi_pointer->this_residual -= res; + ocount += res;/* go to next scatter list if available */ -if (SCpnt->SCp.this_residual ==0 && - SCpnt->SCp.buffers_residual !=0 ) { +if (scsi_pointer->this_residual ==0 && + scsi_pointer->buffers_residual !=0 ) {//nsp_dbg(NSP_DEBUG_DATA_IO, "scatterlist next"); - SCpnt->SCp.buffers_residual--; - SCpnt->SCp.buffer =sg_next (SCpnt->SCp.buffer); - SCpnt->SCp.ptr =BUFFER_ADDR ; - SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; + scsi_pointer->buffers_residual--; + scsi_pointer->buffer =sg_next (scsi_pointer->buffer); + scsi_pointer->ptr =BUFFER_ADDR (SCpnt); + scsi_pointer->this_residual = + scsi_pointer->buffer->length; time_out =1000 ; } }@@ -947,6 +971,7 @@ static irqreturn_t nspintr(int irq, void *dev_id)unsigned int base;unsigned char irq_status, irq_phase, phase;struct scsi_cmnd *tmpSC; +struct scsi_pointer *scsi_pointer;unsigned char target, lun;unsigned int *sync_neg;int i, tmp;@@ -1025,9 +1050,10 @@ static irqreturn_t nspintr(int irq, void *dev_id)if (data->CurrentSC !=NULL ) { tmpSC = data->CurrentSC; - tmpSC->result = (DID_RESET <<16 ) | - ((tmpSC->SCp.Message &0xff ) <<8 ) | - ((tmpSC->SCp.Status &0xff ) <<0 ); + scsi_pointer =nsp_priv (tmpSC); + tmpSC->result = (DID_RESET <<16 ) | + ((scsi_pointer->Message &0xff ) <<8 ) | + ((scsi_pointer->Status &0xff ) <<0 );nsp_scsi_done (tmpSC); }return IRQ_HANDLED ;@@ -1041,6 +1067,7 @@ static irqreturn_t nspintr(int irq, void *dev_id) } tmpSC = data->CurrentSC; + scsi_pointer =nsp_priv (tmpSC); target = tmpSC->device->id; lun = tmpSC->device->lun; sync_neg = &(data->Sync[target].SyncNegotiation);@@ -1063,7 +1090,7 @@ static irqreturn_t nspintr(int irq, void *dev_id)//show_phase(tmpSC); -switch (tmpSC->SCp.phase) { +switch (scsi_pointer->phase) {case PH_SELSTART :// *sync_neg = SYNC_NOT_YET; if ((phase &BUSMON_BSY ) ==0 ) {@@ -1086,7 +1113,7 @@ static irqreturn_t nspintr(int irq, void *dev_id)/* attention assert */ //nsp_dbg(NSP_DEBUG_INTR, "attention assert"); data->SelectionTimeOut =0 ; - tmpSC->SCp.phase =PH_SELECTED ; + scsi_pointer->phase =PH_SELECTED ;nsp_index_write (base,SCSIBUSCTRL ,SCSI_ATN );udelay (1 );nsp_index_write (base,SCSIBUSCTRL ,SCSI_ATN |AUTODIRECTION |ACKENB );@@ -1115,17 +1142,18 @@ static irqreturn_t nspintr(int irq, void *dev_id)//nsp_dbg(NSP_DEBUG_INTR, "start scsi seq"); /* normal disconnect */ -if (((tmpSC->SCp.phase ==PH_MSG_IN ) || (tmpSC->SCp.phase ==PH_MSG_OUT )) && - (irq_phase &LATCHED_BUS_FREE ) !=0 ) { +if ((scsi_pointer->phase ==PH_MSG_IN || + scsi_pointer->phase ==PH_MSG_OUT ) && + (irq_phase &LATCHED_BUS_FREE ) !=0 ) {nsp_dbg (NSP_DEBUG_INTR ,"normal disconnect irq_status=0x%x, phase=0x%x, irq_phase=0x%x" , irq_status, phase, irq_phase);//*sync_neg = SYNC_NOT_YET; /* all command complete and return status */ -if (tmpSC->SCp.Message ==COMMAND_COMPLETE ) { - tmpSC->result = (DID_OK <<16 ) | - ((tmpSC->SCp.Message &0xff ) <<8 ) | - ((tmpSC->SCp.Status &0xff ) <<0 ); +if (scsi_pointer->Message ==COMMAND_COMPLETE ) { + tmpSC->result = (DID_OK <<16 ) | + ((scsi_pointer->Message &0xff ) <<8 ) | + ((scsi_pointer->Status &0xff ) <<0 );nsp_dbg (NSP_DEBUG_INTR ,"command complete result=0x%x" , tmpSC->result);nsp_scsi_done (tmpSC);@@ -1154,7 +1182,7 @@ static irqreturn_t nspintr(int irq, void *dev_id)return IRQ_HANDLED ; } - tmpSC->SCp.phase =PH_COMMAND ; + scsi_pointer->phase =PH_COMMAND ;nsp_nexus (tmpSC);@@ -1170,8 +1198,8 @@ static irqreturn_t nspintr(int irq, void *dev_id)case BUSPHASE_DATA_OUT :nsp_dbg (NSP_DEBUG_INTR ,"BUSPHASE_DATA_OUT" ); - tmpSC->SCp.phase =PH_DATA ; - tmpSC->SCp.have_data_in =IO_OUT ; + scsi_pointer->phase =PH_DATA ; + scsi_pointer->have_data_in =IO_OUT ;nsp_pio_write (tmpSC);@@ -1180,8 +1208,8 @@ static irqreturn_t nspintr(int irq, void *dev_id)case BUSPHASE_DATA_IN :nsp_dbg (NSP_DEBUG_INTR ,"BUSPHASE_DATA_IN" ); - tmpSC->SCp.phase =PH_DATA ; - tmpSC->SCp.have_data_in =IO_IN ; + scsi_pointer->phase =PH_DATA ; + scsi_pointer->have_data_in =IO_IN ;nsp_pio_read (tmpSC);@@ -1191,10 +1219,11 @@ static irqreturn_t nspintr(int irq, void *dev_id)nsp_dataphase_bypass (tmpSC);nsp_dbg (NSP_DEBUG_INTR ,"BUSPHASE_STATUS" ); - tmpSC->SCp.phase =PH_STATUS ; + scsi_pointer->phase =PH_STATUS ; - tmpSC->SCp.Status =nsp_index_read (base,SCSIDATAWITHACK ); -nsp_dbg (NSP_DEBUG_INTR ,"message=0x%x status=0x%x" , tmpSC->SCp.Message, tmpSC->SCp.Status); + scsi_pointer->Status =nsp_index_read (base,SCSIDATAWITHACK ); +nsp_dbg (NSP_DEBUG_INTR ,"message=0x%x status=0x%x" , + scsi_pointer->Message, scsi_pointer->Status);break ;@@ -1204,7 +1233,7 @@ static irqreturn_t nspintr(int irq, void *dev_id) goto timer_out; } - tmpSC->SCp.phase =PH_MSG_OUT ; + scsi_pointer->phase =PH_MSG_OUT ;//*sync_neg = SYNC_NOT_YET; @@ -1237,7 +1266,7 @@ static irqreturn_t nspintr(int irq, void *dev_id) goto timer_out; } - tmpSC->SCp.phase =PH_MSG_IN ; + scsi_pointer->phase =PH_MSG_IN ;nsp_message_in (tmpSC);/**/ @@ -1269,9 +1298,10 @@ static irqreturn_t nspintr(int irq, void *dev_id) i += (1 + data->MsgBuffer[i+1 ]); } } - tmpSC->SCp.Message = tmp; + scsi_pointer->Message = tmp; -nsp_dbg (NSP_DEBUG_INTR ,"message=0x%x len=%d" , tmpSC->SCp.Message, data->MsgLen); +nsp_dbg (NSP_DEBUG_INTR ,"message=0x%x len=%d" , + scsi_pointer->Message, data->MsgLen);show_message (data);break ;drivers/scsi/pcmcia/nsp_cs.h +1
-1@@ -371,7 +371,7 @@ enum _burst_mode { };/* scatter-gather table */ -# define BUFFER_ADDR ((char *)((sg_virt(SCpnt->SCp.buffer)))) +#define BUFFER_ADDR (SCpnt) ((char *)(sg_virt(nsp_priv(SCpnt)->buffer)))#endif /*__nsp_cs__*/ /* end */ drivers/scsi/pcmcia/nsp_debug.c +0
-0
drivers/scsi/pcmcia/nsp_debug.c static void show_command(struct scsi_cmnd *SCpnt) · line 151
Quoted 8 lines
drivers/scsi/pcmcia/nsp_debug.c +1
-1@@ -145,7 +145,7 @@ static void show_command(struct scsi_cmnd *SCpnt)static void show_phase (struct scsi_cmnd *SCpnt) { -int i = SCpnt->SCp.phase; +int i =nsp_scsi_pointer (SCpnt)->phase;char *ph[] = {"PH_UNDETERMINED" ,
--
Himanshu Madhani Oracle Linux Engineering
PATCH v2 34/44 sym53c500_cs: Move the SCSI pointer to private command data
In reply to Bart Van AsscheSet .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.
--- drivers/scsi/pcmcia/sym53c500_cs.c | 53 ++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 18 deletions(-)
drivers/scsi/pcmcia/sym53c500_cs.c +35 -18
@@ -192,6 +192,17 @@ struct sym53c500_data {int fast_pio; }; +struct sym53c500_cmd_priv { +struct scsi_pointer scsi_pointer; +}; + +static struct scsi_pointer *sym53c500_scsi_pointer (struct scsi_cmnd *cmd) +{ +struct sym53c500_cmd_priv *scmd =scsi_cmd_priv (cmd); + +return &scmd->scsi_pointer; +} +enum Phase { idle, data_out,
@@ -351,6 +362,7 @@ SYM53C500_intr(int irq, void *dev_id)struct sym53c500_data *data = (struct sym53c500_data *)dev->hostdata;struct scsi_cmnd *curSC = data->current_SC; +struct scsi_pointer *scsi_pointer =sym53c500_scsi_pointer (curSC);int fast_pio = data->fast_pio;spin_lock_irqsave (dev->host_lock, flags);
@@ -397,11 +409,12 @@ SYM53C500_intr(int irq, void *dev_id)if (int_reg &0x20 ) {/* Disconnect */ DEB (printk ("SYM53C500: disconnect intr received\n" )); -if (curSC->SCp.phase != message_in) {/* Unexpected disconnect */ +if (scsi_pointer->phase != message_in) {/* Unexpected disconnect */ curSC->result =DID_NO_CONNECT <<16 ; }else {/* Command complete, return status and message */ - curSC->result = (curSC->SCp.Status &0xff ) - | ((curSC->SCp.Message &0xff ) <<8 ) | (DID_OK <<16 ); + curSC->result = (scsi_pointer->Status &0xff ) | + ((scsi_pointer->Message &0xff ) <<8 ) | + (DID_OK <<16 ); } goto idle_out; }
@@ -412,7 +425,7 @@ SYM53C500_intr(int irq, void *dev_id)struct scatterlist *sg;int i; - curSC->SCp.phase = data_out; + scsi_pointer->phase = data_out;VDEB (printk ("SYM53C500: Data-Out phase\n" ));outb (FLUSH_FIFO , port_base +CMD_REG );LOAD_DMA_COUNT (port_base,scsi_bufflen (curSC));/* Max transfer size */
@@ -431,7 +444,7 @@ SYM53C500_intr(int irq, void *dev_id)struct scatterlist *sg;int i; - curSC->SCp.phase = data_in; + scsi_pointer->phase = data_in;VDEB (printk ("SYM53C500: Data-In phase\n" ));outb (FLUSH_FIFO , port_base +CMD_REG );LOAD_DMA_COUNT (port_base,scsi_bufflen (curSC));/* Max transfer size */
@@ -446,12 +459,12 @@ SYM53C500_intr(int irq, void *dev_id)break ;case 0x02 :/* COMMAND */ - curSC->SCp.phase = command_ph; + scsi_pointer->phase = command_ph;printk ("SYM53C500: Warning: Unknown interrupt occurred in command phase!\n" );break ;case 0x03 :/* STATUS */ - curSC->SCp.phase = status_ph; + scsi_pointer->phase = status_ph;VDEB (printk ("SYM53C500: Status phase\n" ));outb (FLUSH_FIFO , port_base +CMD_REG );outb (INIT_CMD_COMPLETE , port_base +CMD_REG );
@@ -464,22 +477,24 @@ SYM53C500_intr(int irq, void *dev_id)case 0x06 :/* MESSAGE-OUT */ DEB (printk ("SYM53C500: Message-Out phase\n" )); - curSC->SCp.phase = message_out; + scsi_pointer->phase = message_out;outb (SET_ATN , port_base +CMD_REG );/* Reject the message */ outb (MSG_ACCEPT , port_base +CMD_REG );break ;case 0x07 :/* MESSAGE-IN */ VDEB (printk ("SYM53C500: Message-In phase\n" )); - curSC->SCp.phase = message_in; + scsi_pointer->phase = message_in; - curSC->SCp.Status =inb (port_base +SCSI_FIFO ); - curSC->SCp.Message =inb (port_base +SCSI_FIFO ); + scsi_pointer->Status =inb (port_base +SCSI_FIFO ); + scsi_pointer->Message =inb (port_base +SCSI_FIFO );VDEB (printk ("SCSI FIFO size=%d\n" ,inb (port_base +FIFO_FLAGS ) &0x1f )); -DEB (printk ("Status = %02x Message = %02x\n" , curSC->SCp.Status, curSC->SCp.Message)); +DEB (printk ("Status = %02x Message = %02x\n" , + scsi_pointer->Status, scsi_pointer->Message)); -if (curSC->SCp.Message ==SAVE_POINTERS || curSC->SCp.Message ==DISCONNECT ) { +if (scsi_pointer->Message ==SAVE_POINTERS || + scsi_pointer->Message ==DISCONNECT ) {outb (SET_ATN , port_base +CMD_REG );/* Reject message */ DEB (printk ("Discarding SAVE_POINTERS message\n" )); }
@@ -491,7 +506,7 @@ SYM53C500_intr(int irq, void *dev_id)return IRQ_HANDLED ; idle_out: - curSC->SCp.phase = idle; + scsi_pointer->phase = idle;scsi_done (curSC); goto out; }
@@ -539,6 +554,7 @@ SYM53C500_info(struct Scsi_Host *SChost)static int SYM53C500_queue_lck (struct scsi_cmnd *SCpnt) { +struct scsi_pointer *scsi_pointer =sym53c500_scsi_pointer (SCpnt);int i;int port_base = SCpnt->device->host->io_port; struct sym53c500_data *data =
@@ -555,9 +571,9 @@ static int SYM53C500_queue_lck(struct scsi_cmnd *SCpnt)VDEB (printk ("\n" )); data->current_SC = SCpnt; - data->current_SC->SCp.phase = command_ph; - data->current_SC->SCp.Status =0 ; - data->current_SC->SCp.Message =0 ; + scsi_pointer->phase = command_ph; + scsi_pointer->Status =0 ; + scsi_pointer->Message =0 ;/* We are locked here already by the mid layer */ REG0 (port_base);
@@ -671,7 +687,8 @@ static struct scsi_host_template sym53c500_driver_template = { .can_queue = 1, .this_id = 7, .sg_tablesize = 32, - .shost_groups = SYM53C500_shost_groups + .shost_groups = SYM53C500_shost_groups, + .cmd_size = sizeof(struct sym53c500_cmd_priv), };static int SYM53C500_config_check (struct pcmcia_device *p_dev,void *priv_data)
Hannes Reinecke
maintainerRe: [PATCH v2 34/44] sym53c500_cs: Move the SCSI pointer to private command data
Quoted 19 lines · Bart Van Assche
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 structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/pcmcia/sym53c500_cs.c | 53 ++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 18 deletions(-)drivers/scsi/pcmcia/sym53c500_cs.c +1
-0@@ -192,6 +192,17 @@ struct sym53c500_data {int fast_pio; }; +struct sym53c500_cmd_priv {
drivers/scsi/pcmcia/sym53c500_cs.c struct sym53c500_data { · line 205
Quoted 10 lines
drivers/scsi/pcmcia/sym53c500_cs.c +10
-0+struct scsi_pointer scsi_pointer; +}; + +static struct scsi_pointer *sym53c500_scsi_pointer (struct scsi_cmnd *cmd) +{ +struct sym53c500_cmd_priv *scmd =scsi_cmd_priv (cmd); + +return &scmd->scsi_pointer; +} +
Same here: please use 'struct scsi_pointer' directly.
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 34/44] sym53c500_cs: Move the SCSI pointer to private command data
In reply to Bart Van AsscheQuoted 155 lines · Bart Van Assche
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 structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/pcmcia/sym53c500_cs.c| 53 ++++++++++++++++++++----------1 file changed, 35 insertions(+), 18 deletions(-)drivers/scsi/pcmcia/sym53c500_cs.c +28
-13@@ -192,6 +192,17 @@ struct sym53c500_data {int fast_pio; }; +struct sym53c500_cmd_priv { +struct scsi_pointer scsi_pointer; +}; + +static struct scsi_pointer *sym53c500_scsi_pointer (struct scsi_cmnd *cmd) +{ +struct sym53c500_cmd_priv *scmd =scsi_cmd_priv (cmd); + +return &scmd->scsi_pointer; +} +enum Phase { idle, data_out,@@ -351,6 +362,7 @@ SYM53C500_intr(int irq, void *dev_id)struct sym53c500_data *data = (struct sym53c500_data *)dev->hostdata;struct scsi_cmnd *curSC = data->current_SC; +struct scsi_pointer *scsi_pointer =sym53c500_scsi_pointer (curSC);int fast_pio = data->fast_pio;spin_lock_irqsave (dev->host_lock, flags);@@ -397,11 +409,12 @@ SYM53C500_intr(int irq, void *dev_id)if (int_reg &0x20 ) {/* Disconnect */ DEB (printk ("SYM53C500: disconnect intr received\n" )); -if (curSC->SCp.phase != message_in) {/* Unexpected disconnect */ +if (scsi_pointer->phase != message_in) {/* Unexpected disconnect */ curSC->result =DID_NO_CONNECT <<16 ; }else {/* Command complete, return status and message */ - curSC->result = (curSC->SCp.Status &0xff ) - | ((curSC->SCp.Message &0xff ) <<8 ) | (DID_OK <<16 ); + curSC->result = (scsi_pointer->Status &0xff ) | + ((scsi_pointer->Message &0xff ) <<8 ) | + (DID_OK <<16 ); } goto idle_out; }@@ -412,7 +425,7 @@ SYM53C500_intr(int irq, void *dev_id)struct scatterlist *sg;int i; - curSC->SCp.phase = data_out; + scsi_pointer->phase = data_out;VDEB (printk ("SYM53C500: Data-Out phase\n" ));outb (FLUSH_FIFO , port_base +CMD_REG );LOAD_DMA_COUNT (port_base,scsi_bufflen (curSC));/* Max transfer size */ @@ -431,7 +444,7 @@ SYM53C500_intr(int irq, void *dev_id)struct scatterlist *sg;int i; - curSC->SCp.phase = data_in; + scsi_pointer->phase = data_in;VDEB (printk ("SYM53C500: Data-In phase\n" ));outb (FLUSH_FIFO , port_base +CMD_REG );LOAD_DMA_COUNT (port_base,scsi_bufflen (curSC));/* Max transfer size */ @@ -446,12 +459,12 @@ SYM53C500_intr(int irq, void *dev_id)break ;case 0x02 :/* COMMAND */ - curSC->SCp.phase = command_ph; + scsi_pointer->phase = command_ph;printk ("SYM53C500: Warning: Unknown interrupt occurred in command phase!\n" );break ;case 0x03 :/* STATUS */ - curSC->SCp.phase = status_ph; + scsi_pointer->phase = status_ph;VDEB (printk ("SYM53C500: Status phase\n" ));outb (FLUSH_FIFO , port_base +CMD_REG );outb (INIT_CMD_COMPLETE , port_base +CMD_REG );@@ -464,22 +477,24 @@ SYM53C500_intr(int irq, void *dev_id)case 0x06 :/* MESSAGE-OUT */ DEB (printk ("SYM53C500: Message-Out phase\n" )); - curSC->SCp.phase = message_out; + scsi_pointer->phase = message_out;outb (SET_ATN , port_base +CMD_REG );/* Reject the message */ outb (MSG_ACCEPT , port_base +CMD_REG );break ;case 0x07 :/* MESSAGE-IN */ VDEB (printk ("SYM53C500: Message-In phase\n" )); - curSC->SCp.phase = message_in; + scsi_pointer->phase = message_in; - curSC->SCp.Status =inb (port_base +SCSI_FIFO ); - curSC->SCp.Message =inb (port_base +SCSI_FIFO ); + scsi_pointer->Status =inb (port_base +SCSI_FIFO ); + scsi_pointer->Message =inb (port_base +SCSI_FIFO );VDEB (printk ("SCSI FIFO size=%d\n" ,inb (port_base +FIFO_FLAGS ) &0x1f )); -DEB (printk ("Status = %02x Message = %02x\n" , curSC->SCp.Status, curSC->SCp.Message)); +DEB (printk ("Status = %02x Message = %02x\n" , + scsi_pointer->Status, scsi_pointer->Message)); -if (curSC->SCp.Message ==SAVE_POINTERS || curSC->SCp.Message ==DISCONNECT ) { +if (scsi_pointer->Message ==SAVE_POINTERS || + scsi_pointer->Message ==DISCONNECT ) {outb (SET_ATN , port_base +CMD_REG );/* Reject message */ DEB (printk ("Discarding SAVE_POINTERS message\n" )); }@@ -491,7 +506,7 @@ SYM53C500_intr(int irq, void *dev_id)return IRQ_HANDLED ;
idle_out:drivers/scsi/pcmcia/sym53c500_cs.c +1
-1- curSC->SCp.phase = idle; + scsi_pointer->phase = idle;scsi_done(curSC); goto out; }drivers/scsi/pcmcia/sym53c500_cs.c +4
-3@@ -539,6 +554,7 @@ SYM53C500_info(struct Scsi_Host *SChost)static int SYM53C500_queue_lck (struct scsi_cmnd *SCpnt) { +struct scsi_pointer *scsi_pointer =sym53c500_scsi_pointer (SCpnt);int i;int port_base = SCpnt->device->host->io_port; struct sym53c500_data *data =@@ -555,9 +571,9 @@ static int SYM53C500_queue_lck(struct scsi_cmnd *SCpnt)VDEB (printk ("\n" )); data->current_SC = SCpnt; - data->current_SC->SCp.phase = command_ph; - data->current_SC->SCp.Status =0 ; - data->current_SC->SCp.Message =0 ; + scsi_pointer->phase = command_ph; + scsi_pointer->Status =0 ; + scsi_pointer->Message =0 ;/* We are locked here already by the mid layer */ REG0 (port_base);
drivers/scsi/pcmcia/sym53c500_cs.c static struct scsi_host_template sym53c500_driver_template = { · line 694
Quoted 9 lines
drivers/scsi/pcmcia/sym53c500_cs.c +2
-1@@ -671,7 +687,8 @@ static struct scsi_host_template sym53c500_driver_template = { .can_queue = 1, .this_id = 7, .sg_tablesize = 32, - .shost_groups = SYM53C500_shost_groups + .shost_groups = SYM53C500_shost_groups, + .cmd_size = sizeof(struct sym53c500_cmd_priv), };static int SYM53C500_config_check (struct pcmcia_device *p_dev,void *priv_data)
--
Himanshu Madhani Oracle Linux Engineering
PATCH v2 35/44 ppa: Move the SCSI pointer to private command data
In reply to Bart Van AsscheSet .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.
--- drivers/scsi/ppa.c | 81 ++++++++++++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 32 deletions(-)
drivers/scsi/ppa.c +49 -32
@@ -45,6 +45,17 @@ typedef struct {#include "ppa.h" +struct ppa_cmd_priv { +struct scsi_pointer scsi_pointer; +}; + +static struct scsi_pointer *ppa_scsi_pointer (struct scsi_cmnd *cmd) +{ +struct ppa_cmd_priv *pcmd =scsi_cmd_priv (cmd); + +return &pcmd->scsi_pointer; +} +static inline ppa_struct *ppa_dev (struct Scsi_Host *host) {return *(ppa_struct **)&host->hostdata;
@@ -56,7 +67,7 @@ static void got_it(ppa_struct *dev) { dev->base = dev->dev->port->base;if (dev->cur_cmd) - dev->cur_cmd->SCp.phase =1 ; +ppa_scsi_pointer (dev->cur_cmd)->phase =1 ;else wake_up (dev->waiting); }
@@ -511,13 +522,14 @@ static inline int ppa_send_command(struct scsi_cmnd *cmd)* The driver appears to remain stable if we speed up the parallel port * i/o in this function, but not elsewhere. */ -static int ppa_completion (struct scsi_cmnd *cmd) +static int ppa_completion (struct scsi_cmnd *const cmd) {/* Return codes: * -1 Error * 0 Told to schedule * 1 Finished data transfer */ +struct scsi_pointer *scsi_pointer =ppa_scsi_pointer (cmd);ppa_struct *dev =ppa_dev (cmd->device->host);unsigned short ppb = dev->base;unsigned long start_jiffies = jiffies;
@@ -543,7 +555,7 @@ static int ppa_completion(struct scsi_cmnd *cmd)if (time_after (jiffies, start_jiffies +1 ))return 0 ; -if ((cmd->SCp.this_residual <=0 )) { +if (scsi_pointer->this_residual <=0 ) {ppa_fail (dev,DID_ERROR );return -1 ;/* ERROR_RETURN */ }
@@ -572,28 +584,30 @@ static int ppa_completion(struct scsi_cmnd *cmd) }/* determine if we should use burst I/O */ - fast = (bulk && (cmd->SCp.this_residual >=PPA_BURST_SIZE )) - ?PPA_BURST_SIZE :1 ; + fast = bulk && scsi_pointer->this_residual >=PPA_BURST_SIZE ? +PPA_BURST_SIZE :1 ;if (r == (unsigned char )0xc0 ) - status =ppa_out (dev, cmd->SCp.ptr, fast); + status =ppa_out (dev, scsi_pointer->ptr, fast);else - status =ppa_in (dev, cmd->SCp.ptr, fast); + status =ppa_in (dev, scsi_pointer->ptr, fast); - cmd->SCp.ptr += fast; - cmd->SCp.this_residual -= fast; + scsi_pointer->ptr += fast; + scsi_pointer->this_residual -= fast;if (!status) {ppa_fail (dev,DID_BUS_BUSY );return -1 ;/* ERROR_RETURN */ } -if (cmd->SCp.buffer && !cmd->SCp.this_residual) { +if (scsi_pointer->buffer && !scsi_pointer->this_residual) {/* if scatter/gather, advance to the next segment */ -if (cmd->SCp.buffers_residual--) { - cmd->SCp.buffer =sg_next (cmd->SCp.buffer); - cmd->SCp.this_residual = - cmd->SCp.buffer->length; - cmd->SCp.ptr =sg_virt (cmd->SCp.buffer); +if (scsi_pointer->buffers_residual--) { + scsi_pointer->buffer = +sg_next (scsi_pointer->buffer); + scsi_pointer->this_residual = + scsi_pointer->buffer->length; + scsi_pointer->ptr = +sg_virt (scsi_pointer->buffer); } }/* Now check to see if the drive is ready to comunicate */
@@ -658,7 +672,7 @@ static void ppa_interrupt(struct work_struct *work) }#endif -if (cmd->SCp.phase >1 ) +if (ppa_scsi_pointer (cmd)->phase >1 )ppa_disconnect (dev);ppa_pb_dismiss (dev);
@@ -670,6 +684,7 @@ static void ppa_interrupt(struct work_struct *work)static int ppa_engine (ppa_struct *dev,struct scsi_cmnd *cmd) { +struct scsi_pointer *scsi_pointer =ppa_scsi_pointer (cmd);unsigned short ppb = dev->base;unsigned char l =0 , h =0 ;int retv;
@@ -680,7 +695,7 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd)if (dev->failed)return 0 ; -switch (cmd->SCp.phase) { +switch (scsi_pointer->phase) {case 0 :/* Phase 0 - Waiting for parport */ if (time_after (jiffies, dev->jstart +HZ )) {/*
@@ -715,7 +730,7 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd)return 1 ;/* Try again in a jiffy */ } } - cmd->SCp.phase++; + scsi_pointer->phase++; } fallthrough;
@@ -724,7 +739,7 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd)ppa_fail (dev,DID_NO_CONNECT );return 0 ; } - cmd->SCp.phase++; + scsi_pointer->phase++; fallthrough;case 3 :/* Phase 3 - Ready to accept a command */
@@ -734,21 +749,22 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd)if (!ppa_send_command (cmd))return 0 ; - cmd->SCp.phase++; + scsi_pointer->phase++; fallthrough;case 4 :/* Phase 4 - Setup scatter/gather buffers */ if (scsi_bufflen (cmd)) { - cmd->SCp.buffer =scsi_sglist (cmd); - cmd->SCp.this_residual = cmd->SCp.buffer->length; - cmd->SCp.ptr =sg_virt (cmd->SCp.buffer); + scsi_pointer->buffer =scsi_sglist (cmd); + scsi_pointer->this_residual = + scsi_pointer->buffer->length; + scsi_pointer->ptr =sg_virt (scsi_pointer->buffer); }else { - cmd->SCp.buffer =NULL ; - cmd->SCp.this_residual =0 ; - cmd->SCp.ptr =NULL ; + scsi_pointer->buffer =NULL ; + scsi_pointer->this_residual =0 ; + scsi_pointer->ptr =NULL ; } - cmd->SCp.buffers_residual =scsi_sg_count (cmd) -1 ; - cmd->SCp.phase++; + scsi_pointer->buffers_residual =scsi_sg_count (cmd) -1 ; + scsi_pointer->phase++; fallthrough;case 5 :/* Phase 5 - Data transfer stage */
@@ -761,7 +777,7 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd)return 0 ;if (retv ==0 )return 1 ; - cmd->SCp.phase++; + scsi_pointer->phase++; fallthrough;case 6 :/* Phase 6 - Read status/message */
@@ -798,7 +814,7 @@ static int ppa_queuecommand_lck(struct scsi_cmnd *cmd) dev->jstart = jiffies; dev->cur_cmd = cmd; cmd->result =DID_ERROR <<16 ;/* default return code */ - cmd->SCp.phase =0 ;/* bus free */ +ppa_scsi_pointer (cmd)->phase =0 ;/* bus free */ schedule_delayed_work (&dev->ppa_tq,0 );
@@ -839,7 +855,7 @@ static int ppa_abort(struct scsi_cmnd *cmd)* have tied the SCSI_MESSAGE line high in the interface */ -switch (cmd->SCp.phase) { +switch (ppa_scsi_pointer (cmd)->phase) {case 0 :/* Do not have access to parport */ case 1 :/* Have not connected to interface */ dev->cur_cmd =NULL ;/* Forget the problem */
@@ -861,7 +877,7 @@ static int ppa_reset(struct scsi_cmnd *cmd) {ppa_struct *dev =ppa_dev (cmd->device->host); -if (cmd->SCp.phase) +if (ppa_scsi_pointer (cmd)->phase)ppa_disconnect (dev); dev->cur_cmd =NULL ;/* Forget the problem */
@@ -976,6 +992,7 @@ static struct scsi_host_template ppa_template = { .sg_tablesize = SG_ALL, .can_queue = 1, .slave_alloc = ppa_adjust_queue, + .cmd_size = sizeof(struct ppa_cmd_priv), };/***************************************************************************
Hannes Reinecke
maintainerRe: [PATCH v2 35/44] ppa: Move the SCSI pointer to private command data
Quoted 19 lines · Bart Van Assche
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 structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/ppa.c | 81 ++++++++++++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 32 deletions(-)drivers/scsi/ppa.c +1
-0@@ -45,6 +45,17 @@ typedef struct {#include "ppa.h" +struct ppa_cmd_priv {
drivers/scsi/ppa.c typedef struct { · line 58
Quoted 10 lines
drivers/scsi/ppa.c +10
-0+struct scsi_pointer scsi_pointer; +}; + +static struct scsi_pointer *ppa_scsi_pointer (struct scsi_cmnd *cmd) +{ +struct ppa_cmd_priv *pcmd =scsi_cmd_priv (cmd); + +return &pcmd->scsi_pointer; +} +
Same here: please use 'struct scsi_pointer' directly.
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 35/44] ppa: Move the SCSI pointer to private command data
In reply to Bart Van AsscheQuoted 226 lines · Bart Van Assche
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 structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/ppa.c| 81 ++++++++++++++++++++++++++++------------------1 file changed, 49 insertions(+), 32 deletions(-)drivers/scsi/ppa.c +48
-32@@ -45,6 +45,17 @@ typedef struct {#include "ppa.h" +struct ppa_cmd_priv { +struct scsi_pointer scsi_pointer; +}; + +static struct scsi_pointer *ppa_scsi_pointer (struct scsi_cmnd *cmd) +{ +struct ppa_cmd_priv *pcmd =scsi_cmd_priv (cmd); + +return &pcmd->scsi_pointer; +} +static inline ppa_struct *ppa_dev (struct Scsi_Host *host) {return *(ppa_struct **)&host->hostdata;@@ -56,7 +67,7 @@ static void got_it(ppa_struct *dev) { dev->base = dev->dev->port->base;if (dev->cur_cmd) - dev->cur_cmd->SCp.phase =1 ; +ppa_scsi_pointer (dev->cur_cmd)->phase =1 ;else wake_up (dev->waiting); }@@ -511,13 +522,14 @@ static inline int ppa_send_command(struct scsi_cmnd *cmd)* The driver appears to remain stable if we speed up the parallel port * i/o in this function, but not elsewhere. */ -static int ppa_completion (struct scsi_cmnd *cmd) +static int ppa_completion (struct scsi_cmnd *const cmd) {/* Return codes: * -1 Error * 0 Told to schedule * 1 Finished data transfer */ +struct scsi_pointer *scsi_pointer =ppa_scsi_pointer (cmd);ppa_struct *dev =ppa_dev (cmd->device->host);unsigned short ppb = dev->base;unsigned long start_jiffies = jiffies;@@ -543,7 +555,7 @@ static int ppa_completion(struct scsi_cmnd *cmd)if (time_after (jiffies, start_jiffies +1 ))return 0 ; -if ((cmd->SCp.this_residual <=0 )) { +if (scsi_pointer->this_residual <=0 ) {ppa_fail (dev,DID_ERROR );return -1 ;/* ERROR_RETURN */ }@@ -572,28 +584,30 @@ static int ppa_completion(struct scsi_cmnd *cmd) }/* determine if we should use burst I/O */ - fast = (bulk && (cmd->SCp.this_residual >=PPA_BURST_SIZE )) - ?PPA_BURST_SIZE :1 ; + fast = bulk && scsi_pointer->this_residual >=PPA_BURST_SIZE ? +PPA_BURST_SIZE :1 ;if (r == (unsigned char )0xc0 ) - status =ppa_out (dev, cmd->SCp.ptr, fast); + status =ppa_out (dev, scsi_pointer->ptr, fast);else - status =ppa_in (dev, cmd->SCp.ptr, fast); + status =ppa_in (dev, scsi_pointer->ptr, fast); - cmd->SCp.ptr += fast; - cmd->SCp.this_residual -= fast; + scsi_pointer->ptr += fast; + scsi_pointer->this_residual -= fast;if (!status) {ppa_fail (dev,DID_BUS_BUSY );return -1 ;/* ERROR_RETURN */ } -if (cmd->SCp.buffer && !cmd->SCp.this_residual) { +if (scsi_pointer->buffer && !scsi_pointer->this_residual) {/* if scatter/gather, advance to the next segment */ -if (cmd->SCp.buffers_residual--) { - cmd->SCp.buffer =sg_next (cmd->SCp.buffer); - cmd->SCp.this_residual = - cmd->SCp.buffer->length; - cmd->SCp.ptr =sg_virt (cmd->SCp.buffer); +if (scsi_pointer->buffers_residual--) { + scsi_pointer->buffer = +sg_next (scsi_pointer->buffer); + scsi_pointer->this_residual = + scsi_pointer->buffer->length; + scsi_pointer->ptr = +sg_virt (scsi_pointer->buffer); } }/* Now check to see if the drive is ready to comunicate */ @@ -658,7 +672,7 @@ static void ppa_interrupt(struct work_struct *work) }#endif -if (cmd->SCp.phase >1 ) +if (ppa_scsi_pointer (cmd)->phase >1 )ppa_disconnect (dev);ppa_pb_dismiss (dev);@@ -670,6 +684,7 @@ static void ppa_interrupt(struct work_struct *work)static int ppa_engine (ppa_struct *dev,struct scsi_cmnd *cmd) { +struct scsi_pointer *scsi_pointer =ppa_scsi_pointer (cmd);unsigned short ppb = dev->base;unsigned char l =0 , h =0 ;int retv;@@ -680,7 +695,7 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd)if (dev->failed)return 0 ; -switch (cmd->SCp.phase) { +switch (scsi_pointer->phase) {case 0 :/* Phase 0 - Waiting for parport */ if (time_after (jiffies, dev->jstart +HZ )) {/* @@ -715,7 +730,7 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd)return 1 ;/* Try again in a jiffy */ } } - cmd->SCp.phase++; + scsi_pointer->phase++; } fallthrough;@@ -724,7 +739,7 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd)ppa_fail (dev,DID_NO_CONNECT );return 0 ; } - cmd->SCp.phase++; + scsi_pointer->phase++; fallthrough;case 3 :/* Phase 3 - Ready to accept a command */ @@ -734,21 +749,22 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd)if (!ppa_send_command (cmd))return 0 ; - cmd->SCp.phase++; + scsi_pointer->phase++; fallthrough;case 4 :/* Phase 4 - Setup scatter/gather buffers */ if (scsi_bufflen (cmd)) { - cmd->SCp.buffer =scsi_sglist (cmd); - cmd->SCp.this_residual = cmd->SCp.buffer->length; - cmd->SCp.ptr =sg_virt (cmd->SCp.buffer); + scsi_pointer->buffer =scsi_sglist (cmd); + scsi_pointer->this_residual = + scsi_pointer->buffer->length; + scsi_pointer->ptr =sg_virt (scsi_pointer->buffer); }else { - cmd->SCp.buffer =NULL ; - cmd->SCp.this_residual =0 ; - cmd->SCp.ptr =NULL ; + scsi_pointer->buffer =NULL ; + scsi_pointer->this_residual =0 ; + scsi_pointer->ptr =NULL ; } - cmd->SCp.buffers_residual =scsi_sg_count (cmd) -1 ; - cmd->SCp.phase++; + scsi_pointer->buffers_residual =scsi_sg_count (cmd) -1 ; + scsi_pointer->phase++; fallthrough;case 5 :/* Phase 5 - Data transfer stage */ @@ -761,7 +777,7 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd)return 0 ;if (retv ==0 )return 1 ; - cmd->SCp.phase++; + scsi_pointer->phase++; fallthrough;case 6 :/* Phase 6 - Read status/message */ @@ -798,7 +814,7 @@ static int ppa_queuecommand_lck(struct scsi_cmnd *cmd) dev->jstart = jiffies; dev->cur_cmd = cmd; cmd->result =DID_ERROR <<16 ;/* default return code */ - cmd->SCp.phase =0 ;/* bus free */ +ppa_scsi_pointer (cmd)->phase =0 ;/* bus free */ schedule_delayed_work (&dev->ppa_tq,0 );@@ -839,7 +855,7 @@ static int ppa_abort(struct scsi_cmnd *cmd)* have tied the SCSI_MESSAGE line high in the interface */ -switch (cmd->SCp.phase) { +switch (ppa_scsi_pointer (cmd)->phase) {case 0 :/* Do not have access to parport */ case 1 :/* Have not connected to interface */ dev->cur_cmd =NULL ;/* Forget the problem */ @@ -861,7 +877,7 @@ static int ppa_reset(struct scsi_cmnd *cmd) {ppa_struct *dev =ppa_dev (cmd->device->host); -if (cmd->SCp.phase) +if (ppa_scsi_pointer (cmd)->phase)ppa_disconnect (dev); dev->cur_cmd =NULL ;/* Forget the problem */
drivers/scsi/ppa.c static struct scsi_host_template ppa_template = { · line 998
Quoted 7 lines
drivers/scsi/ppa.c +1
-0@@ -976,6 +992,7 @@ static struct scsi_host_template ppa_template = { .sg_tablesize = SG_ALL, .can_queue = 1, .slave_alloc = ppa_adjust_queue, + .cmd_size = sizeof(struct ppa_cmd_priv), };/***************************************************************************
--
Himanshu Madhani Oracle Linux Engineering
PATCH v2 36/44 qla1280: Move the SCSI pointer to private command data
In reply to Bart Van AsscheSet .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.
--- drivers/scsi/qla1280.c | 21 ++++----------------- drivers/scsi/qla1280.h | 3 +-- 2 files changed, 5 insertions(+), 19 deletions(-)
drivers/scsi/qla1280.c +4 -17
@@ -477,13 +477,6 @@ __setup("qla1280=", qla1280_setup);#endif -/* -* We use the scsi_pointer structure that's included with each scsi_command -* to overlay our struct srb over it. qla1280_init() checks that a srb is not -* bigger than a scsi_pointer. -*/ - -#define CMD_SP (Cmnd) &Cmnd->SCp#define CMD_CDBLEN (Cmnd) Cmnd->cmd_len#define CMD_CDBP (Cmnd) Cmnd->cmnd#define CMD_SNSP (Cmnd) Cmnd->sense_buffer
@@ -693,7 +686,7 @@ static int qla1280_queuecommand_lck(struct scsi_cmnd *cmd) {struct Scsi_Host *host = cmd->device->host;struct scsi_qla_host *ha = (struct scsi_qla_host *)host->hostdata; -struct srb *sp = (struct srb *)CMD_SP (cmd); +struct srb *sp =scsi_cmd_priv (cmd);int status; sp->cmd = cmd;
@@ -828,7 +821,7 @@ qla1280_error_action(struct scsi_cmnd *cmd, enum action action)ENTER ("qla1280_error_action" ); ha = (struct scsi_qla_host *)(CMD_HOST (cmd)->hostdata); - sp = (struct srb *)CMD_SP (cmd); + sp =scsi_cmd_priv (cmd); bus =SCSI_BUS_32 (cmd); target =SCSI_TCN_32 (cmd); lun =SCSI_LUN_32 (cmd);
@@ -3959,7 +3952,7 @@ __qla1280_print_scsi_cmd(struct scsi_cmnd *cmd)int i; ha = (struct scsi_qla_host *)host->hostdata; - sp = (struct srb *)CMD_SP (cmd); + sp =scsi_cmd_priv (cmd);printk ("SCSI Command @= 0x%p, Handle=0x%p\n" , cmd,CMD_HANDLE (cmd)); printk(" chan=%d, target = 0x%02x, lun = 0x%02x, cmd_len = 0x%02x\n", SCSI_BUS_32(cmd), SCSI_TCN_32(cmd), SCSI_LUN_32(cmd),
@@ -3979,7 +3972,6 @@ __qla1280_print_scsi_cmd(struct scsi_cmnd *cmd)} */ printk (" tag=%d, transfersize=0x%x \n" ,scsi_cmd_to_rq (cmd)->tag, cmd->transfersize); -printk (" SP=0x%p\n" ,CMD_SP (cmd));printk (" underflow size = 0x%x, direction=0x%x\n" , cmd->underflow, cmd->sc_data_direction); }
@@ -4139,6 +4131,7 @@ static struct scsi_host_template qla1280_driver_template = { .can_queue = MAX_OUTSTANDING_COMMANDS, .this_id = -1, .sg_tablesize = SG_ALL, + .cmd_size = sizeof(struct srb), };
@@ -4351,12 +4344,6 @@ static struct pci_driver qla1280_pci_driver = {static int __init qla1280_init (void ) { -if (sizeof (struct srb ) >sizeof (struct scsi_pointer )) { -printk (KERN_WARNING -"qla1280: struct srb too big, aborting\n" ); -return -EINVAL ; - } -#ifdef MODULE /* * If we are called as a module, the qla1280 pointer may not be null
drivers/scsi/qla1280.h +1 -2
@@ -87,8 +87,7 @@#define RESPONSE_ENTRY_CNT 63/* Number of response entries. */ /* -* SCSI Request Block structure (sp) that is placed -* on cmd->SCp location of every I/O +* SCSI Request Block structure (sp) that occurs after each struct scsi_cmnd. */ struct srb {struct list_head list;/* (8/16) LU queue */
Re: [PATCH v2 36/44] qla1280: Move the SCSI pointer to private command data
Quoted 11 lines · Bart Van Assche
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 structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/qla1280.c | 21 ++++----------------- drivers/scsi/qla1280.h | 3 +-- 2 files changed, 5 insertions(+), 19 deletions(-)
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 36/44] qla1280: Move the SCSI pointer to private command data
In reply to Bart Van AsscheQuoted 94 lines · Bart Van Assche
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 structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/qla1280.c| 21 ++++-----------------drivers/scsi/qla1280.h| 3 +--2 files changed, 5 insertions(+), 19 deletions(-)drivers/scsi/qla1280.c +4
-11@@ -477,13 +477,6 @@ __setup("qla1280=", qla1280_setup);#endif -/* -* We use the scsi_pointer structure that's included with each scsi_command -* to overlay our struct srb over it. qla1280_init() checks that a srb is not -* bigger than a scsi_pointer. -*/ - -#define CMD_SP (Cmnd) &Cmnd->SCp#define CMD_CDBLEN (Cmnd) Cmnd->cmd_len#define CMD_CDBP (Cmnd) Cmnd->cmnd#define CMD_SNSP (Cmnd) Cmnd->sense_buffer@@ -693,7 +686,7 @@ static int qla1280_queuecommand_lck(struct scsi_cmnd *cmd) {struct Scsi_Host *host = cmd->device->host;struct scsi_qla_host *ha = (struct scsi_qla_host *)host->hostdata; -struct srb *sp = (struct srb *)CMD_SP (cmd); +struct srb *sp =scsi_cmd_priv (cmd);int status; sp->cmd = cmd;@@ -828,7 +821,7 @@ qla1280_error_action(struct scsi_cmnd *cmd, enum action action)ENTER ("qla1280_error_action" ); ha = (struct scsi_qla_host *)(CMD_HOST (cmd)->hostdata); - sp = (struct srb *)CMD_SP (cmd); + sp =scsi_cmd_priv (cmd); bus =SCSI_BUS_32 (cmd); target =SCSI_TCN_32 (cmd); lun =SCSI_LUN_32 (cmd);@@ -3959,7 +3952,7 @@ __qla1280_print_scsi_cmd(struct scsi_cmnd *cmd)int i; ha = (struct scsi_qla_host *)host->hostdata; - sp = (struct srb *)CMD_SP (cmd); + sp =scsi_cmd_priv (cmd);printk ("SCSI Command @= 0x%p, Handle=0x%p\n" , cmd,CMD_HANDLE (cmd)); printk(" chan=%d, target = 0x%02x, lun = 0x%02x, cmd_len = 0x%02x\n", SCSI_BUS_32(cmd), SCSI_TCN_32(cmd), SCSI_LUN_32(cmd),@@ -3979,7 +3972,6 @@ __qla1280_print_scsi_cmd(struct scsi_cmnd *cmd)} */ printk (" tag=%d, transfersize=0x%x \n" ,scsi_cmd_to_rq (cmd)->tag, cmd->transfersize); -printk (" SP=0x%p\n" ,CMD_SP (cmd));printk (" underflow size = 0x%x, direction=0x%x\n" , cmd->underflow, cmd->sc_data_direction); }@@ -4139,6 +4131,7 @@ static struct scsi_host_template qla1280_driver_template = { .can_queue = MAX_OUTSTANDING_COMMANDS, .this_id = -1, .sg_tablesize = SG_ALL, + .cmd_size = sizeof(struct srb), };@@ -4351,12 +4344,6 @@ static struct pci_driver qla1280_pci_driver = {static int
__initqla1280_init(void)
{drivers/scsi/qla1280.c +0
-6-if (sizeof (struct srb ) >sizeof (struct scsi_pointer )) { -printk (KERN_WARNING -"qla1280: struct srb too big, aborting\n" ); -return -EINVAL ; - } -#ifdef MODULE /* * If we are called as a module, the qla1280 pointer may not be nulldrivers/scsi/qla1280.h +0
-0
drivers/scsi/qla1280.h line 93
Quoted 9 lines
drivers/scsi/qla1280.h +1
-2@@ -87,8 +87,7 @@#define RESPONSE_ENTRY_CNT 63/* Number of response entries. */ /* -* SCSI Request Block structure (sp) that is placed -* on cmd->SCp location of every I/O +* SCSI Request Block structure (sp) that occurs after each struct scsi_cmnd. */ struct srb {struct list_head list;/* (8/16) LU queue */
--
Himanshu Madhani Oracle Linux Engineering
PATCH v2 37/44 qla2xxx: Stop using the SCSI pointer
In reply to Bart Van AsscheInstead of using the SCp.ptr field to track whether or not a command is in flight, use the sp->type field to track this information. sp->type must be set for proper operation of the qla2xxx driver. See e.g. the switch (sp->type) statement in qla2x00_ct_entry().
This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.
--- drivers/scsi/qla2xxx/qla_def.h | 2 -- drivers/scsi/qla2xxx/qla_os.c | 13 +++++-------- 2 files changed, 5 insertions(+), 10 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +0 -2
@@ -5191,8 +5191,6 @@ struct secure_flash_update_block_pk {#define QLA_DSDS_PER_IOCB 37 -#define CMD_SP (Cmnd) ((Cmnd)->SCp.ptr) -#define QLA_SG_ALL 1024enum nexus_wait_type {
drivers/scsi/qla2xxx/qla_os.c +5 -8
@@ -730,7 +730,7 @@ void qla2x00_sp_compl(srb_t *sp, int res) sp->free (sp); cmd->result = res; -CMD_SP (cmd) =NULL ; + sp->type =0 ;scsi_done (cmd);if (comp)complete (comp);
@@ -821,7 +821,7 @@ void qla2xxx_qpair_sp_compl(srb_t *sp, int res) sp->free (sp); cmd->result = res; -CMD_SP (cmd) =NULL ; + sp->type =0 ;scsi_done (cmd);if (comp)complete (comp);
@@ -923,8 +923,6 @@ qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) sp->u.scmd.cmd = cmd; sp->type =SRB_SCSI_CMD ; - -CMD_SP (cmd) = (void *)sp; sp->free = qla2x00_sp_free_dma; sp->done = qla2x00_sp_compl;
@@ -1012,7 +1010,6 @@ qla2xxx_mqueuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd, sp->u.scmd.cmd = cmd; sp->type =SRB_SCSI_CMD ; -CMD_SP (cmd) = (void *)sp; sp->free = qla2xxx_qpair_sp_free_dma; sp->done = qla2xxx_qpair_sp_compl;
@@ -1057,6 +1054,7 @@ qla2x00_eh_wait_on_command(struct scsi_cmnd *cmd)unsigned long wait_iter =ABORT_WAIT_ITER ;scsi_qla_host_t *vha =shost_priv (cmd->device->host);struct qla_hw_data *ha = vha->hw; +srb_t *sp =scsi_cmd_priv (cmd);int ret =QLA_SUCCESS ;if (unlikely (pci_channel_offline (ha->pdev)) || ha->flags.eeh_busy) {
@@ -1065,10 +1063,9 @@ qla2x00_eh_wait_on_command(struct scsi_cmnd *cmd)return ret; } -while (CMD_SP (cmd) && wait_iter--) { +while (sp->type && wait_iter--)msleep (ABORT_POLLING_PERIOD ); - } -if (CMD_SP (cmd)) +if (sp->type) ret =QLA_FUNCTION_FAILED ;return ret;
Re: [PATCH v2 37/44] qla2xxx: Stop using the SCSI pointer
Quoted 84 lines · Bart Van Assche
Instead of using the SCp.ptr field to track whether or not a command is in flight, use the
sp->typefield to track this information.sp->typemust be set for proper operation of the qla2xxx driver. See e.g. the switch (sp->type) statement inqla2x00_ct_entry().This patch prepares for removal of the SCSI pointer from struct
scsi_cmnd.Cc Nilesh Javali <[email protected]>Cc Himanshu Madhani <[email protected]>Cc Daniel Wagner <[email protected]>Cc Ewan D. Milne <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/qla2xxx/qla_def.h| 2 --drivers/scsi/qla2xxx/qla_os.c| 13 +++++--------2 files changed, 5 insertions(+), 10 deletions(-)drivers/scsi/qla2xxx/qla_def.h +0
-2@@ -5191,8 +5191,6 @@ struct secure_flash_update_block_pk {#define QLA_DSDS_PER_IOCB 37 -#define CMD_SP (Cmnd) ((Cmnd)->SCp.ptr) -#define QLA_SG_ALL 1024enum nexus_wait_type {drivers/scsi/qla2xxx/qla_os.c +3
-5@@ -730,7 +730,7 @@ void qla2x00_sp_compl(srb_t *sp, int res) sp->free (sp); cmd->result = res; -CMD_SP (cmd) =NULL ; + sp->type =0 ;scsi_done (cmd);if (comp)complete (comp);@@ -821,7 +821,7 @@ void qla2xxx_qpair_sp_compl(srb_t *sp, int res) sp->free (sp); cmd->result = res; -CMD_SP (cmd) =NULL ; + sp->type =0 ;scsi_done (cmd);if (comp)complete (comp);@@ -923,8 +923,6 @@ qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) sp->u.scmd.cmd = cmd; sp->type =SRB_SCSI_CMD ; - -CMD_SP (cmd) = (void *)sp; sp->free = qla2x00_sp_free_dma; sp->done = qla2x00_sp_compl;@@ -1012,7 +1010,6 @@ qla2xxx_mqueuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd, sp->u.scmd.cmd = cmd; sp->type =SRB_SCSI_CMD ; -CMD_SP (cmd) = (void *)sp; sp->free = qla2xxx_qpair_sp_free_dma; sp->done = qla2xxx_qpair_sp_compl;@@ -1057,6 +1054,7 @@ qla2x00_eh_wait_on_command(struct scsi_cmnd *cmd)unsigned long wait_iter =ABORT_WAIT_ITER ;scsi_qla_host_t *vha =shost_priv (cmd->device->host);struct qla_hw_data *ha = vha->hw; +srb_t *sp =scsi_cmd_priv (cmd);int ret =QLA_SUCCESS ;if (unlikely (pci_channel_offline (ha->pdev)) || ha->flags.eeh_busy) {@@ -1065,10 +1063,9 @@ qla2x00_eh_wait_on_command(struct scsi_cmnd *cmd)return ret; }
drivers/scsi/qla2xxx/qla_os.c qla2x00_eh_wait_on_command(struct scsi_cmnd *cmd) · line 1071
Quoted 10 lines
drivers/scsi/qla2xxx/qla_os.c +2
-3-while (CMD_SP (cmd) && wait_iter--) { +while (sp->type && wait_iter--)msleep (ABORT_POLLING_PERIOD ); - } -if (CMD_SP (cmd)) +if (sp->type) ret =QLA_FUNCTION_FAILED ;return ret;
--
Himanshu Madhani Oracle Linux Engineering
Re: [PATCH v2 37/44] qla2xxx: Stop using the SCSI pointer
In reply to Bart Van AsscheQuoted 12 lines · Bart Van Assche
Instead of using the SCp.ptr field to track whether or not a command is in flight, use the
sp->typefield to track this information.sp->typemust be set for proper operation of the qla2xxx driver. See e.g. the switch (sp->type) statement inqla2x00_ct_entry().This patch prepares for removal of the SCSI pointer from struct
scsi_cmnd.Cc Nilesh Javali <[email protected]>Cc Himanshu Madhani <[email protected]>Cc Daniel Wagner <[email protected]>Cc Ewan D. Milne <[email protected]>Signed-off-by Bart Van Assche <[email protected]>
Quoted 5 lines
--- drivers/scsi/qla2xxx/qla_def.h | 2 -- drivers/scsi/qla2xxx/qla_os.c | 13 +++++-------- 2 files changed, 5 insertions(+), 10 deletions(-)
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 37/44] qla2xxx: Stop using the SCSI pointer
In reply to Bart Van AsscheQuoted 5 lines · Bart Van Assche
Instead of using the SCp.ptr field to track whether or not a command is in flight, use the
sp->typefield to track this information.sp->typemust be set for proper operation of the qla2xxx driver. See e.g. the switch (sp->type) statement inqla2x00_ct_entry().
Quoted 7 lines
This patch prepares for removal of the SCSI pointer from struct
scsi_cmnd.Cc Nilesh Javali <[email protected]>Cc Himanshu Madhani <[email protected]>Cc Daniel Wagner <[email protected]>Cc Ewan D. Milne <[email protected]>Signed-off-by Bart Van Assche <[email protected]>
PATCH v2 38/44 smartpqi: Stop using the SCSI pointer
In reply to Bart Van AsscheSet .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.
--- drivers/scsi/smartpqi/smartpqi_init.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/scsi/smartpqi/smartpqi_init.c +12 -2
@@ -54,6 +54,15 @@ MODULE_DESCRIPTION("Driver for Microchip Smart Family Controller version "MODULE_VERSION (DRIVER_VERSION );MODULE_LICENSE ("GPL" ); +struct pqi_cmd_priv { +int this_residual; +}; + +static struct pqi_cmd_priv *pqi_cmd_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +} +static void pqi_take_ctrl_offline (struct pqi_ctrl_info *ctrl_info,enum pqi_ctrl_shutdown_reason ctrl_shutdown_reason);static void pqi_ctrl_offline_worker (struct work_struct *work);
@@ -5555,7 +5564,7 @@ static void pqi_aio_io_complete(struct pqi_io_request *io_request,scsi_dma_unmap (scmd);if (io_request->status == -EAGAIN ||pqi_raid_bypass_retry_needed (io_request)) {set_host_byte (scmd,DID_IMM_RETRY ); - scmd->SCp.this_residual++; +pqi_cmd_priv (scmd)->this_residual++; }pqi_free_io_request (io_request);
@@ -5779,7 +5788,7 @@ static inline bool pqi_is_bypass_eligible_request(struct scsi_cmnd *scmd)if (blk_rq_is_passthrough (scsi_cmd_to_rq (scmd)))return false; -return scmd->SCp.this_residual ==0 ; +return pqi_cmd_priv (scmd)->this_residual ==0 ; }/*
@@ -7159,6 +7168,7 @@ static struct scsi_host_template pqi_driver_template = { .map_queues = pqi_map_queues, .sdev_groups = pqi_sdev_groups, .shost_groups = pqi_shost_groups, + .cmd_size = sizeof(struct pqi_cmd_priv), };static int pqi_register_scsi (struct pqi_ctrl_info *ctrl_info)
Re: [PATCH v2 38/44] smartpqi: Stop using the SCSI pointer
Quoted 10 lines · Bart Van Assche
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 structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/smartpqi/smartpqi_init.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 38/44] smartpqi: Stop using the SCSI pointer
In reply to Bart Van AsscheQuoted 53 lines · Bart Van Assche
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 structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/smartpqi/smartpqi_init.c| 14 ++++++++++++--1 file changed, 12 insertions(+), 2 deletions(-)drivers/scsi/smartpqi/smartpqi_init.c +11
-2@@ -54,6 +54,15 @@ MODULE_DESCRIPTION("Driver for Microchip Smart Family Controller version "MODULE_VERSION (DRIVER_VERSION );MODULE_LICENSE ("GPL" ); +struct pqi_cmd_priv { +int this_residual; +}; + +static struct pqi_cmd_priv *pqi_cmd_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +} +static void pqi_take_ctrl_offline (struct pqi_ctrl_info *ctrl_info,enum pqi_ctrl_shutdown_reason ctrl_shutdown_reason);static void pqi_ctrl_offline_worker (struct work_struct *work);@@ -5555,7 +5564,7 @@ static void pqi_aio_io_complete(struct pqi_io_request *io_request,scsi_dma_unmap (scmd);if (io_request->status == -EAGAIN ||pqi_raid_bypass_retry_needed (io_request)) {set_host_byte (scmd,DID_IMM_RETRY ); - scmd->SCp.this_residual++; +pqi_cmd_priv (scmd)->this_residual++; }pqi_free_io_request (io_request);@@ -5779,7 +5788,7 @@ static inline bool pqi_is_bypass_eligible_request(struct scsi_cmnd *scmd)if (blk_rq_is_passthrough (scsi_cmd_to_rq (scmd)))return false; -return scmd->SCp.this_residual ==0 ; +return pqi_cmd_priv (scmd)->this_residual ==0 ; }/*
drivers/scsi/smartpqi/smartpqi_init.c static struct scsi_host_template pqi_driver_template = { · line 7174
Quoted 7 lines
drivers/scsi/smartpqi/smartpqi_init.c +1
-0@@ -7159,6 +7168,7 @@ static struct scsi_host_template pqi_driver_template = { .map_queues = pqi_map_queues, .sdev_groups = pqi_sdev_groups, .shost_groups = pqi_shost_groups, + .cmd_size = sizeof(struct pqi_cmd_priv), };static int pqi_register_scsi (struct pqi_ctrl_info *ctrl_info)
--
Himanshu Madhani Oracle Linux Engineering
PATCH v2 39/44 sym53c8xx_2: Move the SCSI pointer to private command data
In reply to Bart Van AsscheSet .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.
--- drivers/scsi/sym53c8xx_2/sym_glue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/sym53c8xx_2/sym_glue.c +2 -2
@@ -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,
Re: [PATCH v2 39/44] sym53c8xx_2: Move the SCSI pointer to private command data
Quoted 32 lines · Bart Van Assche
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 structscsi_cmnd.Cc Reviewed-by: Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/sym53c8xx_2/sym_glue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/scsi/sym53c8xx_2/sym_glue.c +1
-2@@ -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);
drivers/scsi/sym53c8xx_2/sym_glue.c static struct scsi_host_template sym2_template = { · line 1635
Quoted 7 lines
drivers/scsi/sym53c8xx_2/sym_glue.c +1
-0@@ -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,
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 39/44] sym53c8xx_2: Move the SCSI pointer to private command data
In reply to Bart Van AsscheQuoted 36 lines · Bart Van Assche
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 structscsi_cmnd.Cc Reviewed-by: Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/sym53c8xx_2/sym_glue.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)drivers/scsi/sym53c8xx_2/sym_glue.c +1
-2@@ -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);
drivers/scsi/sym53c8xx_2/sym_glue.c static struct scsi_host_template sym2_template = { · line 1635
Quoted 7 lines
drivers/scsi/sym53c8xx_2/sym_glue.c +1
-0@@ -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,
--
Himanshu Madhani Oracle Linux Engineering
PATCH v2 40/44 scsi: usb: Stop using the SCSI pointer
In reply to Bart Van AsscheSet scsi_host_template.cmd_size instead of using the SCSI pointer for storing driver-private data. Change the type of the argument of uas_add_work() from struct uas_cmd_info * into struct scsi_cmnd * because it is easier to convert a SCSI command pointer into a uas_cmd_info pointer than the other way around.
This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.
--- drivers/usb/storage/uas.c | 43 ++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 23 deletions(-)
drivers/usb/storage/uas.c +20 -23
@@ -113,7 +113,7 @@ static void uas_do_work(struct work_struct *work)continue ; cmnd = devinfo->cmnd[i]; - cmdinfo = (void *)&cmnd->SCp; + cmdinfo =scsi_cmd_priv (cmnd);if (!(cmdinfo->state &IS_IN_WORK_LIST ))continue ;
@@ -139,10 +139,9 @@ static void uas_scan_work(struct work_struct *work)dev_dbg (&devinfo->intf->dev,"scan complete\n" ); } -static void uas_add_work (struct uas_cmd_info *cmdinfo) +static void uas_add_work (struct scsi_cmnd *cmnd) { -struct scsi_pointer *scp = (void *)cmdinfo; - struct scsi_cmnd *cmnd = container_of(scp, struct scsi_cmnd, SCp); +struct uas_cmd_info *cmdinfo =scsi_cmd_priv (cmnd);struct uas_dev_info *devinfo = cmnd->device->hostdata;lockdep_assert_held (&devinfo->lock);
@@ -163,7 +162,7 @@ static void uas_zap_pending(struct uas_dev_info *devinfo, int result)continue ; cmnd = devinfo->cmnd[i]; - cmdinfo = (void *)&cmnd->SCp; + cmdinfo =scsi_cmd_priv (cmnd);uas_log_cmd_state (cmnd, __func__,0 );/* Sense urbs were killed, clear COMMAND_INFLIGHT manually */ cmdinfo->state &= ~COMMAND_INFLIGHT ;
@@ -200,15 +199,14 @@ static void uas_sense(struct urb *urb, struct scsi_cmnd *cmnd)static void uas_log_cmd_state (struct scsi_cmnd *cmnd,const char *prefix,int status) { -struct uas_cmd_info *ci = (void *)&cmnd->SCp; -struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; +struct uas_cmd_info *ci =scsi_cmd_priv (cmnd);if (status == -ENODEV )/* too late */ return ; scmd_printk(KERN_INFO, cmnd, "%s %d uas-tag %d inflight:%s%s%s%s%s%s%s%s%s%s%s%s ", - prefix, status, cmdinfo->uas_tag, + prefix, status, ci->uas_tag, (ci->state & SUBMIT_STATUS_URB) ? " s-st" : "", (ci->state & ALLOC_DATA_IN_URB) ? " a-in" : "", (ci->state & SUBMIT_DATA_IN_URB) ? " s-in" : "",
@@ -231,7 +229,7 @@ static void uas_free_unsubmitted_urbs(struct scsi_cmnd *cmnd)if (!cmnd)return ; - cmdinfo = (void *)&cmnd->SCp; + cmdinfo =scsi_cmd_priv (cmnd);if (cmdinfo->state &SUBMIT_CMD_URB )usb_free_urb (cmdinfo->cmd_urb);
@@ -245,7 +243,7 @@ static void uas_free_unsubmitted_urbs(struct scsi_cmnd *cmnd)static int uas_try_complete (struct scsi_cmnd *cmnd,const char *caller) { -struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; +struct uas_cmd_info *cmdinfo =scsi_cmd_priv (cmnd);struct uas_dev_info *devinfo = (void *)cmnd->device->hostdata;lockdep_assert_held (&devinfo->lock);
@@ -263,13 +261,13 @@ static int uas_try_complete(struct scsi_cmnd *cmnd, const char *caller)static void uas_xfer_data (struct urb *urb,struct scsi_cmnd *cmnd,unsigned direction) { -struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; +struct uas_cmd_info *cmdinfo =scsi_cmd_priv (cmnd);int err; cmdinfo->state |= direction |SUBMIT_STATUS_URB ; err =uas_submit_urbs (cmnd, cmnd->device->hostdata);if (err) { -uas_add_work (cmdinfo); +uas_add_work (cmnd); } }
@@ -329,7 +327,7 @@ static void uas_stat_cmplt(struct urb *urb) } cmnd = devinfo->cmnd[idx]; - cmdinfo = (void *)&cmnd->SCp; + cmdinfo =scsi_cmd_priv (cmnd);if (!(cmdinfo->state &COMMAND_INFLIGHT )) {uas_log_cmd_state (cmnd,"unexpected status cmplt" ,0 );
@@ -394,7 +392,7 @@ static void uas_stat_cmplt(struct urb *urb)static void uas_data_cmplt (struct urb *urb) {struct scsi_cmnd *cmnd = urb->context; -struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; +struct uas_cmd_info *cmdinfo =scsi_cmd_priv (cmnd);struct uas_dev_info *devinfo = (void *)cmnd->device->hostdata;struct scsi_data_buffer *sdb = &cmnd->sdb;unsigned long flags;
@@ -446,7 +444,7 @@ static struct urb *uas_alloc_data_urb(struct uas_dev_info *devinfo, gfp_t gfp, enum dma_data_direction dir) {struct usb_device *udev = devinfo->udev; -struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; +struct uas_cmd_info *cmdinfo =scsi_cmd_priv (cmnd);struct urb *urb =usb_alloc_urb (0 , gfp);struct scsi_data_buffer *sdb = &cmnd->sdb;unsigned int pipe = (dir ==DMA_FROM_DEVICE )
@@ -468,7 +466,7 @@ static struct urb *uas_alloc_sense_urb(struct uas_dev_info *devinfo, gfp_t gfp, struct scsi_cmnd *cmnd) {struct usb_device *udev = devinfo->udev; -struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; +struct uas_cmd_info *cmdinfo =scsi_cmd_priv (cmnd);struct urb *urb =usb_alloc_urb (0 , gfp);struct sense_iu *iu;
@@ -496,7 +494,7 @@ static struct urb *uas_alloc_cmd_urb(struct uas_dev_info *devinfo, gfp_t gfp, {struct usb_device *udev = devinfo->udev;struct scsi_device *sdev = cmnd->device; -struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; +struct uas_cmd_info *cmdinfo =scsi_cmd_priv (cmnd);struct urb *urb =usb_alloc_urb (0 , gfp);struct command_iu *iu;int len;
@@ -558,7 +556,7 @@ static struct urb *uas_submit_sense_urb(struct scsi_cmnd *cmnd, gfp_t gfp)static int uas_submit_urbs (struct scsi_cmnd *cmnd,struct uas_dev_info *devinfo) { -struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; +struct uas_cmd_info *cmdinfo =scsi_cmd_priv (cmnd);struct urb *urb;int err;
@@ -637,12 +635,10 @@ static int uas_queuecommand_lck(struct scsi_cmnd *cmnd) {struct scsi_device *sdev = cmnd->device;struct uas_dev_info *devinfo = sdev->hostdata; -struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; +struct uas_cmd_info *cmdinfo =scsi_cmd_priv (cmnd);unsigned long flags;int idx, err; -BUILD_BUG_ON (sizeof (struct uas_cmd_info ) >sizeof (struct scsi_pointer )); -/* Re-check scsi_block_requests now that we've the host-lock */ if (cmnd->device->host->host_self_blocked)return SCSI_MLQUEUE_DEVICE_BUSY ;
@@ -712,7 +708,7 @@ static int uas_queuecommand_lck(struct scsi_cmnd *cmnd)spin_unlock_irqrestore (&devinfo->lock, flags);return SCSI_MLQUEUE_DEVICE_BUSY ; } -uas_add_work (cmdinfo); +uas_add_work (cmnd); } devinfo->cmnd[idx] = cmnd;
@@ -730,7 +726,7 @@ static DEF_SCSI_QCMD(uas_queuecommand)*/ static int uas_eh_abort_handler (struct scsi_cmnd *cmnd) { -struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; +struct uas_cmd_info *cmdinfo =scsi_cmd_priv (cmnd);struct uas_dev_info *devinfo = (void *)cmnd->device->hostdata;struct urb *data_in_urb =NULL ;struct urb *data_out_urb =NULL ;
@@ -910,6 +906,7 @@ static struct scsi_host_template uas_host_template = { .this_id = -1, .skip_settle_delay = 1, .dma_boundary = PAGE_SIZE - 1, + .cmd_size = sizeof(struct uas_cmd_info), }; #define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
Re: [PATCH v2 40/44] scsi: usb: Stop using the SCSI pointer
Quoted 8 lines · Bart Van Assche
Set scsi_host_template.cmd_size instead of using the SCSI pointer for storing driver-private data. Change the type of the argument of
uas_add_work()from structuas_cmd_info* into structscsi_cmnd* because it is easier to convert a SCSI command pointer into auas_cmd_infopointer than the other way around.This patch prepares for removal of the SCSI pointer from struct
scsi_cmnd.
Quoted 9 lines
Acked-by Oliver Neukum <[email protected]>Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/usb/storage/uas.c | 43 ++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 23 deletions(-)
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 40/44] scsi: usb: Stop using the SCSI pointer
In reply to Bart Van AsscheQuoted 195 lines · Bart Van Assche
Set scsi_host_template.cmd_size instead of using the SCSI pointer for storing driver-private data. Change the type of the argument of
uas_add_work()from structuas_cmd_info* into structscsi_cmnd* because it is easier to convert a SCSI command pointer into auas_cmd_infopointer than the other way around.This patch prepares for removal of the SCSI pointer from struct
scsi_cmnd.Acked-by Oliver Neukum <[email protected]>Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/usb/storage/uas.c| 43 ++++++++++++++++++---------------------1 file changed, 20 insertions(+), 23 deletions(-)drivers/usb/storage/uas.c +19
-23@@ -113,7 +113,7 @@ static void uas_do_work(struct work_struct *work)continue ; cmnd = devinfo->cmnd[i]; - cmdinfo = (void *)&cmnd->SCp; + cmdinfo =scsi_cmd_priv (cmnd);if (!(cmdinfo->state &IS_IN_WORK_LIST ))continue ;@@ -139,10 +139,9 @@ static void uas_scan_work(struct work_struct *work)dev_dbg (&devinfo->intf->dev,"scan complete\n" ); } -static void uas_add_work (struct uas_cmd_info *cmdinfo) +static void uas_add_work (struct scsi_cmnd *cmnd) { -struct scsi_pointer *scp = (void *)cmdinfo; - struct scsi_cmnd *cmnd = container_of(scp, struct scsi_cmnd, SCp); +struct uas_cmd_info *cmdinfo =scsi_cmd_priv (cmnd);struct uas_dev_info *devinfo = cmnd->device->hostdata;lockdep_assert_held (&devinfo->lock);@@ -163,7 +162,7 @@ static void uas_zap_pending(struct uas_dev_info *devinfo, int result)continue ; cmnd = devinfo->cmnd[i]; - cmdinfo = (void *)&cmnd->SCp; + cmdinfo =scsi_cmd_priv (cmnd);uas_log_cmd_state (cmnd, __func__,0 );/* Sense urbs were killed, clear COMMAND_INFLIGHT manually */ cmdinfo->state &= ~COMMAND_INFLIGHT ;@@ -200,15 +199,14 @@ static void uas_sense(struct urb *urb, struct scsi_cmnd *cmnd)static void uas_log_cmd_state (struct scsi_cmnd *cmnd,const char *prefix,int status) { -struct uas_cmd_info *ci = (void *)&cmnd->SCp; -struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; +struct uas_cmd_info *ci =scsi_cmd_priv (cmnd);if (status == -ENODEV )/* too late */ return ; scmd_printk(KERN_INFO, cmnd, "%s %d uas-tag %d inflight:%s%s%s%s%s%s%s%s%s%s%s%s ", - prefix, status, cmdinfo->uas_tag, + prefix, status, ci->uas_tag, (ci->state & SUBMIT_STATUS_URB) ? " s-st" : "", (ci->state & ALLOC_DATA_IN_URB) ? " a-in" : "", (ci->state & SUBMIT_DATA_IN_URB) ? " s-in" : "",@@ -231,7 +229,7 @@ static void uas_free_unsubmitted_urbs(struct scsi_cmnd *cmnd)if (!cmnd)return ; - cmdinfo = (void *)&cmnd->SCp; + cmdinfo =scsi_cmd_priv (cmnd);if (cmdinfo->state &SUBMIT_CMD_URB )usb_free_urb (cmdinfo->cmd_urb);@@ -245,7 +243,7 @@ static void uas_free_unsubmitted_urbs(struct scsi_cmnd *cmnd)static int uas_try_complete (struct scsi_cmnd *cmnd,const char *caller) { -struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; +struct uas_cmd_info *cmdinfo =scsi_cmd_priv (cmnd);struct uas_dev_info *devinfo = (void *)cmnd->device->hostdata;lockdep_assert_held (&devinfo->lock);@@ -263,13 +261,13 @@ static int uas_try_complete(struct scsi_cmnd *cmnd, const char *caller)static void uas_xfer_data (struct urb *urb,struct scsi_cmnd *cmnd,unsigned direction) { -struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; +struct uas_cmd_info *cmdinfo =scsi_cmd_priv (cmnd);int err; cmdinfo->state |= direction |SUBMIT_STATUS_URB ; err =uas_submit_urbs (cmnd, cmnd->device->hostdata);if (err) { -uas_add_work (cmdinfo); +uas_add_work (cmnd); } }@@ -329,7 +327,7 @@ static void uas_stat_cmplt(struct urb *urb) } cmnd = devinfo->cmnd[idx]; - cmdinfo = (void *)&cmnd->SCp; + cmdinfo =scsi_cmd_priv (cmnd);if (!(cmdinfo->state &COMMAND_INFLIGHT )) {uas_log_cmd_state (cmnd,"unexpected status cmplt" ,0 );@@ -394,7 +392,7 @@ static void uas_stat_cmplt(struct urb *urb)static void uas_data_cmplt (struct urb *urb) {struct scsi_cmnd *cmnd = urb->context; -struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; +struct uas_cmd_info *cmdinfo =scsi_cmd_priv (cmnd);struct uas_dev_info *devinfo = (void *)cmnd->device->hostdata;struct scsi_data_buffer *sdb = &cmnd->sdb;unsigned long flags;@@ -446,7 +444,7 @@ static struct urb *uas_alloc_data_urb(struct uas_dev_info *devinfo, gfp_t gfp, enum dma_data_direction dir) {struct usb_device *udev = devinfo->udev; -struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; +struct uas_cmd_info *cmdinfo =scsi_cmd_priv (cmnd);struct urb *urb =usb_alloc_urb (0 , gfp);struct scsi_data_buffer *sdb = &cmnd->sdb;unsigned int pipe = (dir ==DMA_FROM_DEVICE )@@ -468,7 +466,7 @@ static struct urb *uas_alloc_sense_urb(struct uas_dev_info *devinfo, gfp_t gfp, struct scsi_cmnd *cmnd) {struct usb_device *udev = devinfo->udev; -struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; +struct uas_cmd_info *cmdinfo =scsi_cmd_priv (cmnd);struct urb *urb =usb_alloc_urb (0 , gfp);struct sense_iu *iu;@@ -496,7 +494,7 @@ static struct urb *uas_alloc_cmd_urb(struct uas_dev_info *devinfo, gfp_t gfp, {struct usb_device *udev = devinfo->udev;struct scsi_device *sdev = cmnd->device; -struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; +struct uas_cmd_info *cmdinfo =scsi_cmd_priv (cmnd);struct urb *urb =usb_alloc_urb (0 , gfp);struct command_iu *iu;int len;@@ -558,7 +556,7 @@ static struct urb *uas_submit_sense_urb(struct scsi_cmnd *cmnd, gfp_t gfp)static int uas_submit_urbs (struct scsi_cmnd *cmnd,struct uas_dev_info *devinfo) { -struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; +struct uas_cmd_info *cmdinfo =scsi_cmd_priv (cmnd);struct urb *urb;int err;@@ -637,12 +635,10 @@ static int uas_queuecommand_lck(struct scsi_cmnd *cmnd) {struct scsi_device *sdev = cmnd->device;struct uas_dev_info *devinfo = sdev->hostdata; -struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; +struct uas_cmd_info *cmdinfo =scsi_cmd_priv (cmnd);unsigned long flags;int idx, err; -BUILD_BUG_ON (sizeof (struct uas_cmd_info ) >sizeof (struct scsi_pointer )); -/* Re-check scsi_block_requests now that we've the host-lock */ if (cmnd->device->host->host_self_blocked)return SCSI_MLQUEUE_DEVICE_BUSY ;@@ -712,7 +708,7 @@ static int uas_queuecommand_lck(struct scsi_cmnd *cmnd)spin_unlock_irqrestore (&devinfo->lock, flags);return SCSI_MLQUEUE_DEVICE_BUSY ; } -uas_add_work (cmdinfo); +uas_add_work (cmnd); } devinfo->cmnd[idx] = cmnd;@@ -730,7 +726,7 @@ static DEF_SCSI_QCMD(uas_queuecommand)*/ static int uas_eh_abort_handler (struct scsi_cmnd *cmnd) { -struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; +struct uas_cmd_info *cmdinfo =scsi_cmd_priv (cmnd);struct uas_dev_info *devinfo = (void *)cmnd->device->hostdata;struct urb *data_in_urb =NULL ;struct urb *data_out_urb =NULL ;
drivers/usb/storage/uas.c static struct scsi_host_template uas_host_template = { · line 912
Quoted 7 lines
drivers/usb/storage/uas.c +1
-0@@ -910,6 +906,7 @@ static struct scsi_host_template uas_host_template = { .this_id = -1, .skip_settle_delay = 1, .dma_boundary = PAGE_SIZE - 1, + .cmd_size = sizeof(struct uas_cmd_info), }; #define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
--
Himanshu Madhani Oracle Linux Engineering
PATCH v2 41/44 wd719x: Stop using the SCSI pointer
In reply to Bart Van AsscheMove the DMA handle into the per-command private data instead of using the SCSI pointer from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.
--- drivers/scsi/wd719x.c | 12 ++++++------ drivers/scsi/wd719x.h | 1 + 2 files changed, 7 insertions(+), 6 deletions(-)
drivers/scsi/wd719x.c +6 -6
@@ -196,7 +196,7 @@ static void wd719x_finish_cmd(struct wd719x_scb *scb, int result)dma_unmap_single (&wd->pdev->dev, scb->phys,sizeof (struct wd719x_scb ),DMA_BIDIRECTIONAL );scsi_dma_unmap (cmd); -dma_unmap_single (&wd->pdev->dev, cmd->SCp.dma_handle, +dma_unmap_single (&wd->pdev->dev, scb->dma_handle,SCSI_SENSE_BUFFERSIZE ,DMA_FROM_DEVICE ); cmd->result = result <<16 ;
@@ -229,11 +229,11 @@ static int wd719x_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *cmd)/* map sense buffer */ scb->sense_buf_length =SCSI_SENSE_BUFFERSIZE ; - cmd->SCp.dma_handle =dma_map_single (&wd->pdev->dev, cmd->sense_buffer, -SCSI_SENSE_BUFFERSIZE ,DMA_FROM_DEVICE ); -if (dma_mapping_error (&wd->pdev->dev, cmd->SCp.dma_handle)) + scb->dma_handle =dma_map_single (&wd->pdev->dev, cmd->sense_buffer, +SCSI_SENSE_BUFFERSIZE ,DMA_FROM_DEVICE ); +if (dma_mapping_error (&wd->pdev->dev, scb->dma_handle)) goto out_unmap_scb; - scb->sense_buf =cpu_to_le32 (cmd->SCp.dma_handle); + scb->sense_buf =cpu_to_le32 (scb->dma_handle);/* request autosense */ scb->SCB_options |=WD719X_SCB_FLAGS_AUTO_REQUEST_SENSE ;
@@ -288,7 +288,7 @@ static int wd719x_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *cmd)return 0 ; out_unmap_sense: -dma_unmap_single (&wd->pdev->dev, cmd->SCp.dma_handle, +dma_unmap_single (&wd->pdev->dev, scb->dma_handle,SCSI_SENSE_BUFFERSIZE ,DMA_FROM_DEVICE ); out_unmap_scb: dma_unmap_single(&wd->pdev->dev, scb->phys, sizeof(*scb),
drivers/scsi/wd719x.h +1 -0
@@ -56,6 +56,7 @@ struct wd719x_scb {u8 flags[2 ];/* 62-63 SCB specific flags (local to each thread) */ /* everything below is for driver use (not used by card) */ dma_addr_t phys;/* bus address of the SCB */ +dma_addr_t dma_handle;struct scsi_cmnd *cmd;/* a copy of the pointer we were passed */ struct list_head list;struct wd719x_sglist sg_list[WD719X_SG ]__aligned(8) ;/* SG list */
Hannes Reinecke
maintainerRe: [PATCH v2 41/44] wd719x: Stop using the SCSI pointer
Quoted 8 lines · Bart Van Assche
Move the DMA handle into the per-command private data instead of using the SCSI pointer from struct
scsi_cmnd. This patch prepares for removal of the SCSI pointer from structscsi_cmnd.Cc Ondrej Zary <[email protected]>Cc Christoph Hellwig <[email protected]>Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>
Quoted 5 lines
--- drivers/scsi/wd719x.c | 12 ++++++------ drivers/scsi/wd719x.h | 1 + 2 files changed, 7 insertions(+), 6 deletions(-)Reviewed-by Hannes Reinecke <[email protected]>
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 41/44] wd719x: Stop using the SCSI pointer
In reply to Bart Van AsscheQuoted 60 lines · Bart Van Assche
Move the DMA handle into the per-command private data instead of using the SCSI pointer from struct
scsi_cmnd. This patch prepares for removal of the SCSI pointer from structscsi_cmnd.Cc Ondrej Zary <[email protected]>Cc Christoph Hellwig <[email protected]>Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/wd719x.c| 12 ++++++------drivers/scsi/wd719x.h| 1 +2 files changed, 7 insertions(+), 6 deletions(-)drivers/scsi/wd719x.c +5
-5@@ -196,7 +196,7 @@ static void wd719x_finish_cmd(struct wd719x_scb *scb, int result)dma_unmap_single (&wd->pdev->dev, scb->phys,sizeof (struct wd719x_scb ),DMA_BIDIRECTIONAL );scsi_dma_unmap (cmd); -dma_unmap_single (&wd->pdev->dev, cmd->SCp.dma_handle, +dma_unmap_single (&wd->pdev->dev, scb->dma_handle,SCSI_SENSE_BUFFERSIZE ,DMA_FROM_DEVICE ); cmd->result = result <<16 ;@@ -229,11 +229,11 @@ static int wd719x_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *cmd)/* map sense buffer */ scb->sense_buf_length =SCSI_SENSE_BUFFERSIZE ; - cmd->SCp.dma_handle =dma_map_single (&wd->pdev->dev, cmd->sense_buffer, -SCSI_SENSE_BUFFERSIZE ,DMA_FROM_DEVICE ); -if (dma_mapping_error (&wd->pdev->dev, cmd->SCp.dma_handle)) + scb->dma_handle =dma_map_single (&wd->pdev->dev, cmd->sense_buffer, +SCSI_SENSE_BUFFERSIZE ,DMA_FROM_DEVICE ); +if (dma_mapping_error (&wd->pdev->dev, scb->dma_handle)) goto out_unmap_scb; - scb->sense_buf =cpu_to_le32 (cmd->SCp.dma_handle); + scb->sense_buf =cpu_to_le32 (scb->dma_handle);/* request autosense */ scb->SCB_options |=WD719X_SCB_FLAGS_AUTO_REQUEST_SENSE ;@@ -288,7 +288,7 @@ static int wd719x_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *cmd)return 0 ;
out_unmap_sense:drivers/scsi/wd719x.c +1
-1- dma_unmap_single(&wd->pdev->dev, cmd->SCp.dma_handle, + dma_unmap_single(&wd->pdev->dev, scb->dma_handle,SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE); out_unmap_scb: dma_unmap_single(&wd->pdev->dev, scb->phys, sizeof(*scb),drivers/scsi/wd719x.h +0
-0
drivers/scsi/wd719x.h struct wd719x_scb { · line 62
Quoted 7 lines
drivers/scsi/wd719x.h +1
-0@@ -56,6 +56,7 @@ struct wd719x_scb {u8 flags[2 ];/* 62-63 SCB specific flags (local to each thread) */ /* everything below is for driver use (not used by card) */ dma_addr_t phys;/* bus address of the SCB */ +dma_addr_t dma_handle;struct scsi_cmnd *cmd;/* a copy of the pointer we were passed */ struct list_head list;struct wd719x_sglist sg_list[WD719X_SG ]__aligned(8) ;/* SG list */
--
Himanshu Madhani Oracle Linux Engineering
PATCH v2 42/44 wdc33c93: Move the SCSI pointer to private command data
In reply to Bart Van AsscheSet .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.
--- drivers/scsi/a2091.c | 19 ++++--- drivers/scsi/a3000.c | 19 ++++--- drivers/scsi/gvp11.c | 19 ++++--- drivers/scsi/mvme147.c | 10 ++-- drivers/scsi/sgiwd93.c | 18 ++++--- drivers/scsi/wd33c93.c | 119 ++++++++++++++++++++++------------------- drivers/scsi/wd33c93.h | 10 ++++ 7 files changed, 123 insertions(+), 91 deletions(-)
drivers/scsi/a2091.c +11 -8
@@ -44,16 +44,17 @@ static irqreturn_t a2091_intr(int irq, void *data)static int dma_setup (struct scsi_cmnd *cmd,int dir_in) { +struct scsi_pointer *scsi_pointer =WD33C93_scsi_pointer (cmd);struct Scsi_Host *instance = cmd->device->host;struct a2091_hostdata *hdata =shost_priv (instance);struct WD33C93_hostdata *wh = &hdata->wh;struct a2091_scsiregs *regs = hdata->regs;unsigned short cntr =CNTR_PDMD |CNTR_INTEN ; -unsigned long addr =virt_to_bus (cmd->SCp.ptr); +unsigned long addr =virt_to_bus (scsi_pointer->ptr);/* don't allow DMA if the physical address is bad */ if (addr &A2091_XFER_MASK ) { - wh->dma_bounce_len = (cmd->SCp.this_residual +511 ) & ~0x1ff ; + wh->dma_bounce_len = (scsi_pointer->this_residual +511 ) & ~0x1ff ; wh->dma_bounce_buffer =kmalloc (wh->dma_bounce_len,GFP_KERNEL );
@@ -77,8 +78,8 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)if (!dir_in) {/* copy to bounce buffer for a write */ -memcpy (wh->dma_bounce_buffer, cmd->SCp.ptr, - cmd->SCp.this_residual); +memcpy (wh->dma_bounce_buffer, scsi_pointer->ptr, + scsi_pointer->this_residual); } }
@@ -96,10 +97,10 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)if (dir_in) {/* invalidate any cache */ -cache_clear (addr, cmd->SCp.this_residual); +cache_clear (addr, scsi_pointer->this_residual); }else {/* push any dirty cache */ -cache_push (addr, cmd->SCp.this_residual); +cache_push (addr, scsi_pointer->this_residual); }/* start DMA */ regs->ST_DMA =1 ;
@@ -111,6 +112,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)static void dma_stop (struct Scsi_Host *instance,struct scsi_cmnd *SCpnt,int status) { +struct scsi_pointer *scsi_pointer =WD33C93_scsi_pointer (SCpnt);struct a2091_hostdata *hdata =shost_priv (instance);struct WD33C93_hostdata *wh = &hdata->wh;struct a2091_scsiregs *regs = hdata->regs;
@@ -143,8 +145,8 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,/* copy from a bounce buffer, if necessary */ if (status && wh->dma_bounce_buffer) {if (wh->dma_dir) -memcpy (SCpnt->SCp.ptr, wh->dma_bounce_buffer, - SCpnt->SCp.this_residual); +memcpy (scsi_pointer->ptr, wh->dma_bounce_buffer, + scsi_pointer->this_residual);kfree (wh->dma_bounce_buffer); wh->dma_bounce_buffer =NULL ; wh->dma_bounce_len =0 ;
@@ -165,6 +167,7 @@ static struct scsi_host_template a2091_scsi_template = { .sg_tablesize = SG_ALL, .cmd_per_lun = CMD_PER_LUN, .dma_boundary = PAGE_SIZE - 1, + .cmd_size = sizeof(struct WD33C93_cmd), };static int a2091_probe (struct zorro_dev *z,const struct zorro_device_id *ent)
drivers/scsi/a3000.c +11 -8
@@ -48,12 +48,13 @@ static irqreturn_t a3000_intr(int irq, void *data)static int dma_setup (struct scsi_cmnd *cmd,int dir_in) { +struct scsi_pointer *scsi_pointer =WD33C93_scsi_pointer (cmd);struct Scsi_Host *instance = cmd->device->host;struct a3000_hostdata *hdata =shost_priv (instance);struct WD33C93_hostdata *wh = &hdata->wh;struct a3000_scsiregs *regs = hdata->regs;unsigned short cntr =CNTR_PDMD |CNTR_INTEN ; -unsigned long addr =virt_to_bus (cmd->SCp.ptr); +unsigned long addr =virt_to_bus (scsi_pointer->ptr);/* * if the physical address has the wrong alignment, or if
@@ -62,7 +63,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)* buffer */ if (addr &A3000_XFER_MASK ) { - wh->dma_bounce_len = (cmd->SCp.this_residual +511 ) & ~0x1ff ; + wh->dma_bounce_len = (scsi_pointer->this_residual +511 ) & ~0x1ff ; wh->dma_bounce_buffer =kmalloc (wh->dma_bounce_len,GFP_KERNEL );
@@ -74,8 +75,8 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)if (!dir_in) {/* copy to bounce buffer for a write */ -memcpy (wh->dma_bounce_buffer, cmd->SCp.ptr, - cmd->SCp.this_residual); +memcpy (wh->dma_bounce_buffer, scsi_pointer->ptr, + scsi_pointer->this_residual); } addr =virt_to_bus (wh->dma_bounce_buffer);
@@ -95,10 +96,10 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)if (dir_in) {/* invalidate any cache */ -cache_clear (addr, cmd->SCp.this_residual); +cache_clear (addr, scsi_pointer->this_residual); }else {/* push any dirty cache */ -cache_push (addr, cmd->SCp.this_residual); +cache_push (addr, scsi_pointer->this_residual); }/* start DMA */
@@ -113,6 +114,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)static void dma_stop (struct Scsi_Host *instance,struct scsi_cmnd *SCpnt,int status) { +struct scsi_pointer *scsi_pointer =WD33C93_scsi_pointer (SCpnt);struct a3000_hostdata *hdata =shost_priv (instance);struct WD33C93_hostdata *wh = &hdata->wh;struct a3000_scsiregs *regs = hdata->regs;
@@ -153,8 +155,8 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,if (status && wh->dma_bounce_buffer) {if (SCpnt) {if (wh->dma_dir && SCpnt) -memcpy (SCpnt->SCp.ptr, wh->dma_bounce_buffer, - SCpnt->SCp.this_residual); +memcpy (scsi_pointer->ptr, wh->dma_bounce_buffer, + scsi_pointer->this_residual);kfree (wh->dma_bounce_buffer); wh->dma_bounce_buffer =NULL ; wh->dma_bounce_len =0 ;
@@ -179,6 +181,7 @@ static struct scsi_host_template amiga_a3000_scsi_template = { .this_id = 7, .sg_tablesize = SG_ALL, .cmd_per_lun = CMD_PER_LUN, + .cmd_size = sizeof(struct WD33C93_cmd), };static int __init amiga_a3000_scsi_probe (struct platform_device *pdev)
drivers/scsi/gvp11.c +11 -8
@@ -53,18 +53,19 @@ void gvp11_setup(char *str, int *ints)static int dma_setup (struct scsi_cmnd *cmd,int dir_in) { +struct scsi_pointer *scsi_pointer =WD33C93_scsi_pointer (cmd);struct Scsi_Host *instance = cmd->device->host;struct gvp11_hostdata *hdata =shost_priv (instance);struct WD33C93_hostdata *wh = &hdata->wh;struct gvp11_scsiregs *regs = hdata->regs;unsigned short cntr =GVP11_DMAC_INT_ENABLE ; -unsigned long addr =virt_to_bus (cmd->SCp.ptr); +unsigned long addr =virt_to_bus (scsi_pointer->ptr);int bank_mask;static int scsi_alloc_out_of_range =0 ;/* use bounce buffer if the physical address is bad */ if (addr & wh->dma_xfer_mask) { - wh->dma_bounce_len = (cmd->SCp.this_residual +511 ) & ~0x1ff ; + wh->dma_bounce_len = (scsi_pointer->this_residual +511 ) & ~0x1ff ;if (!scsi_alloc_out_of_range) { wh->dma_bounce_buffer =
@@ -113,8 +114,8 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)if (!dir_in) {/* copy to bounce buffer for a write */ -memcpy (wh->dma_bounce_buffer, cmd->SCp.ptr, - cmd->SCp.this_residual); +memcpy (wh->dma_bounce_buffer, scsi_pointer->ptr, + scsi_pointer->this_residual); } }
@@ -130,10 +131,10 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)if (dir_in) {/* invalidate any cache */ -cache_clear (addr, cmd->SCp.this_residual); +cache_clear (addr, scsi_pointer->this_residual); }else {/* push any dirty cache */ -cache_push (addr, cmd->SCp.this_residual); +cache_push (addr, scsi_pointer->this_residual); } bank_mask = (~wh->dma_xfer_mask >>18 ) &0x01c0 ;
@@ -150,6 +151,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)static void dma_stop (struct Scsi_Host *instance,struct scsi_cmnd *SCpnt,int status) { +struct scsi_pointer *scsi_pointer =WD33C93_scsi_pointer (SCpnt);struct gvp11_hostdata *hdata =shost_priv (instance);struct WD33C93_hostdata *wh = &hdata->wh;struct gvp11_scsiregs *regs = hdata->regs;
@@ -162,8 +164,8 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,/* copy from a bounce buffer, if necessary */ if (status && wh->dma_bounce_buffer) {if (wh->dma_dir && SCpnt) -memcpy (SCpnt->SCp.ptr, wh->dma_bounce_buffer, - SCpnt->SCp.this_residual); +memcpy (scsi_pointer->ptr, wh->dma_bounce_buffer, + scsi_pointer->this_residual);if (wh->dma_buffer_pool ==BUF_SCSI_ALLOCED )kfree (wh->dma_bounce_buffer);
@@ -189,6 +191,7 @@ static struct scsi_host_template gvp11_scsi_template = { .sg_tablesize = SG_ALL, .cmd_per_lun = CMD_PER_LUN, .dma_boundary = PAGE_SIZE - 1, + .cmd_size = sizeof(struct WD33C93_cmd), };static int check_wd33c93 (struct gvp11_scsiregs *regs)
drivers/scsi/mvme147.c +6 -4
@@ -33,10 +33,11 @@ static irqreturn_t mvme147_intr(int irq, void *data)static int dma_setup (struct scsi_cmnd *cmd,int dir_in) { +struct scsi_pointer *scsi_pointer =WD33C93_scsi_pointer (cmd);struct Scsi_Host *instance = cmd->device->host;struct WD33C93_hostdata *hdata =shost_priv (instance);unsigned char flags =0x01 ; -unsigned long addr =virt_to_bus (cmd->SCp.ptr); +unsigned long addr =virt_to_bus (scsi_pointer->ptr);/* setup dma direction */ if (!dir_in)
@@ -47,14 +48,14 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)if (dir_in) {/* invalidate any cache */ -cache_clear (addr, cmd->SCp.this_residual); +cache_clear (addr, scsi_pointer->this_residual); }else {/* push any dirty cache */ -cache_push (addr, cmd->SCp.this_residual); +cache_push (addr, scsi_pointer->this_residual); }/* start DMA */ - m147_pcc->dma_bcr = cmd->SCp.this_residual | (1 <<24 ); + m147_pcc->dma_bcr = scsi_pointer->this_residual | (1 <<24 ); m147_pcc->dma_dadr = addr; m147_pcc->dma_cntrl = flags;
@@ -81,6 +82,7 @@ static struct scsi_host_template mvme147_host_template = { .this_id = 7, .sg_tablesize = SG_ALL, .cmd_per_lun = CMD_PER_LUN, + .cmd_size = sizeof(struct WD33C93_cmd), };static struct Scsi_Host *mvme147_shost;
drivers/scsi/sgiwd93.c +11 -7
@@ -69,14 +69,15 @@ static irqreturn_t sgiwd93_intr(int irq, void *dev_id)static inline void fill_hpc_entries (struct ip22_hostdata *hd,struct scsi_cmnd *cmd,int din) { -unsigned long len = cmd->SCp.this_residual; -void *addr = cmd->SCp.ptr; +struct scsi_pointer *scsi_pointer =WD33C93_scsi_pointer (cmd); +unsigned long len = scsi_pointer->this_residual; +void *addr = scsi_pointer->ptr;dma_addr_t physaddr;unsigned long count;struct hpc_chunk *hcp; physaddr =dma_map_single (hd->dev, addr, len,DMA_DIR (din)); - cmd->SCp.dma_handle = physaddr; + scsi_pointer->dma_handle = physaddr; hcp = hd->cpu;while (len) {
@@ -106,6 +107,7 @@ void fill_hpc_entries(struct ip22_hostdata *hd, struct scsi_cmnd *cmd, int din)static int dma_setup (struct scsi_cmnd *cmd,int datainp) { +struct scsi_pointer *scsi_pointer =WD33C93_scsi_pointer (cmd);struct ip22_hostdata *hdata =host_to_hostdata (cmd->device->host);struct hpc3_scsiregs *hregs = (struct hpc3_scsiregs *) cmd->device->host->base;
@@ -120,7 +122,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int datainp)* obvious). IMHO a better fix would be, not to do these dma setups * in the first place. */ -if (cmd->SCp.ptr ==NULL || cmd->SCp.this_residual ==0 ) +if (scsi_pointer->ptr ==NULL || scsi_pointer->this_residual ==0 )return 1 ;fill_hpc_entries (hdata, cmd, datainp);
@@ -140,13 +142,14 @@ static int dma_setup(struct scsi_cmnd *cmd, int datainp)static void dma_stop (struct Scsi_Host *instance,struct scsi_cmnd *SCpnt,int status) { +struct scsi_pointer *scsi_pointer =WD33C93_scsi_pointer (SCpnt);struct ip22_hostdata *hdata =host_to_hostdata (instance);struct hpc3_scsiregs *hregs;if (!SCpnt)return ; -if (SCpnt->SCp.ptr ==NULL || SCpnt->SCp.this_residual ==0 ) +if (scsi_pointer->ptr ==NULL || scsi_pointer->this_residual ==0 )return ; hregs = (struct hpc3_scsiregs *) SCpnt->device->host->base;
@@ -160,8 +163,8 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,barrier (); } hregs->ctrl =0 ; -dma_unmap_single (hdata->dev, SCpnt->SCp.dma_handle, - SCpnt->SCp.this_residual, +dma_unmap_single (hdata->dev, scsi_pointer->dma_handle, + scsi_pointer->this_residual,DMA_DIR (hdata->wh.dma_dir));pr_debug ("\n" );
@@ -213,6 +216,7 @@ static struct scsi_host_template sgiwd93_template = { .sg_tablesize = SG_ALL, .cmd_per_lun = 8, .dma_boundary = PAGE_SIZE - 1, + .cmd_size = sizeof(struct WD33C93_cmd), };static int sgiwd93_probe (struct platform_device *pdev)
drivers/scsi/wd33c93.c +63 -56
297 lines not on this page · raw message
drivers/scsi/wd33c93.h +10 -0
@@ -262,6 +262,16 @@ struct WD33C93_hostdata {#endif }; +struct WD33C93_cmd { +struct scsi_pointer scsi_pointer; +}; + +static inline struct scsi_pointer *WD33C93_scsi_pointer (struct scsi_cmnd *cmd) +{ +struct WD33C93_cmd *wcmd =scsi_cmd_priv (cmd); + +return &wcmd->scsi_pointer; +}/* defines for hostdata->chip */
Hannes Reinecke
maintainerRe: [PATCH v2 42/44] wdc33c93: Move the SCSI pointer to private command data
Quoted 701 lines · Bart Van Assche
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 structscsi_cmnd.Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/a2091.c | 19 ++++--- drivers/scsi/a3000.c | 19 ++++--- drivers/scsi/gvp11.c | 19 ++++--- drivers/scsi/mvme147.c | 10 ++-- drivers/scsi/sgiwd93.c | 18 ++++--- drivers/scsi/wd33c93.c | 119 ++++++++++++++++++++++------------------- drivers/scsi/wd33c93.h | 10 ++++ 7 files changed, 123 insertions(+), 91 deletions(-)drivers/scsi/a2091.c +11
-8@@ -44,16 +44,17 @@ static irqreturn_t a2091_intr(int irq, void *data)static int dma_setup (struct scsi_cmnd *cmd,int dir_in) { +struct scsi_pointer *scsi_pointer =WD33C93_scsi_pointer (cmd);struct Scsi_Host *instance = cmd->device->host;struct a2091_hostdata *hdata =shost_priv (instance);struct WD33C93_hostdata *wh = &hdata->wh;struct a2091_scsiregs *regs = hdata->regs;unsigned short cntr =CNTR_PDMD |CNTR_INTEN ; -unsigned long addr =virt_to_bus (cmd->SCp.ptr); +unsigned long addr =virt_to_bus (scsi_pointer->ptr);/* don't allow DMA if the physical address is bad */ if (addr &A2091_XFER_MASK ) { - wh->dma_bounce_len = (cmd->SCp.this_residual +511 ) & ~0x1ff ; + wh->dma_bounce_len = (scsi_pointer->this_residual +511 ) & ~0x1ff ; wh->dma_bounce_buffer =kmalloc (wh->dma_bounce_len,GFP_KERNEL );@@ -77,8 +78,8 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)if (!dir_in) {/* copy to bounce buffer for a write */ -memcpy (wh->dma_bounce_buffer, cmd->SCp.ptr, - cmd->SCp.this_residual); +memcpy (wh->dma_bounce_buffer, scsi_pointer->ptr, + scsi_pointer->this_residual); } }@@ -96,10 +97,10 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)if (dir_in) {/* invalidate any cache */ -cache_clear (addr, cmd->SCp.this_residual); +cache_clear (addr, scsi_pointer->this_residual); }else {/* push any dirty cache */ -cache_push (addr, cmd->SCp.this_residual); +cache_push (addr, scsi_pointer->this_residual); }/* start DMA */ regs->ST_DMA =1 ;@@ -111,6 +112,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)static void dma_stop (struct Scsi_Host *instance,struct scsi_cmnd *SCpnt,int status) { +struct scsi_pointer *scsi_pointer =WD33C93_scsi_pointer (SCpnt);struct a2091_hostdata *hdata =shost_priv (instance);struct WD33C93_hostdata *wh = &hdata->wh;struct a2091_scsiregs *regs = hdata->regs;@@ -143,8 +145,8 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,/* copy from a bounce buffer, if necessary */ if (status && wh->dma_bounce_buffer) {if (wh->dma_dir) -memcpy (SCpnt->SCp.ptr, wh->dma_bounce_buffer, - SCpnt->SCp.this_residual); +memcpy (scsi_pointer->ptr, wh->dma_bounce_buffer, + scsi_pointer->this_residual);kfree (wh->dma_bounce_buffer); wh->dma_bounce_buffer =NULL ; wh->dma_bounce_len =0 ;@@ -165,6 +167,7 @@ static struct scsi_host_template a2091_scsi_template = { .sg_tablesize = SG_ALL, .cmd_per_lun = CMD_PER_LUN, .dma_boundary = PAGE_SIZE - 1, + .cmd_size = sizeof(struct WD33C93_cmd), };static int a2091_probe (struct zorro_dev *z,const struct zorro_device_id *ent)drivers/scsi/a3000.c +11
-8@@ -48,12 +48,13 @@ static irqreturn_t a3000_intr(int irq, void *data)static int dma_setup (struct scsi_cmnd *cmd,int dir_in) { +struct scsi_pointer *scsi_pointer =WD33C93_scsi_pointer (cmd);struct Scsi_Host *instance = cmd->device->host;struct a3000_hostdata *hdata =shost_priv (instance);struct WD33C93_hostdata *wh = &hdata->wh;struct a3000_scsiregs *regs = hdata->regs;unsigned short cntr =CNTR_PDMD |CNTR_INTEN ; -unsigned long addr =virt_to_bus (cmd->SCp.ptr); +unsigned long addr =virt_to_bus (scsi_pointer->ptr);/* * if the physical address has the wrong alignment, or if @@ -62,7 +63,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)* buffer */ if (addr &A3000_XFER_MASK ) { - wh->dma_bounce_len = (cmd->SCp.this_residual +511 ) & ~0x1ff ; + wh->dma_bounce_len = (scsi_pointer->this_residual +511 ) & ~0x1ff ; wh->dma_bounce_buffer =kmalloc (wh->dma_bounce_len,GFP_KERNEL );@@ -74,8 +75,8 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)if (!dir_in) {/* copy to bounce buffer for a write */ -memcpy (wh->dma_bounce_buffer, cmd->SCp.ptr, - cmd->SCp.this_residual); +memcpy (wh->dma_bounce_buffer, scsi_pointer->ptr, + scsi_pointer->this_residual); } addr =virt_to_bus (wh->dma_bounce_buffer);@@ -95,10 +96,10 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)if (dir_in) {/* invalidate any cache */ -cache_clear (addr, cmd->SCp.this_residual); +cache_clear (addr, scsi_pointer->this_residual); }else {/* push any dirty cache */ -cache_push (addr, cmd->SCp.this_residual); +cache_push (addr, scsi_pointer->this_residual); }/* start DMA */ @@ -113,6 +114,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)static void dma_stop (struct Scsi_Host *instance,struct scsi_cmnd *SCpnt,int status) { +struct scsi_pointer *scsi_pointer =WD33C93_scsi_pointer (SCpnt);struct a3000_hostdata *hdata =shost_priv (instance);struct WD33C93_hostdata *wh = &hdata->wh;struct a3000_scsiregs *regs = hdata->regs;@@ -153,8 +155,8 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,if (status && wh->dma_bounce_buffer) {if (SCpnt) {if (wh->dma_dir && SCpnt) -memcpy (SCpnt->SCp.ptr, wh->dma_bounce_buffer, - SCpnt->SCp.this_residual); +memcpy (scsi_pointer->ptr, wh->dma_bounce_buffer, + scsi_pointer->this_residual);kfree (wh->dma_bounce_buffer); wh->dma_bounce_buffer =NULL ; wh->dma_bounce_len =0 ;@@ -179,6 +181,7 @@ static struct scsi_host_template amiga_a3000_scsi_template = { .this_id = 7, .sg_tablesize = SG_ALL, .cmd_per_lun = CMD_PER_LUN, + .cmd_size = sizeof(struct WD33C93_cmd), };static int __init amiga_a3000_scsi_probe (struct platform_device *pdev)drivers/scsi/gvp11.c +11
-8@@ -53,18 +53,19 @@ void gvp11_setup(char *str, int *ints)static int dma_setup (struct scsi_cmnd *cmd,int dir_in) { +struct scsi_pointer *scsi_pointer =WD33C93_scsi_pointer (cmd);struct Scsi_Host *instance = cmd->device->host;struct gvp11_hostdata *hdata =shost_priv (instance);struct WD33C93_hostdata *wh = &hdata->wh;struct gvp11_scsiregs *regs = hdata->regs;unsigned short cntr =GVP11_DMAC_INT_ENABLE ; -unsigned long addr =virt_to_bus (cmd->SCp.ptr); +unsigned long addr =virt_to_bus (scsi_pointer->ptr);int bank_mask;static int scsi_alloc_out_of_range =0 ;/* use bounce buffer if the physical address is bad */ if (addr & wh->dma_xfer_mask) { - wh->dma_bounce_len = (cmd->SCp.this_residual +511 ) & ~0x1ff ; + wh->dma_bounce_len = (scsi_pointer->this_residual +511 ) & ~0x1ff ;if (!scsi_alloc_out_of_range) { wh->dma_bounce_buffer =@@ -113,8 +114,8 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)if (!dir_in) {/* copy to bounce buffer for a write */ -memcpy (wh->dma_bounce_buffer, cmd->SCp.ptr, - cmd->SCp.this_residual); +memcpy (wh->dma_bounce_buffer, scsi_pointer->ptr, + scsi_pointer->this_residual); } }@@ -130,10 +131,10 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)if (dir_in) {/* invalidate any cache */ -cache_clear (addr, cmd->SCp.this_residual); +cache_clear (addr, scsi_pointer->this_residual); }else {/* push any dirty cache */ -cache_push (addr, cmd->SCp.this_residual); +cache_push (addr, scsi_pointer->this_residual); } bank_mask = (~wh->dma_xfer_mask >>18 ) &0x01c0 ;@@ -150,6 +151,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)static void dma_stop (struct Scsi_Host *instance,struct scsi_cmnd *SCpnt,int status) { +struct scsi_pointer *scsi_pointer =WD33C93_scsi_pointer (SCpnt);struct gvp11_hostdata *hdata =shost_priv (instance);struct WD33C93_hostdata *wh = &hdata->wh;struct gvp11_scsiregs *regs = hdata->regs;@@ -162,8 +164,8 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,/* copy from a bounce buffer, if necessary */ if (status && wh->dma_bounce_buffer) {if (wh->dma_dir && SCpnt) -memcpy (SCpnt->SCp.ptr, wh->dma_bounce_buffer, - SCpnt->SCp.this_residual); +memcpy (scsi_pointer->ptr, wh->dma_bounce_buffer, + scsi_pointer->this_residual);if (wh->dma_buffer_pool ==BUF_SCSI_ALLOCED )kfree (wh->dma_bounce_buffer);@@ -189,6 +191,7 @@ static struct scsi_host_template gvp11_scsi_template = { .sg_tablesize = SG_ALL, .cmd_per_lun = CMD_PER_LUN, .dma_boundary = PAGE_SIZE - 1, + .cmd_size = sizeof(struct WD33C93_cmd), };static int check_wd33c93 (struct gvp11_scsiregs *regs)drivers/scsi/mvme147.c +6
-4@@ -33,10 +33,11 @@ static irqreturn_t mvme147_intr(int irq, void *data)static int dma_setup (struct scsi_cmnd *cmd,int dir_in) { +struct scsi_pointer *scsi_pointer =WD33C93_scsi_pointer (cmd);struct Scsi_Host *instance = cmd->device->host;struct WD33C93_hostdata *hdata =shost_priv (instance);unsigned char flags =0x01 ; -unsigned long addr =virt_to_bus (cmd->SCp.ptr); +unsigned long addr =virt_to_bus (scsi_pointer->ptr);/* setup dma direction */ if (!dir_in)@@ -47,14 +48,14 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)if (dir_in) {/* invalidate any cache */ -cache_clear (addr, cmd->SCp.this_residual); +cache_clear (addr, scsi_pointer->this_residual); }else {/* push any dirty cache */ -cache_push (addr, cmd->SCp.this_residual); +cache_push (addr, scsi_pointer->this_residual); }/* start DMA */ - m147_pcc->dma_bcr = cmd->SCp.this_residual | (1 <<24 ); + m147_pcc->dma_bcr = scsi_pointer->this_residual | (1 <<24 ); m147_pcc->dma_dadr = addr; m147_pcc->dma_cntrl = flags;@@ -81,6 +82,7 @@ static struct scsi_host_template mvme147_host_template = { .this_id = 7, .sg_tablesize = SG_ALL, .cmd_per_lun = CMD_PER_LUN, + .cmd_size = sizeof(struct WD33C93_cmd), };static struct Scsi_Host *mvme147_shost;drivers/scsi/sgiwd93.c +11
-7@@ -69,14 +69,15 @@ static irqreturn_t sgiwd93_intr(int irq, void *dev_id)static inline void fill_hpc_entries (struct ip22_hostdata *hd,struct scsi_cmnd *cmd,int din) { -unsigned long len = cmd->SCp.this_residual; -void *addr = cmd->SCp.ptr; +struct scsi_pointer *scsi_pointer =WD33C93_scsi_pointer (cmd); +unsigned long len = scsi_pointer->this_residual; +void *addr = scsi_pointer->ptr;dma_addr_t physaddr;unsigned long count;struct hpc_chunk *hcp; physaddr =dma_map_single (hd->dev, addr, len,DMA_DIR (din)); - cmd->SCp.dma_handle = physaddr; + scsi_pointer->dma_handle = physaddr; hcp = hd->cpu;while (len) {@@ -106,6 +107,7 @@ void fill_hpc_entries(struct ip22_hostdata *hd, struct scsi_cmnd *cmd, int din)static int dma_setup (struct scsi_cmnd *cmd,int datainp) { +struct scsi_pointer *scsi_pointer =WD33C93_scsi_pointer (cmd);struct ip22_hostdata *hdata =host_to_hostdata (cmd->device->host);struct hpc3_scsiregs *hregs = (struct hpc3_scsiregs *) cmd->device->host->base;@@ -120,7 +122,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int datainp)* obvious). IMHO a better fix would be, not to do these dma setups * in the first place. */ -if (cmd->SCp.ptr ==NULL || cmd->SCp.this_residual ==0 ) +if (scsi_pointer->ptr ==NULL || scsi_pointer->this_residual ==0 )return 1 ;fill_hpc_entries (hdata, cmd, datainp);@@ -140,13 +142,14 @@ static int dma_setup(struct scsi_cmnd *cmd, int datainp)static void dma_stop (struct Scsi_Host *instance,struct scsi_cmnd *SCpnt,int status) { +struct scsi_pointer *scsi_pointer =WD33C93_scsi_pointer (SCpnt);struct ip22_hostdata *hdata =host_to_hostdata (instance);struct hpc3_scsiregs *hregs;if (!SCpnt)return ; -if (SCpnt->SCp.ptr ==NULL || SCpnt->SCp.this_residual ==0 ) +if (scsi_pointer->ptr ==NULL || scsi_pointer->this_residual ==0 )return ; hregs = (struct hpc3_scsiregs *) SCpnt->device->host->base;@@ -160,8 +163,8 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,barrier (); } hregs->ctrl =0 ; -dma_unmap_single (hdata->dev, SCpnt->SCp.dma_handle, - SCpnt->SCp.this_residual, +dma_unmap_single (hdata->dev, scsi_pointer->dma_handle, + scsi_pointer->this_residual,DMA_DIR (hdata->wh.dma_dir));pr_debug ("\n" );@@ -213,6 +216,7 @@ static struct scsi_host_template sgiwd93_template = { .sg_tablesize = SG_ALL, .cmd_per_lun = 8, .dma_boundary = PAGE_SIZE - 1, + .cmd_size = sizeof(struct WD33C93_cmd), };static int sgiwd93_probe (struct platform_device *pdev)drivers/scsi/wd33c93.c +63
-56@@ -364,6 +364,7 @@ calc_sync_msg(unsigned int period, unsigned int offset, unsigned int fast,static int wd33c93_queuecommand_lck (struct scsi_cmnd *cmd) { +struct scsi_pointer *scsi_pointer =WD33C93_scsi_pointer (cmd);struct WD33C93_hostdata *hostdata;struct scsi_cmnd *tmp;@@ -395,15 +396,15 @@ static int wd33c93_queuecommand_lck(struct scsi_cmnd *cmd)*/ if (scsi_bufflen (cmd)) { - cmd->SCp.buffer =scsi_sglist (cmd); - cmd->SCp.buffers_residual =scsi_sg_count (cmd) -1 ; - cmd->SCp.ptr =sg_virt (cmd->SCp.buffer); - cmd->SCp.this_residual = cmd->SCp.buffer->length; + scsi_pointer->buffer =scsi_sglist (cmd); + scsi_pointer->buffers_residual =scsi_sg_count (cmd) -1 ; + scsi_pointer->ptr =sg_virt (scsi_pointer->buffer); + scsi_pointer->this_residual = scsi_pointer->buffer->length; }else { - cmd->SCp.buffer =NULL ; - cmd->SCp.buffers_residual =0 ; - cmd->SCp.ptr =NULL ; - cmd->SCp.this_residual =0 ; + scsi_pointer->buffer =NULL ; + scsi_pointer->buffers_residual =0 ; + scsi_pointer->ptr =NULL ; + scsi_pointer->this_residual =0 ; }/* WD docs state that at the conclusion of a "LEVEL2" command, the @@ -423,7 +424,7 @@ static int wd33c93_queuecommand_lck(struct scsi_cmnd *cmd)* status byte is stored. */ - cmd->SCp.Status =ILLEGAL_STATUS_BYTE ; + scsi_pointer->Status =ILLEGAL_STATUS_BYTE ;/* * Add the cmd to the end of 'input_Q'. Note that REQUEST SENSE @@ -470,6 +471,7 @@ DEF_SCSI_QCMD(wd33c93_queuecommand)static void wd33c93_execute (struct Scsi_Host *instance) { +struct scsi_pointer *scsi_pointer;struct WD33C93_hostdata *hostdata = (struct WD33C93_hostdata *) instance->hostdata;const wd33c93_regs regs = hostdata->regs;@@ -546,7 +548,8 @@ wd33c93_execute(struct Scsi_Host *instance)* to change around and experiment with for now. */ - cmd->SCp.phase =0 ;/* assume no disconnect */ + scsi_pointer =WD33C93_scsi_pointer (cmd); + scsi_pointer->phase =0 ;/* assume no disconnect */ if (hostdata->disconnect ==DIS_NEVER ) goto no;if (hostdata->disconnect ==DIS_ALWAYS )@@ -563,7 +566,7 @@ wd33c93_execute(struct Scsi_Host *instance) (prev->device->lun != cmd->device->lun)) {for (prev = (struct scsi_cmnd *) hostdata->input_Q; prev; prev = (struct scsi_cmnd *) prev->host_scribble) - prev->SCp.phase =1 ; +WD33C93_scsi_pointer (prev)->phase =1 ; goto yes; } }@@ -571,7 +574,7 @@ wd33c93_execute(struct Scsi_Host *instance) goto no; yes: - cmd->SCp.phase =1 ; + scsi_pointer->phase =1 ;#ifdef PROC_STATISTICS hostdata->disc_allowed_cnt[cmd->device->id]++;@@ -579,7 +582,7 @@ wd33c93_execute(struct Scsi_Host *instance) no: -write_wd33c93 (regs,WD_SOURCE_ID , ((cmd->SCp.phase) ?SRCID_ER :0 )); +write_wd33c93 (regs,WD_SOURCE_ID , scsi_pointer->phase ?SRCID_ER :0 );write_wd33c93 (regs,WD_TARGET_LUN , (u8 )cmd->device->lun); write_wd33c93(regs, WD_SYNCHRONOUS_TRANSFER,@@ -648,14 +651,14 @@ wd33c93_execute(struct Scsi_Host *instance)* up ahead of time. */ -if ((cmd->SCp.phase ==0 ) && (hostdata->no_dma ==0 )) { +if (scsi_pointer->phase ==0 && hostdata->no_dma ==0 ) {if (hostdata->dma_setup (cmd, (cmd->sc_data_direction ==DMA_TO_DEVICE ) ?DATA_OUT_DIR :DATA_IN_DIR ))write_wd33c93_count (regs,0 );/* guarantee a DATA_PHASE interrupt */ else {write_wd33c93_count (regs, - cmd->SCp.this_residual); + scsi_pointer->this_residual);write_wd33c93 (regs,WD_CONTROL ,CTRL_IDI |CTRL_EDI | hostdata->dma_mode); hostdata->dma =D_DMA_RUNNING ;@@ -675,7 +678,7 @@ wd33c93_execute(struct Scsi_Host *instance)*/ DB (DB_EXECUTE , - printk("%s)EX-2 ", (cmd->SCp.phase) ? "d:" : "")) + printk("%s)EX-2 ", scsi_pointer->phase ? "d:" : "")) } static void@@ -717,6 +720,7 @@ static void transfer_bytes(const wd33c93_regs regs, struct scsi_cmnd *cmd, int data_in_dir) { + struct scsi_pointer *scsi_pointer = WD33C93_scsi_pointer(cmd);struct WD33C93_hostdata *hostdata;unsigned long length;@@ -730,13 +734,13 @@ transfer_bytes(const wd33c93_regs regs, struct scsi_cmnd *cmd,* now we need to setup the next scatter-gather buffer as the * source or destination for THIS transfer. */ -if (!cmd->SCp.this_residual && cmd->SCp.buffers_residual) { - cmd->SCp.buffer =sg_next (cmd->SCp.buffer); - --cmd->SCp.buffers_residual; - cmd->SCp.this_residual = cmd->SCp.buffer->length; - cmd->SCp.ptr =sg_virt (cmd->SCp.buffer); +if (!scsi_pointer->this_residual && scsi_pointer->buffers_residual) { + scsi_pointer->buffer =sg_next (scsi_pointer->buffer); + --scsi_pointer->buffers_residual; + scsi_pointer->this_residual = scsi_pointer->buffer->length; + scsi_pointer->ptr =sg_virt (scsi_pointer->buffer); } -if (!cmd->SCp.this_residual)/* avoid bogus setups */ +if (!scsi_pointer->this_residual)/* avoid bogus setups */ return ; write_wd33c93(regs, WD_SYNCHRONOUS_TRANSFER,@@ -750,11 +754,12 @@ transfer_bytes(const wd33c93_regs regs, struct scsi_cmnd *cmd,#ifdef PROC_STATISTICS hostdata->pio_cnt++;#endif -transfer_pio (regs, (uchar *) cmd->SCp.ptr, - cmd->SCp.this_residual, data_in_dir, hostdata); - length = cmd->SCp.this_residual; - cmd->SCp.this_residual =read_wd33c93_count (regs); - cmd->SCp.ptr += (length - cmd->SCp.this_residual); +transfer_pio (regs, (uchar *) scsi_pointer->ptr, + scsi_pointer->this_residual, data_in_dir, + hostdata); + length = scsi_pointer->this_residual; + scsi_pointer->this_residual =read_wd33c93_count (regs); + scsi_pointer->ptr += length - scsi_pointer->this_residual; }/* We are able to do DMA (in fact, the Amiga hardware is @@ -771,10 +776,10 @@ transfer_bytes(const wd33c93_regs regs, struct scsi_cmnd *cmd, hostdata->dma_cnt++;#endif write_wd33c93 (regs,WD_CONTROL ,CTRL_IDI |CTRL_EDI | hostdata->dma_mode); -write_wd33c93_count (regs, cmd->SCp.this_residual); +write_wd33c93_count (regs, scsi_pointer->this_residual);if ((hostdata->level2 >=L2_DATA ) || - (hostdata->level2 ==L2_BASIC && cmd->SCp.phase ==0 )) { + (hostdata->level2 ==L2_BASIC && scsi_pointer->phase ==0 )) {write_wd33c93 (regs,WD_COMMAND_PHASE ,0x45 );write_wd33c93_cmd (regs,WD_CMD_SEL_ATN_XFER ); hostdata->state =S_RUNNING_LEVEL2 ;@@ -788,6 +793,7 @@ transfer_bytes(const wd33c93_regs regs, struct scsi_cmnd *cmd,void wd33c93_intr (struct Scsi_Host *instance) { +struct scsi_pointer *scsi_pointer;struct WD33C93_hostdata *hostdata = (struct WD33C93_hostdata *) instance->hostdata;const wd33c93_regs regs = hostdata->regs;@@ -806,6 +812,7 @@ wd33c93_intr(struct Scsi_Host *instance)#endif cmd = (struct scsi_cmnd *) hostdata->connected;/* assume we're connected */ + scsi_pointer =WD33C93_scsi_pointer (cmd); sr =read_wd33c93 (regs,WD_SCSI_STATUS );/* clear the interrupt */ phs =read_wd33c93 (regs,WD_COMMAND_PHASE );@@ -827,14 +834,14 @@ wd33c93_intr(struct Scsi_Host *instance)*/ if (hostdata->dma ==D_DMA_RUNNING ) {DB (DB_TRANSFER , -printk ("[%p/%d:" , cmd->SCp.ptr, cmd->SCp.this_residual)) +printk ("[%p/%d:" , scsi_pointer->ptr, scsi_pointer->this_residual)) hostdata->dma_stop(cmd->device->host, cmd, 1); hostdata->dma =D_DMA_OFF ; - length = cmd->SCp.this_residual; - cmd->SCp.this_residual =read_wd33c93_count (regs); - cmd->SCp.ptr += (length - cmd->SCp.this_residual); + length = scsi_pointer->this_residual; + scsi_pointer->this_residual =read_wd33c93_count (regs); + scsi_pointer->ptr += length - scsi_pointer->this_residual;DB (DB_TRANSFER , - printk("%p/%d]", cmd->SCp.ptr, cmd->SCp.this_residual)) + printk("%p/%d]", scsi_pointer->ptr, scsi_pointer->this_residual)) }/* Respond to the specific WD3393 interrupt - there are quite a few! */ @@ -884,7 +891,7 @@ wd33c93_intr(struct Scsi_Host *instance)/* construct an IDENTIFY message with correct disconnect bit */ hostdata->outgoing_msg[0 ] =IDENTIFY (0 , cmd->device->lun); -if (cmd->SCp.phase) +if (scsi_pointer->phase) hostdata->outgoing_msg[0 ] |=0x40 ;if (hostdata->sync_stat[cmd->device->id] ==SS_FIRST ) {@@ -926,8 +933,8 @@ wd33c93_intr(struct Scsi_Host *instance)case CSR_UNEXP |PHS_DATA_IN :case CSR_SRV_REQ |PHS_DATA_IN :DB (DB_INTR , -printk ("IN-%d.%d" , cmd->SCp.this_residual, - cmd->SCp.buffers_residual)) +printk ("IN-%d.%d" , scsi_pointer->this_residual, + scsi_pointer->buffers_residual))transfer_bytes (regs, cmd,DATA_IN_DIR );if (hostdata->state !=S_RUNNING_LEVEL2 ) hostdata->state =S_CONNECTED ;@@ -938,8 +945,8 @@ wd33c93_intr(struct Scsi_Host *instance)case CSR_UNEXP |PHS_DATA_OUT :case CSR_SRV_REQ |PHS_DATA_OUT :DB (DB_INTR , -printk ("OUT-%d.%d" , cmd->SCp.this_residual, - cmd->SCp.buffers_residual)) +printk ("OUT-%d.%d" , scsi_pointer->this_residual, + scsi_pointer->buffers_residual))transfer_bytes (regs, cmd,DATA_OUT_DIR );if (hostdata->state !=S_RUNNING_LEVEL2 ) hostdata->state =S_CONNECTED ;@@ -962,8 +969,8 @@ wd33c93_intr(struct Scsi_Host *instance)case CSR_UNEXP |PHS_STATUS :case CSR_SRV_REQ |PHS_STATUS : DB(DB_INTR, printk("STATUS=")) - cmd->SCp.Status = read_1_byte(regs); - DB(DB_INTR, printk("%02x", cmd->SCp.Status)) + scsi_pointer->Status =read_1_byte (regs); + DB(DB_INTR, printk("%02x", scsi_pointer->Status))if (hostdata->level2 >=L2_BASIC ) { sr =read_wd33c93 (regs,WD_SCSI_STATUS );/* clear interrupt */ udelay (7 );@@ -991,7 +998,7 @@ wd33c93_intr(struct Scsi_Host *instance)else hostdata->incoming_ptr =0 ; - cmd->SCp.Message = msg; + scsi_pointer->Message = msg;switch (msg) {case COMMAND_COMPLETE :@@ -1163,21 +1170,21 @@ wd33c93_intr(struct Scsi_Host *instance)write_wd33c93 (regs,WD_SOURCE_ID ,SRCID_ER );if (phs ==0x60 ) { DB(DB_INTR, printk("SX-DONE")) - cmd->SCp.Message = COMMAND_COMPLETE; + scsi_pointer->Message =COMMAND_COMPLETE ; lun =read_wd33c93 (regs,WD_TARGET_LUN ); -DB (DB_INTR ,printk (":%d.%d" , cmd->SCp.Status, lun)) +DB (DB_INTR ,printk (":%d.%d" , scsi_pointer->Status, lun)) hostdata->connected = NULL; hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun &0xff )); hostdata->state =S_UNCONNECTED ; -if (cmd->SCp.Status ==ILLEGAL_STATUS_BYTE ) - cmd->SCp.Status = lun; +if (scsi_pointer->Status ==ILLEGAL_STATUS_BYTE ) + scsi_pointer->Status = lun;if (cmd->cmnd[0 ] ==REQUEST_SENSE - && cmd->SCp.Status !=SAM_STAT_GOOD ) { + && scsi_pointer->Status !=SAM_STAT_GOOD ) {set_host_byte (cmd,DID_ERROR ); }else {set_host_byte (cmd,DID_OK ); -scsi_msg_to_host_byte (cmd, cmd->SCp.Message); -set_status_byte (cmd, cmd->SCp.Status); +scsi_msg_to_host_byte (cmd, scsi_pointer->Message); +set_status_byte (cmd, scsi_pointer->Status); }scsi_done (cmd);@@ -1259,12 +1266,12 @@ wd33c93_intr(struct Scsi_Host *instance) hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun &0xff )); hostdata->state =S_UNCONNECTED ;if (cmd->cmnd[0 ] ==REQUEST_SENSE && - cmd->SCp.Status !=SAM_STAT_GOOD ) { + scsi_pointer->Status !=SAM_STAT_GOOD ) {set_host_byte (cmd,DID_ERROR ); }else {set_host_byte (cmd,DID_OK ); -scsi_msg_to_host_byte (cmd, cmd->SCp.Message); -set_status_byte (cmd, cmd->SCp.Status); +scsi_msg_to_host_byte (cmd, scsi_pointer->Message); +set_status_byte (cmd, scsi_pointer->Status); }scsi_done (cmd);@@ -1293,14 +1300,14 @@ wd33c93_intr(struct Scsi_Host *instance) hostdata->connected =NULL ; hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun &0xff )); hostdata->state =S_UNCONNECTED ; - DB(DB_INTR, printk(":%d", cmd->SCp.Status)) + DB(DB_INTR, printk(":%d", scsi_pointer->Status))if (cmd->cmnd[0 ] ==REQUEST_SENSE - && cmd->SCp.Status !=SAM_STAT_GOOD ) { + && scsi_pointer->Status !=SAM_STAT_GOOD ) {set_host_byte (cmd,DID_ERROR ); }else {set_host_byte (cmd,DID_OK ); -scsi_msg_to_host_byte (cmd, cmd->SCp.Message); -set_status_byte (cmd, cmd->SCp.Status); +scsi_msg_to_host_byte (cmd, scsi_pointer->Message); +set_status_byte (cmd, scsi_pointer->Status); }scsi_done (cmd);break ;drivers/scsi/wd33c93.h +3
-0@@ -262,6 +262,16 @@ struct WD33C93_hostdata {#endif }; +struct WD33C93_cmd { +struct scsi_pointer scsi_pointer; +};
drivers/scsi/wd33c93.h struct WD33C93_hostdata { · line 277
Quoted 10 lines
drivers/scsi/wd33c93.h +7
-0+ +static inline struct scsi_pointer *WD33C93_scsi_pointer (struct scsi_cmnd *cmd) +{ +struct WD33C93_cmd *wcmd =scsi_cmd_priv (cmd); + +return &wcmd->scsi_pointer; +}/* defines for hostdata->chip */
Please use 'struct scsi_pointer' directly.
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 42/44] wdc33c93: Move the SCSI pointer to private command data
In reply to Bart Van AsscheQuoted 705 lines · Bart Van Assche
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 structscsi_cmnd.Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/a2091.c | 19 ++++--- drivers/scsi/a3000.c | 19 ++++--- drivers/scsi/gvp11.c | 19 ++++--- drivers/scsi/mvme147.c | 10 ++-- drivers/scsi/sgiwd93.c | 18 ++++--- drivers/scsi/wd33c93.c | 119 ++++++++++++++++++++++------------------- drivers/scsi/wd33c93.h | 10 ++++ 7 files changed, 123 insertions(+), 91 deletions(-)drivers/scsi/a2091.c +11
-8@@ -44,16 +44,17 @@ static irqreturn_t a2091_intr(int irq, void *data)static int dma_setup (struct scsi_cmnd *cmd,int dir_in) { +struct scsi_pointer *scsi_pointer =WD33C93_scsi_pointer (cmd);struct Scsi_Host *instance = cmd->device->host;struct a2091_hostdata *hdata =shost_priv (instance);struct WD33C93_hostdata *wh = &hdata->wh;struct a2091_scsiregs *regs = hdata->regs;unsigned short cntr =CNTR_PDMD |CNTR_INTEN ; -unsigned long addr =virt_to_bus (cmd->SCp.ptr); +unsigned long addr =virt_to_bus (scsi_pointer->ptr);/* don't allow DMA if the physical address is bad */ if (addr &A2091_XFER_MASK ) { - wh->dma_bounce_len = (cmd->SCp.this_residual +511 ) & ~0x1ff ; + wh->dma_bounce_len = (scsi_pointer->this_residual +511 ) & ~0x1ff ; wh->dma_bounce_buffer =kmalloc (wh->dma_bounce_len,GFP_KERNEL );@@ -77,8 +78,8 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)if (!dir_in) {/* copy to bounce buffer for a write */ -memcpy (wh->dma_bounce_buffer, cmd->SCp.ptr, - cmd->SCp.this_residual); +memcpy (wh->dma_bounce_buffer, scsi_pointer->ptr, + scsi_pointer->this_residual); } }@@ -96,10 +97,10 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)if (dir_in) {/* invalidate any cache */ -cache_clear (addr, cmd->SCp.this_residual); +cache_clear (addr, scsi_pointer->this_residual); }else {/* push any dirty cache */ -cache_push (addr, cmd->SCp.this_residual); +cache_push (addr, scsi_pointer->this_residual); }/* start DMA */ regs->ST_DMA =1 ;@@ -111,6 +112,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)static void dma_stop (struct Scsi_Host *instance,struct scsi_cmnd *SCpnt,int status) { +struct scsi_pointer *scsi_pointer =WD33C93_scsi_pointer (SCpnt);struct a2091_hostdata *hdata =shost_priv (instance);struct WD33C93_hostdata *wh = &hdata->wh;struct a2091_scsiregs *regs = hdata->regs;@@ -143,8 +145,8 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,/* copy from a bounce buffer, if necessary */ if (status && wh->dma_bounce_buffer) {if (wh->dma_dir) -memcpy (SCpnt->SCp.ptr, wh->dma_bounce_buffer, - SCpnt->SCp.this_residual); +memcpy (scsi_pointer->ptr, wh->dma_bounce_buffer, + scsi_pointer->this_residual);kfree (wh->dma_bounce_buffer); wh->dma_bounce_buffer =NULL ; wh->dma_bounce_len =0 ;@@ -165,6 +167,7 @@ static struct scsi_host_template a2091_scsi_template = { .sg_tablesize = SG_ALL, .cmd_per_lun = CMD_PER_LUN, .dma_boundary = PAGE_SIZE - 1, + .cmd_size = sizeof(struct WD33C93_cmd), };static int a2091_probe (struct zorro_dev *z,const struct zorro_device_id *ent)drivers/scsi/a3000.c +11
-8@@ -48,12 +48,13 @@ static irqreturn_t a3000_intr(int irq, void *data)static int dma_setup (struct scsi_cmnd *cmd,int dir_in) { +struct scsi_pointer *scsi_pointer =WD33C93_scsi_pointer (cmd);struct Scsi_Host *instance = cmd->device->host;struct a3000_hostdata *hdata =shost_priv (instance);struct WD33C93_hostdata *wh = &hdata->wh;struct a3000_scsiregs *regs = hdata->regs;unsigned short cntr =CNTR_PDMD |CNTR_INTEN ; -unsigned long addr =virt_to_bus (cmd->SCp.ptr); +unsigned long addr =virt_to_bus (scsi_pointer->ptr);/* * if the physical address has the wrong alignment, or if @@ -62,7 +63,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)* buffer */ if (addr &A3000_XFER_MASK ) { - wh->dma_bounce_len = (cmd->SCp.this_residual +511 ) & ~0x1ff ; + wh->dma_bounce_len = (scsi_pointer->this_residual +511 ) & ~0x1ff ; wh->dma_bounce_buffer =kmalloc (wh->dma_bounce_len,GFP_KERNEL );@@ -74,8 +75,8 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)if (!dir_in) {/* copy to bounce buffer for a write */ -memcpy (wh->dma_bounce_buffer, cmd->SCp.ptr, - cmd->SCp.this_residual); +memcpy (wh->dma_bounce_buffer, scsi_pointer->ptr, + scsi_pointer->this_residual); } addr =virt_to_bus (wh->dma_bounce_buffer);@@ -95,10 +96,10 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)if (dir_in) {/* invalidate any cache */ -cache_clear (addr, cmd->SCp.this_residual); +cache_clear (addr, scsi_pointer->this_residual); }else {/* push any dirty cache */ -cache_push (addr, cmd->SCp.this_residual); +cache_push (addr, scsi_pointer->this_residual); }/* start DMA */ @@ -113,6 +114,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)static void dma_stop (struct Scsi_Host *instance,struct scsi_cmnd *SCpnt,int status) { +struct scsi_pointer *scsi_pointer =WD33C93_scsi_pointer (SCpnt);struct a3000_hostdata *hdata =shost_priv (instance);struct WD33C93_hostdata *wh = &hdata->wh;struct a3000_scsiregs *regs = hdata->regs;@@ -153,8 +155,8 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,if (status && wh->dma_bounce_buffer) {if (SCpnt) {if (wh->dma_dir && SCpnt) -memcpy (SCpnt->SCp.ptr, wh->dma_bounce_buffer, - SCpnt->SCp.this_residual); +memcpy (scsi_pointer->ptr, wh->dma_bounce_buffer, + scsi_pointer->this_residual);kfree (wh->dma_bounce_buffer); wh->dma_bounce_buffer =NULL ; wh->dma_bounce_len =0 ;@@ -179,6 +181,7 @@ static struct scsi_host_template amiga_a3000_scsi_template = { .this_id = 7, .sg_tablesize = SG_ALL, .cmd_per_lun = CMD_PER_LUN, + .cmd_size = sizeof(struct WD33C93_cmd), };static int __init amiga_a3000_scsi_probe (struct platform_device *pdev)drivers/scsi/gvp11.c +11
-8@@ -53,18 +53,19 @@ void gvp11_setup(char *str, int *ints)static int dma_setup (struct scsi_cmnd *cmd,int dir_in) { +struct scsi_pointer *scsi_pointer =WD33C93_scsi_pointer (cmd);struct Scsi_Host *instance = cmd->device->host;struct gvp11_hostdata *hdata =shost_priv (instance);struct WD33C93_hostdata *wh = &hdata->wh;struct gvp11_scsiregs *regs = hdata->regs;unsigned short cntr =GVP11_DMAC_INT_ENABLE ; -unsigned long addr =virt_to_bus (cmd->SCp.ptr); +unsigned long addr =virt_to_bus (scsi_pointer->ptr);int bank_mask;static int scsi_alloc_out_of_range =0 ;/* use bounce buffer if the physical address is bad */ if (addr & wh->dma_xfer_mask) { - wh->dma_bounce_len = (cmd->SCp.this_residual +511 ) & ~0x1ff ; + wh->dma_bounce_len = (scsi_pointer->this_residual +511 ) & ~0x1ff ;if (!scsi_alloc_out_of_range) { wh->dma_bounce_buffer =@@ -113,8 +114,8 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)if (!dir_in) {/* copy to bounce buffer for a write */ -memcpy (wh->dma_bounce_buffer, cmd->SCp.ptr, - cmd->SCp.this_residual); +memcpy (wh->dma_bounce_buffer, scsi_pointer->ptr, + scsi_pointer->this_residual); } }@@ -130,10 +131,10 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)if (dir_in) {/* invalidate any cache */ -cache_clear (addr, cmd->SCp.this_residual); +cache_clear (addr, scsi_pointer->this_residual); }else {/* push any dirty cache */ -cache_push (addr, cmd->SCp.this_residual); +cache_push (addr, scsi_pointer->this_residual); } bank_mask = (~wh->dma_xfer_mask >>18 ) &0x01c0 ;@@ -150,6 +151,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)static void dma_stop (struct Scsi_Host *instance,struct scsi_cmnd *SCpnt,int status) { +struct scsi_pointer *scsi_pointer =WD33C93_scsi_pointer (SCpnt);struct gvp11_hostdata *hdata =shost_priv (instance);struct WD33C93_hostdata *wh = &hdata->wh;struct gvp11_scsiregs *regs = hdata->regs;@@ -162,8 +164,8 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,/* copy from a bounce buffer, if necessary */ if (status && wh->dma_bounce_buffer) {if (wh->dma_dir && SCpnt) -memcpy (SCpnt->SCp.ptr, wh->dma_bounce_buffer, - SCpnt->SCp.this_residual); +memcpy (scsi_pointer->ptr, wh->dma_bounce_buffer, + scsi_pointer->this_residual);if (wh->dma_buffer_pool ==BUF_SCSI_ALLOCED )kfree (wh->dma_bounce_buffer);@@ -189,6 +191,7 @@ static struct scsi_host_template gvp11_scsi_template = { .sg_tablesize = SG_ALL, .cmd_per_lun = CMD_PER_LUN, .dma_boundary = PAGE_SIZE - 1, + .cmd_size = sizeof(struct WD33C93_cmd), };static int check_wd33c93 (struct gvp11_scsiregs *regs)drivers/scsi/mvme147.c +6
-4@@ -33,10 +33,11 @@ static irqreturn_t mvme147_intr(int irq, void *data)static int dma_setup (struct scsi_cmnd *cmd,int dir_in) { +struct scsi_pointer *scsi_pointer =WD33C93_scsi_pointer (cmd);struct Scsi_Host *instance = cmd->device->host;struct WD33C93_hostdata *hdata =shost_priv (instance);unsigned char flags =0x01 ; -unsigned long addr =virt_to_bus (cmd->SCp.ptr); +unsigned long addr =virt_to_bus (scsi_pointer->ptr);/* setup dma direction */ if (!dir_in)@@ -47,14 +48,14 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)if (dir_in) {/* invalidate any cache */ -cache_clear (addr, cmd->SCp.this_residual); +cache_clear (addr, scsi_pointer->this_residual); }else {/* push any dirty cache */ -cache_push (addr, cmd->SCp.this_residual); +cache_push (addr, scsi_pointer->this_residual); }/* start DMA */ - m147_pcc->dma_bcr = cmd->SCp.this_residual | (1 <<24 ); + m147_pcc->dma_bcr = scsi_pointer->this_residual | (1 <<24 ); m147_pcc->dma_dadr = addr; m147_pcc->dma_cntrl = flags;@@ -81,6 +82,7 @@ static struct scsi_host_template mvme147_host_template = { .this_id = 7, .sg_tablesize = SG_ALL, .cmd_per_lun = CMD_PER_LUN, + .cmd_size = sizeof(struct WD33C93_cmd), };static struct Scsi_Host *mvme147_shost;drivers/scsi/sgiwd93.c +0
-0@@ -69,14 +69,15 @@ static irqreturn_t sgiwd93_intr(int irq, void *dev_id)static inline
voidfill_hpc_entries(struct ip22_hostdata *hd, struct scsi_cmnd *cmd, int din){drivers/scsi/sgiwd93.c +3
-2-unsigned long len = cmd->SCp.this_residual; -void *addr = cmd->SCp.ptr; +struct scsi_pointer *scsi_pointer =WD33C93_scsi_pointer (cmd); +unsigned long len = scsi_pointer->this_residual; +void *addr = scsi_pointer->ptr;dma_addr_t physaddr; unsigned long count; struct hpc_chunk *hcp; physaddr = dma_map_single(hd->dev, addr, len, DMA_DIR(din));drivers/scsi/sgiwd93.c +1
-1- cmd->SCp.dma_handle = physaddr; + scsi_pointer->dma_handle = physaddr;hcp = hd->cpu; while (len) {drivers/scsi/sgiwd93.c +7
-4@@ -106,6 +107,7 @@ void fill_hpc_entries(struct ip22_hostdata *hd, struct scsi_cmnd *cmd, int din)static int dma_setup (struct scsi_cmnd *cmd,int datainp) { +struct scsi_pointer *scsi_pointer =WD33C93_scsi_pointer (cmd);struct ip22_hostdata *hdata =host_to_hostdata (cmd->device->host);struct hpc3_scsiregs *hregs = (struct hpc3_scsiregs *) cmd->device->host->base;@@ -120,7 +122,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int datainp)* obvious). IMHO a better fix would be, not to do these dma setups * in the first place. */ -if (cmd->SCp.ptr ==NULL || cmd->SCp.this_residual ==0 ) +if (scsi_pointer->ptr ==NULL || scsi_pointer->this_residual ==0 )return 1 ;fill_hpc_entries (hdata, cmd, datainp);@@ -140,13 +142,14 @@ static int dma_setup(struct scsi_cmnd *cmd, int datainp)static void dma_stop (struct Scsi_Host *instance,struct scsi_cmnd *SCpnt,int status) { +struct scsi_pointer *scsi_pointer =WD33C93_scsi_pointer (SCpnt);struct ip22_hostdata *hdata =host_to_hostdata (instance);struct hpc3_scsiregs *hregs;if (!SCpnt)return ; -if (SCpnt->SCp.ptr ==NULL || SCpnt->SCp.this_residual ==0 ) +if (scsi_pointer->ptr ==NULL || scsi_pointer->this_residual ==0 )return ; hregs = (struct hpc3_scsiregs *) SCpnt->device->host->base;@@ -160,8 +163,8 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,barrier (); } hregs->ctrl =0 ; -dma_unmap_single (hdata->dev, SCpnt->SCp.dma_handle, - SCpnt->SCp.this_residual, +dma_unmap_single (hdata->dev, scsi_pointer->dma_handle, + scsi_pointer->this_residual,DMA_DIR (hdata->wh.dma_dir));pr_debug ("\n" );@@ -213,6 +216,7 @@ static struct scsi_host_template sgiwd93_template = { .sg_tablesize = SG_ALL, .cmd_per_lun = 8, .dma_boundary = PAGE_SIZE - 1, + .cmd_size = sizeof(struct WD33C93_cmd), };static int sgiwd93_probe (struct platform_device *pdev)drivers/scsi/wd33c93.c +10
-9@@ -364,6 +364,7 @@ calc_sync_msg(unsigned int period, unsigned int offset, unsigned int fast,static int wd33c93_queuecommand_lck (struct scsi_cmnd *cmd) { +struct scsi_pointer *scsi_pointer =WD33C93_scsi_pointer (cmd);struct WD33C93_hostdata *hostdata;struct scsi_cmnd *tmp;@@ -395,15 +396,15 @@ static int wd33c93_queuecommand_lck(struct scsi_cmnd *cmd)*/ if (scsi_bufflen (cmd)) { - cmd->SCp.buffer =scsi_sglist (cmd); - cmd->SCp.buffers_residual =scsi_sg_count (cmd) -1 ; - cmd->SCp.ptr =sg_virt (cmd->SCp.buffer); - cmd->SCp.this_residual = cmd->SCp.buffer->length; + scsi_pointer->buffer =scsi_sglist (cmd); + scsi_pointer->buffers_residual =scsi_sg_count (cmd) -1 ; + scsi_pointer->ptr =sg_virt (scsi_pointer->buffer); + scsi_pointer->this_residual = scsi_pointer->buffer->length; }else { - cmd->SCp.buffer =NULL ; - cmd->SCp.buffers_residual =0 ; - cmd->SCp.ptr =NULL ; - cmd->SCp.this_residual =0 ; + scsi_pointer->buffer =NULL ; + scsi_pointer->buffers_residual =0 ; + scsi_pointer->ptr =NULL ; + scsi_pointer->this_residual =0 ; }/* WD docs state that at the conclusion of a "LEVEL2" command, the @@ -423,7 +424,7 @@ static int wd33c93_queuecommand_lck(struct scsi_cmnd *cmd)* status byte is stored. */ - cmd->SCp.Status =ILLEGAL_STATUS_BYTE ; + scsi_pointer->Status =ILLEGAL_STATUS_BYTE ;/* * Add the cmd to the end of 'input_Q'. Note that REQUEST SENSE @@ -470,6 +471,7 @@ DEF_SCSI_QCMD(wd33c93_queuecommand)static void
wd33c93_execute(struct Scsi_Host *instance)
{drivers/scsi/wd33c93.c +1
-0+struct scsi_pointer *scsi_pointer;struct WD33C93_hostdata *hostdata = (struct WD33C93_hostdata *) instance->hostdata; const wd33c93_regs regs = hostdata->regs;drivers/scsi/wd33c93.c +8
-7@@ -546,7 +548,8 @@ wd33c93_execute(struct Scsi_Host *instance)* to change around and experiment with for now. */ - cmd->SCp.phase =0 ;/* assume no disconnect */ + scsi_pointer =WD33C93_scsi_pointer (cmd); + scsi_pointer->phase =0 ;/* assume no disconnect */ if (hostdata->disconnect ==DIS_NEVER ) goto no;if (hostdata->disconnect ==DIS_ALWAYS )@@ -563,7 +566,7 @@ wd33c93_execute(struct Scsi_Host *instance) (prev->device->lun != cmd->device->lun)) {for (prev = (struct scsi_cmnd *) hostdata->input_Q; prev; prev = (struct scsi_cmnd *) prev->host_scribble) - prev->SCp.phase =1 ; +WD33C93_scsi_pointer (prev)->phase =1 ; goto yes; } }@@ -571,7 +574,7 @@ wd33c93_execute(struct Scsi_Host *instance) goto no; yes: - cmd->SCp.phase =1 ; + scsi_pointer->phase =1 ;#ifdef PROC_STATISTICS hostdata->disc_allowed_cnt[cmd->device->id]++;@@ -579,7 +582,7 @@ wd33c93_execute(struct Scsi_Host *instance) no: -write_wd33c93 (regs,WD_SOURCE_ID , ((cmd->SCp.phase) ?SRCID_ER :0 )); +write_wd33c93 (regs,WD_SOURCE_ID , scsi_pointer->phase ?SRCID_ER :0 );write_wd33c93 (regs,WD_TARGET_LUN , (u8 )cmd->device->lun); write_wd33c93(regs, WD_SYNCHRONOUS_TRANSFER,@@ -648,14 +651,14 @@ wd33c93_execute(struct Scsi_Host *instance)* up ahead of time. */ -if ((cmd->SCp.phase ==0 ) && (hostdata->no_dma ==0 )) { +if (scsi_pointer->phase ==0 && hostdata->no_dma ==0 ) {if (hostdata->dma_setup (cmd, (cmd->sc_data_direction ==DMA_TO_DEVICE ) ?DATA_OUT_DIR :DATA_IN_DIR ))write_wd33c93_count (regs,0 );/* guarantee a DATA_PHASE interrupt */ else {write_wd33c93_count (regs, - cmd->SCp.this_residual); + scsi_pointer->this_residual);write_wd33c93 (regs,WD_CONTROL ,CTRL_IDI |CTRL_EDI | hostdata->dma_mode); hostdata->dma =D_DMA_RUNNING ;@@ -675,7 +678,7 @@ wd33c93_execute(struct Scsi_Host *instance)*/ DB (DB_EXECUTE , - printk("%s)EX-2 ", (cmd->SCp.phase) ? "d:" : "")) + printk("%s)EX-2 ", scsi_pointer->phase ? "d:" : "")) }static void
drivers/scsi/wd33c93.c +15
-13@@ -717,6 +720,7 @@ static void transfer_bytes(const wd33c93_regs regs, struct scsi_cmnd *cmd, int data_in_dir) { + struct scsi_pointer *scsi_pointer = WD33C93_scsi_pointer(cmd);struct WD33C93_hostdata *hostdata;unsigned long length;@@ -730,13 +734,13 @@ transfer_bytes(const wd33c93_regs regs, struct scsi_cmnd *cmd,* now we need to setup the next scatter-gather buffer as the * source or destination for THIS transfer. */ -if (!cmd->SCp.this_residual && cmd->SCp.buffers_residual) { - cmd->SCp.buffer =sg_next (cmd->SCp.buffer); - --cmd->SCp.buffers_residual; - cmd->SCp.this_residual = cmd->SCp.buffer->length; - cmd->SCp.ptr =sg_virt (cmd->SCp.buffer); +if (!scsi_pointer->this_residual && scsi_pointer->buffers_residual) { + scsi_pointer->buffer =sg_next (scsi_pointer->buffer); + --scsi_pointer->buffers_residual; + scsi_pointer->this_residual = scsi_pointer->buffer->length; + scsi_pointer->ptr =sg_virt (scsi_pointer->buffer); } -if (!cmd->SCp.this_residual)/* avoid bogus setups */ +if (!scsi_pointer->this_residual)/* avoid bogus setups */ return ; write_wd33c93(regs, WD_SYNCHRONOUS_TRANSFER,@@ -750,11 +754,12 @@ transfer_bytes(const wd33c93_regs regs, struct scsi_cmnd *cmd,#ifdef PROC_STATISTICS hostdata->pio_cnt++;#endif -transfer_pio (regs, (uchar *) cmd->SCp.ptr, - cmd->SCp.this_residual, data_in_dir, hostdata); - length = cmd->SCp.this_residual; - cmd->SCp.this_residual =read_wd33c93_count (regs); - cmd->SCp.ptr += (length - cmd->SCp.this_residual); +transfer_pio (regs, (uchar *) scsi_pointer->ptr, + scsi_pointer->this_residual, data_in_dir, + hostdata); + length = scsi_pointer->this_residual; + scsi_pointer->this_residual =read_wd33c93_count (regs); + scsi_pointer->ptr += length - scsi_pointer->this_residual; }/* We are able to do DMA (in fact, the Amiga hardware is @@ -771,10 +776,10 @@ transfer_bytes(const wd33c93_regs regs, struct scsi_cmnd *cmd, hostdata->dma_cnt++;#endif write_wd33c93 (regs,WD_CONTROL ,CTRL_IDI |CTRL_EDI | hostdata->dma_mode); -write_wd33c93_count (regs, cmd->SCp.this_residual); +write_wd33c93_count (regs, scsi_pointer->this_residual);if ((hostdata->level2 >=L2_DATA ) || - (hostdata->level2 ==L2_BASIC && cmd->SCp.phase ==0 )) { + (hostdata->level2 ==L2_BASIC && scsi_pointer->phase ==0 )) {write_wd33c93 (regs,WD_COMMAND_PHASE ,0x45 );write_wd33c93_cmd (regs,WD_CMD_SEL_ATN_XFER ); hostdata->state =S_RUNNING_LEVEL2 ;@@ -788,6 +793,7 @@ transfer_bytes(const wd33c93_regs regs, struct scsi_cmnd *cmd,void
wd33c93_intr(struct Scsi_Host *instance)
{drivers/scsi/wd33c93.c +1
-0+struct scsi_pointer *scsi_pointer;struct WD33C93_hostdata *hostdata = (struct WD33C93_hostdata *) instance->hostdata; const wd33c93_regs regs = hostdata->regs;drivers/scsi/wd33c93.c +28
-27@@ -806,6 +812,7 @@ wd33c93_intr(struct Scsi_Host *instance)#endif cmd = (struct scsi_cmnd *) hostdata->connected;/* assume we're connected */ + scsi_pointer =WD33C93_scsi_pointer (cmd); sr =read_wd33c93 (regs,WD_SCSI_STATUS );/* clear the interrupt */ phs =read_wd33c93 (regs,WD_COMMAND_PHASE );@@ -827,14 +834,14 @@ wd33c93_intr(struct Scsi_Host *instance)*/ if (hostdata->dma ==D_DMA_RUNNING ) {DB (DB_TRANSFER , -printk ("[%p/%d:" , cmd->SCp.ptr, cmd->SCp.this_residual)) +printk ("[%p/%d:" , scsi_pointer->ptr, scsi_pointer->this_residual)) hostdata->dma_stop(cmd->device->host, cmd, 1); hostdata->dma =D_DMA_OFF ; - length = cmd->SCp.this_residual; - cmd->SCp.this_residual =read_wd33c93_count (regs); - cmd->SCp.ptr += (length - cmd->SCp.this_residual); + length = scsi_pointer->this_residual; + scsi_pointer->this_residual =read_wd33c93_count (regs); + scsi_pointer->ptr += length - scsi_pointer->this_residual;DB (DB_TRANSFER , - printk("%p/%d]", cmd->SCp.ptr, cmd->SCp.this_residual)) + printk("%p/%d]", scsi_pointer->ptr, scsi_pointer->this_residual)) }/* Respond to the specific WD3393 interrupt - there are quite a few! */ @@ -884,7 +891,7 @@ wd33c93_intr(struct Scsi_Host *instance)/* construct an IDENTIFY message with correct disconnect bit */ hostdata->outgoing_msg[0 ] =IDENTIFY (0 , cmd->device->lun); -if (cmd->SCp.phase) +if (scsi_pointer->phase) hostdata->outgoing_msg[0 ] |=0x40 ;if (hostdata->sync_stat[cmd->device->id] ==SS_FIRST ) {@@ -926,8 +933,8 @@ wd33c93_intr(struct Scsi_Host *instance)case CSR_UNEXP |PHS_DATA_IN :case CSR_SRV_REQ |PHS_DATA_IN :DB (DB_INTR , -printk ("IN-%d.%d" , cmd->SCp.this_residual, - cmd->SCp.buffers_residual)) +printk ("IN-%d.%d" , scsi_pointer->this_residual, + scsi_pointer->buffers_residual))transfer_bytes (regs, cmd,DATA_IN_DIR );if (hostdata->state !=S_RUNNING_LEVEL2 ) hostdata->state =S_CONNECTED ;@@ -938,8 +945,8 @@ wd33c93_intr(struct Scsi_Host *instance)case CSR_UNEXP |PHS_DATA_OUT :case CSR_SRV_REQ |PHS_DATA_OUT :DB (DB_INTR , -printk ("OUT-%d.%d" , cmd->SCp.this_residual, - cmd->SCp.buffers_residual)) +printk ("OUT-%d.%d" , scsi_pointer->this_residual, + scsi_pointer->buffers_residual))transfer_bytes (regs, cmd,DATA_OUT_DIR );if (hostdata->state !=S_RUNNING_LEVEL2 ) hostdata->state =S_CONNECTED ;@@ -962,8 +969,8 @@ wd33c93_intr(struct Scsi_Host *instance)case CSR_UNEXP |PHS_STATUS :case CSR_SRV_REQ |PHS_STATUS : DB(DB_INTR, printk("STATUS=")) - cmd->SCp.Status = read_1_byte(regs); - DB(DB_INTR, printk("%02x", cmd->SCp.Status)) + scsi_pointer->Status =read_1_byte (regs); + DB(DB_INTR, printk("%02x", scsi_pointer->Status))if (hostdata->level2 >=L2_BASIC ) { sr =read_wd33c93 (regs,WD_SCSI_STATUS );/* clear interrupt */ udelay (7 );@@ -991,7 +998,7 @@ wd33c93_intr(struct Scsi_Host *instance)else hostdata->incoming_ptr =0 ; - cmd->SCp.Message = msg; + scsi_pointer->Message = msg;switch (msg) {case COMMAND_COMPLETE :@@ -1163,21 +1170,21 @@ wd33c93_intr(struct Scsi_Host *instance)write_wd33c93 (regs,WD_SOURCE_ID ,SRCID_ER );if (phs ==0x60 ) { DB(DB_INTR, printk("SX-DONE")) - cmd->SCp.Message = COMMAND_COMPLETE; + scsi_pointer->Message =COMMAND_COMPLETE ; lun =read_wd33c93 (regs,WD_TARGET_LUN ); -DB (DB_INTR ,printk (":%d.%d" , cmd->SCp.Status, lun)) +DB (DB_INTR ,printk (":%d.%d" , scsi_pointer->Status, lun)) hostdata->connected = NULL; hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun &0xff )); hostdata->state =S_UNCONNECTED ; -if (cmd->SCp.Status ==ILLEGAL_STATUS_BYTE ) - cmd->SCp.Status = lun; +if (scsi_pointer->Status ==ILLEGAL_STATUS_BYTE ) + scsi_pointer->Status = lun;if (cmd->cmnd[0 ] ==REQUEST_SENSE - && cmd->SCp.Status !=SAM_STAT_GOOD ) { + && scsi_pointer->Status !=SAM_STAT_GOOD ) {set_host_byte (cmd,DID_ERROR ); }else {set_host_byte (cmd,DID_OK ); -scsi_msg_to_host_byte (cmd, cmd->SCp.Message); -set_status_byte (cmd, cmd->SCp.Status); +scsi_msg_to_host_byte (cmd, scsi_pointer->Message); +set_status_byte (cmd, scsi_pointer->Status); }scsi_done (cmd);@@ -1259,12 +1266,12 @@ wd33c93_intr(struct Scsi_Host *instance) hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun &0xff )); hostdata->state =S_UNCONNECTED ;if (cmd->cmnd[0 ] ==REQUEST_SENSE && - cmd->SCp.Status !=SAM_STAT_GOOD ) { + scsi_pointer->Status !=SAM_STAT_GOOD ) {set_host_byte (cmd,DID_ERROR ); }else {set_host_byte (cmd,DID_OK ); -scsi_msg_to_host_byte (cmd, cmd->SCp.Message); -set_status_byte (cmd, cmd->SCp.Status); +scsi_msg_to_host_byte (cmd, scsi_pointer->Message); +set_status_byte (cmd, scsi_pointer->Status); }scsi_done (cmd);@@ -1293,14 +1300,14 @@ wd33c93_intr(struct Scsi_Host *instance) hostdata->connected =NULL ; hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun &0xff )); hostdata->state =S_UNCONNECTED ; - DB(DB_INTR, printk(":%d", cmd->SCp.Status)) + DB(DB_INTR, printk(":%d", scsi_pointer->Status))if (cmd->cmnd[0 ] ==REQUEST_SENSE - && cmd->SCp.Status !=SAM_STAT_GOOD ) { + && scsi_pointer->Status !=SAM_STAT_GOOD ) {set_host_byte (cmd,DID_ERROR ); }else {set_host_byte (cmd,DID_OK ); -scsi_msg_to_host_byte (cmd, cmd->SCp.Message); -set_status_byte (cmd, cmd->SCp.Status); +scsi_msg_to_host_byte (cmd, scsi_pointer->Message); +set_status_byte (cmd, scsi_pointer->Status); }scsi_done (cmd);break ;drivers/scsi/wd33c93.h +3
-0@@ -262,6 +262,16 @@ struct WD33C93_hostdata {#endif }; +struct WD33C93_cmd { +struct scsi_pointer scsi_pointer; +};
drivers/scsi/wd33c93.h struct WD33C93_hostdata { · line 277
Quoted 10 lines
drivers/scsi/wd33c93.h +7
-0+ +static inline struct scsi_pointer *WD33C93_scsi_pointer (struct scsi_cmnd *cmd) +{ +struct WD33C93_cmd *wcmd =scsi_cmd_priv (cmd); + +return &wcmd->scsi_pointer; +}/* defines for hostdata->chip */
--
Himanshu Madhani Oracle Linux Engineering
PATCH v2 43/44 zalon: Stop using the SCSI pointer
In reply to Bart Van AsscheSet .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.
--- drivers/scsi/ncr53c8xx.c | 22 ++++++++++++---------- drivers/scsi/ncr53c8xx.h | 6 ++++++ drivers/scsi/zalon.c | 1 + 3 files changed, 19 insertions(+), 10 deletions(-)
drivers/scsi/ncr53c8xx.c +12 -10
@@ -514,30 +514,29 @@ static m_addr_t __vtobus(m_bush_t bush, void *m)* Deal with DMA mapping/unmapping. */ -/* To keep track of the dma mapping (sg/single) that has been set */ -#define __data_mapped SCp.phase -#define __data_mapping SCp.have_data_in -static void __unmap_scsi_data (struct device *dev,struct scsi_cmnd *cmd) { -switch (cmd->__data_mapped) { +struct ncr_cmd_priv *cmd_priv =scsi_cmd_priv (cmd); + +switch (cmd_priv->data_mapped) {case 2 :scsi_dma_unmap (cmd);break ; } - cmd->__data_mapped =0 ; + cmd_priv->data_mapped =0 ; }static int __map_scsi_sg_data (struct device *dev,struct scsi_cmnd *cmd) { +struct ncr_cmd_priv *cmd_priv =scsi_cmd_priv (cmd);int use_sg; use_sg =scsi_dma_map (cmd);if (!use_sg)return 0 ; - cmd->__data_mapped =2 ; - cmd->__data_mapping = use_sg; + cmd_priv->data_mapped =2 ; + cmd_priv->data_mapping = use_sg;return use_sg; }
@@ -7854,6 +7853,7 @@ static int ncr53c8xx_slave_configure(struct scsi_device *device)static int ncr53c8xx_queue_command_lck (struct scsi_cmnd *cmd) { +struct ncr_cmd_priv *cmd_priv =scsi_cmd_priv (cmd);void (*done)(struct scsi_cmnd *) = scsi_done;struct ncb *np = ((struct host_data *) cmd->device->host->hostdata)->ncb;unsigned long flags;
@@ -7864,8 +7864,8 @@ printk("ncr53c8xx_queue_command\n");#endif cmd->host_scribble =NULL ; - cmd->__data_mapped =0 ; - cmd->__data_mapping =0 ; + cmd_priv->data_mapped =0 ; + cmd_priv->data_mapping =0 ;spin_lock_irqsave (&np->smp_lock, flags);
@@ -8085,6 +8085,8 @@ struct Scsi_Host * __init ncr_attach(struct scsi_host_template *tpnt,u_long flags =0 ;int i; +WARN_ON_ONCE (tpnt->cmd_size <sizeof (struct ncr_cmd_priv )); +if (!tpnt->name) tpnt->name =SCSI_NCR_DRIVER_NAME ;if (!tpnt->shost_groups)
drivers/scsi/ncr53c8xx.h +6 -0
@@ -1288,6 +1288,12 @@ struct ncr_device {u8 differential; }; +/* To keep track of the dma mapping (sg/single) that has been set */ +struct ncr_cmd_priv { +int data_mapped; +int data_mapping; +}; +extern struct Scsi_Host *ncr_attach (struct scsi_host_template *tpnt,int unit,struct ncr_device *device);extern void ncr53c8xx_release (struct Scsi_Host *host);irqreturn_t ncr53c8xx_intr (int irq,void *dev_id);
drivers/scsi/zalon.c +1 -0
@@ -81,6 +81,7 @@ lasi_scsi_clock(void * hpa, int defaultclock)static struct scsi_host_template zalon7xx_template = { .module =THIS_MODULE , .proc_name ="zalon7xx" , + .cmd_size =sizeof (struct ncr_cmd_priv ), }; static int __init
Re: [PATCH v2 43/44] zalon: Stop using the SCSI pointer
Quoted 4 lines · Bart Van Assche
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 structscsi_cmnd.
Quoted 9 lines
Cc Helge Deller <[email protected]>Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/ncr53c8xx.c | 22 ++++++++++++---------- drivers/scsi/ncr53c8xx.h | 6 ++++++ drivers/scsi/zalon.c | 1 + 3 files changed, 19 insertions(+), 10 deletions(-)
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 43/44] zalon: Stop using the SCSI pointer
In reply to Bart Van AsscheQuoted 115 lines · Bart Van Assche
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 structscsi_cmnd.Cc Helge Deller <[email protected]>Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/ncr53c8xx.c | 22 ++++++++++++---------- drivers/scsi/ncr53c8xx.h | 6 ++++++ drivers/scsi/zalon.c | 1 + 3 files changed, 19 insertions(+), 10 deletions(-)drivers/scsi/ncr53c8xx.c +12
-10@@ -514,30 +514,29 @@ static m_addr_t __vtobus(m_bush_t bush, void *m)* Deal with DMA mapping/unmapping. */ -/* To keep track of the dma mapping (sg/single) that has been set */ -#define __data_mapped SCp.phase -#define __data_mapping SCp.have_data_in -static void __unmap_scsi_data (struct device *dev,struct scsi_cmnd *cmd) { -switch (cmd->__data_mapped) { +struct ncr_cmd_priv *cmd_priv =scsi_cmd_priv (cmd); + +switch (cmd_priv->data_mapped) {case 2 :scsi_dma_unmap (cmd);break ; } - cmd->__data_mapped =0 ; + cmd_priv->data_mapped =0 ; }static int __map_scsi_sg_data (struct device *dev,struct scsi_cmnd *cmd) { +struct ncr_cmd_priv *cmd_priv =scsi_cmd_priv (cmd);int use_sg; use_sg =scsi_dma_map (cmd);if (!use_sg)return 0 ; - cmd->__data_mapped =2 ; - cmd->__data_mapping = use_sg; + cmd_priv->data_mapped =2 ; + cmd_priv->data_mapping = use_sg;return use_sg; }@@ -7854,6 +7853,7 @@ static int ncr53c8xx_slave_configure(struct scsi_device *device)static int ncr53c8xx_queue_command_lck (struct scsi_cmnd *cmd) { +struct ncr_cmd_priv *cmd_priv =scsi_cmd_priv (cmd);void (*done)(struct scsi_cmnd *) = scsi_done;struct ncb *np = ((struct host_data *) cmd->device->host->hostdata)->ncb;unsigned long flags;@@ -7864,8 +7864,8 @@ printk("ncr53c8xx_queue_command\n");#endif cmd->host_scribble =NULL ; - cmd->__data_mapped =0 ; - cmd->__data_mapping =0 ; + cmd_priv->data_mapped =0 ; + cmd_priv->data_mapping =0 ;spin_lock_irqsave (&np->smp_lock, flags);@@ -8085,6 +8085,8 @@ struct Scsi_Host * __init ncr_attach(struct scsi_host_template *tpnt,u_long flags =0 ;int i; +WARN_ON_ONCE (tpnt->cmd_size <sizeof (struct ncr_cmd_priv )); +if (!tpnt->name) tpnt->name =SCSI_NCR_DRIVER_NAME ;if (!tpnt->shost_groups)drivers/scsi/ncr53c8xx.h +6
-0@@ -1288,6 +1288,12 @@ struct ncr_device {u8 differential; }; +/* To keep track of the dma mapping (sg/single) that has been set */ +struct ncr_cmd_priv { +int data_mapped; +int data_mapping; +}; +extern struct Scsi_Host *ncr_attach (struct scsi_host_template *tpnt,int unit,struct ncr_device *device);extern void ncr53c8xx_release (struct Scsi_Host *host);irqreturn_t ncr53c8xx_intr (int irq,void *dev_id);drivers/scsi/zalon.c +1
-0@@ -81,6 +81,7 @@ lasi_scsi_clock(void * hpa, int defaultclock)static struct scsi_host_template zalon7xx_template = { .module =THIS_MODULE , .proc_name ="zalon7xx" , + .cmd_size =sizeof (struct ncr_cmd_priv ), };
Quoted 1 line
static int
__init
--
Himanshu Madhani Oracle Linux Engineering
PATCH v2 44/44 scsi: core: Remove struct scsi_pointer from struct scsi_cmnd
In reply to Bart Van AsscheRemove struct scsi_pointer from struct scsi_cmnd since the previous patches removed all users of that member of struct scsi_cmnd. Additionally, reorder the members of struct scsi_cmnd such that the statement that the field below can be modified by the SCSI LLD is again correct.
--- include/scsi/scsi_cmnd.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
include/scsi/scsi_cmnd.h +7 -7
@@ -123,11 +123,15 @@ struct scsi_cmnd {* command (auto-sense). Length must be * SCSI_SENSE_BUFFERSIZE bytes. */ +int flags;/* Command flags */ +unsigned long state;/* Command completion state */ + +unsigned int extra_len;/* length of alignment and padding */ +/* -* The following fields can be written to by the host specific code. -* Everything else should be left alone. +* The fields below can be modified by the SCSI LLD but the fields +* above not. */ -struct scsi_pointer SCp;/* Scratchpad used by some host adapters */ unsigned char *host_scribble;/* The host adapter is allowed to * call scsi_malloc and get some memory
@@ -138,10 +142,6 @@ struct scsi_cmnd {* to be at an address < 16Mb). */ int result;/* Status code from lower level driver */ -int flags;/* Command flags */ -unsigned long state;/* Command completion state */ - -unsigned int extra_len;/* length of alignment and padding */ };/* Variant of blk_mq_rq_from_pdu() that verifies the type of its argument. */
Re: [PATCH v2 44/44] scsi: core: Remove struct scsi_pointer from struct scsi_cmnd
Quoted 10 lines · Bart Van Assche
Remove struct
scsi_pointerfrom structscsi_cmndsince the previous patches removed all users of that member of structscsi_cmnd. Additionally, reorder the members of structscsi_cmndsuch that the statement that the field below can be modified by the SCSI LLD is again correct.Cc Ming Lei <[email protected]>Cc Hannes Reinecke <[email protected]>Cc Christoph Hellwig <[email protected]>Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>
FWIW, regadless of a nitpicking comment, below:
Quoted 12 lines
--- include/scsi/scsi_cmnd.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)include/scsi/scsi_cmnd.h +0
-0@@ -123,11 +123,15 @@ struct scsi_cmnd {* command (auto-sense). Length must be * SCSI_SENSE_BUFFERSIZE bytes. */
include/scsi/scsi_cmnd.h struct scsi_cmnd { · line 133
Quoted 10 lines
include/scsi/scsi_cmnd.h +7
-2+int flags;/* Command flags */ +unsigned long state;/* Command completion state */ + +unsigned int extra_len;/* length of alignment and padding */ +/* -* The following fields can be written to by the host specific code. -* Everything else should be left alone. +* The fields below can be modified by the SCSI LLD but the fields +* above not.
"but the fields above not" - this sounds a bit odd, maybe this is better: "but the fields above may not be modified"
And I don't think that we need to mention SCSI in that comment ..
Thanks,
John
Quoted 17 lines
include/scsi/scsi_cmnd.h +0
-5*/ -struct scsi_pointer SCp;/* Scratchpad used by some host adapters */ unsigned char *host_scribble;/* The host adapter is allowed to * call scsi_malloc and get some memory @@ -138,10 +142,6 @@ struct scsi_cmnd {* to be at an address < 16Mb). */ int result;/* Status code from lower level driver */ -int flags;/* Command flags */ -unsigned long state;/* Command completion state */ - -unsigned int extra_len;/* length of alignment and padding */ };/* Variant of blk_mq_rq_from_pdu() that verifies the type of its argument. */ .
Re: [PATCH v2 44/44] scsi: core: Remove struct scsi_pointer from struct scsi_cmnd
Quoted 8 lines · John Garry
Quoted 5 lines · Bart Van Assche
/*
- * The following fields can be written to by the host specific code. - * Everything else should be left alone.
+ * The fields below can be modified by the SCSI LLD but the fields + * above not."but the fields above not" - this sounds a bit odd, maybe this is better: "but the fields above may not be modified"
may not -> must not? See also https://en.wiktionary.org/wiki/must_not. Anyway, I can make that change.
Quoted 1 line
And I don't think that we need to mention SCSI in that comment ..
I can leave the word "SCSI" out.
Thanks,
Bart.
Re: [PATCH v2 44/44] scsi: core: Remove struct scsi_pointer from struct scsi_cmnd
In reply to Bart Van AsscheQuoted 42 lines · Bart Van Assche
Remove struct
scsi_pointerfrom structscsi_cmndsince the previous patches removed all users of that member of structscsi_cmnd. Additionally, reorder the members of structscsi_cmndsuch that the statement that the field below can be modified by the SCSI LLD is again correct.Cc Ming Lei <[email protected]>Cc Hannes Reinecke <[email protected]>Cc Christoph Hellwig <[email protected]>Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
include/scsi/scsi_cmnd.h| 14 +++++++-------1 file changed, 7 insertions(+), 7 deletions(-)include/scsi/scsi_cmnd.h +7
-3@@ -123,11 +123,15 @@ struct scsi_cmnd {* command (auto-sense). Length must be * SCSI_SENSE_BUFFERSIZE bytes. */ +int flags;/* Command flags */ +unsigned long state;/* Command completion state */ + +unsigned int extra_len;/* length of alignment and padding */ +/* -* The following fields can be written to by the host specific code. -* Everything else should be left alone. +* The fields below can be modified by the SCSI LLD but the fields +* above not. */ -struct scsi_pointer SCp;/* Scratchpad used by some host adapters */ unsigned char *host_scribble;/* The host adapter is allowed to * call scsi_malloc and get some memory
include/scsi/scsi_cmnd.h struct scsi_cmnd { · line 147
Quoted 10 lines
include/scsi/scsi_cmnd.h +0
-4@@ -138,10 +142,6 @@ struct scsi_cmnd {* to be at an address < 16Mb). */ int result;/* Status code from lower level driver */ -int flags;/* Command flags */ -unsigned long state;/* Command completion state */ - -unsigned int extra_len;/* length of alignment and padding */ };/* Variant of blk_mq_rq_from_pdu() that verifies the type of its argument. */
--
Himanshu Madhani Oracle Linux Engineering
Re: [PATCH v2 44/44] scsi: core: Remove struct scsi_pointer from struct scsi_cmnd
In reply to Bart Van AsscheQuoted 38 lines · Bart Van Assche
Remove struct
scsi_pointerfrom structscsi_cmndsince the previous patches removed all users of that member of structscsi_cmnd. Additionally, reorder the members of structscsi_cmndsuch that the statement that the field below can be modified by the SCSI LLD is again correct.Cc Ming Lei <[email protected]>Cc Hannes Reinecke <[email protected]>Cc Christoph Hellwig <[email protected]>Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- include/scsi/scsi_cmnd.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)include/scsi/scsi_cmnd.h +7
-3@@ -123,11 +123,15 @@ struct scsi_cmnd {* command (auto-sense). Length must be * SCSI_SENSE_BUFFERSIZE bytes. */ +int flags;/* Command flags */ +unsigned long state;/* Command completion state */ + +unsigned int extra_len;/* length of alignment and padding */ +/* -* The following fields can be written to by the host specific code. -* Everything else should be left alone. +* The fields below can be modified by the SCSI LLD but the fields +* above not. */ -struct scsi_pointer SCp;/* Scratchpad used by some host adapters */ unsigned char *host_scribble;/* The host adapter is allowed to * call scsi_malloc and get some memory
include/scsi/scsi_cmnd.h struct scsi_cmnd { · line 147
Quoted 10 lines
include/scsi/scsi_cmnd.h +0
-4@@ -138,10 +142,6 @@ struct scsi_cmnd {* to be at an address < 16Mb). */ int result;/* Status code from lower level driver */ -int flags;/* Command flags */ -unsigned long state;/* Command completion state */ - -unsigned int extra_len;/* length of alignment and padding */ };/* Variant of blk_mq_rq_from_pdu() that verifies the type of its argument. */
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer