git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git]
/
drivers
/
mtd
/
devices
/
ms02-nv.c
diff --git
a/drivers/mtd/devices/ms02-nv.c
b/drivers/mtd/devices/ms02-nv.c
index
42417b0
..
9cff119
100644
(file)
--- a/
drivers/mtd/devices/ms02-nv.c
+++ b/
drivers/mtd/devices/ms02-nv.c
@@
-6,7
+6,7
@@
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
- * $Id: ms02-nv.c,v 1.
7 2004/07/29 14:16:45
macro Exp $
+ * $Id: ms02-nv.c,v 1.
11 2005/11/14 13:41:47
macro Exp $
*/
#include <linux/init.h>
*/
#include <linux/init.h>
@@
-59,7
+59,7
@@
static struct mtd_info *root_ms02nv_mtd;
static int ms02nv_read(struct mtd_info *mtd, loff_t from,
size_t len, size_t *retlen, u_char *buf)
{
static int ms02nv_read(struct mtd_info *mtd, loff_t from,
size_t len, size_t *retlen, u_char *buf)
{
- struct ms02nv_private *mp =
(struct ms02nv_private *)
mtd->priv;
+ struct ms02nv_private *mp = mtd->priv;
if (from + len > mtd->size)
return -EINVAL;
if (from + len > mtd->size)
return -EINVAL;
@@
-73,7
+73,7
@@
static int ms02nv_read(struct mtd_info *mtd, loff_t from,
static int ms02nv_write(struct mtd_info *mtd, loff_t to,
size_t len, size_t *retlen, const u_char *buf)
{
static int ms02nv_write(struct mtd_info *mtd, loff_t to,
size_t len, size_t *retlen, const u_char *buf)
{
- struct ms02nv_private *mp =
(struct ms02nv_private *)
mtd->priv;
+ struct ms02nv_private *mp = mtd->priv;
if (to + len > mtd->size)
return -EINVAL;
if (to + len > mtd->size)
return -EINVAL;
@@
-99,8
+99,8
@@
static inline uint ms02nv_probe_one(ulong addr)
* The firmware writes MS02NV_ID at MS02NV_MAGIC and also
* a diagnostic status at MS02NV_DIAG.
*/
* The firmware writes MS02NV_ID at MS02NV_MAGIC and also
* a diagnostic status at MS02NV_DIAG.
*/
- ms02nv_diagp = (ms02nv_uint *)(KSEG1ADDR(addr + MS02NV_DIAG));
- ms02nv_magicp = (ms02nv_uint *)(KSEG1ADDR(addr + MS02NV_MAGIC));
+ ms02nv_diagp = (ms02nv_uint *)(
C
KSEG1ADDR(addr + MS02NV_DIAG));
+ ms02nv_magicp = (ms02nv_uint *)(
C
KSEG1ADDR(addr + MS02NV_MAGIC));
err = get_dbe(ms02nv_magic, ms02nv_magicp);
if (err)
return 0;
err = get_dbe(ms02nv_magic, ms02nv_magicp);
if (err)
return 0;
@@
-131,11
+131,10
@@
static int __init ms02nv_init_one(ulong addr)
int ret = -ENODEV;
/* The module decodes 8MiB of address space. */
int ret = -ENODEV;
/* The module decodes 8MiB of address space. */
- mod_res = k
m
alloc(sizeof(*mod_res), GFP_KERNEL);
+ mod_res = k
z
alloc(sizeof(*mod_res), GFP_KERNEL);
if (!mod_res)
return -ENOMEM;
if (!mod_res)
return -ENOMEM;
- memset(mod_res, 0, sizeof(*mod_res));
mod_res->name = ms02nv_name;
mod_res->start = addr;
mod_res->end = addr + MS02NV_SLOT_SIZE - 1;
mod_res->name = ms02nv_name;
mod_res->start = addr;
mod_res->end = addr + MS02NV_SLOT_SIZE - 1;
@@
-153,24
+152,21
@@
static int __init ms02nv_init_one(ulong addr)
}
ret = -ENOMEM;
}
ret = -ENOMEM;
- mtd = k
m
alloc(sizeof(*mtd), GFP_KERNEL);
+ mtd = k
z
alloc(sizeof(*mtd), GFP_KERNEL);
if (!mtd)
goto err_out_mod_res_rel;
if (!mtd)
goto err_out_mod_res_rel;
- memset(mtd, 0, sizeof(*mtd));
- mp = kmalloc(sizeof(*mp), GFP_KERNEL);
+ mp = kzalloc(sizeof(*mp), GFP_KERNEL);
if (!mp)
goto err_out_mtd;
if (!mp)
goto err_out_mtd;
- memset(mp, 0, sizeof(*mp));
mtd->priv = mp;
mp->resource.module = mod_res;
/* Firmware's diagnostic NVRAM area. */
mtd->priv = mp;
mp->resource.module = mod_res;
/* Firmware's diagnostic NVRAM area. */
- diag_res = k
m
alloc(sizeof(*diag_res), GFP_KERNEL);
+ diag_res = k
z
alloc(sizeof(*diag_res), GFP_KERNEL);
if (!diag_res)
goto err_out_mp;
if (!diag_res)
goto err_out_mp;
- memset(diag_res, 0, sizeof(*diag_res));
diag_res->name = ms02nv_res_diag_ram;
diag_res->start = addr;
diag_res->end = addr + MS02NV_RAM - 1;
diag_res->name = ms02nv_res_diag_ram;
diag_res->start = addr;
diag_res->end = addr + MS02NV_RAM - 1;
@@
-180,11
+176,10
@@
static int __init ms02nv_init_one(ulong addr)
mp->resource.diag_ram = diag_res;
/* User-available general-purpose NVRAM area. */
mp->resource.diag_ram = diag_res;
/* User-available general-purpose NVRAM area. */
- user_res = k
m
alloc(sizeof(*user_res), GFP_KERNEL);
+ user_res = k
z
alloc(sizeof(*user_res), GFP_KERNEL);
if (!user_res)
goto err_out_diag_res;
if (!user_res)
goto err_out_diag_res;
- memset(user_res, 0, sizeof(*user_res));
user_res->name = ms02nv_res_user_ram;
user_res->start = addr + MS02NV_RAM;
user_res->end = addr + size - 1;
user_res->name = ms02nv_res_user_ram;
user_res->start = addr + MS02NV_RAM;
user_res->end = addr + size - 1;
@@
-194,11
+189,10
@@
static int __init ms02nv_init_one(ulong addr)
mp->resource.user_ram = user_res;
/* Control and status register. */
mp->resource.user_ram = user_res;
/* Control and status register. */
- csr_res = k
m
alloc(sizeof(*csr_res), GFP_KERNEL);
+ csr_res = k
z
alloc(sizeof(*csr_res), GFP_KERNEL);
if (!csr_res)
goto err_out_user_res;
if (!csr_res)
goto err_out_user_res;
- memset(csr_res, 0, sizeof(*csr_res));
csr_res->name = ms02nv_res_csr;
csr_res->start = addr + MS02NV_CSR;
csr_res->end = addr + MS02NV_CSR + 3;
csr_res->name = ms02nv_res_csr;
csr_res->start = addr + MS02NV_CSR;
csr_res->end = addr + MS02NV_CSR + 3;
@@
-219,12
+213,13
@@
static int __init ms02nv_init_one(ulong addr)
mp->uaddr = phys_to_virt(fixaddr);
mtd->type = MTD_RAM;
mp->uaddr = phys_to_virt(fixaddr);
mtd->type = MTD_RAM;
- mtd->flags = MTD_CAP_RAM
| MTD_XIP
;
+ mtd->flags = MTD_CAP_RAM;
mtd->size = fixsize;
mtd->name = (char *)ms02nv_name;
mtd->owner = THIS_MODULE;
mtd->read = ms02nv_read;
mtd->write = ms02nv_write;
mtd->size = fixsize;
mtd->name = (char *)ms02nv_name;
mtd->owner = THIS_MODULE;
mtd->read = ms02nv_read;
mtd->write = ms02nv_write;
+ mtd->writesize = 1;
ret = -EIO;
if (add_mtd_device(mtd)) {
ret = -EIO;
if (add_mtd_device(mtd)) {
@@
-233,7
+228,7
@@
static int __init ms02nv_init_one(ulong addr)
goto err_out_csr_res;
}
goto err_out_csr_res;
}
- printk(KERN_INFO "mtd%d: %s at 0x%08lx, size %uMiB.\n",
+ printk(KERN_INFO "mtd%d: %s at 0x%08lx, size %
z
uMiB.\n",
mtd->index, ms02nv_name, addr, size >> 20);
mp->next = root_ms02nv_mtd;
mtd->index, ms02nv_name, addr, size >> 20);
mp->next = root_ms02nv_mtd;
@@
-265,7
+260,7
@@
err_out_mod_res:
static void __exit ms02nv_remove_one(void)
{
struct mtd_info *mtd = root_ms02nv_mtd;
static void __exit ms02nv_remove_one(void)
{
struct mtd_info *mtd = root_ms02nv_mtd;
- struct ms02nv_private *mp =
(struct ms02nv_private *)
mtd->priv;
+ struct ms02nv_private *mp = mtd->priv;
root_ms02nv_mtd = mp->next;
root_ms02nv_mtd = mp->next;
@@
-293,13
+288,13
@@
static int __init ms02nv_init(void)
switch (mips_machtype) {
case MACH_DS5000_200:
switch (mips_machtype) {
case MACH_DS5000_200:
- csr = (volatile u32 *)
KN02_CSR_BASE
;
+ csr = (volatile u32 *)
CKSEG1ADDR(KN02_SLOT_BASE + KN02_CSR)
;
if (*csr & KN02_CSR_BNK32M)
stride = 2;
break;
case MACH_DS5000_2X0:
case MACH_DS5900:
if (*csr & KN02_CSR_BNK32M)
stride = 2;
break;
case MACH_DS5000_2X0:
case MACH_DS5900:
- csr = (volatile u32 *)
KN03_MCR_BASE
;
+ csr = (volatile u32 *)
CKSEG1ADDR(KN03_SLOT_BASE + IOASIC_MCR)
;
if (*csr & KN03_MCR_BNK32M)
stride = 2;
break;
if (*csr & KN03_MCR_BNK32M)
stride = 2;
break;
@@
-308,7
+303,7
@@
static int __init ms02nv_init(void)
break;
}
break;
}
- for (i = 0; i <
(sizeof(ms02nv_addrs) / sizeof(*ms02nv_addrs)
); i++)
+ for (i = 0; i <
ARRAY_SIZE(ms02nv_addrs
); i++)
if (!ms02nv_init_one(ms02nv_addrs[i] << stride))
count++;
if (!ms02nv_init_one(ms02nv_addrs[i] << stride))
count++;