Commit fa7f2893 authored by akinobu.mita@gmail.com's avatar akinobu.mita@gmail.com Committed by Linus Torvalds

zorro: use memory_read_from_buffer

zorro: use memory_read_from_buffer
Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent a6a26a3e
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/zorro.h> #include <linux/zorro.h>
#include <linux/stat.h> #include <linux/stat.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/fs.h>
#include "zorro.h" #include "zorro.h"
...@@ -56,12 +57,6 @@ static ssize_t zorro_read_config(struct kobject *kobj, ...@@ -56,12 +57,6 @@ static ssize_t zorro_read_config(struct kobject *kobj,
struct zorro_dev *z = to_zorro_dev(container_of(kobj, struct device, struct zorro_dev *z = to_zorro_dev(container_of(kobj, struct device,
kobj)); kobj));
struct ConfigDev cd; struct ConfigDev cd;
unsigned int size = sizeof(cd);
if (off > size)
return 0;
if (off+count > size)
count = size-off;
/* Construct a ConfigDev */ /* Construct a ConfigDev */
memset(&cd, 0, sizeof(cd)); memset(&cd, 0, sizeof(cd));
...@@ -71,8 +66,7 @@ static ssize_t zorro_read_config(struct kobject *kobj, ...@@ -71,8 +66,7 @@ static ssize_t zorro_read_config(struct kobject *kobj,
cd.cd_BoardAddr = (void *)zorro_resource_start(z); cd.cd_BoardAddr = (void *)zorro_resource_start(z);
cd.cd_BoardSize = zorro_resource_len(z); cd.cd_BoardSize = zorro_resource_len(z);
memcpy(buf, (void *)&cd+off, count); return memory_read_from_buffer(buf, count, &off, &cd, sizeof(cd));
return count;
} }
static struct bin_attribute zorro_config_attr = { static struct bin_attribute zorro_config_attr = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment