Merge git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus
[sfrench/cifs-2.6.git] / sound / ppc / beep.c
index 5f38f670102c8940bedc6d90b56d5e8be32e754b..baa2a7237370af2db7a0160e8bcc5502b82b945f 100644 (file)
@@ -18,7 +18,6 @@
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
 
-#include <sound/driver.h>
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <linux/init.h>
@@ -118,7 +117,7 @@ static int snd_pmac_beep_event(struct input_dev *dev, unsigned int type,
        default: return -1;
        }
 
-       chip = dev->private;
+       chip = input_get_drvdata(dev);
        if (! chip || (beep = chip->beep) == NULL)
                return -1;
 
@@ -195,10 +194,13 @@ static int snd_pmac_put_beep(struct snd_kcontrol *kcontrol,
                             struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
-       int oval;
+       unsigned int oval, nval;
        snd_assert(chip->beep, return -ENXIO);
        oval = chip->beep->volume;
-       chip->beep->volume = ucontrol->value.integer.value[0];
+       nval = ucontrol->value.integer.value[0];
+       if (nval > 100)
+               return -EINVAL;
+       chip->beep->volume = nval;
        return oval != chip->beep->volume;
 }
 
@@ -236,11 +238,11 @@ int __init snd_pmac_attach_beep(struct snd_pmac *chip)
        input_dev->id.product = 0x0001;
        input_dev->id.version = 0x0100;
 
-       input_dev->evbit[0] = BIT(EV_SND);
-       input_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE);
+       input_dev->evbit[0] = BIT_MASK(EV_SND);
+       input_dev->sndbit[0] = BIT_MASK(SND_BELL) | BIT_MASK(SND_TONE);
        input_dev->event = snd_pmac_beep_event;
-       input_dev->private = chip;
-       input_dev->cdev.dev = &chip->pdev->dev;
+       input_dev->dev.parent = &chip->pdev->dev;
+       input_set_drvdata(input_dev, chip);
 
        beep->dev = input_dev;
        beep->buf = dmabuf;
@@ -251,8 +253,8 @@ int __init snd_pmac_attach_beep(struct snd_pmac *chip)
        err = snd_ctl_add(chip->card, beep_ctl);
        if (err < 0)
                goto fail1;
-       chip->beep = beep;
+
+       chip->beep = beep;
 
        err = input_register_device(beep->dev);
        if (err)