diff options
Diffstat (limited to 'sound/firewire/scs1x.c')
-rw-r--r-- | sound/firewire/scs1x.c | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/sound/firewire/scs1x.c b/sound/firewire/scs1x.c index 844a555c3b1..505fc812319 100644 --- a/sound/firewire/scs1x.c +++ b/sound/firewire/scs1x.c @@ -384,9 +384,8 @@ static void scs_card_free(struct snd_card *card) kfree(scs->buffer); } -static int scs_probe(struct device *unit_dev) +static int scs_probe(struct fw_unit *unit, const struct ieee1394_device_id *id) { - struct fw_unit *unit = fw_unit(unit_dev); struct fw_device *fw_dev = fw_parent_device(unit); struct snd_card *card; struct scs *scs; @@ -395,7 +394,7 @@ static int scs_probe(struct device *unit_dev) err = snd_card_create(-16, NULL, THIS_MODULE, sizeof(*scs), &card); if (err < 0) return err; - snd_card_set_dev(card, unit_dev); + snd_card_set_dev(card, &unit->device); scs = card->private_data; scs->card = card; @@ -405,8 +404,10 @@ static int scs_probe(struct device *unit_dev) scs->output_idle = true; scs->buffer = kmalloc(HSS1394_MAX_PACKET_SIZE, GFP_KERNEL); - if (!scs->buffer) + if (!scs->buffer) { + err = -ENOMEM; goto err_card; + } scs->hss_handler.length = HSS1394_MAX_PACKET_SIZE; scs->hss_handler.address_callback = handle_hss; @@ -440,7 +441,7 @@ static int scs_probe(struct device *unit_dev) if (err < 0) goto err_card; - dev_set_drvdata(unit_dev, scs); + dev_set_drvdata(&unit->device, scs); return 0; @@ -451,9 +452,20 @@ err_card: return err; } -static int scs_remove(struct device *dev) +static void scs_update(struct fw_unit *unit) { - struct scs *scs = dev_get_drvdata(dev); + struct scs *scs = dev_get_drvdata(&unit->device); + __be64 data; + + data = cpu_to_be64(((u64)HSS1394_TAG_CHANGE_ADDRESS << 56) | + scs->hss_handler.offset); + snd_fw_transaction(scs->unit, TCODE_WRITE_BLOCK_REQUEST, + HSS1394_ADDRESS, &data, 8); +} + +static void scs_remove(struct fw_unit *unit) +{ + struct scs *scs = dev_get_drvdata(&unit->device); snd_card_disconnect(scs->card); @@ -465,19 +477,6 @@ static int scs_remove(struct device *dev) tasklet_kill(&scs->tasklet); snd_card_free_when_closed(scs->card); - - return 0; -} - -static void scs_update(struct fw_unit *unit) -{ - struct scs *scs = dev_get_drvdata(&unit->device); - __be64 data; - - data = cpu_to_be64(((u64)HSS1394_TAG_CHANGE_ADDRESS << 56) | - scs->hss_handler.offset); - snd_fw_transaction(scs->unit, TCODE_WRITE_BLOCK_REQUEST, - HSS1394_ADDRESS, &data, 8); } static const struct ieee1394_device_id scs_id_table[] = { @@ -506,10 +505,10 @@ static struct fw_driver scs_driver = { .owner = THIS_MODULE, .name = KBUILD_MODNAME, .bus = &fw_bus_type, - .probe = scs_probe, - .remove = scs_remove, }, + .probe = scs_probe, .update = scs_update, + .remove = scs_remove, .id_table = scs_id_table, }; |