ALSA: oxfw: reuse driver entry to detect quirks
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Tue, 15 Dec 2015 14:56:20 +0000 (23:56 +0900)
committerTakashi Iwai <tiwai@suse.de>
Tue, 15 Dec 2015 15:30:04 +0000 (16:30 +0100)
Currently, assignment to model-dependent quirk is corresponding to
asynchronous transactions on IEEE 1394 bus. This is also achieved with
device entry.

This commit changes the processing of model-dependent quirk with the
entry. As a result, the transactions are sent only for Loud models.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/firewire/oxfw/oxfw.c
sound/firewire/oxfw/oxfw.h

index 0304d4549f44267f868e0eb4509c258245f2cd44..836d757779736d01bc38aa1da65e4c72a32baf06 100644 (file)
@@ -59,6 +59,7 @@ static bool detect_loud_models(struct fw_unit *unit)
 static int name_card(struct snd_oxfw *oxfw)
 {
        struct fw_device *fw_dev = fw_parent_device(oxfw->unit);
+       const struct device_info *info;
        char vendor[24];
        char model[32];
        const char *d, *v, *m;
@@ -84,10 +85,12 @@ static int name_card(struct snd_oxfw *oxfw)
        be32_to_cpus(&firmware);
 
        /* to apply card definitions */
-       if (oxfw->device_info) {
-               d = oxfw->device_info->driver_name;
-               v = oxfw->device_info->vendor_name;
-               m = oxfw->device_info->model_name;
+       if (oxfw->entry->vendor_id == VENDOR_GRIFFIN ||
+           oxfw->entry->vendor_id == VENDOR_LACIE) {
+               info = (const struct device_info *)oxfw->entry->driver_data;
+               d = info->driver_name;
+               v = info->vendor_name;
+               m = info->model_name;
        } else {
                d = "OXFW";
                v = vendor;
@@ -139,6 +142,16 @@ static void detect_quirks(struct snd_oxfw *oxfw)
        int key, val;
        int vendor, model;
 
+       /*
+        * TASCAM FireOne has physical control and requires a pair of additional
+        * MIDI ports.
+        */
+       if (oxfw->entry->vendor_id == VENDOR_TASCAM) {
+               oxfw->midi_input_ports++;
+               oxfw->midi_output_ports++;
+               return;
+       }
+
        /* Seek from Root Directory of Config ROM. */
        vendor = model = 0;
        fw_csr_iterator_init(&it, fw_dev->config_rom + 5);
@@ -155,25 +168,16 @@ static void detect_quirks(struct snd_oxfw *oxfw)
         */
        if (vendor == VENDOR_LOUD && model == MODEL_SATELLITE)
                oxfw->wrong_dbs = true;
-
-       /*
-        * TASCAM FireOne has physical control and requires a pair of additional
-        * MIDI ports.
-        */
-       if (vendor == VENDOR_TASCAM) {
-               oxfw->midi_input_ports++;
-               oxfw->midi_output_ports++;
-       }
 }
 
 static int oxfw_probe(struct fw_unit *unit,
-                      const struct ieee1394_device_id *id)
+                     const struct ieee1394_device_id *entry)
 {
        struct snd_card *card;
        struct snd_oxfw *oxfw;
        int err;
 
-       if ((id->vendor_id == VENDOR_LOUD) && !detect_loud_models(unit))
+       if (entry->vendor_id == VENDOR_LOUD && !detect_loud_models(unit))
                return -ENODEV;
 
        err = snd_card_new(&unit->device, -1, NULL, THIS_MODULE,
@@ -186,7 +190,7 @@ static int oxfw_probe(struct fw_unit *unit,
        oxfw->card = card;
        mutex_init(&oxfw->mutex);
        oxfw->unit = fw_unit_get(unit);
-       oxfw->device_info = (const struct device_info *)id->driver_data;
+       oxfw->entry = entry;
        spin_lock_init(&oxfw->lock);
        init_waitqueue_head(&oxfw->hwdep_wait);
 
@@ -205,6 +209,8 @@ static int oxfw_probe(struct fw_unit *unit,
                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;
index 9efdc026fdad2109d947fd7edfea467d86e72ed5..f3e14fff4ba07cd28277625e95123e66ff8bcf59 100644 (file)
@@ -72,6 +72,8 @@ struct snd_oxfw {
        int dev_lock_count;
        bool dev_lock_changed;
        wait_queue_head_t hwdep_wait;
+
+       const struct ieee1394_device_id *entry;
 };
 
 /*
This page took 0.026668 seconds and 5 git commands to generate.