diff options
author | Chris Boot <bootc@bootc.net> | 2012-02-01 17:36:02 -0500 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-05-09 18:25:17 -0400 |
commit | fc5f80b152896c1ffded2a91d11dcb08ffcffebb (patch) | |
tree | 4596cd1ee2c896df4259ee2c75ad3b027b6f2469 | |
parent | 253d92371ca29a470b2bbf91fb9824a9fef05657 (diff) |
firewire: Move fw_card kref functions into linux/firewire.h
When writing a firewire driver that doesn't deal with struct fw_device
objects (e.g. it only publishes FireWire units and doesn't subscribe to
them), you likely need to keep referenced to struct fw_card objects so
that you can send messages to other nodes. This patch moves
fw_card_put(), fw_card_get() and fw_card_release() into the public
include/linux/firewire.h header instead of drivers/firewire/core.h, and
adds EXPORT_SYMBOL_GPL(fw_card_release).
The firewire-sbp-target module requires these so it can keep a reference
to the fw_card object in order that it can fetch ORBs to execute and
read/write related data and status information.
Signed-off-by: Chris Boot <bootc@bootc.net>
Acked-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r-- | drivers/firewire/core-card.c | 1 | ||||
-rw-r--r-- | drivers/firewire/core.h | 15 | ||||
-rw-r--r-- | include/linux/firewire.h | 14 |
3 files changed, 15 insertions, 15 deletions
diff --git a/drivers/firewire/core-card.c b/drivers/firewire/core-card.c index cc595eba7ba9..f5552b362efc 100644 --- a/drivers/firewire/core-card.c +++ b/drivers/firewire/core-card.c | |||
@@ -676,6 +676,7 @@ void fw_card_release(struct kref *kref) | |||
676 | 676 | ||
677 | complete(&card->done); | 677 | complete(&card->done); |
678 | } | 678 | } |
679 | EXPORT_SYMBOL_GPL(fw_card_release); | ||
679 | 680 | ||
680 | void fw_core_remove_card(struct fw_card *card) | 681 | void fw_core_remove_card(struct fw_card *card) |
681 | { | 682 | { |
diff --git a/drivers/firewire/core.h b/drivers/firewire/core.h index 9047f5547d98..b5a2f6197053 100644 --- a/drivers/firewire/core.h +++ b/drivers/firewire/core.h | |||
@@ -120,21 +120,6 @@ int fw_compute_block_crc(__be32 *block); | |||
120 | void fw_schedule_bus_reset(struct fw_card *card, bool delayed, bool short_reset); | 120 | void fw_schedule_bus_reset(struct fw_card *card, bool delayed, bool short_reset); |
121 | void fw_schedule_bm_work(struct fw_card *card, unsigned long delay); | 121 | void fw_schedule_bm_work(struct fw_card *card, unsigned long delay); |
122 | 122 | ||
123 | static inline struct fw_card *fw_card_get(struct fw_card *card) | ||
124 | { | ||
125 | kref_get(&card->kref); | ||
126 | |||
127 | return card; | ||
128 | } | ||
129 | |||
130 | void fw_card_release(struct kref *kref); | ||
131 | |||
132 | static inline void fw_card_put(struct fw_card *card) | ||
133 | { | ||
134 | kref_put(&card->kref, fw_card_release); | ||
135 | } | ||
136 | |||
137 | |||
138 | /* -cdev */ | 123 | /* -cdev */ |
139 | 124 | ||
140 | extern const struct file_operations fw_device_ops; | 125 | extern const struct file_operations fw_device_ops; |
diff --git a/include/linux/firewire.h b/include/linux/firewire.h index 46831303b0b9..e83c24af358a 100644 --- a/include/linux/firewire.h +++ b/include/linux/firewire.h | |||
@@ -135,6 +135,20 @@ struct fw_card { | |||
135 | __be32 maint_utility_register; | 135 | __be32 maint_utility_register; |
136 | }; | 136 | }; |
137 | 137 | ||
138 | static inline struct fw_card *fw_card_get(struct fw_card *card) | ||
139 | { | ||
140 | kref_get(&card->kref); | ||
141 | |||
142 | return card; | ||
143 | } | ||
144 | |||
145 | void fw_card_release(struct kref *kref); | ||
146 | |||
147 | static inline void fw_card_put(struct fw_card *card) | ||
148 | { | ||
149 | kref_put(&card->kref, fw_card_release); | ||
150 | } | ||
151 | |||
138 | struct fw_attribute_group { | 152 | struct fw_attribute_group { |
139 | struct attribute_group *groups[2]; | 153 | struct attribute_group *groups[2]; |
140 | struct attribute_group group; | 154 | struct attribute_group group; |