linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: akinobu.mita@gmail.com
To: linux-kernel@vger.kernel.org
Cc: Brian King <brking@us.ibm.com>,
	"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
	linux-scsi@vger.kernel.org
Subject: [patch -v2 22/23] ipr: use memory_read_from_buffer
Date: Mon, 02 Jun 2008 08:13:51 +0900	[thread overview]
Message-ID: <20080601231648.183353549@gmail.com> (raw)
In-Reply-To: 20080601231329.223608711@gmail.com

[-- Attachment #1: scsi-ipr-use-memory-read-from-buffer.patch --]
[-- Type: text/plain, Size: 1185 bytes --]

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Brian King <brking@us.ibm.com>
Cc: James E.J. Bottomley <James.Bottomley@HansenPartnership.com>
Cc: linux-scsi@vger.kernel.org
---
 drivers/scsi/ipr.c |   16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

Index: 2.6-git/drivers/scsi/ipr.c
===================================================================
--- 2.6-git.orig/drivers/scsi/ipr.c
+++ 2.6-git/drivers/scsi/ipr.c
@@ -2455,20 +2455,14 @@ static ssize_t ipr_read_trace(struct kob
 	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 = {

-- 

       reply	other threads:[~2008-06-01 23:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080601231329.223608711@gmail.com>
2008-06-01 23:13 ` akinobu.mita [this message]
2008-06-01 23:13 ` [patch -v2 23/23] qla2xxx: use memory_read_from_buffer akinobu.mita

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080601231648.183353549@gmail.com \
    --to=akinobu.mita@gmail.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=brking@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).