diff options
author | Takashi Iwai <tiwai@suse.de> | 2021-07-15 09:59:17 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2021-07-19 16:17:15 +0200 |
commit | e031577eef6118bd9c4f3ec319f69986531cd32c (patch) | |
tree | 7a844cfabed65115cf5289613c9fe2545e7f1f8d /sound/isa | |
parent | ALSA: sb: Allocate resources with device-managed APIs (diff) | |
download | linux-e031577eef6118bd9c4f3ec319f69986531cd32c.tar.xz linux-e031577eef6118bd9c4f3ec319f69986531cd32c.zip |
ALSA: ad1848: Allocate resources with device-managed APIs
This patch converts the resource management in ISA ad1848 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-56-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/isa')
-rw-r--r-- | sound/isa/ad1848/ad1848.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/sound/isa/ad1848/ad1848.c b/sound/isa/ad1848/ad1848.c index edafb49797e7..c471ac2aa450 100644 --- a/sound/isa/ad1848/ad1848.c +++ b/sound/isa/ad1848/ad1848.c @@ -72,7 +72,7 @@ static int snd_ad1848_probe(struct device *dev, unsigned int n) struct snd_wss *chip; int error; - error = snd_card_new(dev, index[n], id[n], THIS_MODULE, 0, &card); + error = snd_devm_card_new(dev, index[n], id[n], THIS_MODULE, 0, &card); if (error < 0) return error; @@ -80,17 +80,17 @@ static int snd_ad1848_probe(struct device *dev, unsigned int n) thinkpad[n] ? WSS_HW_THINKPAD : WSS_HW_DETECT, 0, &chip); if (error < 0) - goto out; + return error; card->private_data = chip; error = snd_wss_pcm(chip, 0); if (error < 0) - goto out; + return error; error = snd_wss_mixer(chip); if (error < 0) - goto out; + return error; strscpy(card->driver, "AD1848", sizeof(card->driver)); strscpy(card->shortname, chip->pcm->name, sizeof(card->shortname)); @@ -106,18 +106,10 @@ static int snd_ad1848_probe(struct device *dev, unsigned int n) error = snd_card_register(card); if (error < 0) - goto out; + return error; dev_set_drvdata(dev, card); return 0; - -out: snd_card_free(card); - return error; -} - -static void snd_ad1848_remove(struct device *dev, unsigned int n) -{ - snd_card_free(dev_get_drvdata(dev)); } #ifdef CONFIG_PM @@ -145,7 +137,6 @@ static int snd_ad1848_resume(struct device *dev, unsigned int n) static struct isa_driver snd_ad1848_driver = { .match = snd_ad1848_match, .probe = snd_ad1848_probe, - .remove = snd_ad1848_remove, #ifdef CONFIG_PM .suspend = snd_ad1848_suspend, .resume = snd_ad1848_resume, |