eeprom: at24: coding style fixes
[cascardo/linux.git] / drivers / misc / eeprom / at24.c
index 9ceb63b..564a201 100644 (file)
@@ -111,23 +111,23 @@ MODULE_PARM_DESC(write_timeout, "Time (in ms) to try writes (default 25)");
 
 static const struct i2c_device_id at24_ids[] = {
        /* needs 8 addresses as A0-A2 are ignored */
-       { "24c00", AT24_DEVICE_MAGIC(128 / 8, AT24_FLAG_TAKE8ADDR) },
+       { "24c00",      AT24_DEVICE_MAGIC(128 / 8,      AT24_FLAG_TAKE8ADDR) },
        /* old variants can't be handled with this generic entry! */
-       { "24c01", AT24_DEVICE_MAGIC(1024 / 8, 0) },
-       { "24c02", AT24_DEVICE_MAGIC(2048 / 8, 0) },
+       { "24c01",      AT24_DEVICE_MAGIC(1024 / 8,     0) },
+       { "24c02",      AT24_DEVICE_MAGIC(2048 / 8,     0) },
        /* spd is a 24c02 in memory DIMMs */
-       { "spd", AT24_DEVICE_MAGIC(2048 / 8,
-               AT24_FLAG_READONLY | AT24_FLAG_IRUGO) },
-       { "24c04", AT24_DEVICE_MAGIC(4096 / 8, 0) },
+       { "spd",        AT24_DEVICE_MAGIC(2048 / 8,
+                               AT24_FLAG_READONLY | AT24_FLAG_IRUGO) },
+       { "24c04",      AT24_DEVICE_MAGIC(4096 / 8,     0) },
        /* 24rf08 quirk is handled at i2c-core */
-       { "24c08", AT24_DEVICE_MAGIC(8192 / 8, 0) },
-       { "24c16", AT24_DEVICE_MAGIC(16384 / 8, 0) },
-       { "24c32", AT24_DEVICE_MAGIC(32768 / 8, AT24_FLAG_ADDR16) },
-       { "24c64", AT24_DEVICE_MAGIC(65536 / 8, AT24_FLAG_ADDR16) },
-       { "24c128", AT24_DEVICE_MAGIC(131072 / 8, AT24_FLAG_ADDR16) },
-       { "24c256", AT24_DEVICE_MAGIC(262144 / 8, AT24_FLAG_ADDR16) },
-       { "24c512", AT24_DEVICE_MAGIC(524288 / 8, AT24_FLAG_ADDR16) },
-       { "24c1024", AT24_DEVICE_MAGIC(1048576 / 8, AT24_FLAG_ADDR16) },
+       { "24c08",      AT24_DEVICE_MAGIC(8192 / 8,     0) },
+       { "24c16",      AT24_DEVICE_MAGIC(16384 / 8,    0) },
+       { "24c32",      AT24_DEVICE_MAGIC(32768 / 8,    AT24_FLAG_ADDR16) },
+       { "24c64",      AT24_DEVICE_MAGIC(65536 / 8,    AT24_FLAG_ADDR16) },
+       { "24c128",     AT24_DEVICE_MAGIC(131072 / 8,   AT24_FLAG_ADDR16) },
+       { "24c256",     AT24_DEVICE_MAGIC(262144 / 8,   AT24_FLAG_ADDR16) },
+       { "24c512",     AT24_DEVICE_MAGIC(524288 / 8,   AT24_FLAG_ADDR16) },
+       { "24c1024",    AT24_DEVICE_MAGIC(1048576 / 8,  AT24_FLAG_ADDR16) },
        { "at24", 0 },
        { /* END OF LIST */ }
 };
@@ -147,7 +147,7 @@ MODULE_DEVICE_TABLE(acpi, at24_acpi_ids);
  * Assumes that sanity checks for offset happened at sysfs-layer.
  */
 static struct i2c_client *at24_translate_offset(struct at24_data *at24,
-               unsigned *offset)
+                                               unsigned int *offset)
 {
        unsigned i;
 
@@ -163,7 +163,7 @@ static struct i2c_client *at24_translate_offset(struct at24_data *at24,
 }
 
 static ssize_t at24_eeprom_read(struct at24_data *at24, char *buf,
-               unsigned offset, size_t count)
+                               unsigned int offset, size_t count)
 {
        struct i2c_msg msg[2];
        u8 msgbuf[2];
@@ -249,38 +249,6 @@ static ssize_t at24_eeprom_read(struct at24_data *at24, char *buf,
        return -ETIMEDOUT;
 }
 
-static int at24_read(void *priv, unsigned int off, void *val, size_t count)
-{
-       struct at24_data *at24 = priv;
-       char *buf = val;
-
-       if (unlikely(!count))
-               return count;
-
-       /*
-        * Read data from chip, protecting against concurrent updates
-        * from this host, but not from other I2C masters.
-        */
-       mutex_lock(&at24->lock);
-
-       while (count) {
-               int     status;
-
-               status = at24_eeprom_read(at24, buf, off, count);
-               if (status < 0) {
-                       mutex_unlock(&at24->lock);
-                       return status;
-               }
-               buf += status;
-               off += status;
-               count -= status;
-       }
-
-       mutex_unlock(&at24->lock);
-
-       return 0;
-}
-
 /*
  * Note that if the hardware write-protect pin is pulled high, the whole
  * chip is normally write protected. But there are plenty of product
@@ -290,7 +258,7 @@ static int at24_read(void *priv, unsigned int off, void *val, size_t count)
  * writes at most one page.
  */
 static ssize_t at24_eeprom_write(struct at24_data *at24, const char *buf,
-               unsigned offset, size_t count)
+                                unsigned int offset, size_t count)
 {
        struct i2c_client *client;
        struct i2c_msg msg;
@@ -366,6 +334,38 @@ static ssize_t at24_eeprom_write(struct at24_data *at24, const char *buf,
        return -ETIMEDOUT;
 }
 
+static int at24_read(void *priv, unsigned int off, void *val, size_t count)
+{
+       struct at24_data *at24 = priv;
+       char *buf = val;
+
+       if (unlikely(!count))
+               return count;
+
+       /*
+        * Read data from chip, protecting against concurrent updates
+        * from this host, but not from other I2C masters.
+        */
+       mutex_lock(&at24->lock);
+
+       while (count) {
+               int     status;
+
+               status = at24_eeprom_read(at24, buf, off, count);
+               if (status < 0) {
+                       mutex_unlock(&at24->lock);
+                       return status;
+               }
+               buf += status;
+               off += status;
+               count -= status;
+       }
+
+       mutex_unlock(&at24->lock);
+
+       return 0;
+}
+
 static int at24_write(void *priv, unsigned int off, void *val, size_t count)
 {
        struct at24_data *at24 = priv;
@@ -400,7 +400,7 @@ static int at24_write(void *priv, unsigned int off, void *val, size_t count)
 
 #ifdef CONFIG_OF
 static void at24_get_ofdata(struct i2c_client *client,
-               struct at24_platform_data *chip)
+                           struct at24_platform_data *chip)
 {
        const __be32 *val;
        struct device_node *node = client->dev.of_node;
@@ -415,7 +415,7 @@ static void at24_get_ofdata(struct i2c_client *client,
 }
 #else
 static void at24_get_ofdata(struct i2c_client *client,
-               struct at24_platform_data *chip)
+                           struct at24_platform_data *chip)
 { }
 #endif /* CONFIG_OF */