]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ALSA: hda/ca0110: Rewrite to new probe method
authorTakashi Iwai <tiwai@suse.de>
Wed, 9 Jul 2025 16:04:17 +0000 (18:04 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 11 Jul 2025 07:55:37 +0000 (09:55 +0200)
Convert the CA0110 codec driver to use the new hda_codec_ops probe.
No functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250709160434.1859-15-tiwai@suse.de
sound/hda/codecs/ca0110.c

index 0353544435b9ade1a9cff70d59dab69be2e5401d..c75a9ff9460dd83b9e2aa992bcc8b2d2093c5a34 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * HD audio interface patch for Creative X-Fi CA0110-IBG chip
+ * HD audio codec driver for Creative X-Fi CA0110-IBG chip
  *
  * Copyright (c) 2008 Takashi Iwai <tiwai@suse.de>
  */
 #include "hda_jack.h"
 #include "generic.h"
 
-
-static const struct hda_codec_ops ca0110_patch_ops = {
-       .build_controls = snd_hda_gen_build_controls,
-       .build_pcms = snd_hda_gen_build_pcms,
-       .init = snd_hda_gen_init,
-       .free = snd_hda_gen_free,
-       .unsol_event = snd_hda_jack_unsol_event,
-};
-
 static int ca0110_parse_auto_config(struct hda_codec *codec)
 {
        struct hda_gen_spec *spec = codec->spec;
@@ -39,8 +30,7 @@ static int ca0110_parse_auto_config(struct hda_codec *codec)
        return 0;
 }
 
-
-static int patch_ca0110(struct hda_codec *codec)
+static int ca0110_probe(struct hda_codec *codec, const struct hda_device_id *id)
 {
        struct hda_gen_spec *spec;
        int err;
@@ -50,7 +40,6 @@ static int patch_ca0110(struct hda_codec *codec)
                return -ENOMEM;
        snd_hda_gen_spec_init(spec);
        codec->spec = spec;
-       codec->patch_ops = ca0110_patch_ops;
 
        spec->multi_cap_vol = 1;
        codec->bus->core.needs_damn_long_delay = 1;
@@ -62,18 +51,27 @@ static int patch_ca0110(struct hda_codec *codec)
        return 0;
 
  error:
-       snd_hda_gen_free(codec);
+       snd_hda_gen_remove(codec);
        return err;
 }
 
 
+static const struct hda_codec_ops ca0110_codec_ops = {
+       .probe = ca0110_probe,
+       .remove = snd_hda_gen_remove,
+       .build_controls = snd_hda_gen_build_controls,
+       .build_pcms = snd_hda_gen_build_pcms,
+       .init = snd_hda_gen_init,
+       .unsol_event = snd_hda_jack_unsol_event,
+};
+
 /*
- * patch entries
+ * driver entries
  */
 static const struct hda_device_id snd_hda_id_ca0110[] = {
-       HDA_CODEC_ENTRY(0x1102000a, "CA0110-IBG", patch_ca0110),
-       HDA_CODEC_ENTRY(0x1102000b, "CA0110-IBG", patch_ca0110),
-       HDA_CODEC_ENTRY(0x1102000d, "SB0880 X-Fi", patch_ca0110),
+       HDA_CODEC_ID(0x1102000a, "CA0110-IBG"),
+       HDA_CODEC_ID(0x1102000b, "CA0110-IBG"),
+       HDA_CODEC_ID(0x1102000d, "SB0880 X-Fi"),
        {} /* terminator */
 };
 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_ca0110);
@@ -83,6 +81,7 @@ MODULE_DESCRIPTION("Creative CA0110-IBG HD-audio codec");
 
 static struct hda_codec_driver ca0110_driver = {
        .id = snd_hda_id_ca0110,
+       .ops = &ca0110_codec_ops,
 };
 
 module_hda_codec_driver(ca0110_driver);