diff options
author | Krzysztof Helt <krzysztof.h1@wp.pl> | 2008-08-19 15:51:49 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-08-25 03:57:13 -0400 |
commit | f87426e085cba525d41bd7639121e2b74fb7e50c (patch) | |
tree | a899b94f03edeebf1f44bd0bd22745c466400406 | |
parent | c08744498491759168119255fae2a1bd9532a268 (diff) |
ALSA: opl3sa2: replace nd_opl3sa2_info_xxx() with snd_wss_info_xxx()
Replace snd_opl3sa2_info_xxx() with snd_wss_info_xxx().
Drop check of card->private_data which cannot be NULL
if card is not NULL (spotted by Rene Herman).
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Reviewed-by: Rene Herman <rene.herman@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
-rw-r--r-- | sound/isa/opl3sa2.c | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c index 1ac29270a402..58c972b2af03 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c | |||
@@ -300,7 +300,7 @@ static irqreturn_t snd_opl3sa2_interrupt(int irq, void *dev_id) | |||
300 | struct snd_opl3sa2 *chip; | 300 | struct snd_opl3sa2 *chip; |
301 | int handled = 0; | 301 | int handled = 0; |
302 | 302 | ||
303 | if (card == NULL || card->private_data == NULL) | 303 | if (card == NULL) |
304 | return IRQ_NONE; | 304 | return IRQ_NONE; |
305 | 305 | ||
306 | chip = card->private_data; | 306 | chip = card->private_data; |
@@ -338,29 +338,18 @@ static irqreturn_t snd_opl3sa2_interrupt(int irq, void *dev_id) | |||
338 | 338 | ||
339 | #define OPL3SA2_SINGLE(xname, xindex, reg, shift, mask, invert) \ | 339 | #define OPL3SA2_SINGLE(xname, xindex, reg, shift, mask, invert) \ |
340 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ | 340 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ |
341 | .info = snd_opl3sa2_info_single, \ | 341 | .info = snd_wss_info_single, \ |
342 | .get = snd_opl3sa2_get_single, .put = snd_opl3sa2_put_single, \ | 342 | .get = snd_opl3sa2_get_single, .put = snd_opl3sa2_put_single, \ |
343 | .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) } | 343 | .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) } |
344 | #define OPL3SA2_SINGLE_TLV(xname, xindex, reg, shift, mask, invert, xtlv) \ | 344 | #define OPL3SA2_SINGLE_TLV(xname, xindex, reg, shift, mask, invert, xtlv) \ |
345 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | 345 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
346 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, \ | 346 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, \ |
347 | .name = xname, .index = xindex, \ | 347 | .name = xname, .index = xindex, \ |
348 | .info = snd_opl3sa2_info_single, \ | 348 | .info = snd_wss_info_single, \ |
349 | .get = snd_opl3sa2_get_single, .put = snd_opl3sa2_put_single, \ | 349 | .get = snd_opl3sa2_get_single, .put = snd_opl3sa2_put_single, \ |
350 | .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24), \ | 350 | .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24), \ |
351 | .tlv = { .p = (xtlv) } } | 351 | .tlv = { .p = (xtlv) } } |
352 | 352 | ||
353 | static int snd_opl3sa2_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | ||
354 | { | ||
355 | int mask = (kcontrol->private_value >> 16) & 0xff; | ||
356 | |||
357 | uinfo->type = mask == 1 ? SNDRV_CTL_ELEM_TYPE_BOOLEAN : SNDRV_CTL_ELEM_TYPE_INTEGER; | ||
358 | uinfo->count = 1; | ||
359 | uinfo->value.integer.min = 0; | ||
360 | uinfo->value.integer.max = mask; | ||
361 | return 0; | ||
362 | } | ||
363 | |||
364 | static int snd_opl3sa2_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 353 | static int snd_opl3sa2_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
365 | { | 354 | { |
366 | struct snd_opl3sa2 *chip = snd_kcontrol_chip(kcontrol); | 355 | struct snd_opl3sa2 *chip = snd_kcontrol_chip(kcontrol); |
@@ -404,29 +393,18 @@ static int snd_opl3sa2_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_ | |||
404 | 393 | ||
405 | #define OPL3SA2_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \ | 394 | #define OPL3SA2_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \ |
406 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ | 395 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ |
407 | .info = snd_opl3sa2_info_double, \ | 396 | .info = snd_wss_info_double, \ |
408 | .get = snd_opl3sa2_get_double, .put = snd_opl3sa2_put_double, \ | 397 | .get = snd_opl3sa2_get_double, .put = snd_opl3sa2_put_double, \ |
409 | .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) } | 398 | .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) } |
410 | #define OPL3SA2_DOUBLE_TLV(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert, xtlv) \ | 399 | #define OPL3SA2_DOUBLE_TLV(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert, xtlv) \ |
411 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | 400 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
412 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, \ | 401 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, \ |
413 | .name = xname, .index = xindex, \ | 402 | .name = xname, .index = xindex, \ |
414 | .info = snd_opl3sa2_info_double, \ | 403 | .info = snd_wss_info_double, \ |
415 | .get = snd_opl3sa2_get_double, .put = snd_opl3sa2_put_double, \ | 404 | .get = snd_opl3sa2_get_double, .put = snd_opl3sa2_put_double, \ |
416 | .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22), \ | 405 | .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22), \ |
417 | .tlv = { .p = (xtlv) } } | 406 | .tlv = { .p = (xtlv) } } |
418 | 407 | ||
419 | static int snd_opl3sa2_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | ||
420 | { | ||
421 | int mask = (kcontrol->private_value >> 24) & 0xff; | ||
422 | |||
423 | uinfo->type = mask == 1 ? SNDRV_CTL_ELEM_TYPE_BOOLEAN : SNDRV_CTL_ELEM_TYPE_INTEGER; | ||
424 | uinfo->count = 2; | ||
425 | uinfo->value.integer.min = 0; | ||
426 | uinfo->value.integer.max = mask; | ||
427 | return 0; | ||
428 | } | ||
429 | |||
430 | static int snd_opl3sa2_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 408 | static int snd_opl3sa2_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
431 | { | 409 | { |
432 | struct snd_opl3sa2 *chip = snd_kcontrol_chip(kcontrol); | 410 | struct snd_opl3sa2 *chip = snd_kcontrol_chip(kcontrol); |