diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2008-02-24 13:01:21 -0500 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2008-04-18 11:55:32 -0400 |
commit | 1dc3bea78b6cd71c2017aa5da076684c049d8b98 (patch) | |
tree | 7bbdc2ca8204d48701e2d0b895da217bde49c711 /drivers | |
parent | 7c1fca336661aaeb70b9094c4b8eaae389027509 (diff) |
firewire: refactor fw_unit reference counting
Add wrappers for getting and putting a unit.
Remove some line breaks.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Jarod Wilson <jwilson@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/firewire/fw-device.h | 27 | ||||
-rw-r--r-- | drivers/firewire/fw-sbp2.c | 4 |
2 files changed, 19 insertions, 12 deletions
diff --git a/drivers/firewire/fw-device.h b/drivers/firewire/fw-device.h index 78ecd3991b7f..0d771fda86de 100644 --- a/drivers/firewire/fw-device.h +++ b/drivers/firewire/fw-device.h | |||
@@ -64,28 +64,24 @@ struct fw_device { | |||
64 | struct fw_attribute_group attribute_group; | 64 | struct fw_attribute_group attribute_group; |
65 | }; | 65 | }; |
66 | 66 | ||
67 | static inline struct fw_device * | 67 | static inline struct fw_device *fw_device(struct device *dev) |
68 | fw_device(struct device *dev) | ||
69 | { | 68 | { |
70 | return container_of(dev, struct fw_device, device); | 69 | return container_of(dev, struct fw_device, device); |
71 | } | 70 | } |
72 | 71 | ||
73 | static inline int | 72 | static inline int fw_device_is_shutdown(struct fw_device *device) |
74 | fw_device_is_shutdown(struct fw_device *device) | ||
75 | { | 73 | { |
76 | return atomic_read(&device->state) == FW_DEVICE_SHUTDOWN; | 74 | return atomic_read(&device->state) == FW_DEVICE_SHUTDOWN; |
77 | } | 75 | } |
78 | 76 | ||
79 | static inline struct fw_device * | 77 | static inline struct fw_device *fw_device_get(struct fw_device *device) |
80 | fw_device_get(struct fw_device *device) | ||
81 | { | 78 | { |
82 | get_device(&device->device); | 79 | get_device(&device->device); |
83 | 80 | ||
84 | return device; | 81 | return device; |
85 | } | 82 | } |
86 | 83 | ||
87 | static inline void | 84 | static inline void fw_device_put(struct fw_device *device) |
88 | fw_device_put(struct fw_device *device) | ||
89 | { | 85 | { |
90 | put_device(&device->device); | 86 | put_device(&device->device); |
91 | } | 87 | } |
@@ -104,12 +100,23 @@ struct fw_unit { | |||
104 | struct fw_attribute_group attribute_group; | 100 | struct fw_attribute_group attribute_group; |
105 | }; | 101 | }; |
106 | 102 | ||
107 | static inline struct fw_unit * | 103 | static inline struct fw_unit *fw_unit(struct device *dev) |
108 | fw_unit(struct device *dev) | ||
109 | { | 104 | { |
110 | return container_of(dev, struct fw_unit, device); | 105 | return container_of(dev, struct fw_unit, device); |
111 | } | 106 | } |
112 | 107 | ||
108 | static inline struct fw_unit *fw_unit_get(struct fw_unit *unit) | ||
109 | { | ||
110 | get_device(&unit->device); | ||
111 | |||
112 | return unit; | ||
113 | } | ||
114 | |||
115 | static inline void fw_unit_put(struct fw_unit *unit) | ||
116 | { | ||
117 | put_device(&unit->device); | ||
118 | } | ||
119 | |||
113 | #define CSR_OFFSET 0x40 | 120 | #define CSR_OFFSET 0x40 |
114 | #define CSR_LEAF 0x80 | 121 | #define CSR_LEAF 0x80 |
115 | #define CSR_DIRECTORY 0xc0 | 122 | #define CSR_DIRECTORY 0xc0 |
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c index 8fff18e05000..c7aba5cff5d2 100644 --- a/drivers/firewire/fw-sbp2.c +++ b/drivers/firewire/fw-sbp2.c | |||
@@ -796,7 +796,7 @@ static void sbp2_release_target(struct kref *kref) | |||
796 | scsi_remove_host(shost); | 796 | scsi_remove_host(shost); |
797 | fw_notify("released %s\n", tgt->bus_id); | 797 | fw_notify("released %s\n", tgt->bus_id); |
798 | 798 | ||
799 | put_device(&tgt->unit->device); | 799 | fw_unit_put(tgt->unit); |
800 | scsi_host_put(shost); | 800 | scsi_host_put(shost); |
801 | fw_device_put(device); | 801 | fw_device_put(device); |
802 | } | 802 | } |
@@ -1119,7 +1119,7 @@ static int sbp2_probe(struct device *dev) | |||
1119 | goto fail_shost_put; | 1119 | goto fail_shost_put; |
1120 | 1120 | ||
1121 | fw_device_get(device); | 1121 | fw_device_get(device); |
1122 | get_device(&unit->device); | 1122 | fw_unit_get(unit); |
1123 | 1123 | ||
1124 | /* Initialize to values that won't match anything in our table. */ | 1124 | /* Initialize to values that won't match anything in our table. */ |
1125 | firmware_revision = 0xff000000; | 1125 | firmware_revision = 0xff000000; |