aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/devices/block2mtd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/devices/block2mtd.c')
-rw-r--r--drivers/mtd/devices/block2mtd.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c
index cfe6ccf07972..4a7a805e7564 100644
--- a/drivers/mtd/devices/block2mtd.c
+++ b/drivers/mtd/devices/block2mtd.c
@@ -1,10 +1,9 @@
1/* 1/*
2 * $Id: block2mtd.c,v 1.23 2005/01/05 17:05:46 dwmw2 Exp $ 2 * $Id: block2mtd.c,v 1.28 2005/03/19 22:40:44 gleixner Exp $
3 * 3 *
4 * block2mtd.c - create an mtd from a block device 4 * block2mtd.c - create an mtd from a block device
5 * 5 *
6 * Copyright (C) 2001,2002 Simon Evans <spse@secret.org.uk> 6 * Copyright (C) 2001,2002 Simon Evans <spse@secret.org.uk>
7 * Copyright (C) 2004 Gareth Bult <Gareth@Encryptec.net>
8 * Copyright (C) 2004,2005 Jörn Engel <joern@wh.fh-wedel.de> 7 * Copyright (C) 2004,2005 Jörn Engel <joern@wh.fh-wedel.de>
9 * 8 *
10 * Licence: GPL 9 * Licence: GPL
@@ -20,7 +19,7 @@
20#include <linux/mtd/mtd.h> 19#include <linux/mtd/mtd.h>
21#include <linux/buffer_head.h> 20#include <linux/buffer_head.h>
22 21
23#define VERSION "$Revision: 1.23 $" 22#define VERSION "$Revision: 1.28 $"
24 23
25 24
26#define ERROR(fmt, args...) printk(KERN_ERR "block2mtd: " fmt "\n" , ## args) 25#define ERROR(fmt, args...) printk(KERN_ERR "block2mtd: " fmt "\n" , ## args)
@@ -89,7 +88,6 @@ void cache_readahead(struct address_space *mapping, int index)
89static struct page* page_readahead(struct address_space *mapping, int index) 88static struct page* page_readahead(struct address_space *mapping, int index)
90{ 89{
91 filler_t *filler = (filler_t*)mapping->a_ops->readpage; 90 filler_t *filler = (filler_t*)mapping->a_ops->readpage;
92 //do_page_cache_readahead(mapping, index, XXX, 64);
93 cache_readahead(mapping, index); 91 cache_readahead(mapping, index);
94 return read_cache_page(mapping, index, filler, NULL); 92 return read_cache_page(mapping, index, filler, NULL);
95} 93}
@@ -157,7 +155,7 @@ static int block2mtd_read(struct mtd_info *mtd, loff_t from, size_t len,
157 struct block2mtd_dev *dev = mtd->priv; 155 struct block2mtd_dev *dev = mtd->priv;
158 struct page *page; 156 struct page *page;
159 int index = from >> PAGE_SHIFT; 157 int index = from >> PAGE_SHIFT;
160 int offset = from & (PAGE_SHIFT-1); 158 int offset = from & (PAGE_SIZE-1);
161 int cpylen; 159 int cpylen;
162 160
163 if (from > mtd->size) 161 if (from > mtd->size)
@@ -370,16 +368,16 @@ static int ustrtoul(const char *cp, char **endp, unsigned int base)
370} 368}
371 369
372 370
373static int parse_num32(u32 *num32, const char *token) 371static int parse_num(size_t *num, const char *token)
374{ 372{
375 char *endp; 373 char *endp;
376 unsigned long n; 374 size_t n;
377 375
378 n = ustrtoul(token, &endp, 0); 376 n = (size_t) ustrtoul(token, &endp, 0);
379 if (*endp) 377 if (*endp)
380 return -EINVAL; 378 return -EINVAL;
381 379
382 *num32 = n; 380 *num = n;
383 return 0; 381 return 0;
384} 382}
385 383
@@ -422,7 +420,7 @@ static int block2mtd_setup(const char *val, struct kernel_param *kp)
422 char buf[80+12], *str=buf; /* 80 for device, 12 for erase size */ 420 char buf[80+12], *str=buf; /* 80 for device, 12 for erase size */
423 char *token[2]; 421 char *token[2];
424 char *name; 422 char *name;
425 u32 erase_size = PAGE_SIZE; 423 size_t erase_size = PAGE_SIZE;
426 int i, ret; 424 int i, ret;
427 425
428 if (strnlen(val, sizeof(buf)) >= sizeof(buf)) 426 if (strnlen(val, sizeof(buf)) >= sizeof(buf))
@@ -449,7 +447,7 @@ static int block2mtd_setup(const char *val, struct kernel_param *kp)
449 return 0; 447 return 0;
450 448
451 if (token[1]) { 449 if (token[1]) {
452 ret = parse_num32(&erase_size, token[1]); 450 ret = parse_num(&erase_size, token[1]);
453 if (ret) 451 if (ret)
454 parse_err("illegal erase size"); 452 parse_err("illegal erase size");
455 } 453 }