aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/sound/pci/cs5535audio/cs5535audio_olpc.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2021-07-15 09:58:53 +0200
committerTakashi Iwai <tiwai@suse.de>2021-07-19 16:16:55 +0200
commit5eba4c646dfe3d8bdb8b86df64e84f836ed992f4 (patch)
tree24ba9b6e9ce5a6288ffba464549ce0b14b872dc9 /sound/pci/cs5535audio/cs5535audio_olpc.c
parentALSA: cs46xx: Allocate resources with device-managed APIs (diff)
downloadwireguard-linux-5eba4c646dfe3d8bdb8b86df64e84f836ed992f4.tar.xz
wireguard-linux-5eba4c646dfe3d8bdb8b86df64e84f836ed992f4.zip
ALSA: cs5535audio: Allocate resources with device-managed APIs
This patch converts the resource management in PCI cs5535audio driver with devres as a clean up. Each manual resource management is converted with the corresponding devres helper, and the card object release is managed now via card->private_free instead of a lowlevel snd_device. A slight uncertain change is the call of olpc_quirks_cleanup() at removal: formerly this was called unconditionally at remove, but this should be a conditionally call, hence the machine_is_olpc() check is added here as well. This should give no user-visible functional changes. Link: https://lore.kernel.org/r/20210715075941.23332-32-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/cs5535audio/cs5535audio_olpc.c')
-rw-r--r--sound/pci/cs5535audio/cs5535audio_olpc.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sound/pci/cs5535audio/cs5535audio_olpc.c b/sound/pci/cs5535audio/cs5535audio_olpc.c
index 110d3209441b..122170a410d9 100644
--- a/sound/pci/cs5535audio/cs5535audio_olpc.c
+++ b/sound/pci/cs5535audio/cs5535audio_olpc.c
@@ -171,10 +171,8 @@ int olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97)
for (i = 0; i < ARRAY_SIZE(olpc_cs5535audio_ctls); i++) {
err = snd_ctl_add(card, snd_ctl_new1(&olpc_cs5535audio_ctls[i],
ac97->private_data));
- if (err < 0) {
- gpio_free(OLPC_GPIO_MIC_AC);
+ if (err < 0)
return err;
- }
}
/* turn off the mic by default */
@@ -184,5 +182,6 @@ int olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97)
void olpc_quirks_cleanup(void)
{
- gpio_free(OLPC_GPIO_MIC_AC);
+ if (machine_is_olpc())
+ gpio_free(OLPC_GPIO_MIC_AC);
}