[PATCH] trivial iomem annotations: istallion
[powerpc.git] / sound / ppc / tumbler.c
index 15c63cb..2fbe1d1 100644 (file)
@@ -28,7 +28,6 @@
 #include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/i2c.h>
-#include <linux/i2c-dev.h>
 #include <linux/kmod.h>
 #include <linux/slab.h>
 #include <linux/interrupt.h>
@@ -191,7 +190,7 @@ static int check_audio_gpio(struct pmac_gpio *gp)
 
        ret = do_gpio_read(gp);
 
-       return (ret & 0xd) == (gp->active_val & 0xd);
+       return (ret & 0x1) == (gp->active_val & 0x1);
 }
 
 static int read_audio_gpio(struct pmac_gpio *gp)
@@ -199,7 +198,8 @@ static int read_audio_gpio(struct pmac_gpio *gp)
        int ret;
        if (! gp->addr)
                return 0;
-       ret = ((do_gpio_read(gp) & 0x02) !=0);
+       ret = do_gpio_read(gp);
+       ret = (ret & 0x02) !=0;
        return ret == gp->active_state;
 }
 
@@ -239,8 +239,8 @@ static int tumbler_set_master_volume(struct pmac_tumbler *mix)
        block[4] = (right_vol >> 8)  & 0xff;
        block[5] = (right_vol >> 0)  & 0xff;
   
-       if (i2c_smbus_write_block_data(mix->i2c.client, TAS_REG_VOL,
-                                      6, block) < 0) {
+       if (i2c_smbus_write_i2c_block_data(mix->i2c.client, TAS_REG_VOL, 6,
+                                          block) < 0) {
                snd_printk("failed to set volume \n");
                return -EINVAL;
        }
@@ -345,8 +345,8 @@ static int tumbler_set_drc(struct pmac_tumbler *mix)
                val[1] = 0;
        }
 
