Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 89678
b: refs/heads/master
c: 6690bae
h: refs/heads/master
v: v3
  • Loading branch information
FUJITA Tomonori authored and James Bottomley committed Apr 7, 2008
1 parent fcabd2f commit 824f7ef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 43 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1a7a2e1a77f29179f997ca5e873c50ae2fb7fcc1
refs/heads/master: 6690bae7e0279451ee92580bf1c5d39a76e3687e
50 changes: 8 additions & 42 deletions trunk/drivers/scsi/ips.c
Original file line number Diff line number Diff line change
Expand Up @@ -3502,28 +3502,11 @@ ips_send_wait(ips_ha_t * ha, ips_scb_t * scb, int timeout, int intr)
static void
ips_scmd_buf_write(struct scsi_cmnd *scmd, void *data, unsigned int count)
{
int i;
unsigned int min_cnt, xfer_cnt;
char *cdata = (char *) data;
unsigned char *buffer;
unsigned long flags;
struct scatterlist *sg = scsi_sglist(scmd);

for (i = 0, xfer_cnt = 0;
(i < scsi_sg_count(scmd)) && (xfer_cnt < count);
i++, sg = sg_next(sg)) {
min_cnt = min(count - xfer_cnt, sg->length);

/* kmap_atomic() ensures addressability of the data buffer.*/
/* local_irq_save() protects the KM_IRQ0 address slot. */
local_irq_save(flags);
buffer = kmap_atomic(sg_page(sg), KM_IRQ0) + sg->offset;
memcpy(buffer, &cdata[xfer_cnt], min_cnt);
kunmap_atomic(buffer - sg->offset, KM_IRQ0);
local_irq_restore(flags);
unsigned long flags;

xfer_cnt += min_cnt;
}
local_irq_save(flags);
scsi_sg_copy_from_buffer(scmd, data, count);
local_irq_restore(flags);
}

/****************************************************************************/
Expand All @@ -3536,28 +3519,11 @@ ips_scmd_buf_write(struct scsi_cmnd *scmd, void *data, unsigned int count)
static void
ips_scmd_buf_read(struct scsi_cmnd *scmd, void *data, unsigned int count)
{
int i;
unsigned int min_cnt, xfer_cnt;
char *cdata = (char *) data;
unsigned char *buffer;
unsigned long flags;
struct scatterlist *sg = scsi_sglist(scmd);

for (i = 0, xfer_cnt = 0;
(i < scsi_sg_count(scmd)) && (xfer_cnt < count);
i++, sg = sg_next(sg)) {
min_cnt = min(count - xfer_cnt, sg->length);

/* kmap_atomic() ensures addressability of the data buffer.*/
/* local_irq_save() protects the KM_IRQ0 address slot. */
local_irq_save(flags);
buffer = kmap_atomic(sg_page(sg), KM_IRQ0) + sg->offset;
memcpy(&cdata[xfer_cnt], buffer, min_cnt);
kunmap_atomic(buffer - sg->offset, KM_IRQ0);
local_irq_restore(flags);
unsigned long flags;

xfer_cnt += min_cnt;
}
local_irq_save(flags);
scsi_sg_copy_to_buffer(scmd, data, count);
local_irq_restore(flags);
}

/****************************************************************************/
Expand Down

0 comments on commit 824f7ef

Please sign in to comment.