mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
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 <[email protected]>
This commit is contained in:
parent
2ca526bf49
commit
2107622684
5 changed files with 16 additions and 19 deletions
|
|
@ -612,7 +612,6 @@ static void isight_card_free(struct snd_card *card)
|
|||
|
||||
fw_iso_resources_destroy(&isight->resources);
|
||||
fw_unit_put(isight->unit);
|
||||
fw_device_put(isight->device);
|
||||
mutex_destroy(&isight->mutex);
|
||||
}
|
||||
|
||||
|
|
@ -645,7 +644,7 @@ static int isight_probe(struct device *unit_dev)
|
|||
isight->card = card;
|
||||
mutex_init(&isight->mutex);
|
||||
isight->unit = fw_unit_get(unit);
|
||||
isight->device = fw_device_get(fw_dev);
|
||||
isight->device = fw_dev;
|
||||
isight->audio_base = get_unit_base(unit);
|
||||
if (!isight->audio_base) {
|
||||
dev_err(&unit->device, "audio unit base not found\n");
|
||||
|
|
@ -682,7 +681,6 @@ static int isight_probe(struct device *unit_dev)
|
|||
|
||||
err_unit:
|
||||
fw_unit_put(isight->unit);
|
||||
fw_device_put(isight->device);
|
||||
mutex_destroy(&isight->mutex);
|
||||
error:
|
||||
snd_card_free(card);
|
||||
|
|
|
|||
|
|
@ -656,12 +656,10 @@ static u32 fwspk_read_firmware_version(struct fw_unit *unit)
|
|||
static void fwspk_card_free(struct snd_card *card)
|
||||
{
|
||||
struct fwspk *fwspk = card->private_data;
|
||||
struct fw_device *dev = fw_parent_device(fwspk->unit);
|
||||
|
||||
amdtp_out_stream_destroy(&fwspk->stream);
|
||||
cmp_connection_destroy(&fwspk->connection);
|
||||
fw_unit_put(fwspk->unit);
|
||||
fw_device_put(dev);
|
||||
mutex_destroy(&fwspk->mutex);
|
||||
}
|
||||
|
||||
|
|
@ -718,7 +716,6 @@ static int __devinit fwspk_probe(struct device *unit_dev)
|
|||
fwspk = card->private_data;
|
||||
fwspk->card = card;
|
||||
mutex_init(&fwspk->mutex);
|
||||
fw_device_get(fw_dev);
|
||||
fwspk->unit = fw_unit_get(unit);
|
||||
fwspk->device_info = fwspk_detect(fw_dev);
|
||||
if (!fwspk->device_info) {
|
||||
|
|
@ -767,7 +764,6 @@ err_connection:
|
|||
cmp_connection_destroy(&fwspk->connection);
|
||||
err_unit:
|
||||
fw_unit_put(fwspk->unit);
|
||||
fw_device_put(fw_dev);
|
||||
mutex_destroy(&fwspk->mutex);
|
||||
error:
|
||||
snd_card_free(card);
|
||||
|
|
|
|||
Loading…
Reference in a new issue