diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2008-09-23 01:56:47 +0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-10-23 20:42:15 +0400 |
commit | d777aaf386ba71d6fbe803c015330a766cad53d8 (patch) | |
tree | 3a0f360120bb681b405a64533b8df8c4899220df /drivers | |
parent | 3ba7f18cd9d974a5b1e75a68a4f0a50f1df8585e (diff) | |
download | linux-d777aaf386ba71d6fbe803c015330a766cad53d8.tar.xz |
[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')
-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 d30eb7ba018e..de62f4dfeb0e 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c @@ -2456,20 +2456,14 @@ static ssize_t ipr_read_trace(struct kobject *kobj, struct Scsi_Host *shost = class_to_shost(dev); struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; unsigned long lock_flags = 0; - int size = IPR_TRACE_SIZE; - char *src = (char *)ioa_cfg->trace; - - if (off > size) - return 0; - if (off + count > size) { - size -= off; - count = size; - } + ssize_t ret; spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); - memcpy(buf, &src[off], count); + ret = memory_read_from_buffer(buf, count, &off, ioa_cfg->trace, + IPR_TRACE_SIZE); spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); - return count; + + return ret; } static struct bin_attribute ipr_trace_attr = { |