[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>
This commit is contained in:
parent
3ba7f18cd9
commit
d777aaf386
1 changed files with 5 additions and 11 deletions
|
@ -2456,20 +2456,14 @@ static ssize_t ipr_read_trace(struct kobject *kobj,
|
||||||
struct Scsi_Host *shost = class_to_shost(dev);
|
struct Scsi_Host *shost = class_to_shost(dev);
|
||||||
struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata;
|
struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata;
|
||||||
unsigned long lock_flags = 0;
|
unsigned long lock_flags = 0;
|
||||||
int size = IPR_TRACE_SIZE;
|
ssize_t ret;
|
||||||
char *src = (char *)ioa_cfg->trace;
|
|
||||||
|
|
||||||
if (off > size)
|
|
||||||
return 0;
|
|
||||||
if (off + count > size) {
|
|
||||||
size -= off;
|
|
||||||
count = size;
|
|
||||||
}
|
|
||||||
|
|
||||||
spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
|
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);
|
spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
|
||||||
return count;
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bin_attribute ipr_trace_attr = {
|
static struct bin_attribute ipr_trace_attr = {
|
||||||
|
|
Loading…
Add table
Reference in a new issue