[alsa-devel] [PATCH 9/9] ALSA: hda - Drop codec driver module refcounting
Takashi Iwai
tiwai at suse.de
Fri Feb 27 23:55:44 CET 2015
Since we have a full safe control of codec driver bind/unbind, we can
lower the safety bar -- the module refcount from the controller
driver. This have always annoyed some people because it interferes
rmmod in the order of lsmod (due to the reversed dependency).
Signed-off-by: Takashi Iwai <tiwai at suse.de>
---
sound/pci/hda/hda_bind.c | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/sound/pci/hda/hda_bind.c b/sound/pci/hda/hda_bind.c
index ba1adbf0f85f..529aec82d3b2 100644
--- a/sound/pci/hda/hda_bind.c
+++ b/sound/pci/hda/hda_bind.c
@@ -91,7 +91,6 @@ static int codec_refresh_name(struct hda_codec *codec, const char *name)
static int hda_codec_driver_probe(struct device *dev)
{
struct hda_codec *codec = dev_to_hda_codec(dev);
- struct module *owner = dev->driver->owner;
int err;
if (WARN_ON(!codec->preset))
@@ -101,35 +100,27 @@ static int hda_codec_driver_probe(struct device *dev)
if (err < 0)
goto error;
- if (!try_module_get(owner)) {
- err = -EINVAL;
- goto error;
- }
-
err = snd_hda_regmap_init(codec);
if (err < 0)
goto error;
err = codec->preset->patch(codec);
if (err < 0)
- goto error_module;
+ goto error;
err = snd_hda_codec_build_pcms(codec);
if (err < 0)
- goto error_module;
+ goto error;
err = snd_hda_codec_build_controls(codec);
if (err < 0)
- goto error_module;
+ goto error;
if (codec->card->registered) {
err = snd_card_register(codec->card);
if (err < 0)
- goto error_module;
+ goto error;
}
return 0;
- error_module:
- module_put(owner);
-
error:
snd_hda_codec_cleanup_for_unbind(codec);
snd_hda_regmap_exit(codec);
@@ -144,7 +135,6 @@ static int hda_codec_driver_remove(struct device *dev)
codec->patch_ops.free(codec);
snd_hda_codec_cleanup_for_unbind(codec);
snd_hda_regmap_exit(codec);
- module_put(dev->driver->owner);
return 0;
}
--
2.3.0
More information about the Alsa-devel
mailing list