-       if (i2c_smbus_write_block_data(mix->i2c.client, TAS_REG_DRC,
-                                      2, val) < 0) {
+       if (i2c_smbus_write_i2c_block_data(mix->i2c.client, TAS_REG_DRC,
+                                          2, val) < 0) {
                snd_printk("failed to set DRC\n");
                return -EINVAL;
        }
@@ -381,8 +381,8 @@ static int snapper_set_drc(struct pmac_tumbler *mix)
        val[4] = 0x60;
        val[5] = 0xa0;
 
-       if (i2c_smbus_write_block_data(mix->i2c.client, TAS_REG_DRC,
-                                      6, val) < 0) {
+       if (i2c_smbus_write_i2c_block_data(mix->i2c.client, TAS_REG_DRC,
+                                          6, val) < 0) {
                snd_printk("failed to set DRC\n");
                return -EINVAL;
        }
@@ -492,8 +492,8 @@ static int tumbler_set_mono_volume(struct pmac_tumbler *mix,
        vol = info->table[vol];
        for (i = 0; i < info->bytes; i++)
                block[i] = (vol >> ((info->bytes - i - 1) * 8)) & 0xff;
-       if (i2c_smbus_write_block_data(mix->i2c.client, info->reg,
-                                      info->bytes, block) < 0) {
+       if (i2c_smbus_write_i2c_block_data(mix->i2c.client, info->reg,
+                                          info->bytes, block) < 0) {
                snd_printk("failed to set mono volume %d\n", info->index);
                return -EINVAL;
        }
@@ -625,7 +625,8 @@ static int snapper_set_mix_vol1(struct pmac_tumbler *mix, int idx, int ch, int r
                for (j = 0; j < 3; j++)
                        block[i * 3 + j] = (vol >> ((2 - j) * 8)) & 0xff;
        }
-       if (i2c_smbus_write_block_data(mix->i2c.client, reg, 9, block) < 0) {
+       if (i2c_smbus_write_i2c_block_data(mix->i2c.client, reg,
+                                          9, block) < 0) {
                snd_printk("failed to set mono volume %d\n", reg);
                return -EINVAL;
        }
@@ -1016,7 +1017,7 @@ static void tumbler_update_automute(struct snd_pmac *chip, int do_notify)
 
 
 /* interrupt - headphone plug changed */
-static irqreturn_t headphone_intr(int irq, void *devid, struct pt_regs *regs)
+static irqreturn_t headphone_intr(int irq, void *devid)
 {
        struct snd_pmac *chip = devid;
        if (chip->update_automute && chip->initialized) {
@@ -1035,7 +1036,7 @@ static struct device_node *find_audio_device(const char *name)
                return NULL;
   
        for (np = np->child; np; np = np->sibling) {
-               char *property = get_property(np, "audio-gpio", NULL);
+               const char *property = get_property(np, "audio-gpio", NULL);
                if (property && strcmp(property, name) == 0)
                        return np;
        }  
@@ -1062,7 +1063,8 @@ static long tumbler_find_device(const char *device, const char *platform,
                                struct pmac_gpio *gp, int is_compatible)
 {
        struct device_node *node;
-       u32 *base, addr;
+       const u32 *base;
+       u32 addr;
 
        if (is_compatible)
                node = find_compatible_audio_device(device);
@@ -1074,9 +1076,9 @@ static long tumbler_find_device(const char *device, const char *platform,
                return -ENODEV;
        }
 
-       base = (u32 *)get_property(node, "AAPL,address", NULL);
+       base = get_property(node, "AAPL,address", NULL);
        if (! base) {
-               base = (u32 *)get_property(node, "reg", NULL);
+               base = get_property(node, "reg", NULL);
                if (!base) {
                        DBG("(E) cannot find address for device %s !\n", device);
                        snd_printd("cannot find address for device %s\n", device);
@@ -1090,13 +1092,13 @@ static long tumbler_find_device(const char *device, const char *platform,
 
        gp->addr = addr & 0x0000ffff;
        /* Try to find the active state, default to 0 ! */
-       base = (u32 *)get_property(node, "audio-gpio-active-state", NULL);
+       base = get_property(node, "audio-gpio-active-state", NULL);
        if (base) {
                gp->active_state = *base;
                gp->active_val = (*base) ? 0x5 : 0x4;
                gp->inactive_val = (*base) ? 0x4 : 0x5;
        } else {
-               u32 *prop = NULL;
+               const u32 *prop = NULL;
                gp->active_state = 0;
                gp->active_val = 0x4;
                gp->inactive_val = 0x5;
@@ -1105,7 +1107,7 @@ static long tumbler_find_device(const char *device, const char *platform,
                 * as we don't yet have an interpreter for these things
                 */
                if (platform)
-                       prop = (u32 *)get_property(node, platform, NULL);
+                       prop = get_property(node, platform, NULL);
                if (prop) {
                        if (prop[3] == 0x9 && prop[4] == 0x9) {
                                gp->active_val = 0xd;
@@ -1121,7 +1123,7 @@ static long tumbler_find_device(const char *device, const char *platform,
        DBG("(I) GPIO device %s found, offset: %x, active state: %d !\n",
            device, gp->addr, gp->active_state);
 
-       return (node->n_intrs > 0) ? node->intrs[0].line : 0;
+       return irq_of_parse_and_map(node, 0);
 }
 
 /* reset audio */
@@ -1264,16 +1266,16 @@ static int __init tumbler_init(struct snd_pmac *chip)
                                    &mix->line_mute, 1);
        irq = tumbler_find_device("headphone-detect",
                                  NULL, &mix->hp_detect, 0);
-       if (irq < 0)
+       if (irq <= NO_IRQ)
                irq = tumbler_find_device("headphone-detect",
                                          NULL, &mix->hp_detect, 1);
-       if (irq < 0)
+       if (irq <= NO_IRQ)
                irq = tumbler_find_device("keywest-gpio15",
                                          NULL, &mix->hp_detect, 1);
        mix->headphone_irq = irq;
        irq = tumbler_find_device("line-output-detect",
                                  NULL, &mix->line_detect, 0);
-       if (irq < 0)
+       if (irq <= NO_IRQ)
                irq = tumbler_find_device("line-output-detect",
                                          NULL, &mix->line_detect, 1);
        mix->lineout_irq = irq;
@@ -1313,13 +1315,12 @@ int __init snd_pmac_tumbler_init(struct snd_pmac *chip)
 
 #ifdef CONFIG_KMOD
        if (current->fs->root)
-               request_module("i2c-keywest");
+               request_module("i2c-powermac");
 #endif /* CONFIG_KMOD */       
 
-       mix = kmalloc(sizeof(*mix), GFP_KERNEL);
+       mix = kzalloc(sizeof(*mix), GFP_KERNEL);
        if (! mix)
                return -ENOMEM;
-       memset(mix, 0, sizeof(*mix));
        mix->headphone_irq = -1;
 
        chip->mixer_data = mix;