summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/arm/pxa2xx-ac97.c8
-rw-r--r--sound/core/init.c14
-rw-r--r--sound/core/sound.c2
-rw-r--r--sound/oss/soundcard.c4
-rw-r--r--sound/pci/ac97/ac97_bus.c6
-rw-r--r--sound/ppc/beep.c66
-rw-r--r--sound/sound_core.c2
7 files changed, 53 insertions, 49 deletions
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c
index 38b20ef..877bb00 100644
--- a/sound/arm/pxa2xx-ac97.c
+++ b/sound/arm/pxa2xx-ac97.c
@@ -275,23 +275,23 @@ static int pxa2xx_ac97_do_resume(snd_card_t *card)
return 0;
}
-static int pxa2xx_ac97_suspend(struct device *_dev, pm_message_t state, u32 level)
+static int pxa2xx_ac97_suspend(struct device *_dev, pm_message_t state)
{
snd_card_t *card = dev_get_drvdata(_dev);
int ret = 0;
- if (card && level == SUSPEND_DISABLE)
+ if (card)
ret = pxa2xx_ac97_do_suspend(card, PMSG_SUSPEND);
return ret;
}
-static int pxa2xx_ac97_resume(struct device *_dev, u32 level)
+static int pxa2xx_ac97_resume(struct device *_dev)
{
snd_card_t *card = dev_get_drvdata(_dev);
int ret = 0;
- if (card && level == RESUME_ENABLE)
+ if (card)
ret = pxa2xx_ac97_do_resume(card);
return ret;
diff --git a/sound/core/init.c b/sound/core/init.c
index c72a791..59202de 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -676,8 +676,8 @@ struct snd_generic_device {
#define SND_GENERIC_NAME "snd_generic"
#ifdef CONFIG_PM
-static int snd_generic_suspend(struct device *dev, pm_message_t state, u32 level);
-static int snd_generic_resume(struct device *dev, u32 level);
+static int snd_generic_suspend(struct device *dev, pm_message_t state);
+static int snd_generic_resume(struct device *dev);
#endif
/* initialized in sound.c */
@@ -818,13 +818,10 @@ int snd_card_set_pm_callback(snd_card_t *card,
#ifdef CONFIG_SND_GENERIC_DRIVER
/* suspend/resume callbacks for snd_generic platform device */
-static int snd_generic_suspend(struct device *dev, pm_message_t state, u32 level)
+static int snd_generic_suspend(struct device *dev, pm_message_t state)
{
snd_card_t *card;
- if (level != SUSPEND_DISABLE)
- return 0;
-
card = get_snd_generic_card(dev);
if (card->power_state == SNDRV_CTL_POWER_D3hot)
return 0;
@@ -834,13 +831,10 @@ static int snd_generic_suspend(struct device *dev, pm_message_t state, u32 level
return 0;
}
-static int snd_generic_resume(struct device *dev, u32 level)
+static int snd_generic_resume(struct device *dev)
{
snd_card_t *card;
- if (level != RESUME_ENABLE)
- return 0;
-
card = get_snd_generic_card(dev);
if (card->power_state == SNDRV_CTL_POWER_D0)
return 0;
diff --git a/sound/core/sound.c b/sound/core/sound.c
index 9e76bdd..b57519a 100644
--- a/sound/core/sound.c
+++ b/sound/core/sound.c
@@ -231,7 +231,7 @@ int snd_register_device(int type, snd_card_t * card, int dev, snd_minor_t * reg,
devfs_mk_cdev(MKDEV(major, minor), S_IFCHR | device_mode, "snd/%s", name);
if (card)
device = card->dev;
- class_device_create(sound_class, MKDEV(major, minor), device, "%s", name);
+ class_device_create(sound_class, NULL, MKDEV(major, minor), device, "%s", name);
up(&sound_mutex);
return 0;
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c
index 95fa81e..d33bb46 100644
--- a/sound/oss/soundcard.c
+++ b/sound/oss/soundcard.c
@@ -567,7 +567,7 @@ static int __init oss_init(void)
devfs_mk_cdev(MKDEV(SOUND_MAJOR, dev_list[i].minor),
S_IFCHR | dev_list[i].mode,
"sound/%s", dev_list[i].name);
- class_device_create(sound_class,
+ class_device_create(sound_class, NULL,
MKDEV(SOUND_MAJOR, dev_list[i].minor),
NULL, "%s", dev_list[i].name);
@@ -579,7 +579,7 @@ static int __init oss_init(void)
dev_list[i].minor + (j*0x10)),
S_IFCHR | dev_list[i].mode,
"sound/%s%d", dev_list[i].name, j);
- class_device_create(sound_class,
+ class_device_create(sound_class, NULL,
MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10)),
NULL, "%s%d", dev_list[i].name, j);
}
diff --git a/sound/pci/ac97/ac97_bus.c b/sound/pci/ac97/ac97_bus.c
index becbc42..ec70fad 100644
--- a/sound/pci/ac97/ac97_bus.c
+++ b/sound/pci/ac97/ac97_bus.c
@@ -31,7 +31,8 @@ static int ac97_bus_suspend(struct device *dev, pm_message_t state)
int ret = 0;
if (dev->driver && dev->driver->suspend)
- ret = dev->driver->suspend(dev, state, SUSPEND_POWER_DOWN);
+ ret = dev->driver->suspend(dev, state);
+
return ret;
}
@@ -40,7 +41,8 @@ static int ac97_bus_resume(struct device *dev)
int ret = 0;
if (dev->driver && dev->driver->resume)
- ret = dev->driver->resume(dev, RESUME_POWER_ON);
+ ret = dev->driver->resume(dev);
+
return ret;
}
diff --git a/sound/ppc/beep.c b/sound/ppc/beep.c
index 31ea7a4..1681ee1 100644
--- a/sound/ppc/beep.c
+++ b/sound/ppc/beep.c
@@ -31,14 +31,14 @@
#include "pmac.h"
struct snd_pmac_beep {
- int running; /* boolean */
- int volume; /* mixer volume: 0-100 */
+ int running; /* boolean */
+ int volume; /* mixer volume: 0-100 */
int volume_play; /* currently playing volume */
int hz;
int nsamples;
short *buf; /* allocated wave buffer */
dma_addr_t addr; /* physical address of buffer */
- struct input_dev dev;
+ struct input_dev *dev;
};
/*
@@ -212,47 +212,55 @@ static snd_kcontrol_new_t snd_pmac_beep_mixer = {
int __init snd_pmac_attach_beep(pmac_t *chip)
{
pmac_beep_t *beep;
- int err;
+ struct input_dev *input_dev;
+ void *dmabuf;
+ int err = -ENOMEM;
- beep = kmalloc(sizeof(*beep), GFP_KERNEL);
- if (! beep)
- return -ENOMEM;
-
- memset(beep, 0, sizeof(*beep));
- beep->buf = dma_alloc_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4,
- &beep->addr, GFP_KERNEL);
-
- beep->dev.evbit[0] = BIT(EV_SND);
- beep->dev.sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE);
- beep->dev.event = snd_pmac_beep_event;
- beep->dev.private = chip;
+ beep = kzalloc(sizeof(*beep), GFP_KERNEL);
+ dmabuf = dma_alloc_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4,
+ &beep->addr, GFP_KERNEL);
+ input_dev = input_allocate_device();
+ if (!beep || !dmabuf || !input_dev)
+ goto fail;
/* FIXME: set more better values */
- beep->dev.name = "PowerMac Beep";
- beep->dev.phys = "powermac/beep";
- beep->dev.id.bustype = BUS_ADB;
- beep->dev.id.vendor = 0x001f;
- beep->dev.id.product = 0x0001;
- beep->dev.id.version = 0x0100;
+ input_dev->name = "PowerMac Beep";
+ input_dev->phys = "powermac/beep";
+ input_dev->id.bustype = BUS_ADB;
+ input_dev->id.vendor = 0x001f;
+ 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->event = snd_pmac_beep_event;
+ input_dev->private = chip;
+ input_dev->cdev.dev = &chip->pdev->dev;
+ beep->dev = input_dev;
+ beep->buf = dmabuf;
beep->volume = BEEP_VOLUME;
beep->running = 0;
- if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_pmac_beep_mixer, chip))) < 0) {
- kfree(beep->buf);
- kfree(beep);
- return err;
- }
+
+ err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_pmac_beep_mixer, chip));
+ if (err < 0)
+ goto fail;
chip->beep = beep;
- input_register_device(&beep->dev);
+ input_register_device(beep->dev);
return 0;
+
+ fail: input_free_device(input_dev);
+ kfree(dmabuf);
+ kfree(beep);
+ return err;
}
void snd_pmac_detach_beep(pmac_t *chip)
{
if (chip->beep) {
- input_unregister_device(&chip->beep->dev);
+ input_unregister_device(chip->beep->dev);
dma_free_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4,
chip->beep->buf, chip->beep->addr);
kfree(chip->beep);
diff --git a/sound/sound_core.c b/sound/sound_core.c
index 954f994..394b53e 100644
--- a/sound/sound_core.c
+++ b/sound/sound_core.c
@@ -174,7 +174,7 @@ static int sound_insert_unit(struct sound_unit **list, struct file_operations *f
devfs_mk_cdev(MKDEV(SOUND_MAJOR, s->unit_minor),
S_IFCHR | mode, s->name);
- class_device_create(sound_class, MKDEV(SOUND_MAJOR, s->unit_minor),
+ class_device_create(sound_class, NULL, MKDEV(SOUND_MAJOR, s->unit_minor),
dev, s->name+6);
return r;
OpenPOWER on IntegriCloud