public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 09/17] ipr: use memory_read_from_buffer()
@ 2008-09-22 21:56 akpm
  2008-09-29 22:24 ` James Bottomley
  2008-10-07 18:50 ` Brian King
  0 siblings, 2 replies; 3+ messages in thread
From: akpm @ 2008-09-22 21:56 UTC (permalink / raw)
  To: James.Bottomley; +Cc: linux-scsi, akpm, akinobu.mita, brking

From: Akinobu Mita <akinobu.mita@gmail.com>

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>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/scsi/ipr.c |   16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff -puN drivers/scsi/ipr.c~ipr-use-memory_read_from_buffer drivers/scsi/ipr.c
--- a/drivers/scsi/ipr.c~ipr-use-memory_read_from_buffer
+++ a/drivers/scsi/ipr.c
@@ -2456,20 +2456,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 = {
_

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch 09/17] ipr: use memory_read_from_buffer()
  2008-09-22 21:56 [patch 09/17] ipr: use memory_read_from_buffer() akpm
@ 2008-09-29 22:24 ` James Bottomley
  2008-10-07 18:50 ` Brian King
  1 sibling, 0 replies; 3+ messages in thread
From: James Bottomley @ 2008-09-29 22:24 UTC (permalink / raw)
  To: akpm; +Cc: linux-scsi, akinobu.mita, brking

On Mon, 2008-09-22 at 14:56 -0700, akpm@linux-foundation.org wrote:
> From: Akinobu Mita <akinobu.mita@gmail.com>
> 
> 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>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Brian,

Can I get an ack for this (or can you merge it into your patch set)?

Thanks,

James



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch 09/17] ipr: use memory_read_from_buffer()
  2008-09-22 21:56 [patch 09/17] ipr: use memory_read_from_buffer() akpm
  2008-09-29 22:24 ` James Bottomley
@ 2008-10-07 18:50 ` Brian King
  1 sibling, 0 replies; 3+ messages in thread
From: Brian King @ 2008-10-07 18:50 UTC (permalink / raw)
  To: akpm; +Cc: James.Bottomley, linux-scsi, akinobu.mita, brking

Acked by: Brian King <brking@linux.vnet.ibm.com>

akpm@linux-foundation.org wrote:
> From: Akinobu Mita <akinobu.mita@gmail.com>
> 
> 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>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>  drivers/scsi/ipr.c |   16 +++++-----------
>  1 file changed, 5 insertions(+), 11 deletions(-)
> 
> diff -puN drivers/scsi/ipr.c~ipr-use-memory_read_from_buffer drivers/scsi/ipr.c
> --- a/drivers/scsi/ipr.c~ipr-use-memory_read_from_buffer
> +++ a/drivers/scsi/ipr.c
> @@ -2456,20 +2456,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 = {
> _
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


-- 
Brian King
Linux on Power Virtualization
IBM Linux Technology Center



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-10-07 18:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-22 21:56 [patch 09/17] ipr: use memory_read_from_buffer() akpm
2008-09-29 22:24 ` James Bottomley
2008-10-07 18:50 ` Brian King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox