aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire/fw-transaction.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/firewire/fw-transaction.h')
-rw-r--r--drivers/firewire/fw-transaction.h34
1 files changed, 26 insertions, 8 deletions
diff --git a/drivers/firewire/fw-transaction.h b/drivers/firewire/fw-transaction.h
index 04d3854f6560..2ae1b0d6cb7b 100644
--- a/drivers/firewire/fw-transaction.h
+++ b/drivers/firewire/fw-transaction.h
@@ -19,14 +19,15 @@
19#ifndef __fw_transaction_h 19#ifndef __fw_transaction_h
20#define __fw_transaction_h 20#define __fw_transaction_h
21 21
22#include <linux/completion.h>
22#include <linux/device.h> 23#include <linux/device.h>
23#include <linux/timer.h>
24#include <linux/interrupt.h>
25#include <linux/list.h>
26#include <linux/fs.h>
27#include <linux/dma-mapping.h> 24#include <linux/dma-mapping.h>
28#include <linux/firewire-constants.h> 25#include <linux/firewire-constants.h>
29#include <asm/atomic.h> 26#include <linux/kref.h>
27#include <linux/list.h>
28#include <linux/spinlock_types.h>
29#include <linux/timer.h>
30#include <linux/workqueue.h>
30 31
31#define TCODE_IS_READ_REQUEST(tcode) (((tcode) & ~1) == 4) 32#define TCODE_IS_READ_REQUEST(tcode) (((tcode) & ~1) == 4)
32#define TCODE_IS_BLOCK_PACKET(tcode) (((tcode) & 1) != 0) 33#define TCODE_IS_BLOCK_PACKET(tcode) (((tcode) & 1) != 0)
@@ -80,6 +81,9 @@
80#define CSR_SPEED_MAP 0x2000 81#define CSR_SPEED_MAP 0x2000
81#define CSR_SPEED_MAP_END 0x3000 82#define CSR_SPEED_MAP_END 0x3000
82 83
84#define BROADCAST_CHANNEL_INITIAL (1 << 31 | 31)
85#define BROADCAST_CHANNEL_VALID (1 << 30)
86
83#define fw_notify(s, args...) printk(KERN_NOTICE KBUILD_MODNAME ": " s, ## args) 87#define fw_notify(s, args...) printk(KERN_NOTICE KBUILD_MODNAME ": " s, ## args)
84#define fw_error(s, args...) printk(KERN_ERR KBUILD_MODNAME ": " s, ## args) 88#define fw_error(s, args...) printk(KERN_ERR KBUILD_MODNAME ": " s, ## args)
85 89
@@ -216,7 +220,8 @@ extern struct bus_type fw_bus_type;
216struct fw_card { 220struct fw_card {
217 const struct fw_card_driver *driver; 221 const struct fw_card_driver *driver;
218 struct device *device; 222 struct device *device;
219 atomic_t device_count; 223 struct kref kref;
224 struct completion done;
220 225
221 int node_id; 226 int node_id;
222 int generation; 227 int generation;
@@ -236,6 +241,7 @@ struct fw_card {
236 */ 241 */
237 int self_id_count; 242 int self_id_count;
238 u32 topology_map[252 + 3]; 243 u32 topology_map[252 + 3];
244 u32 broadcast_channel;
239 245
240 spinlock_t lock; /* Take this lock when handling the lists in 246 spinlock_t lock; /* Take this lock when handling the lists in
241 * this struct. */ 247 * this struct. */
@@ -256,6 +262,20 @@ struct fw_card {
256 int bm_generation; 262 int bm_generation;
257}; 263};
258 264
265static inline struct fw_card *fw_card_get(struct fw_card *card)
266{
267 kref_get(&card->kref);
268
269 return card;
270}
271
272void fw_card_release(struct kref *kref);
273
274static inline void fw_card_put(struct fw_card *card)
275{
276 kref_put(&card->kref, fw_card_release);
277}
278
259/* 279/*
260 * The iso packet format allows for an immediate header/payload part 280 * The iso packet format allows for an immediate header/payload part
261 * stored in 'header' immediately after the packet info plus an 281 * stored in 'header' immediately after the packet info plus an
@@ -348,8 +368,6 @@ int
348fw_iso_context_stop(struct fw_iso_context *ctx); 368fw_iso_context_stop(struct fw_iso_context *ctx);
349 369
350struct fw_card_driver { 370struct fw_card_driver {
351 const char *name;
352
353 /* 371 /*
354 * Enable the given card with the given initial config rom. 372 * Enable the given card with the given initial config rom.
355 * This function is expected to activate the card, and either 373 * This function is expected to activate the card, and either