diff options
Diffstat (limited to 'sound/oss')
-rw-r--r-- | sound/oss/ad1848.c | 1 | ||||
-rw-r--r-- | sound/oss/au1550_ac97.c | 29 | ||||
-rw-r--r-- | sound/oss/cs4281/cs4281m.c | 1 | ||||
-rw-r--r-- | sound/oss/maestro.c | 1 | ||||
-rw-r--r-- | sound/oss/nm256_audio.c | 1 | ||||
-rw-r--r-- | sound/oss/opl3sa2.c | 18 |
6 files changed, 32 insertions, 19 deletions
diff --git a/sound/oss/ad1848.c b/sound/oss/ad1848.c index 7c835abd99b..3f30c57676c 100644 --- a/sound/oss/ad1848.c +++ b/sound/oss/ad1848.c @@ -47,6 +47,7 @@ #include <linux/module.h> #include <linux/stddef.h> #include <linux/pm.h> +#include <linux/pm_legacy.h> #include <linux/isapnp.h> #include <linux/pnp.h> #include <linux/spinlock.h> diff --git a/sound/oss/au1550_ac97.c b/sound/oss/au1550_ac97.c index 6b46a8a4b1c..b963c550dae 100644 --- a/sound/oss/au1550_ac97.c +++ b/sound/oss/au1550_ac97.c @@ -578,17 +578,15 @@ set_recv_slots(int num_channels) } while ((stat & PSC_AC97STAT_DR) == 0); } +/* Hold spinlock for both start_dac() and start_adc() calls */ static void start_dac(struct au1550_state *s) { struct dmabuf *db = &s->dma_dac; - unsigned long flags; if (!db->stopped) return; - spin_lock_irqsave(&s->lock, flags); - set_xmit_slots(db->num_channels); au_writel(PSC_AC97PCR_TC, PSC_AC97PCR); au_sync(); @@ -598,8 +596,6 @@ start_dac(struct au1550_state *s) au1xxx_dbdma_start(db->dmanr); db->stopped = 0; - - spin_unlock_irqrestore(&s->lock, flags); } static void @@ -718,7 +714,6 @@ prog_dmabuf_dac(struct au1550_state *s) } -/* hold spinlock for the following */ static void dac_dma_interrupt(int irq, void *dev_id, struct pt_regs *regs) { @@ -726,6 +721,8 @@ dac_dma_interrupt(int irq, void *dev_id, struct pt_regs *regs) struct dmabuf *db = &s->dma_dac; u32 ac97c_stat; + spin_lock(&s->lock); + ac97c_stat = au_readl(PSC_AC97STAT); if (ac97c_stat & (AC97C_XU | AC97C_XO | AC97C_TE)) pr_debug("AC97C status = 0x%08x\n", ac97c_stat); @@ -747,6 +744,8 @@ dac_dma_interrupt(int irq, void *dev_id, struct pt_regs *regs) /* wake up anybody listening */ if (waitqueue_active(&db->wait)) wake_up(&db->wait); + + spin_unlock(&s->lock); } @@ -758,6 +757,8 @@ adc_dma_interrupt(int irq, void *dev_id, struct pt_regs *regs) u32 obytes; char *obuf; + spin_lock(&s->lock); + /* Pull the buffer from the dma queue. */ au1xxx_dbdma_get_dest(dp->dmanr, (void *)(&obuf), &obytes); @@ -765,6 +766,7 @@ adc_dma_interrupt(int irq, void *dev_id, struct pt_regs *regs) if ((dp->count + obytes) > dp->dmasize) { /* Overrun. Stop ADC and log the error */ + spin_unlock(&s->lock); stop_adc(s); dp->error++; err("adc overrun"); @@ -787,6 +789,7 @@ adc_dma_interrupt(int irq, void *dev_id, struct pt_regs *regs) if (waitqueue_active(&dp->wait)) wake_up(&dp->wait); + spin_unlock(&s->lock); } static loff_t @@ -1048,9 +1051,9 @@ au1550_read(struct file *file, char *buffer, size_t count, loff_t *ppos) /* wait for samples in ADC dma buffer */ do { + spin_lock_irqsave(&s->lock, flags); if (db->stopped) start_adc(s); - spin_lock_irqsave(&s->lock, flags); avail = db->count; if (avail <= 0) __set_current_state(TASK_INTERRUPTIBLE); @@ -1570,15 +1573,19 @@ au1550_ioctl(struct inode *inode, struct file *file, unsigned int cmd, if (get_user(val, (int *) arg)) return -EFAULT; if (file->f_mode & FMODE_READ) { - if (val & PCM_ENABLE_INPUT) + if (val & PCM_ENABLE_INPUT) { + spin_lock_irqsave(&s->lock, flags); start_adc(s); - else + spin_unlock_irqrestore(&s->lock, flags); + } else stop_adc(s); } if (file->f_mode & FMODE_WRITE) { - if (val & PCM_ENABLE_OUTPUT) + if (val & PCM_ENABLE_OUTPUT) { + spin_lock_irqsave(&s->lock, flags); start_dac(s); - else + spin_unlock_irqrestore(&s->lock, flags); + } else stop_dac(s); } return 0; diff --git a/sound/oss/cs4281/cs4281m.c b/sound/oss/cs4281/cs4281m.c index d0d3963e1b8..adc689649fe 100644 --- a/sound/oss/cs4281/cs4281m.c +++ b/sound/oss/cs4281/cs4281m.c @@ -298,6 +298,7 @@ struct cs4281_state { struct cs4281_pipeline pl[CS4281_NUMBER_OF_PIPELINES]; }; +#include <linux/pm_legacy.h> #include "cs4281pm-24.c" #if CSDEBUG diff --git a/sound/oss/maestro.c b/sound/oss/maestro.c index 3dce504e6d6..3abd3541cbc 100644 --- a/sound/oss/maestro.c +++ b/sound/oss/maestro.c @@ -231,6 +231,7 @@ #include <asm/uaccess.h> #include <linux/pm.h> +#include <linux/pm_legacy.h> static int maestro_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *d); #include "maestro.h" diff --git a/sound/oss/nm256_audio.c b/sound/oss/nm256_audio.c index 66970062eb3..0ce2c404a73 100644 --- a/sound/oss/nm256_audio.c +++ b/sound/oss/nm256_audio.c @@ -25,6 +25,7 @@ #include <linux/kernel.h> #include <linux/module.h> #include <linux/pm.h> +#include <linux/pm_legacy.h> #include <linux/delay.h> #include <linux/spinlock.h> #include "sound_config.h" diff --git a/sound/oss/opl3sa2.c b/sound/oss/opl3sa2.c index 2efbd865109..cd41d0e4706 100644 --- a/sound/oss/opl3sa2.c +++ b/sound/oss/opl3sa2.c @@ -70,6 +70,7 @@ #include <linux/module.h> #include <linux/delay.h> #include <linux/pm.h> +#include <linux/pm_legacy.h> #include "sound_config.h" #include "ad1848.h" @@ -138,7 +139,7 @@ typedef struct { struct pnp_dev* pdev; int activated; /* Whether said devices have been activated */ #endif -#ifdef CONFIG_PM +#ifdef CONFIG_PM_LEGACY unsigned int in_suspend; struct pm_dev *pmdev; #endif @@ -341,7 +342,7 @@ static void opl3sa2_mixer_reset(opl3sa2_state_t* devc) } /* Currently only used for power management */ -#ifdef CONFIG_PM +#ifdef CONFIG_PM_LEGACY static void opl3sa2_mixer_restore(opl3sa2_state_t* devc) { if (devc) { @@ -354,7 +355,7 @@ static void opl3sa2_mixer_restore(opl3sa2_state_t* devc) } } } -#endif +#endif /* CONFIG_PM_LEGACY */ static inline void arg_to_vol_mono(unsigned int vol, int* value) { @@ -831,7 +832,8 @@ static struct pnp_driver opl3sa2_driver = { /* End of component functions */ -#ifdef CONFIG_PM +#ifdef CONFIG_PM_LEGACY + static DEFINE_SPINLOCK(opl3sa2_lock); /* Power Management support functions */ @@ -906,7 +908,7 @@ static int opl3sa2_pm_callback(struct pm_dev *pdev, pm_request_t rqst, void *dat } return 0; } -#endif /* CONFIG_PM */ +#endif /* CONFIG_PM_LEGACY */ /* * Install OPL3-SA2 based card(s). @@ -1019,12 +1021,12 @@ static int __init init_opl3sa2(void) /* ewww =) */ opl3sa2_state[card].card = card; -#ifdef CONFIG_PM +#ifdef CONFIG_PM_LEGACY /* register our power management capabilities */ opl3sa2_state[card].pmdev = pm_register(PM_ISA_DEV, card, opl3sa2_pm_callback); if (opl3sa2_state[card].pmdev) opl3sa2_state[card].pmdev->data = &opl3sa2_state[card]; -#endif /* CONFIG_PM */ +#endif /* CONFIG_PM_LEGACY */ /* * Set the Yamaha 3D enhancement mode (aka Ymersion) if asked to and @@ -1081,7 +1083,7 @@ static void __exit cleanup_opl3sa2(void) int card; for(card = 0; card < opl3sa2_cards_num; card++) { -#ifdef CONFIG_PM +#ifdef CONFIG_PM_LEGACY if (opl3sa2_state[card].pmdev) pm_unregister(opl3sa2_state[card].pmdev); #endif |