ALSA: oxfw: gather model-dependent conditions to a function
Adding control elements is just for models supported by old firewire-speakers modules. The processing should be in a function to add model-dependent quirk. This commit moves the codes to the function. As a result, the function should handle error state, thus this commit also changes prototype of the function. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
committed by
Takashi Iwai
parent
27e6663501
commit
5ce8cc4844
+18
-11
@@ -135,13 +135,24 @@ static void oxfw_card_free(struct snd_card *card)
|
|||||||
mutex_destroy(&oxfw->mutex);
|
mutex_destroy(&oxfw->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void detect_quirks(struct snd_oxfw *oxfw)
|
static int detect_quirks(struct snd_oxfw *oxfw)
|
||||||
{
|
{
|
||||||
struct fw_device *fw_dev = fw_parent_device(oxfw->unit);
|
struct fw_device *fw_dev = fw_parent_device(oxfw->unit);
|
||||||
struct fw_csr_iterator it;
|
struct fw_csr_iterator it;
|
||||||
int key, val;
|
int key, val;
|
||||||
int vendor, model;
|
int vendor, model;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add ALSA control elements for two models to keep compatibility to
|
||||||
|
* old firewire-speaker module.
|
||||||
|
*/
|
||||||
|
if (oxfw->entry->vendor_id == VENDOR_GRIFFIN ||
|
||||||
|
oxfw->entry->vendor_id == VENDOR_LACIE) {
|
||||||
|
oxfw->device_info =
|
||||||
|
(const struct device_info *)oxfw->entry->driver_data;
|
||||||
|
return snd_oxfw_add_spkr(oxfw);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TASCAM FireOne has physical control and requires a pair of additional
|
* TASCAM FireOne has physical control and requires a pair of additional
|
||||||
* MIDI ports.
|
* MIDI ports.
|
||||||
@@ -149,7 +160,7 @@ static void detect_quirks(struct snd_oxfw *oxfw)
|
|||||||
if (oxfw->entry->vendor_id == VENDOR_TASCAM) {
|
if (oxfw->entry->vendor_id == VENDOR_TASCAM) {
|
||||||
oxfw->midi_input_ports++;
|
oxfw->midi_input_ports++;
|
||||||
oxfw->midi_output_ports++;
|
oxfw->midi_output_ports++;
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Seek from Root Directory of Config ROM. */
|
/* Seek from Root Directory of Config ROM. */
|
||||||
@@ -168,6 +179,8 @@ static void detect_quirks(struct snd_oxfw *oxfw)
|
|||||||
*/
|
*/
|
||||||
if (vendor == VENDOR_LOUD && model == MODEL_SATELLITE)
|
if (vendor == VENDOR_LOUD && model == MODEL_SATELLITE)
|
||||||
oxfw->wrong_dbs = true;
|
oxfw->wrong_dbs = true;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int oxfw_probe(struct fw_unit *unit,
|
static int oxfw_probe(struct fw_unit *unit,
|
||||||
@@ -198,7 +211,9 @@ static int oxfw_probe(struct fw_unit *unit,
|
|||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
detect_quirks(oxfw);
|
err = detect_quirks(oxfw);
|
||||||
|
if (err < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
err = name_card(oxfw);
|
err = name_card(oxfw);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
@@ -208,14 +223,6 @@ static int oxfw_probe(struct fw_unit *unit,
|
|||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (oxfw->device_info) {
|
|
||||||
oxfw->device_info =
|
|
||||||
(const struct device_info *)entry->driver_data;
|
|
||||||
err = snd_oxfw_add_spkr(oxfw);
|
|
||||||
if (err < 0)
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
snd_oxfw_proc_init(oxfw);
|
snd_oxfw_proc_init(oxfw);
|
||||||
|
|
||||||
err = snd_oxfw_create_midi(oxfw);
|
err = snd_oxfw_create_midi(oxfw);
|
||||||
|
|||||||
Reference in New Issue
Block a user