[PATCH 2/2] replace sizeof sense_buffer with SCSI_SENSE_BUFFERSIZE
This is the second version of http://marc.info/?l=linux-scsi&m=119933628210012&w=2 o I dropped fas216 since Boaz's patch in scsi-pending will be merged before solving the sense_buffer dma issue. o This is a 'grep and replace' style patch but cleans up dpt_i2o a bit as by permission of Mark (I use min macro). o The previous version overlooked some sizeof sense_buffer lines in aacraid and qla4xxx. o I overlooked the ncr53c8xx compile warning. = From: FUJITA Tomonori <[EMAIL PROTECTED]> Subject: [PATCH 2/2] replace sizeof sense_buffer with SCSI_SENSE_BUFFERSIZE This replaces sizeof sense_buffer with SCSI_SENSE_BUFFERSIZE in several LLDs. It's a preparation for the future changes to remove sense_buffer array in scsi_cmnd structure. Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]> --- drivers/ata/libata-scsi.c |4 ++-- drivers/message/fusion/mptscsih.c |2 +- drivers/message/i2o/i2o_scsi.c |2 +- drivers/scsi/53c700.c | 11 ++- drivers/scsi/BusLogic.c |2 +- drivers/scsi/aacraid/aachba.c | 32 drivers/scsi/advansys.c | 14 +++--- drivers/scsi/aha1542.c |4 ++-- drivers/scsi/aha1740.c |2 +- drivers/scsi/aic7xxx/aic79xx_osm.c |6 +++--- drivers/scsi/aic7xxx/aic7xxx_osm.c |6 +++--- drivers/scsi/aic7xxx_old.c | 10 +- drivers/scsi/arcmsr/arcmsr_hba.c|6 +++--- drivers/scsi/dc395x.c | 16 +++- drivers/scsi/dpt_i2o.c |5 ++--- drivers/scsi/eata.c |4 ++-- drivers/scsi/hptiop.c |2 +- drivers/scsi/ips.c |6 ++ drivers/scsi/ncr53c8xx.c|3 ++- drivers/scsi/qla1280.c |4 ++-- drivers/scsi/qla2xxx/qla_isr.c | 12 ++-- drivers/scsi/qla4xxx/ql4_isr.c | 11 --- drivers/scsi/qlogicpti.c|2 +- drivers/scsi/scsi_error.c |6 +++--- drivers/scsi/scsi_lib.c |2 +- drivers/scsi/sym53c8xx_2/sym_glue.c |5 ++--- drivers/scsi/tmscsim.c |6 +++--- drivers/scsi/u14-34f.c |4 ++-- drivers/scsi/ultrastor.c|2 +- 29 files changed, 92 insertions(+), 99 deletions(-) diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 4bb268b..b633341 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -2334,7 +2334,7 @@ static void atapi_request_sense(struct ata_queued_cmd *qc) DPRINTK("ATAPI request sense\n"); /* FIXME: is this needed? */ - memset(cmd->sense_buffer, 0, sizeof(cmd->sense_buffer)); + memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); ap->ops->tf_read(ap, &qc->tf); @@ -2344,7 +2344,7 @@ static void atapi_request_sense(struct ata_queued_cmd *qc) ata_qc_reinit(qc); - ata_sg_init_one(qc, cmd->sense_buffer, sizeof(cmd->sense_buffer)); + ata_sg_init_one(qc, cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE); qc->dma_dir = DMA_FROM_DEVICE; memset(&qc->cdb, 0, qc->dev->cdb_len); diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index 626bb3c..5c614ec 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c @@ -111,7 +111,7 @@ int mptscsih_suspend(struct pci_dev *pdev, pm_message_t state); intmptscsih_resume(struct pci_dev *pdev); #endif -#define SNS_LEN(scp) sizeof((scp)->sense_buffer) +#define SNS_LEN(scp) SCSI_SENSE_BUFFERSIZE /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /** diff --git a/drivers/message/i2o/i2o_scsi.c b/drivers/message/i2o/i2o_scsi.c index aa6fb94..1bcdbbb 100644 --- a/drivers/message/i2o/i2o_scsi.c +++ b/drivers/message/i2o/i2o_scsi.c @@ -370,7 +370,7 @@ static int i2o_scsi_reply(struct i2o_controller *c, u32 m, */ if (cmd->result) memcpy(cmd->sense_buffer, &msg->body[3], - min(sizeof(cmd->sense_buffer), (size_t) 40)); + min(SCSI_SENSE_BUFFERSIZE, 40)); /* only output error code if AdapterStatus is not HBA_SUCCESS */ if ((error >> 8) & 0xff) diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c index 71ff3fb..f4c4fe9 100644 --- a/drivers/scsi/53c700.c +++ b/drivers/scsi/53c700.c @@ -608,7 +608,8 @@ NCR_700_scsi_done(struct NCR_700_Host_Parameters *hostdata, scsi_print_sense("53c700", SCp); #endif - dma_unmap_single(hostdata->dev, slot->dma_handle, sizeof(SCp->sense_buffer), DMA_FROM_DEVICE); + dma_unmap_single(hostdata->dev, slot->dma_handle, +
RE: [PATCH 2/2] replace sizeof sense_buffer with SCSI_SENSE_BUFFERSIZE
ACK on ips, aacraid and dpt_i2o bits. Cursory inspection of other bits as well. Thanks Fujita, looks good! Will do a 'min()' cleanup on aacraid once patch propagates into scsi-misc-2.6 Sincerely -- Mark Salyzyn cur*so*ry - adjective going rapidly over something, without noticing details; hasty; superficial. spedd reeding . . . > o This is a 'grep and replace' style patch but cleans up dpt_i2o a bit > as by permission of Mark (I use min macro). > > o The previous version overlooked some sizeof sense_buffer lines in > aacraid and qla4xxx. . . . > diff --git a/drivers/scsi/aacraid/aachba.c > b/drivers/scsi/aacraid/aachba.c > index 62d9516..aadedbd 100644 > --- a/drivers/scsi/aacraid/aachba.c > +++ b/drivers/scsi/aacraid/aachba.c > @@ -912,8 +912,8 @@ static int aac_bounds_32(struct aac_dev * > dev, struct scsi_cmnd * cmd, u64 lba) > ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0, > 0, 0); > memcpy(cmd->sense_buffer, > &dev->fsa_dev[cid].sense_data, > - (sizeof(dev->fsa_dev[cid].sense_data) > > sizeof(cmd->sense_buffer)) > - ? sizeof(cmd->sense_buffer) > + (sizeof(dev->fsa_dev[cid].sense_data) > > SCSI_SENSE_BUFFERSIZE) > + ? SCSI_SENSE_BUFFERSIZE > : sizeof(dev->fsa_dev[cid].sense_data)); > cmd->scsi_done(cmd); > return 1; > @@ -1525,8 +1525,8 @@ static void io_callback(void *context, > struct fib * fibptr) > > ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0, > 0, 0); > memcpy(scsicmd->sense_buffer, > &dev->fsa_dev[cid].sense_data, > - (sizeof(dev->fsa_dev[cid].sense_data) > > sizeof(scsicmd->sense_buffer)) > - ? sizeof(scsicmd->sense_buffer) > + (sizeof(dev->fsa_dev[cid].sense_data) > > SCSI_SENSE_BUFFERSIZE) > + ? SCSI_SENSE_BUFFERSIZE > : sizeof(dev->fsa_dev[cid].sense_data)); > } > aac_fib_complete(fibptr); > @@ -1739,8 +1739,8 @@ static void synchronize_callback(void > *context, struct fib *fibptr) > > ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0, > 0, 0); > memcpy(cmd->sense_buffer, > &dev->fsa_dev[cid].sense_data, > - min(sizeof(dev->fsa_dev[cid].sense_data), > - sizeof(cmd->sense_buffer))); > + min_t(size_t, > sizeof(dev->fsa_dev[cid].sense_data), > +SCSI_SENSE_BUFFERSIZE)); > } > > aac_fib_complete(fibptr); > @@ -1949,8 +1949,8 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) > SENCODE_INVALID_COMMAND, > ASENCODE_INVALID_COMMAND, 0, 0, 0, 0); > memcpy(scsicmd->sense_buffer, > &dev->fsa_dev[cid].sense_data, > - (sizeof(dev->fsa_dev[cid].sense_data) > > sizeof(scsicmd->sense_buffer)) > - ? sizeof(scsicmd->sense_buffer) > + (sizeof(dev->fsa_dev[cid].sense_data) > > SCSI_SENSE_BUFFERSIZE) > + ? SCSI_SENSE_BUFFERSIZE > : sizeof(dev->fsa_dev[cid].sense_data)); > scsicmd->scsi_done(scsicmd); > return 0; > @@ -2002,8 +2002,8 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) > memcpy(scsicmd->sense_buffer, > &dev->fsa_dev[cid].sense_data, > > (sizeof(dev->fsa_dev[cid].sense_data) > > - sizeof(scsicmd->sense_buffer)) > - ? sizeof(scsicmd->sense_buffer) > + SCSI_SENSE_BUFFERSIZE) > + ? SCSI_SENSE_BUFFERSIZE >: > sizeof(dev->fsa_dev[cid].sense_data)); > } > scsicmd->scsi_done(scsicmd); > @@ -2259,8 +2259,8 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) > ILLEGAL_REQUEST, > SENCODE_INVALID_COMMAND, > ASENCODE_INVALID_COMMAND, 0, 0, 0, 0); > memcpy(scsicmd->sense_buffer, > &dev->fsa_dev[cid].sense_data, > - > (sizeof(dev->fsa_dev[cid].sense_data) > sizeof(scsicmd->sense_buffer)) > - ? sizeof(scsicmd->sense_buffer) > + > (sizeof(dev->fsa_dev[cid].sense_data) > SCSI_SENSE_BUFFERSIZE) > + ? SCSI_SENSE_BUFFERSIZE > : sizeof(dev->fsa_dev[cid].sense_data)); > scsicmd->scsi_done(scsicmd); > return 0; > @@ -2422,8 +2422,8 @@ static void aac_srb_callback(void > *context, struct fib * fibptr) > int len; > printk(KERN_WARNING "aac_srb_callback: srb > failed, status = %d\n", le32_to_cpu(srbreply->status)); >