diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2013-06-09 12:15:00 -0400 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2013-06-09 12:15:00 -0400 |
commit | 94a87157cde95d38b9cdf1116e4f0fd93f6d25df (patch) | |
tree | 42cb11cbab50860a66d3e4191c43a85cf42bd77f /sound/firewire/scs1x.c | |
parent | 317ddd256b9c24b0d78fa8018f80f1e495481a10 (diff) |
firewire: introduce fw_driver.probe and .remove methods
FireWire upper layer drivers are converted from generic
struct driver.probe() and .remove()
to bus-specific
struct fw_driver.probe() and .remove().
The new .probe() adds a const struct ieee1394_device_id *id argument,
indicating the entry in the driver's device identifiers table which
matched the fw_unit to be probed. This new argument is used by the
snd-firewire-speakers driver to look up device-specific parameters and
methods. There is at least one other FireWire audio driver currently in
development in which this will be useful too.
The new .remove() drops the unused error return code.
Although all in-tree drivers are being converted to the new methods,
support for the old methods is left in place in this commit. This
allows public developer trees to merge this commit and then move to the
new fw_driver methods.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Acked-by: Clemens Ladisch <clemens@ladisch.de> (for sound/firewire/)
Cc: Peter Hurley <peter@hurleysoftware.com> (for drivers/staging/fwserial/)
Diffstat (limited to 'sound/firewire/scs1x.c')
-rw-r--r-- | sound/firewire/scs1x.c | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/sound/firewire/scs1x.c b/sound/firewire/scs1x.c index 844a555c3b1e..1f5920d6eacc 100644 --- a/sound/firewire/scs1x.c +++ b/sound/firewire/scs1x.c | |||
@@ -384,9 +384,8 @@ static void scs_card_free(struct snd_card *card) | |||
384 | kfree(scs->buffer); | 384 | kfree(scs->buffer); |
385 | } | 385 | } |
386 | 386 | ||
387 | static int scs_probe(struct device *unit_dev) | 387 | static int scs_probe(struct fw_unit *unit, const struct ieee1394_device_id *id) |
388 | { | 388 | { |
389 | struct fw_unit *unit = fw_unit(unit_dev); | ||
390 | struct fw_device *fw_dev = fw_parent_device(unit); | 389 | struct fw_device *fw_dev = fw_parent_device(unit); |
391 | struct snd_card *card; | 390 | struct snd_card *card; |
392 | struct scs *scs; | 391 | struct scs *scs; |
@@ -395,7 +394,7 @@ static int scs_probe(struct device *unit_dev) | |||
395 | err = snd_card_create(-16, NULL, THIS_MODULE, sizeof(*scs), &card); | 394 | err = snd_card_create(-16, NULL, THIS_MODULE, sizeof(*scs), &card); |
396 | if (err < 0) | 395 | if (err < 0) |
397 | return err; | 396 | return err; |
398 | snd_card_set_dev(card, unit_dev); | 397 | snd_card_set_dev(card, &unit->device); |
399 | 398 | ||
400 | scs = card->private_data; | 399 | scs = card->private_data; |
401 | scs->card = card; | 400 | scs->card = card; |
@@ -440,7 +439,7 @@ static int scs_probe(struct device *unit_dev) | |||
440 | if (err < 0) | 439 | if (err < 0) |
441 | goto err_card; | 440 | goto err_card; |
442 | 441 | ||
443 | dev_set_drvdata(unit_dev, scs); | 442 | dev_set_drvdata(&unit->device, scs); |
444 | 443 | ||
445 | return 0; | 444 | return 0; |
446 | 445 | ||
@@ -451,9 +450,20 @@ err_card: | |||
451 | return err; | 450 | return err; |
452 | } | 451 | } |
453 | 452 | ||
454 | static int scs_remove(struct device *dev) | 453 | static void scs_update(struct fw_unit *unit) |
455 | { | 454 | { |
456 | struct scs *scs = dev_get_drvdata(dev); | 455 | struct scs *scs = dev_get_drvdata(&unit->device); |
456 | __be64 data; | ||
457 | |||
458 | data = cpu_to_be64(((u64)HSS1394_TAG_CHANGE_ADDRESS << 56) | | ||
459 | scs->hss_handler.offset); | ||
460 | snd_fw_transaction(scs->unit, TCODE_WRITE_BLOCK_REQUEST, | ||
461 | HSS1394_ADDRESS, &data, 8); | ||
462 | } | ||
463 | |||
464 | static void scs_remove(struct fw_unit *unit) | ||
465 | { | ||
466 | struct scs *scs = dev_get_drvdata(&unit->device); | ||
457 | 467 | ||
458 | snd_card_disconnect(scs->card); | 468 | snd_card_disconnect(scs->card); |
459 | 469 | ||
@@ -465,19 +475,6 @@ static int scs_remove(struct device *dev) | |||
465 | tasklet_kill(&scs->tasklet); | 475 | tasklet_kill(&scs->tasklet); |
466 | 476 | ||
467 | snd_card_free_when_closed(scs->card); | 477 | snd_card_free_when_closed(scs->card); |
468 | |||
469 | return 0; | ||
470 | } | ||
471 | |||
472 | static void scs_update(struct fw_unit *unit) | ||
473 | { | ||
474 | struct scs *scs = dev_get_drvdata(&unit->device); | ||
475 | __be64 data; | ||
476 | |||
477 | data = cpu_to_be64(((u64)HSS1394_TAG_CHANGE_ADDRESS << 56) | | ||
478 | scs->hss_handler.offset); | ||
479 | snd_fw_transaction(scs->unit, TCODE_WRITE_BLOCK_REQUEST, | ||
480 | HSS1394_ADDRESS, &data, 8); | ||
481 | } | 478 | } |
482 | 479 | ||
483 | static const struct ieee1394_device_id scs_id_table[] = { | 480 | static const struct ieee1394_device_id scs_id_table[] = { |
@@ -506,10 +503,10 @@ static struct fw_driver scs_driver = { | |||
506 | .owner = THIS_MODULE, | 503 | .owner = THIS_MODULE, |
507 | .name = KBUILD_MODNAME, | 504 | .name = KBUILD_MODNAME, |
508 | .bus = &fw_bus_type, | 505 | .bus = &fw_bus_type, |
509 | .probe = scs_probe, | ||
510 | .remove = scs_remove, | ||
511 | }, | 506 | }, |
507 | .probe = scs_probe, | ||
512 | .update = scs_update, | 508 | .update = scs_update, |
509 | .remove = scs_remove, | ||
513 | .id_table = scs_id_table, | 510 | .id_table = scs_id_table, |
514 | }; | 511 | }; |
515 | 512 | ||