aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/es1688/es1688_lib.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2021-07-15 09:59:24 +0200
committerTakashi Iwai <tiwai@suse.de>2021-07-19 16:17:20 +0200
commit1bb11c1c7f6e264a737b30c667c3c84fbe511d98 (patch)
tree1951dfc613380be046813a16217e3f4e9cc78dca /sound/isa/es1688/es1688_lib.c
parentALSA: cs423x: Allocate resources with device-managed APIs (diff)
downloadlinux-dev-1bb11c1c7f6e264a737b30c667c3c84fbe511d98.tar.xz
linux-dev-1bb11c1c7f6e264a737b30c667c3c84fbe511d98.zip
ALSA: es1688: Allocate resources with device-managed APIs
This patch converts the resource management in ISA es1688 driver with devres as a clean up. Each manual resource management is converted with the corresponding devres helper. The remove callback became superfluous and dropped. This should give no user-visible functional changes. Link: https://lore.kernel.org/r/20210715075941.23332-63-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to '')
-rw-r--r--sound/isa/es1688/es1688_lib.c29
1 files changed, 9 insertions, 20 deletions
diff --git a/sound/isa/es1688/es1688_lib.c b/sound/isa/es1688/es1688_lib.c
index 8554cb2263c1..9cd66b236cef 100644
--- a/sound/isa/es1688/es1688_lib.c
+++ b/sound/isa/es1688/es1688_lib.c
@@ -580,13 +580,6 @@ static int snd_es1688_free(struct snd_es1688 *chip)
{
if (chip->hardware != ES1688_HW_UNDEF)
snd_es1688_init(chip, 0);
- release_and_free_resource(chip->res_port);
- if (chip->irq >= 0)
- free_irq(chip->irq, (void *) chip);
- if (chip->dma8 >= 0) {
- disable_dma(chip->dma8);
- free_dma(chip->dma8);
- }
return 0;
}
@@ -624,26 +617,25 @@ int snd_es1688_create(struct snd_card *card,
chip->dma8 = -1;
chip->hardware = ES1688_HW_UNDEF;
- chip->res_port = request_region(port + 4, 12, "ES1688");
- if (chip->res_port == NULL) {
+ if (!devm_request_region(card->dev, port + 4, 12, "ES1688")) {
snd_printk(KERN_ERR "es1688: can't grab port 0x%lx\n", port + 4);
- err = -EBUSY;
- goto exit;
+ return -EBUSY;
}
- err = request_irq(irq, snd_es1688_interrupt, 0, "ES1688", (void *) chip);
+ err = devm_request_irq(card->dev, irq, snd_es1688_interrupt, 0,
+ "ES1688", (void *) chip);
if (err < 0) {
snd_printk(KERN_ERR "es1688: can't grab IRQ %d\n", irq);
- goto exit;
+ return err;
}
chip->irq = irq;
card->sync_irq = chip->irq;
- err = request_dma(dma8, "ES1688");
+ err = snd_devm_request_dma(card->dev, dma8, "ES1688");
if (err < 0) {
snd_printk(KERN_ERR "es1688: can't grab DMA8 %d\n", dma8);
- goto exit;
+ return err;
}
chip->dma8 = dma8;
@@ -659,17 +651,14 @@ int snd_es1688_create(struct snd_card *card,
err = snd_es1688_probe(chip);
if (err < 0)
- goto exit;
+ return err;
err = snd_es1688_init(chip, 1);
if (err < 0)
- goto exit;
+ return err;
/* Register device */
err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
-exit:
- if (err)
- snd_es1688_free(chip);
return err;
}