[MTD] Pre-CFI Sharp chip driver: Some speedups and cleanups

Remove useless udelay(100) after status value already read.  Poll
for status OK with reduced udelay if not immediate OK status return.

Fix read and compare of 32-bit status value using 16-bit variable.

Include slab.h since kmalloc/kfree are called.

Signed-off-by: Todd Poynor <tpoynor@mvista.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
Todd Poynor 2005-08-02 21:36:09 +01:00 committed by Thomas Gleixner
parent 65a8de36b4
commit 1da2c9a638

View file

@ -4,7 +4,7 @@
* Copyright 2000,2001 David A. Schleef <ds@schleef.org> * Copyright 2000,2001 David A. Schleef <ds@schleef.org>
* 2000,2001 Lineo, Inc. * 2000,2001 Lineo, Inc.
* *
* $Id: sharp.c,v 1.14 2004/08/09 13:19:43 dwmw2 Exp $ * $Id: sharp.c,v 1.15 2005/08/02 20:36:05 tpoynor Exp $
* *
* Devices supported: * Devices supported:
* LH28F016SCT Symmetrical block flash memory, 2Mx8 * LH28F016SCT Symmetrical block flash memory, 2Mx8
@ -31,6 +31,7 @@
#include <linux/mtd/cfi.h> #include <linux/mtd/cfi.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/slab.h>
#define CMD_RESET 0xffffffff #define CMD_RESET 0xffffffff
#define CMD_READ_ID 0x90909090 #define CMD_READ_ID 0x90909090
@ -214,7 +215,7 @@ static int sharp_probe_map(struct map_info *map,struct mtd_info *mtd)
/* This function returns with the chip->mutex lock held. */ /* This function returns with the chip->mutex lock held. */
static int sharp_wait(struct map_info *map, struct flchip *chip) static int sharp_wait(struct map_info *map, struct flchip *chip)
{ {
__u16 status; int status, i;
unsigned long timeo = jiffies + HZ; unsigned long timeo = jiffies + HZ;
DECLARE_WAITQUEUE(wait, current); DECLARE_WAITQUEUE(wait, current);
int adr = 0; int adr = 0;
@ -227,13 +228,11 @@ static int sharp_wait(struct map_info *map, struct flchip *chip)
map_write32(map,CMD_READ_STATUS,adr); map_write32(map,CMD_READ_STATUS,adr);
chip->state = FL_STATUS; chip->state = FL_STATUS;
case FL_STATUS: case FL_STATUS:
for(i=0;i<100;i++){
status = map_read32(map,adr); status = map_read32(map,adr);
//printk("status=%08x\n",status); if((status & SR_READY)==SR_READY)
break;
udelay(100); udelay(1);
if((status & SR_READY)!=SR_READY){
//printk(".status=%08x\n",status);
udelay(100);
} }
break; break;
default: default: