aboutsummaryrefslogtreecommitdiffstats
path: root/sound/firewire
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2011-08-27 12:53:03 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2012-01-15 12:37:20 -0500
commit210762268466634ddbfaddb48fdf5181ce4b5f2d (patch)
tree8c07da360066158aa48f450dfeb593ed9ed76d0f /sound/firewire
parent2ca526bf4953380abfe5dff455e356967b239c70 (diff)
firewire: move fw_device reference counting from drivers to core
fw_unit device drivers invariably need to talk to the fw_unit's parent (an fw_device) and grandparent (an fw_card). firewire-core already maintains an fw_card reference for the entire lifetime of an fw_device. Likewise, let firewire-core maintain an fw_device reference for the entire lifetime of an fw_unit so that fw_unit drivers don't have to. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'sound/firewire')
-rw-r--r--sound/firewire/isight.c4
-rw-r--r--sound/firewire/speakers.c4
2 files changed, 1 insertions, 7 deletions
diff --git a/sound/firewire/isight.c b/sound/firewire/isight.c
index 440030818db7..412b65f740d9 100644
--- a/sound/firewire/isight.c
+++ b/sound/firewire/isight.c
@@ -612,7 +612,6 @@ static void isight_card_free(struct snd_card *card)
612 612
613 fw_iso_resources_destroy(&isight->resources); 613 fw_iso_resources_destroy(&isight->resources);
614 fw_unit_put(isight->unit); 614 fw_unit_put(isight->unit);
615 fw_device_put(isight->device);
616 mutex_destroy(&isight->mutex); 615 mutex_destroy(&isight->mutex);
617} 616}
618 617
@@ -645,7 +644,7 @@ static int isight_probe(struct device *unit_dev)
645 isight->card = card; 644 isight->card = card;
646 mutex_init(&isight->mutex); 645 mutex_init(&isight->mutex);
647 isight->unit = fw_unit_get(unit); 646 isight->unit = fw_unit_get(unit);
648 isight->device = fw_device_get(fw_dev); 647 isight->device = fw_dev;
649 isight->audio_base = get_unit_base(unit); 648 isight->audio_base = get_unit_base(unit);
650 if (!isight->audio_base) { 649 if (!isight->audio_base) {
651 dev_err(&unit->device, "audio unit base not found\n"); 650 dev_err(&unit->device, "audio unit base not found\n");
@@ -682,7 +681,6 @@ static int isight_probe(struct device *unit_dev)
682 681
683err_unit: 682err_unit:
684 fw_unit_put(isight->unit); 683 fw_unit_put(isight->unit);
685 fw_device_put(isight->device);
686 mutex_destroy(&isight->mutex); 684 mutex_destroy(&isight->mutex);
687error: 685error:
688 snd_card_free(card); 686 snd_card_free(card);
diff --git a/sound/firewire/speakers.c b/sound/firewire/speakers.c
index 3fc257da180c..18b9b5607f3c 100644
--- a/sound/firewire/speakers.c
+++ b/sound/firewire/speakers.c
@@ -656,12 +656,10 @@ static u32 fwspk_read_firmware_version(struct fw_unit *unit)
656static void fwspk_card_free(struct snd_card *card) 656static void fwspk_card_free(struct snd_card *card)
657{ 657{
658 struct fwspk *fwspk = card->private_data; 658 struct fwspk *fwspk = card->private_data;
659 struct fw_device *dev = fw_parent_device(fwspk->unit);
660 659
661 amdtp_out_stream_destroy(&fwspk->stream); 660 amdtp_out_stream_destroy(&fwspk->stream);
662 cmp_connection_destroy(&fwspk->connection); 661 cmp_connection_destroy(&fwspk->connection);
663 fw_unit_put(fwspk->unit); 662 fw_unit_put(fwspk->unit);
664 fw_device_put(dev);
665 mutex_destroy(&fwspk->mutex); 663 mutex_destroy(&fwspk->mutex);
666} 664}
667 665
@@ -718,7 +716,6 @@ static int __devinit fwspk_probe(struct device *unit_dev)
718 fwspk = card->private_data; 716 fwspk = card->private_data;
719 fwspk->card = card; 717 fwspk->card = card;
720 mutex_init(&fwspk->mutex); 718 mutex_init(&fwspk->mutex);
721 fw_device_get(fw_dev);
722 fwspk->unit = fw_unit_get(unit); 719 fwspk->unit = fw_unit_get(unit);
723 fwspk->device_info = fwspk_detect(fw_dev); 720 fwspk->device_info = fwspk_detect(fw_dev);
724 if (!fwspk->device_info) { 721 if (!fwspk->device_info) {
@@ -767,7 +764,6 @@ err_connection:
767 cmp_connection_destroy(&fwspk->connection); 764 cmp_connection_destroy(&fwspk->connection);
768err_unit: 765err_unit:
769 fw_unit_put(fwspk->unit); 766 fw_unit_put(fwspk->unit);
770 fw_device_put(fw_dev);
771 mutex_destroy(&fwspk->mutex); 767 mutex_destroy(&fwspk->mutex);
772error: 768error:
773 snd_card_free(card); 769 snd_card_free(card);