[ARM] 5544/1: Trust PrimeCell resource sizes
[safe/jmp/linux-2.6] / sound / arm / aaci.c
index 3b73ba7..dc78272 100644 (file)
@@ -23,7 +23,6 @@
 #include <asm/irq.h>
 #include <asm/sizes.h>
 
-#include <sound/driver.h>
 #include <sound/core.h>
 #include <sound/initval.h>
 #include <sound/ac97_codec.h>
@@ -91,7 +90,7 @@ static void aaci_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
         */
        do {
                v = readl(aaci->base + AACI_SLFR);
-       } while ((v & (SLFR_1TXB|SLFR_2TXB)) && timeout--);
+       } while ((v & (SLFR_1TXB|SLFR_2TXB)) && --timeout);
 
        if (!timeout)
                dev_err(&aaci->dev->dev,
@@ -127,7 +126,7 @@ static unsigned short aaci_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
         */
        do {
                v = readl(aaci->base + AACI_SLFR);
-       } while ((v & SLFR_1TXB) && timeout--);
+       } while ((v & SLFR_1TXB) && --timeout);
 
        if (!timeout) {
                dev_err(&aaci->dev->dev, "timeout on slot 1 TX busy\n");
@@ -148,7 +147,7 @@ static unsigned short aaci_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
        do {
                cond_resched();
                v = readl(aaci->base + AACI_SLFR) & (SLFR_1RXV|SLFR_2RXV);
-       } while ((v != (SLFR_1RXV|SLFR_2RXV)) && timeout--);
+       } while ((v != (SLFR_1RXV|SLFR_2RXV)) && --timeout);
 
        if (!timeout) {
                dev_err(&aaci->dev->dev, "timeout on RX valid\n");
@@ -996,11 +995,12 @@ static struct aaci * __devinit aaci_init_card(struct amba_device *dev)
 {
        struct aaci *aaci;
        struct snd_card *card;
+       int err;
 
-       card = snd_card_new(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
-                           THIS_MODULE, sizeof(struct aaci));
-       if (card == NULL)
-               return ERR_PTR(-ENOMEM);
+       err = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
+                             THIS_MODULE, sizeof(struct aaci), &card);
+       if (err < 0)
+               return NULL;
 
        card->private_free = aaci_free_card;
 
@@ -1074,7 +1074,7 @@ static unsigned int __devinit aaci_size_fifo(struct aaci *aaci)
        return i;
 }
 
-static int __devinit aaci_probe(struct amba_device *dev, void *id)
+static int __devinit aaci_probe(struct amba_device *dev, struct amba_id *id)
 {
        struct aaci *aaci;
        int ret, i;
@@ -1084,12 +1084,12 @@ static int __devinit aaci_probe(struct amba_device *dev, void *id)
                return ret;
 
        aaci = aaci_init_card(dev);
-       if (IS_ERR(aaci)) {
-               ret = PTR_ERR(aaci);
+       if (!aaci) {
+               ret = -ENOMEM;
                goto out;
        }
 
-       aaci->base = ioremap(dev->res.start, SZ_4K);
+       aaci->base = ioremap(dev->res.start, resource_size(&dev->res));
        if (!aaci->base) {
                ret = -ENOMEM;
                goto out;