public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: akinobu.mita@gmail.com
To: linux-kernel@vger.kernel.org
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	linux390@de.ibm.com, linux-s390@vger.kernel.org
Subject: [patch -v2 20/23] s390/cio: use memory_read_from_buffer
Date: Mon, 02 Jun 2008 08:13:49 +0900	[thread overview]
Message-ID: <20080601231638.355013541@gmail.com> (raw)
In-Reply-To: 20080601231329.223608711@gmail.com

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

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux390@de.ibm.com
Cc: linux-s390@vger.kernel.org
---
 drivers/s390/cio/chp.c |   12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

Index: 2.6-git/drivers/s390/cio/chp.c
===================================================================
--- 2.6-git.orig/drivers/s390/cio/chp.c
+++ 2.6-git/drivers/s390/cio/chp.c
@@ -15,6 +15,7 @@
 #include <linux/wait.h>
 #include <linux/mutex.h>
 #include <linux/errno.h>
+#include <linux/fs.h>
 #include <asm/chpid.h>
 #include <asm/sclp.h>
 
@@ -141,21 +142,14 @@ static ssize_t chp_measurement_chars_rea
 {
 	struct channel_path *chp;
 	struct device *device;
-	unsigned int size;
 
 	device = container_of(kobj, struct device, kobj);
 	chp = to_channelpath(device);
 	if (!chp->cmg_chars)
 		return 0;
 
-	size = sizeof(struct cmg_chars);
-
-	if (off > size)
-		return 0;
-	if (off + count > size)
-		count = size - off;
-	memcpy(buf, chp->cmg_chars + off, count);
-	return count;
+	return memory_read_from_buffer(buf, count, &off,
+				chp->cmg_chars, sizeof(struct cmg_chars));
 }
 
 static struct bin_attribute chp_measurement_chars_attr = {

-- 

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

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080601231329.223608711@gmail.com>
2008-06-01 23:13 ` [patch -v2 06/23] s390/vmcp: use simple_read_from_buffer akinobu.mita
2008-06-02  8:53   ` Christian Borntraeger
2008-06-02 12:28     ` Akinobu Mita
2008-06-01 23:13 ` [patch -v2 07/23] s390: " akinobu.mita
2008-06-01 23:13 ` akinobu.mita [this message]
2008-06-01 23:13 ` [patch -v2 21/23] s390: 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=20080601231638.355013541@gmail.com \
    --to=akinobu.mita@gmail.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux390@de.ibm.com \
    --cc=schwidefsky@de.ibm.com \
    /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