Skip to content

Commit

Permalink
zorro: use memory_read_from_buffer
Browse files Browse the repository at this point in the history
zorro: use memory_read_from_buffer

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
akinobu.mita@gmail.com authored and Linus Torvalds committed Jul 21, 2008
1 parent a6a26a3 commit fa7f289
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions drivers/zorro/zorro-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <linux/zorro.h>
#include <linux/stat.h>
#include <linux/string.h>
#include <linux/fs.h>

#include "zorro.h"

Expand Down Expand Up @@ -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,
kobj));
struct ConfigDev cd;
unsigned int size = sizeof(cd);

if (off > size)
return 0;
if (off+count > size)
count = size-off;

/* Construct a ConfigDev */
memset(&cd, 0, sizeof(cd));
Expand All @@ -71,8 +66,7 @@ static ssize_t zorro_read_config(struct kobject *kobj,
cd.cd_BoardAddr = (void *)zorro_resource_start(z);
cd.cd_BoardSize = zorro_resource_len(z);

memcpy(buf, (void *)&cd+off, count);
return count;
return memory_read_from_buffer(buf, count, &off, &cd, sizeof(cd));
}

static struct bin_attribute zorro_config_attr = {
Expand Down

0 comments on commit fa7f289

Please sign in to comment.