--- zzzz-none-000/linux-3.10.107/sound/firewire/scs1x.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/sound/firewire/scs1x.c 2021-02-04 17:41:59.000000000 +0000 @@ -369,7 +369,7 @@ data = cpu_to_be64(((u64)HSS1394_TAG_CHANGE_ADDRESS << 56) | scs->hss_handler.offset); err = snd_fw_transaction(scs->unit, TCODE_WRITE_BLOCK_REQUEST, - HSS1394_ADDRESS, &data, 8); + HSS1394_ADDRESS, &data, 8, 0); if (err < 0) dev_err(&scs->unit->device, "HSS1394 communication failed\n"); @@ -384,18 +384,17 @@ 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; int err; - err = snd_card_create(-16, NULL, THIS_MODULE, sizeof(*scs), &card); + err = snd_card_new(&unit->device, -16, NULL, THIS_MODULE, + sizeof(*scs), &card); if (err < 0) return err; - snd_card_set_dev(card, unit_dev); scs = card->private_data; scs->card = card; @@ -405,8 +404,10 @@ 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 @@ if (err < 0) goto err_card; - dev_set_drvdata(unit_dev, scs); + dev_set_drvdata(&unit->device, scs); return 0; @@ -451,9 +452,24 @@ return err; } -static int scs_remove(struct device *dev) +static void scs_update(struct fw_unit *unit) +{ + struct scs *scs = dev_get_drvdata(&unit->device); + int generation; + __be64 data; + + data = cpu_to_be64(((u64)HSS1394_TAG_CHANGE_ADDRESS << 56) | + scs->hss_handler.offset); + generation = fw_parent_device(unit)->generation; + smp_rmb(); /* node_id vs. generation */ + snd_fw_transaction(scs->unit, TCODE_WRITE_BLOCK_REQUEST, + HSS1394_ADDRESS, &data, 8, + FW_FIXED_GENERATION | generation); +} + +static void scs_remove(struct fw_unit *unit) { - struct scs *scs = dev_get_drvdata(dev); + struct scs *scs = dev_get_drvdata(&unit->device); snd_card_disconnect(scs->card); @@ -465,19 +481,6 @@ 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 +509,10 @@ .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, };