]> err.no Git - linux-2.6/blobdiff - drivers/mtd/onenand/onenand_sim.c
Char: mxser, globals cleanup
[linux-2.6] / drivers / mtd / onenand / onenand_sim.c
index dfa39dfcc1b2942a2b2d4b56a9b74a530a5870ae..d64200b7c94bfd4c0caf5dc782ba2146d0f584f9 100644 (file)
@@ -3,7 +3,7 @@
  *
  *  The OneNAND simulator
  *
- *  Copyright(C) 2005-2007 Samsung Electronics
+ *  Copyright © 2005-2007 Samsung Electronics
  *  Kyungmin Park <kyungmin.park@samsung.com>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -19,8 +19,7 @@
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/onenand.h>
 
-#include <asm/io.h>
-#include <asm/sizes.h>
+#include <linux/io.h>
 
 #ifndef CONFIG_ONENAND_SIM_MANUFACTURER
 #define CONFIG_ONENAND_SIM_MANUFACTURER         0xec
@@ -79,20 +78,21 @@ struct onenand_info {
        struct onenand_flash    flash;
 };
 
-struct onenand_info *info;
+static struct onenand_info *info;
 
 #define DPRINTK(format, args...)                                       \
 do {                                                                   \
-       printk("%s[%d]: " format "\n", __func__, __LINE__, ##args);     \
+       printk(KERN_DEBUG "%s[%d]: " format "\n", __func__,             \
+                          __LINE__, ##args);                           \
 } while (0)
 
 /**
  * onenand_lock_handle - Handle Lock scheme
- * @param this         OneNAND device structure
- * @param cmd          The command to be sent
+ * @this:              OneNAND device structure
+ * @cmd:               The command to be sent
  *
  * Send lock command to OneNAND device.
- * The lock scheme is depends on chip type.
+ * The lock scheme depends on chip type.
  */
 static void onenand_lock_handle(struct onenand_chip *this, int cmd)
 {
@@ -131,8 +131,8 @@ static void onenand_lock_handle(struct onenand_chip *this, int cmd)
 
 /**
  * onenand_bootram_handle - Handle BootRAM area
- * @param this         OneNAND device structure
- * @param cmd          The command to be sent
+ * @this:              OneNAND device structure
+ * @cmd:               The command to be sent
  *
  * Emulate BootRAM area. It is possible to do basic operation using BootRAM.
  */
@@ -153,10 +153,10 @@ static void onenand_bootram_handle(struct onenand_chip *this, int cmd)
 
 /**
  * onenand_update_interrupt - Set interrupt register
- * @param this         OneNAND device structure
- * @param cmd          The command to be sent
+ * @this:         OneNAND device structure
+ * @cmd:          The command to be sent
  *
- * Update interrupt register. The status is depends on command.
+ * Update interrupt register. The status depends on command.
  */
 static void onenand_update_interrupt(struct onenand_chip *this, int cmd)
 {
@@ -189,11 +189,12 @@ static void onenand_update_interrupt(struct onenand_chip *this, int cmd)
 }
 
 /**
- * onenand_check_overwrite - Check over-write if happend
- * @param dest         The destination pointer
- * @param src          The source pointer
- * @param count                The length to be check
- * @return             0 on same, otherwise 1
+ * onenand_check_overwrite - Check if over-write happened
+ * @dest:              The destination pointer
+ * @src:               The source pointer
+ * @count:             The length to be check
+ *
+ * Returns:            0 on same, otherwise 1
  *
  * Compare the source with destination
  */
@@ -213,10 +214,10 @@ static int onenand_check_overwrite(void *dest, void *src, size_t count)
 
 /**
  * onenand_data_handle - Handle OneNAND Core and DataRAM
- * @param this         OneNAND device structure
- * @param cmd          The command to be sent
- * @param dataram      Which dataram used
- * @param offset       The offset to OneNAND Core
+ * @this:              OneNAND device structure
+ * @cmd:               The command to be sent
+ * @dataram:           Which dataram used
+ * @offset:            The offset to OneNAND Core
  *
  * Copy data from OneNAND Core to DataRAM (read)
  * Copy data from DataRAM to OneNAND Core (write)
@@ -295,8 +296,8 @@ static void onenand_data_handle(struct onenand_chip *this, int cmd,
 
 /**
  * onenand_command_handle - Handle command
- * @param this         OneNAND device structure
- * @param cmd          The command to be sent
+ * @this:              OneNAND device structure
+ * @cmd:               The command to be sent
  *
  * Emulate OneNAND command.
  */
@@ -350,8 +351,8 @@ static void onenand_command_handle(struct onenand_chip *this, int cmd)
 
 /**
  * onenand_writew - [OneNAND Interface] Emulate write operation
- * @param value                value to write
- * @param addr         address to write
+ * @value:             value to write
+ * @addr:              address to write
  *
  * Write OneNAND register with value
  */
@@ -373,7 +374,7 @@ static void onenand_writew(unsigned short value, void __iomem * addr)
 
 /**
  * flash_init - Initialize OneNAND simulator
- * @param flash                OneNAND simulaotr data strucutres
+ * @flash:             OneNAND simulator data strucutres
  *
  * Initialize OneNAND simulator.
  */
@@ -382,9 +383,9 @@ static int __init flash_init(struct onenand_flash *flash)
        int density, size;
        int buffer_size;
 
-       flash->base = kzalloc(SZ_128K, GFP_KERNEL);
+       flash->base = kzalloc(131072, GFP_KERNEL);
        if (!flash->base) {
-               printk(KERN_ERR "Unalbe to allocate base address.\n");
+               printk(KERN_ERR "Unable to allocate base address.\n");
                return -ENOMEM;
        }
 
@@ -393,7 +394,7 @@ static int __init flash_init(struct onenand_flash *flash)
 
        ONENAND_CORE(flash) = vmalloc(size + (size >> 5));
        if (!ONENAND_CORE(flash)) {
-               printk(KERN_ERR "Unalbe to allocate nand core address.\n");
+               printk(KERN_ERR "Unable to allocate nand core address.\n");
                kfree(flash->base);
                return -ENOMEM;
        }
@@ -406,9 +407,9 @@ static int __init flash_init(struct onenand_flash *flash)
        writew(version_id, flash->base + ONENAND_REG_VERSION_ID);
 
        if (density < 2)
-               buffer_size = 0x0400;   /* 1KB page */
+               buffer_size = 0x0400;   /* 1KiB page */
        else
-               buffer_size = 0x0800;   /* 2KB page */
+               buffer_size = 0x0800;   /* 2KiB page */
        writew(buffer_size, flash->base + ONENAND_REG_DATA_BUFFER_SIZE);
 
        return 0;
@@ -416,7 +417,7 @@ static int __init flash_init(struct onenand_flash *flash)
 
 /**
  * flash_exit - Clean up OneNAND simulator
- * @param flash                OneNAND simulaotr data strucutres
+ * @flash:             OneNAND simulator data structures
  *
  * Clean up OneNAND simulator.
  */
@@ -424,7 +425,6 @@ static void flash_exit(struct onenand_flash *flash)
 {
        vfree(ONENAND_CORE(flash));
        kfree(flash->base);
-       kfree(flash);
 }
 
 static int __init onenand_sim_init(void)
@@ -449,7 +449,7 @@ static int __init onenand_sim_init(void)
        info->onenand.write_word = onenand_writew;
 
        if (flash_init(&info->flash)) {
-               printk(KERN_ERR "Unable to allocat flash.\n");
+               printk(KERN_ERR "Unable to allocate flash.\n");
                kfree(ffchars);
                kfree(info);
                return -ENOMEM;