diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2008-09-22 17:56:47 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-10-23 12:42:15 -0400 |
commit | d777aaf386ba71d6fbe803c015330a766cad53d8 (patch) | |
tree | 3a0f360120bb681b405a64533b8df8c4899220df /drivers/scsi/ipr.c | |
parent | 3ba7f18cd9d974a5b1e75a68a4f0a50f1df8585e (diff) |
[SCSI] ipr: use memory_read_from_buffer()
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Brian King <brking@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/ipr.c')
-rw-r--r-- | drivers/scsi/ipr.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index d30eb7ba018..de62f4dfeb0 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -2456,20 +2456,14 @@ static ssize_t ipr_read_trace(struct kobject *kobj, | |||
2456 | struct Scsi_Host *shost = class_to_shost(dev); | 2456 | struct Scsi_Host *shost = class_to_shost(dev); |
2457 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; | 2457 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; |
2458 | unsigned long lock_flags = 0; | 2458 | unsigned long lock_flags = 0; |
2459 | int size = IPR_TRACE_SIZE; | 2459 | ssize_t ret; |
2460 | char *src = (char *)ioa_cfg->trace; | ||
2461 | |||
2462 | if (off > size) | ||
2463 | return 0; | ||
2464 | if (off + count > size) { | ||
2465 | size -= off; | ||
2466 | count = size; | ||
2467 | } | ||
2468 | 2460 | ||
2469 | spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); | 2461 | spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); |
2470 | memcpy(buf, &src[off], count); | 2462 | ret = memory_read_from_buffer(buf, count, &off, ioa_cfg->trace, |
2463 | IPR_TRACE_SIZE); | ||
2471 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); | 2464 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); |
2472 | return count; | 2465 | |
2466 | return ret; | ||
2473 | } | 2467 | } |
2474 | 2468 | ||
2475 | static struct bin_attribute ipr_trace_attr = { | 2469 | static struct bin_attribute ipr_trace_attr = { |