File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -641,6 +641,7 @@ static void fw_unit_release(struct device *dev)
641641{
642642 struct fw_unit * unit = fw_unit (dev );
643643
644+ fw_device_put (fw_parent_device (unit ));
644645 kfree (unit );
645646}
646647
@@ -692,6 +693,7 @@ static void create_units(struct fw_device *device)
692693 if (device_register (& unit -> device ) < 0 )
693694 goto skip_unit ;
694695
696+ fw_device_get (device );
695697 continue ;
696698
697699 skip_unit :
Original file line number Diff line number Diff line change 11#ifndef _FIREWIRE_CORE_H
22#define _FIREWIRE_CORE_H
33
4+ #include <linux/device.h>
45#include <linux/fs.h>
56#include <linux/list.h>
67#include <linux/idr.h>
@@ -141,6 +142,18 @@ extern struct rw_semaphore fw_device_rwsem;
141142extern struct idr fw_device_idr ;
142143extern int fw_cdev_major ;
143144
145+ static inline struct fw_device * fw_device_get (struct fw_device * device )
146+ {
147+ get_device (& device -> device );
148+
149+ return device ;
150+ }
151+
152+ static inline void fw_device_put (struct fw_device * device )
153+ {
154+ put_device (& device -> device );
155+ }
156+
144157struct fw_device * fw_device_get_by_devt (dev_t devt );
145158int fw_device_set_broadcast_channel (struct device * dev , void * gen );
146159void fw_node_event (struct fw_card * card , struct fw_node * node , int event );
Original file line number Diff line number Diff line change @@ -203,18 +203,6 @@ static inline int fw_device_is_shutdown(struct fw_device *device)
203203 return atomic_read (& device -> state ) == FW_DEVICE_SHUTDOWN ;
204204}
205205
206- static inline struct fw_device * fw_device_get (struct fw_device * device )
207- {
208- get_device (& device -> device );
209-
210- return device ;
211- }
212-
213- static inline void fw_device_put (struct fw_device * device )
214- {
215- put_device (& device -> device );
216- }
217-
218206int fw_device_enable_phys_dma (struct fw_device * device );
219207
220208/*
Original file line number Diff line number Diff line change @@ -612,7 +612,6 @@ static void isight_card_free(struct snd_card *card)
612612
613613 fw_iso_resources_destroy (& isight -> resources );
614614 fw_unit_put (isight -> unit );
615- fw_device_put (isight -> device );
616615 mutex_destroy (& isight -> mutex );
617616}
618617
@@ -645,7 +644,7 @@ static int isight_probe(struct device *unit_dev)
645644 isight -> card = card ;
646645 mutex_init (& isight -> mutex );
647646 isight -> unit = fw_unit_get (unit );
648- isight -> device = fw_device_get ( fw_dev ) ;
647+ isight -> device = fw_dev ;
649648 isight -> audio_base = get_unit_base (unit );
650649 if (!isight -> audio_base ) {
651650 dev_err (& unit -> device , "audio unit base not found\n" );
@@ -682,7 +681,6 @@ static int isight_probe(struct device *unit_dev)
682681
683682err_unit :
684683 fw_unit_put (isight -> unit );
685- fw_device_put (isight -> device );
686684 mutex_destroy (& isight -> mutex );
687685error :
688686 snd_card_free (card );
Original file line number Diff line number Diff line change @@ -656,12 +656,10 @@ static u32 fwspk_read_firmware_version(struct fw_unit *unit)
656656static void fwspk_card_free (struct snd_card * card )
657657{
658658 struct fwspk * fwspk = card -> private_data ;
659- struct fw_device * dev = fw_parent_device (fwspk -> unit );
660659
661660 amdtp_out_stream_destroy (& fwspk -> stream );
662661 cmp_connection_destroy (& fwspk -> connection );
663662 fw_unit_put (fwspk -> unit );
664- fw_device_put (dev );
665663 mutex_destroy (& fwspk -> mutex );
666664}
667665
@@ -718,7 +716,6 @@ static int __devinit fwspk_probe(struct device *unit_dev)
718716 fwspk = card -> private_data ;
719717 fwspk -> card = card ;
720718 mutex_init (& fwspk -> mutex );
721- fw_device_get (fw_dev );
722719 fwspk -> unit = fw_unit_get (unit );
723720 fwspk -> device_info = fwspk_detect (fw_dev );
724721 if (!fwspk -> device_info ) {
@@ -767,7 +764,6 @@ static int __devinit fwspk_probe(struct device *unit_dev)
767764 cmp_connection_destroy (& fwspk -> connection );
768765err_unit :
769766 fw_unit_put (fwspk -> unit );
770- fw_device_put (fw_dev );
771767 mutex_destroy (& fwspk -> mutex );
772768error :
773769 snd_card_free (card );
You can’t perform that action at this time.
0 commit comments