From db0a5214b8d6cc7a90ce3336d24a85b90cbb4e67 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 9 Sep 2014 17:17:20 +0200 Subject: ALSA: vx: Use nonatomic PCM ops Rewrite VXpocket and VX222 drivers to use the new PCM nonatomic ops. The former irq tasklet is replaced with a threaded irq handler, and the tasklet for the PCM delayed start is simply merged into the normal PCM trigger, as well as the replacement of spinlock with mutex. Signed-off-by: Takashi Iwai --- sound/pcmcia/vx/vxp_ops.c | 10 ++++------ sound/pcmcia/vx/vxpocket.c | 13 +++++++++---- 2 files changed, 13 insertions(+), 10 deletions(-) (limited to 'sound/pcmcia/vx') diff --git a/sound/pcmcia/vx/vxp_ops.c b/sound/pcmcia/vx/vxp_ops.c index fe33e122e372..281972913c32 100644 --- a/sound/pcmcia/vx/vxp_ops.c +++ b/sound/pcmcia/vx/vxp_ops.c @@ -468,12 +468,11 @@ static void vxp_write_codec_reg(struct vx_core *chip, int codec, unsigned int da void vx_set_mic_boost(struct vx_core *chip, int boost) { struct snd_vxpocket *pchip = (struct snd_vxpocket *)chip; - unsigned long flags; if (chip->chip_status & VX_STAT_IS_STALE) return; - spin_lock_irqsave(&chip->lock, flags); + mutex_lock(&chip->lock); if (pchip->regCDSP & P24_CDSP_MICS_SEL_MASK) { if (boost) { /* boost: 38 dB */ @@ -486,7 +485,7 @@ void vx_set_mic_boost(struct vx_core *chip, int boost) } vx_outb(chip, CDSP, pchip->regCDSP); } - spin_unlock_irqrestore(&chip->lock, flags); + mutex_unlock(&chip->lock); } /* @@ -511,17 +510,16 @@ static int vx_compute_mic_level(int level) void vx_set_mic_level(struct vx_core *chip, int level) { struct snd_vxpocket *pchip = (struct snd_vxpocket *)chip; - unsigned long flags; if (chip->chip_status & VX_STAT_IS_STALE) return; - spin_lock_irqsave(&chip->lock, flags); + mutex_lock(&chip->lock); if (pchip->regCDSP & VXP_CDSP_MIC_SEL_MASK) { level = vx_compute_mic_level(level); vx_outb(chip, MICRO, level); } - spin_unlock_irqrestore(&chip->lock, flags); + mutex_unlock(&chip->lock); } diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c index 786e7e139c9e..92ec11456e3a 100644 --- a/sound/pcmcia/vx/vxpocket.c +++ b/sound/pcmcia/vx/vxpocket.c @@ -62,6 +62,7 @@ static unsigned int card_alloc; */ static void vxpocket_release(struct pcmcia_device *link) { + free_irq(link->irq, link->priv); pcmcia_disable_device(link); } @@ -227,11 +228,13 @@ static int vxpocket_config(struct pcmcia_device *link) ret = pcmcia_request_io(link); if (ret) - goto failed; + goto failed_preirq; - ret = pcmcia_request_irq(link, snd_vx_irq_handler); + ret = request_threaded_irq(link->irq, snd_vx_irq_handler, + snd_vx_threaded_irq_handler, + IRQF_SHARED, link->devname, link->priv); if (ret) - goto failed; + goto failed_preirq; ret = pcmcia_enable_device(link); if (ret) @@ -245,7 +248,9 @@ static int vxpocket_config(struct pcmcia_device *link) return 0; -failed: + failed: + free_irq(link->irq, link->priv); +failed_preirq: pcmcia_disable_device(link); return -ENODEV; } -- cgit v1.2.3-70-g09d2