ALSA: parisc/harmony: fix printk format warning
[linux-2.6.git] / sound / parisc / harmony.c
index 0513137..63ae0f9 100644 (file)
@@ -45,7 +45,6 @@
 #include <linux/spinlock.h>
 #include <linux/dma-mapping.h>
 
-#include <sound/driver.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/control.h>
@@ -99,32 +98,32 @@ static unsigned int rate_bits[14] = {
        HARMONY_SR_44KHZ, HARMONY_SR_48KHZ
 };
 
-static snd_pcm_hw_constraint_list_t hw_constraint_rates = {
+static struct snd_pcm_hw_constraint_list hw_constraint_rates = {
        .count = ARRAY_SIZE(snd_harmony_rates),
        .list = snd_harmony_rates,
        .mask = 0,
 };
 
-inline unsigned long
-harmony_read(harmony_t *h, unsigned r)
+static inline unsigned long
+harmony_read(struct snd_harmony *h, unsigned r)
 {
        return __raw_readl(h->iobase + r);
 }
 
-inline void
-harmony_write(harmony_t *h, unsigned r, unsigned long v)
+static inline void
+harmony_write(struct snd_harmony *h, unsigned r, unsigned long v)
 {
        __raw_writel(v, h->iobase + r);
 }
 
-static void
-harmony_wait_for_control(harmony_t *h)
+static inline void
+harmony_wait_for_control(struct snd_harmony *h)
 {
        while (harmony_read(h, HARMONY_CNTL) & HARMONY_CNTL_C) ;
 }
 
-inline void
-harmony_reset(harmony_t *h)
+static inline void
+harmony_reset(struct snd_harmony *h)
 {
        harmony_write(h, HARMONY_RESET, 1);
        mdelay(50);
@@ -132,7 +131,7 @@ harmony_reset(harmony_t *h)
 }
 
 static void
-harmony_disable_interrupts(harmony_t *h)
+harmony_disable_interrupts(struct snd_harmony *h)
 {
        u32 dstatus;
        harmony_wait_for_control(h);
@@ -142,7 +141,7 @@ harmony_disable_interrupts(harmony_t *h)
 }
 
 static void
-harmony_enable_interrupts(harmony_t *h)
+harmony_enable_interrupts(struct snd_harmony *h)
 {
        u32 dstatus;
        harmony_wait_for_control(h);
@@ -152,7 +151,7 @@ harmony_enable_interrupts(harmony_t *h)
 }
 
 static void
-harmony_mute(harmony_t *h)
+harmony_mute(struct snd_harmony *h)
 {
        unsigned long flags;
 
@@ -163,7 +162,7 @@ harmony_mute(harmony_t *h)
 }
 
 static void
-harmony_unmute(harmony_t *h)
+harmony_unmute(struct snd_harmony *h)
 {
        unsigned long flags;
 
@@ -174,7 +173,7 @@ harmony_unmute(harmony_t *h)
 }
 
 static void
-harmony_set_control(harmony_t *h)
+harmony_set_control(struct snd_harmony *h)
 {
        u32 ctrl;
        unsigned long flags;
@@ -193,10 +192,10 @@ harmony_set_control(harmony_t *h)
 }
 
 static irqreturn_t
-snd_harmony_interrupt(int irq, void *dev, struct pt_regs *regs)
+snd_harmony_interrupt(int irq, void *dev)
 {
        u32 dstatus;
-       harmony_t *h = dev;
+       struct snd_harmony *h = dev;
 
        spin_lock(&h->lock);
        harmony_disable_interrupts(h);
@@ -261,7 +260,7 @@ snd_harmony_rate_bits(int rate)
        return HARMONY_SR_44KHZ;
 }
 
-static snd_pcm_hardware_t snd_harmony_playback =
+static struct snd_pcm_hardware snd_harmony_playback =
 {
        .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 
                 SNDRV_PCM_INFO_JOINT_DUPLEX | SNDRV_PCM_INFO_MMAP_VALID |
@@ -282,7 +281,7 @@ static snd_pcm_hardware_t snd_harmony_playback =
        .fifo_size = 0,
 };
 
-static snd_pcm_hardware_t snd_harmony_capture =
+static struct snd_pcm_hardware snd_harmony_capture =
 {
         .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
                  SNDRV_PCM_INFO_JOINT_DUPLEX | SNDRV_PCM_INFO_MMAP_VALID |
@@ -304,9 +303,9 @@ static snd_pcm_hardware_t snd_harmony_capture =
 };
 
 static int
-snd_harmony_playback_trigger(snd_pcm_substream_t *ss, int cmd)
+snd_harmony_playback_trigger(struct snd_pcm_substream *ss, int cmd)
 {
-       harmony_t *h = snd_pcm_substream_chip(ss);
+       struct snd_harmony *h = snd_pcm_substream_chip(ss);
 
        if (h->st.capturing)
                return -EBUSY;
@@ -340,9 +339,9 @@ snd_harmony_playback_trigger(snd_pcm_substream_t *ss, int cmd)
 }
 
 static int
-snd_harmony_capture_trigger(snd_pcm_substream_t *ss, int cmd)
+snd_harmony_capture_trigger(struct snd_pcm_substream *ss, int cmd)
 {
-        harmony_t *h = snd_pcm_substream_chip(ss);
+        struct snd_harmony *h = snd_pcm_substream_chip(ss);
 
        if (h->st.playing)
                return -EBUSY;
@@ -376,7 +375,7 @@ snd_harmony_capture_trigger(snd_pcm_substream_t *ss, int cmd)
 }
 
 static int
-snd_harmony_set_data_format(harmony_t *h, int fmt, int force)
+snd_harmony_set_data_format(struct snd_harmony *h, int fmt, int force)
 {
        int o = h->st.format;
        int n;
@@ -406,10 +405,10 @@ snd_harmony_set_data_format(harmony_t *h, int fmt, int force)
 }
 
 static int
-snd_harmony_playback_prepare(snd_pcm_substream_t *ss)
+snd_harmony_playback_prepare(struct snd_pcm_substream *ss)
 {
-       harmony_t *h = snd_pcm_substream_chip(ss);
-       snd_pcm_runtime_t *rt = ss->runtime;
+       struct snd_harmony *h = snd_pcm_substream_chip(ss);
+       struct snd_pcm_runtime *rt = ss->runtime;
        
        if (h->st.capturing)
                return -EBUSY;
@@ -436,10 +435,10 @@ snd_harmony_playback_prepare(snd_pcm_substream_t *ss)
 }
 
 static int
-snd_harmony_capture_prepare(snd_pcm_substream_t *ss)
+snd_harmony_capture_prepare(struct snd_pcm_substream *ss)
 {
-        harmony_t *h = snd_pcm_substream_chip(ss);
-        snd_pcm_runtime_t *rt = ss->runtime;
+        struct snd_harmony *h = snd_pcm_substream_chip(ss);
+        struct snd_pcm_runtime *rt = ss->runtime;
 
        if (h->st.playing)
                return -EBUSY;
@@ -466,10 +465,10 @@ snd_harmony_capture_prepare(snd_pcm_substream_t *ss)
 }
 
 static snd_pcm_uframes_t 
-snd_harmony_playback_pointer(snd_pcm_substream_t *ss)
+snd_harmony_playback_pointer(struct snd_pcm_substream *ss)
 {
-       snd_pcm_runtime_t *rt = ss->runtime;
-       harmony_t *h = snd_pcm_substream_chip(ss);
+       struct snd_pcm_runtime *rt = ss->runtime;
+       struct snd_harmony *h = snd_pcm_substream_chip(ss);
        unsigned long pcuradd;
        unsigned long played;
 
@@ -495,10 +494,10 @@ snd_harmony_playback_pointer(snd_pcm_substream_t *ss)
 }
 
 static snd_pcm_uframes_t
-snd_harmony_capture_pointer(snd_pcm_substream_t *ss)
+snd_harmony_capture_pointer(struct snd_pcm_substream *ss)
 {
-        snd_pcm_runtime_t *rt = ss->runtime;
-        harmony_t *h = snd_pcm_substream_chip(ss);
+        struct snd_pcm_runtime *rt = ss->runtime;
+        struct snd_harmony *h = snd_pcm_substream_chip(ss);
         unsigned long rcuradd;
         unsigned long caught;
 
@@ -524,10 +523,10 @@ snd_harmony_capture_pointer(snd_pcm_substream_t *ss)
 }
 
 static int 
-snd_harmony_playback_open(snd_pcm_substream_t *ss)
+snd_harmony_playback_open(struct snd_pcm_substream *ss)
 {
-       harmony_t *h = snd_pcm_substream_chip(ss);
-       snd_pcm_runtime_t *rt = ss->runtime;
+       struct snd_harmony *h = snd_pcm_substream_chip(ss);
+       struct snd_pcm_runtime *rt = ss->runtime;
        int err;
        
        h->psubs = ss;
@@ -543,10 +542,10 @@ snd_harmony_playback_open(snd_pcm_substream_t *ss)
 }
 
 static int
-snd_harmony_capture_open(snd_pcm_substream_t *ss)
+snd_harmony_capture_open(struct snd_pcm_substream *ss)
 {
-        harmony_t *h = snd_pcm_substream_chip(ss);
-        snd_pcm_runtime_t *rt = ss->runtime;
+        struct snd_harmony *h = snd_pcm_substream_chip(ss);
+        struct snd_pcm_runtime *rt = ss->runtime;
         int err;
 
         h->csubs = ss;
@@ -562,27 +561,27 @@ snd_harmony_capture_open(snd_pcm_substream_t *ss)
 }
 
 static int 
-snd_harmony_playback_close(snd_pcm_substream_t *ss)
+snd_harmony_playback_close(struct snd_pcm_substream *ss)
 {
-       harmony_t *h = snd_pcm_substream_chip(ss);
+       struct snd_harmony *h = snd_pcm_substream_chip(ss);
        h->psubs = NULL;
        return 0;
 }
 
 static int
-snd_harmony_capture_close(snd_pcm_substream_t *ss)
+snd_harmony_capture_close(struct snd_pcm_substream *ss)
 {
-        harmony_t *h = snd_pcm_substream_chip(ss);
+        struct snd_harmony *h = snd_pcm_substream_chip(ss);
         h->csubs = NULL;
         return 0;
 }
 
 static int 
-snd_harmony_hw_params(snd_pcm_substream_t *ss,
-                     snd_pcm_hw_params_t *hw)
+snd_harmony_hw_params(struct snd_pcm_substream *ss,
+                     struct snd_pcm_hw_params *hw)
 {
        int err;
-       harmony_t *h = snd_pcm_substream_chip(ss);
+       struct snd_harmony *h = snd_pcm_substream_chip(ss);
        
        err = snd_pcm_lib_malloc_pages(ss, params_buffer_bytes(hw));
        if (err > 0 && h->dma.type == SNDRV_DMA_TYPE_CONTINUOUS)
@@ -592,12 +591,12 @@ snd_harmony_hw_params(snd_pcm_substream_t *ss,
 }
 
 static int 
-snd_harmony_hw_free(snd_pcm_substream_t *ss) 
+snd_harmony_hw_free(struct snd_pcm_substream *ss) 
 {
        return snd_pcm_lib_free_pages(ss);
 }
 
-static snd_pcm_ops_t snd_harmony_playback_ops = {
+static struct snd_pcm_ops snd_harmony_playback_ops = {
        .open = snd_harmony_playback_open,
        .close = snd_harmony_playback_close,
        .ioctl = snd_pcm_lib_ioctl,
@@ -608,7 +607,7 @@ static snd_pcm_ops_t snd_harmony_playback_ops = {
        .pointer = snd_harmony_playback_pointer,
 };
 
-static snd_pcm_ops_t snd_harmony_capture_ops = {
+static struct snd_pcm_ops snd_harmony_capture_ops = {
         .open = snd_harmony_capture_open,
         .close = snd_harmony_capture_close,
         .ioctl = snd_pcm_lib_ioctl,
@@ -620,9 +619,9 @@ static snd_pcm_ops_t snd_harmony_capture_ops = {
 };
 
 static int 
-snd_harmony_pcm_init(harmony_t *h)
+snd_harmony_pcm_init(struct snd_harmony *h)
 {
-       snd_pcm_t *pcm;
+       struct snd_pcm *pcm;
        int err;
 
        harmony_disable_interrupts(h);
@@ -683,15 +682,15 @@ snd_harmony_pcm_init(harmony_t *h)
 }
 
 static void 
-snd_harmony_set_new_gain(harmony_t *h)
+snd_harmony_set_new_gain(struct snd_harmony *h)
 {
        harmony_wait_for_control(h);
        harmony_write(h, HARMONY_GAINCTL, h->st.gain);
 }
 
 static int 
-snd_harmony_mixercontrol_info(snd_kcontrol_t *kc, 
-                             snd_ctl_elem_info_t *uinfo)
+snd_harmony_mixercontrol_info(struct snd_kcontrol *kc, 
+                             struct snd_ctl_elem_info *uinfo)
 {
        int mask = (kc->private_value >> 16) & 0xff;
        int left_shift = (kc->private_value) & 0xff;
@@ -707,10 +706,10 @@ snd_harmony_mixercontrol_info(snd_kcontrol_t *kc,
 }
 
 static int 
-snd_harmony_volume_get(snd_kcontrol_t *kc, 
-                      snd_ctl_elem_value_t *ucontrol)
+snd_harmony_volume_get(struct snd_kcontrol *kc, 
+                      struct snd_ctl_elem_value *ucontrol)
 {
-       harmony_t *h = snd_kcontrol_chip(kc);
+       struct snd_harmony *h = snd_kcontrol_chip(kc);
        int shift_left = (kc->private_value) & 0xff;
        int shift_right = (kc->private_value >> 8) & 0xff;
        int mask = (kc->private_value >> 16) & 0xff;
@@ -736,10 +735,10 @@ snd_harmony_volume_get(snd_kcontrol_t *kc,
 }  
 
 static int 
-snd_harmony_volume_put(snd_kcontrol_t *kc, 
-                      snd_ctl_elem_value_t *ucontrol)
+snd_harmony_volume_put(struct snd_kcontrol *kc, 
+                      struct snd_ctl_elem_value *ucontrol)
 {
-       harmony_t *h = snd_kcontrol_chip(kc);
+       struct snd_harmony *h = snd_kcontrol_chip(kc);
        int shift_left = (kc->private_value) & 0xff;
        int shift_right = (kc->private_value >> 8) & 0xff;
        int mask = (kc->private_value >> 16) & 0xff;
@@ -771,8 +770,8 @@ snd_harmony_volume_put(snd_kcontrol_t *kc,
 }
 
 static int 
-snd_harmony_captureroute_info(snd_kcontrol_t *kc, 
-                             snd_ctl_elem_info_t *uinfo)
+snd_harmony_captureroute_info(struct snd_kcontrol *kc, 
+                             struct snd_ctl_elem_info *uinfo)
 {
        static char *texts[2] = { "Line", "Mic" };
        uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
@@ -786,10 +785,10 @@ snd_harmony_captureroute_info(snd_kcontrol_t *kc,
 }
 
 static int 
-snd_harmony_captureroute_get(snd_kcontrol_t *kc, 
-                            snd_ctl_elem_value_t *ucontrol)
+snd_harmony_captureroute_get(struct snd_kcontrol *kc, 
+                            struct snd_ctl_elem_value *ucontrol)
 {
-       harmony_t *h = snd_kcontrol_chip(kc);
+       struct snd_harmony *h = snd_kcontrol_chip(kc);
        int value;
        
        spin_lock_irq(&h->mixer_lock);
@@ -803,10 +802,10 @@ snd_harmony_captureroute_get(snd_kcontrol_t *kc,
 }  
 
 static int 
-snd_harmony_captureroute_put(snd_kcontrol_t *kc, 
-                            snd_ctl_elem_value_t *ucontrol)
+snd_harmony_captureroute_put(struct snd_kcontrol *kc, 
+                            struct snd_ctl_elem_value *ucontrol)
 {
-       harmony_t *h = snd_kcontrol_chip(kc);
+       struct snd_harmony *h = snd_kcontrol_chip(kc);
        int value;
        int old_gain = h->st.gain;
        
@@ -823,8 +822,7 @@ snd_harmony_captureroute_put(snd_kcontrol_t *kc,
        return h->st.gain != old_gain;
 }
 
-#define HARMONY_CONTROLS (sizeof(snd_harmony_controls)/ \
-                          sizeof(snd_kcontrol_new_t))
+#define HARMONY_CONTROLS       ARRAY_SIZE(snd_harmony_controls)
 
 #define HARMONY_VOLUME(xname, left_shift, right_shift, mask, invert) \
 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,                \
@@ -833,7 +831,7 @@ snd_harmony_captureroute_put(snd_kcontrol_t *kc,
   .private_value = ((left_shift) | ((right_shift) << 8) |            \
                    ((mask) << 16) | ((invert) << 24)) }
 
-static snd_kcontrol_new_t snd_harmony_controls[] = {
+static struct snd_kcontrol_new snd_harmony_controls[] = {
        HARMONY_VOLUME("Master Playback Volume", HARMONY_GAIN_LO_SHIFT, 
                       HARMONY_GAIN_RO_SHIFT, HARMONY_GAIN_OUT, 1),
        HARMONY_VOLUME("Capture Volume", HARMONY_GAIN_LI_SHIFT,
@@ -855,8 +853,8 @@ static snd_kcontrol_new_t snd_harmony_controls[] = {
                       HARMONY_GAIN_HE_SHIFT, 1, 0),
 };
 
-static void __init 
-snd_harmony_mixer_reset(harmony_t *h)
+static void __devinit
+snd_harmony_mixer_reset(struct snd_harmony *h)
 {
        harmony_mute(h);
        harmony_reset(h);
@@ -864,13 +862,14 @@ snd_harmony_mixer_reset(harmony_t *h)
        harmony_unmute(h);
 }
 
-static int __init 
-snd_harmony_mixer_init(harmony_t *h)
+static int __devinit
+snd_harmony_mixer_init(struct snd_harmony *h)
 {
-       snd_card_t *card = h->card;
+       struct snd_card *card = h->card;
        int idx, err;
 
-       snd_assert(h != NULL, return -EINVAL);
+       if (snd_BUG_ON(!h))
+               return -EINVAL;
        strcpy(card->mixername, "Harmony Gain control interface");
 
        for (idx = 0; idx < HARMONY_CONTROLS; idx++) {
@@ -886,7 +885,7 @@ snd_harmony_mixer_init(harmony_t *h)
 }
 
 static int
-snd_harmony_free(harmony_t *h)
+snd_harmony_free(struct snd_harmony *h)
 {
         if (h->gdma.addr)
                 snd_dma_free_pages(&h->gdma);
@@ -906,20 +905,20 @@ snd_harmony_free(harmony_t *h)
 }
 
 static int
-snd_harmony_dev_free(snd_device_t *dev)
+snd_harmony_dev_free(struct snd_device *dev)
 {
-       harmony_t *h = dev->device_data;
+       struct snd_harmony *h = dev->device_data;
        return snd_harmony_free(h);
 }
 
 static int __devinit
-snd_harmony_create(snd_card_t *card, 
+snd_harmony_create(struct snd_card *card, 
                   struct parisc_device *padev, 
-                  harmony_t **rchip)
+                  struct snd_harmony **rchip)
 {
        int err;
-       harmony_t *h;
-       static snd_device_ops_t ops = {
+       struct snd_harmony *h;
+       static struct snd_device_ops ops = {
                .dev_free = snd_harmony_dev_free,
        };
 
@@ -936,7 +935,7 @@ snd_harmony_create(snd_card_t *card,
        h->iobase = ioremap_nocache(padev->hpa.start, HARMONY_SIZE);
        if (h->iobase == NULL) {
                printk(KERN_ERR PFX "unable to remap hpa 0x%lx\n",
-                      padev->hpa.start);
+                      (unsigned long)padev->hpa.start);
                err = -EBUSY;
                goto free_and_ret;
        }
@@ -973,12 +972,12 @@ static int __devinit
 snd_harmony_probe(struct parisc_device *padev)
 {
        int err;
-       snd_card_t *card;
-       harmony_t *h;
+       struct snd_card *card;
+       struct snd_harmony *h;
 
-       card = snd_card_new(index, id, THIS_MODULE, 0);
-       if (card == NULL)
-               return -ENOMEM;
+       err = snd_card_create(index, id, THIS_MODULE, 0, &card);
+       if (err < 0)
+               return err;
 
        err = snd_harmony_create(card, padev, &h);
        if (err < 0)
@@ -1033,7 +1032,7 @@ alsa_harmony_init(void)
 static void __exit
 alsa_harmony_fini(void)
 {
-       return unregister_parisc_driver(&snd_harmony_driver);
+       unregister_parisc_driver(&snd_harmony_driver);
 }
 
 MODULE_LICENSE("GPL");