Skip to content

Commit 3cea413

Browse files
committed
ALSA: hda/senary: Rewrite to new probe method
Convert the Senary codec driver to use the new hda_codec_ops probe. No functional changes. Signed-off-by: Takashi Iwai <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent dec9613 commit 3cea413

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

sound/hda/codecs/senarytech.c

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0-or-later
22
/*
3-
* HD audio interface patch for Senary HDA audio codec
3+
* HD audio codec driver for Senary HDA audio codec
44
*
55
* Initially based on conexant.c
66
*/
@@ -129,7 +129,7 @@ static void senary_init_gpio_led(struct hda_codec *codec)
129129
}
130130
}
131131

132-
static int senary_auto_init(struct hda_codec *codec)
132+
static int senary_init(struct hda_codec *codec)
133133
{
134134
snd_hda_gen_init(codec);
135135
senary_init_gpio_led(codec);
@@ -138,7 +138,7 @@ static int senary_auto_init(struct hda_codec *codec)
138138
return 0;
139139
}
140140

141-
static void senary_auto_shutdown(struct hda_codec *codec)
141+
static void senary_shutdown(struct hda_codec *codec)
142142
{
143143
struct senary_spec *spec = codec->spec;
144144

@@ -148,29 +148,19 @@ static void senary_auto_shutdown(struct hda_codec *codec)
148148
senary_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, false);
149149
}
150150

151-
static void senary_auto_free(struct hda_codec *codec)
151+
static void senary_remove(struct hda_codec *codec)
152152
{
153-
senary_auto_shutdown(codec);
154-
snd_hda_gen_free(codec);
153+
senary_shutdown(codec);
154+
snd_hda_gen_remove(codec);
155155
}
156156

157-
static int senary_auto_suspend(struct hda_codec *codec)
157+
static int senary_suspend(struct hda_codec *codec)
158158
{
159-
senary_auto_shutdown(codec);
159+
senary_shutdown(codec);
160160
return 0;
161161
}
162162

163-
static const struct hda_codec_ops senary_auto_patch_ops = {
164-
.build_controls = snd_hda_gen_build_controls,
165-
.build_pcms = snd_hda_gen_build_pcms,
166-
.init = senary_auto_init,
167-
.free = senary_auto_free,
168-
.unsol_event = snd_hda_jack_unsol_event,
169-
.suspend = senary_auto_suspend,
170-
.check_power_status = snd_hda_gen_check_power_status,
171-
};
172-
173-
static int patch_senary_auto(struct hda_codec *codec)
163+
static int senary_probe(struct hda_codec *codec, const struct hda_device_id *id)
174164
{
175165
struct senary_spec *spec;
176166
int err;
@@ -182,7 +172,6 @@ static int patch_senary_auto(struct hda_codec *codec)
182172
return -ENOMEM;
183173
snd_hda_gen_spec_init(&spec->gen);
184174
codec->spec = spec;
185-
codec->patch_ops = senary_auto_patch_ops;
186175

187176
senary_auto_parse_eapd(codec);
188177
spec->gen.own_eapd_ctl = 1;
@@ -221,15 +210,27 @@ static int patch_senary_auto(struct hda_codec *codec)
221210
return 0;
222211

223212
error:
224-
senary_auto_free(codec);
213+
senary_remove(codec);
225214
return err;
226215
}
227216

217+
static const struct hda_codec_ops senary_codec_ops = {
218+
.probe = senary_probe,
219+
.remove = senary_remove,
220+
.build_controls = snd_hda_gen_build_controls,
221+
.build_pcms = snd_hda_gen_build_pcms,
222+
.init = senary_init,
223+
.unsol_event = snd_hda_jack_unsol_event,
224+
.suspend = senary_suspend,
225+
.check_power_status = snd_hda_gen_check_power_status,
226+
.stream_pm = snd_hda_gen_stream_pm,
227+
};
228+
228229
/*
229230
*/
230231

231232
static const struct hda_device_id snd_hda_id_senary[] = {
232-
HDA_CODEC_ENTRY(0x1fa86186, "SN6186", patch_senary_auto),
233+
HDA_CODEC_ID(0x1fa86186, "SN6186"),
233234
{} /* terminator */
234235
};
235236
MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_senary);
@@ -239,6 +240,7 @@ MODULE_DESCRIPTION("Senarytech HD-audio codec");
239240

240241
static struct hda_codec_driver senary_driver = {
241242
.id = snd_hda_id_senary,
243+
.ops = &senary_codec_ops,
242244
};
243245

244246
module_hda_codec_driver(senary_driver);

0 commit comments

Comments
 (0)