From 22c1090f91c625ea0922df56653758c142234271 Mon Sep 17 00:00:00 2001 From: blogic Date: Sat, 28 Jun 2008 17:28:31 +0000 Subject: add proper ebu locking to ifxmips git-svn-id: svn://svn.openwrt.org/openwrt/trunk@11597 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ifxmips/files/drivers/mtd/maps/ifxmips.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'target/linux/ifxmips/files/drivers') diff --git a/target/linux/ifxmips/files/drivers/mtd/maps/ifxmips.c b/target/linux/ifxmips/files/drivers/mtd/maps/ifxmips.c index b38c6269b..808904a56 100644 --- a/target/linux/ifxmips/files/drivers/mtd/maps/ifxmips.c +++ b/target/linux/ifxmips/files/drivers/mtd/maps/ifxmips.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -41,19 +42,23 @@ ifxmips_map = { static map_word ifxmips_read16(struct map_info * map, unsigned long adr) { + unsigned long flags; map_word temp; - + spin_lock_irqsave(&ebu_lock, flags); adr ^= 2; temp.x[0] = *((__u16 *) (map->virt + adr)); - + spin_unlock_irqrestore(&ebu_lock, flags); return temp; } static void ifxmips_write16(struct map_info *map, map_word d, unsigned long adr) { + unsigned long flags; + spin_lock_irqsave(&ebu_lock, flags); adr ^= 2; *((__u16 *) (map->virt + adr)) = d.x[0]; + spin_unlock_irqrestore(&ebu_lock, flags); } void @@ -61,12 +66,14 @@ ifxmips_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t le { unsigned char *p; unsigned char *to_8; - + unsigned long flags; + spin_lock_irqsave(&ebu_lock, flags); from = (unsigned long)(from + map->virt); p = (unsigned char*) from; to_8 = (unsigned char*) to; while(len--) *to_8++ = *p++; + spin_unlock_irqrestore(&ebu_lock, flags); } void @@ -74,12 +81,14 @@ ifxmips_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_ { unsigned char *p = (unsigned char*)from; unsigned char *to_8; - + unsigned long flags; + spin_lock_irqsave(&ebu_lock, flags); to += (unsigned long) map->virt; to_8 = (unsigned char*)to; while(len--){ *p++ = *to_8++; } + spin_unlock_irqrestore(&ebu_lock, flags); } static struct mtd_partition -- cgit v1.2.3