firewire: remove line breaks before function names

type
    function_name(parameters);

is nice to look at but was not used consistently.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
This commit is contained in:
Stefan Richter 2008-12-14 21:47:04 +01:00
parent 2dbd7d7e23
commit 53dca51175
11 changed files with 248 additions and 376 deletions

View File

@ -63,8 +63,7 @@ static int descriptor_count;
#define BIB_CMC ((1) << 30) #define BIB_CMC ((1) << 30)
#define BIB_IMC ((1) << 31) #define BIB_IMC ((1) << 31)
static u32 * static u32 *generate_config_rom(struct fw_card *card, size_t *config_rom_length)
generate_config_rom(struct fw_card *card, size_t *config_rom_length)
{ {
struct fw_descriptor *desc; struct fw_descriptor *desc;
static u32 config_rom[256]; static u32 config_rom[256];
@ -128,8 +127,7 @@ generate_config_rom(struct fw_card *card, size_t *config_rom_length)
return config_rom; return config_rom;
} }
static void static void update_config_roms(void)
update_config_roms(void)
{ {
struct fw_card *card; struct fw_card *card;
u32 *config_rom; u32 *config_rom;
@ -141,8 +139,7 @@ update_config_roms(void)
} }
} }
int int fw_core_add_descriptor(struct fw_descriptor *desc)
fw_core_add_descriptor(struct fw_descriptor *desc)
{ {
size_t i; size_t i;
@ -171,8 +168,7 @@ fw_core_add_descriptor(struct fw_descriptor *desc)
return 0; return 0;
} }
void void fw_core_remove_descriptor(struct fw_descriptor *desc)
fw_core_remove_descriptor(struct fw_descriptor *desc)
{ {
mutex_lock(&card_mutex); mutex_lock(&card_mutex);
@ -189,8 +185,7 @@ static const char gap_count_table[] = {
63, 5, 7, 8, 10, 13, 16, 18, 21, 24, 26, 29, 32, 35, 37, 40 63, 5, 7, 8, 10, 13, 16, 18, 21, 24, 26, 29, 32, 35, 37, 40
}; };
void void fw_schedule_bm_work(struct fw_card *card, unsigned long delay)
fw_schedule_bm_work(struct fw_card *card, unsigned long delay)
{ {
int scheduled; int scheduled;
@ -200,8 +195,7 @@ fw_schedule_bm_work(struct fw_card *card, unsigned long delay)
fw_card_put(card); fw_card_put(card);
} }
static void static void fw_card_bm_work(struct work_struct *work)
fw_card_bm_work(struct work_struct *work)
{ {
struct fw_card *card = container_of(work, struct fw_card, work.work); struct fw_card *card = container_of(work, struct fw_card, work.work);
struct fw_device *root_device; struct fw_device *root_device;
@ -371,17 +365,16 @@ fw_card_bm_work(struct work_struct *work)
fw_card_put(card); fw_card_put(card);
} }
static void static void flush_timer_callback(unsigned long data)
flush_timer_callback(unsigned long data)
{ {
struct fw_card *card = (struct fw_card *)data; struct fw_card *card = (struct fw_card *)data;
fw_flush_transactions(card); fw_flush_transactions(card);
} }
void void fw_card_initialize(struct fw_card *card,
fw_card_initialize(struct fw_card *card, const struct fw_card_driver *driver, const struct fw_card_driver *driver,
struct device *device) struct device *device)
{ {
static atomic_t index = ATOMIC_INIT(-1); static atomic_t index = ATOMIC_INIT(-1);
@ -406,9 +399,8 @@ fw_card_initialize(struct fw_card *card, const struct fw_card_driver *driver,
} }
EXPORT_SYMBOL(fw_card_initialize); EXPORT_SYMBOL(fw_card_initialize);
int int fw_card_add(struct fw_card *card,
fw_card_add(struct fw_card *card, u32 max_receive, u32 link_speed, u64 guid)
u32 max_receive, u32 link_speed, u64 guid)
{ {
u32 *config_rom; u32 *config_rom;
size_t length; size_t length;
@ -442,23 +434,20 @@ EXPORT_SYMBOL(fw_card_add);
* dummy driver just fails all IO. * dummy driver just fails all IO.
*/ */
static int static int dummy_enable(struct fw_card *card, u32 *config_rom, size_t length)
dummy_enable(struct fw_card *card, u32 *config_rom, size_t length)
{ {
BUG(); BUG();
return -1; return -1;
} }
static int static int dummy_update_phy_reg(struct fw_card *card, int address,
dummy_update_phy_reg(struct fw_card *card, int address, int clear_bits, int set_bits)
int clear_bits, int set_bits)
{ {
return -ENODEV; return -ENODEV;
} }
static int static int dummy_set_config_rom(struct fw_card *card,
dummy_set_config_rom(struct fw_card *card, u32 *config_rom, size_t length)
u32 *config_rom, size_t length)
{ {
/* /*
* We take the card out of card_list before setting the dummy * We take the card out of card_list before setting the dummy
@ -468,27 +457,23 @@ dummy_set_config_rom(struct fw_card *card,
return -1; return -1;
} }
static void static void dummy_send_request(struct fw_card *card, struct fw_packet *packet)
dummy_send_request(struct fw_card *card, struct fw_packet *packet)
{ {
packet->callback(packet, card, -ENODEV); packet->callback(packet, card, -ENODEV);
} }
static void static void dummy_send_response(struct fw_card *card, struct fw_packet *packet)
dummy_send_response(struct fw_card *card, struct fw_packet *packet)
{ {
packet->callback(packet, card, -ENODEV); packet->callback(packet, card, -ENODEV);
} }
static int static int dummy_cancel_packet(struct fw_card *card, struct fw_packet *packet)
dummy_cancel_packet(struct fw_card *card, struct fw_packet *packet)
{ {
return -ENOENT; return -ENOENT;
} }
static int static int dummy_enable_phys_dma(struct fw_card *card,
dummy_enable_phys_dma(struct fw_card *card, int node_id, int generation)
int node_id, int generation)
{ {
return -ENODEV; return -ENODEV;
} }
@ -503,16 +488,14 @@ static struct fw_card_driver dummy_driver = {
.enable_phys_dma = dummy_enable_phys_dma, .enable_phys_dma = dummy_enable_phys_dma,
}; };
void void fw_card_release(struct kref *kref)
fw_card_release(struct kref *kref)
{ {
struct fw_card *card = container_of(kref, struct fw_card, kref); struct fw_card *card = container_of(kref, struct fw_card, kref);
complete(&card->done); complete(&card->done);
} }
void void fw_core_remove_card(struct fw_card *card)
fw_core_remove_card(struct fw_card *card)
{ {
card->driver->update_phy_reg(card, 4, card->driver->update_phy_reg(card, 4,
PHY_LINK_ACTIVE | PHY_CONTENDER, 0); PHY_LINK_ACTIVE | PHY_CONTENDER, 0);
@ -536,8 +519,7 @@ fw_core_remove_card(struct fw_card *card)
} }
EXPORT_SYMBOL(fw_core_remove_card); EXPORT_SYMBOL(fw_core_remove_card);
int int fw_core_initiate_bus_reset(struct fw_card *card, int short_reset)
fw_core_initiate_bus_reset(struct fw_card *card, int short_reset)
{ {
int reg = short_reset ? 5 : 1; int reg = short_reset ? 5 : 1;
int bit = short_reset ? PHY_BUS_SHORT_RESET : PHY_BUS_RESET; int bit = short_reset ? PHY_BUS_SHORT_RESET : PHY_BUS_RESET;

View File

@ -96,14 +96,12 @@ struct client {
struct list_head link; struct list_head link;
}; };
static inline void __user * static inline void __user *u64_to_uptr(__u64 value)
u64_to_uptr(__u64 value)
{ {
return (void __user *)(unsigned long)value; return (void __user *)(unsigned long)value;
} }
static inline __u64 static inline __u64 uptr_to_u64(void __user *ptr)
uptr_to_u64(void __user *ptr)
{ {
return (__u64)(unsigned long)ptr; return (__u64)(unsigned long)ptr;
} }
@ -163,8 +161,8 @@ static void queue_event(struct client *client, struct event *event,
wake_up_interruptible(&client->wait); wake_up_interruptible(&client->wait);
} }
static int static int dequeue_event(struct client *client,
dequeue_event(struct client *client, char __user *buffer, size_t count) char __user *buffer, size_t count)
{ {
unsigned long flags; unsigned long flags;
struct event *event; struct event *event;
@ -203,18 +201,16 @@ dequeue_event(struct client *client, char __user *buffer, size_t count)
return ret; return ret;
} }
static ssize_t static ssize_t fw_device_op_read(struct file *file, char __user *buffer,
fw_device_op_read(struct file *file, size_t count, loff_t *offset)
char __user *buffer, size_t count, loff_t *offset)
{ {
struct client *client = file->private_data; struct client *client = file->private_data;
return dequeue_event(client, buffer, count); return dequeue_event(client, buffer, count);
} }
static void static void fill_bus_reset_event(struct fw_cdev_event_bus_reset *event,
fill_bus_reset_event(struct fw_cdev_event_bus_reset *event, struct client *client)
struct client *client)
{ {
struct fw_card *card = client->device->card; struct fw_card *card = client->device->card;
unsigned long flags; unsigned long flags;
@ -233,9 +229,8 @@ fill_bus_reset_event(struct fw_cdev_event_bus_reset *event,
spin_unlock_irqrestore(&card->lock, flags); spin_unlock_irqrestore(&card->lock, flags);
} }
static void static void for_each_client(struct fw_device *device,
for_each_client(struct fw_device *device, void (*callback)(struct client *client))
void (*callback)(struct client *client))
{ {
struct client *c; struct client *c;
@ -245,8 +240,7 @@ for_each_client(struct fw_device *device,
mutex_unlock(&device->client_list_mutex); mutex_unlock(&device->client_list_mutex);
} }
static void static void queue_bus_reset_event(struct client *client)
queue_bus_reset_event(struct client *client)
{ {
struct bus_reset *bus_reset; struct bus_reset *bus_reset;
@ -316,9 +310,8 @@ static int ioctl_get_info(struct client *client, void *buffer)
return 0; return 0;
} }
static int static int add_client_resource(struct client *client,
add_client_resource(struct client *client, struct client_resource *resource, struct client_resource *resource, gfp_t gfp_mask)
gfp_t gfp_mask)
{ {
unsigned long flags; unsigned long flags;
int ret; int ret;
@ -341,10 +334,9 @@ add_client_resource(struct client *client, struct client_resource *resource,
return ret < 0 ? ret : 0; return ret < 0 ? ret : 0;
} }
static int static int release_client_resource(struct client *client, u32 handle,
release_client_resource(struct client *client, u32 handle, client_resource_release_fn_t release,
client_resource_release_fn_t release, struct client_resource **resource)
struct client_resource **resource)
{ {
struct client_resource *r; struct client_resource *r;
unsigned long flags; unsigned long flags;
@ -369,8 +361,8 @@ release_client_resource(struct client *client, u32 handle,
return 0; return 0;
} }
static void static void release_transaction(struct client *client,
release_transaction(struct client *client, struct client_resource *resource) struct client_resource *resource)
{ {
struct response *response = struct response *response =
container_of(resource, struct response, resource); container_of(resource, struct response, resource);
@ -378,9 +370,8 @@ release_transaction(struct client *client, struct client_resource *resource)
fw_cancel_transaction(client->device->card, &response->transaction); fw_cancel_transaction(client->device->card, &response->transaction);
} }
static void static void complete_transaction(struct fw_card *card, int rcode,
complete_transaction(struct fw_card *card, int rcode, void *payload, size_t length, void *data)
void *payload, size_t length, void *data)
{ {
struct response *response = data; struct response *response = data;
struct client *client = response->client; struct client *client = response->client;
@ -506,8 +497,8 @@ struct request_event {
struct fw_cdev_event_request request; struct fw_cdev_event_request request;
}; };
static void static void release_request(struct client *client,
release_request(struct client *client, struct client_resource *resource) struct client_resource *resource)
{ {
struct request *request = struct request *request =
container_of(resource, struct request, resource); container_of(resource, struct request, resource);
@ -517,12 +508,11 @@ release_request(struct client *client, struct client_resource *resource)
kfree(request); kfree(request);
} }
static void static void handle_request(struct fw_card *card, struct fw_request *r,
handle_request(struct fw_card *card, struct fw_request *r, int tcode, int destination, int source,
int tcode, int destination, int source, int generation, int speed,
int generation, int speed, unsigned long long offset,
unsigned long long offset, void *payload, size_t length, void *callback_data)
void *payload, size_t length, void *callback_data)
{ {
struct address_handler *handler = callback_data; struct address_handler *handler = callback_data;
struct request *request; struct request *request;
@ -561,9 +551,8 @@ handle_request(struct fw_card *card, struct fw_request *r,
fw_send_response(card, r, RCODE_CONFLICT_ERROR); fw_send_response(card, r, RCODE_CONFLICT_ERROR);
} }
static void static void release_address_handler(struct client *client,
release_address_handler(struct client *client, struct client_resource *resource)
struct client_resource *resource)
{ {
struct address_handler *handler = struct address_handler *handler =
container_of(resource, struct address_handler, resource); container_of(resource, struct address_handler, resource);
@ -716,9 +705,8 @@ static int ioctl_remove_descriptor(struct client *client, void *buffer)
release_descriptor, NULL); release_descriptor, NULL);
} }
static void static void iso_callback(struct fw_iso_context *context, u32 cycle,
iso_callback(struct fw_iso_context *context, u32 cycle, size_t header_length, void *header, void *data)
size_t header_length, void *header, void *data)
{ {
struct client *client = data; struct client *client = data;
struct iso_interrupt *irq; struct iso_interrupt *irq;
@ -954,8 +942,8 @@ static int (* const ioctl_handlers[])(struct client *client, void *buffer) = {
ioctl_get_cycle_timer, ioctl_get_cycle_timer,
}; };
static int static int dispatch_ioctl(struct client *client,
dispatch_ioctl(struct client *client, unsigned int cmd, void __user *arg) unsigned int cmd, void __user *arg)
{ {
char buffer[256]; char buffer[256];
int ret; int ret;
@ -983,9 +971,8 @@ dispatch_ioctl(struct client *client, unsigned int cmd, void __user *arg)
return ret; return ret;
} }
static long static long fw_device_op_ioctl(struct file *file,
fw_device_op_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
unsigned int cmd, unsigned long arg)
{ {
struct client *client = file->private_data; struct client *client = file->private_data;
@ -996,9 +983,8 @@ fw_device_op_ioctl(struct file *file,
} }
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
static long static long fw_device_op_compat_ioctl(struct file *file,
fw_device_op_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
unsigned int cmd, unsigned long arg)
{ {
struct client *client = file->private_data; struct client *client = file->private_data;

View File

@ -134,8 +134,7 @@ static int get_modalias(struct fw_unit *unit, char *buffer, size_t buffer_size)
vendor, model, specifier_id, version); vendor, model, specifier_id, version);
} }
static int static int fw_unit_uevent(struct device *dev, struct kobj_uevent_env *env)
fw_unit_uevent(struct device *dev, struct kobj_uevent_env *env)
{ {
struct fw_unit *unit = fw_unit(dev); struct fw_unit *unit = fw_unit(dev);
char modalias[64]; char modalias[64];
@ -193,8 +192,8 @@ struct config_rom_attribute {
u32 key; u32 key;
}; };
static ssize_t static ssize_t show_immediate(struct device *dev,
show_immediate(struct device *dev, struct device_attribute *dattr, char *buf) struct device_attribute *dattr, char *buf)
{ {
struct config_rom_attribute *attr = struct config_rom_attribute *attr =
container_of(dattr, struct config_rom_attribute, attr); container_of(dattr, struct config_rom_attribute, attr);
@ -225,8 +224,8 @@ show_immediate(struct device *dev, struct device_attribute *dattr, char *buf)
#define IMMEDIATE_ATTR(name, key) \ #define IMMEDIATE_ATTR(name, key) \
{ __ATTR(name, S_IRUGO, show_immediate, NULL), key } { __ATTR(name, S_IRUGO, show_immediate, NULL), key }
static ssize_t static ssize_t show_text_leaf(struct device *dev,
show_text_leaf(struct device *dev, struct device_attribute *dattr, char *buf) struct device_attribute *dattr, char *buf)
{ {
struct config_rom_attribute *attr = struct config_rom_attribute *attr =
container_of(dattr, struct config_rom_attribute, attr); container_of(dattr, struct config_rom_attribute, attr);
@ -295,10 +294,9 @@ static struct config_rom_attribute config_rom_attributes[] = {
TEXT_LEAF_ATTR(hardware_version_name, CSR_HARDWARE_VERSION), TEXT_LEAF_ATTR(hardware_version_name, CSR_HARDWARE_VERSION),
}; };
static void static void init_fw_attribute_group(struct device *dev,
init_fw_attribute_group(struct device *dev, struct device_attribute *attrs,
struct device_attribute *attrs, struct fw_attribute_group *group)
struct fw_attribute_group *group)
{ {
struct device_attribute *attr; struct device_attribute *attr;
int i, j; int i, j;
@ -321,9 +319,8 @@ init_fw_attribute_group(struct device *dev,
dev->groups = group->groups; dev->groups = group->groups;
} }
static ssize_t static ssize_t modalias_show(struct device *dev,
modalias_show(struct device *dev, struct device_attribute *attr, char *buf)
struct device_attribute *attr, char *buf)
{ {
struct fw_unit *unit = fw_unit(dev); struct fw_unit *unit = fw_unit(dev);
int length; int length;
@ -334,9 +331,8 @@ modalias_show(struct device *dev,
return length + 1; return length + 1;
} }
static ssize_t static ssize_t rom_index_show(struct device *dev,
rom_index_show(struct device *dev, struct device_attribute *attr, char *buf)
struct device_attribute *attr, char *buf)
{ {
struct fw_device *device = fw_device(dev->parent); struct fw_device *device = fw_device(dev->parent);
struct fw_unit *unit = fw_unit(dev); struct fw_unit *unit = fw_unit(dev);
@ -351,8 +347,8 @@ static struct device_attribute fw_unit_attributes[] = {
__ATTR_NULL, __ATTR_NULL,
}; };
static ssize_t static ssize_t config_rom_show(struct device *dev,
config_rom_show(struct device *dev, struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct fw_device *device = fw_device(dev); struct fw_device *device = fw_device(dev);
size_t length; size_t length;
@ -365,8 +361,8 @@ config_rom_show(struct device *dev, struct device_attribute *attr, char *buf)
return length; return length;
} }
static ssize_t static ssize_t guid_show(struct device *dev,
guid_show(struct device *dev, struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct fw_device *device = fw_device(dev); struct fw_device *device = fw_device(dev);
int ret; int ret;
@ -385,8 +381,8 @@ static struct device_attribute fw_device_attributes[] = {
__ATTR_NULL, __ATTR_NULL,
}; };
static int static int read_rom(struct fw_device *device,
read_rom(struct fw_device *device, int generation, int index, u32 *data) int generation, int index, u32 *data)
{ {
int rcode; int rcode;

View File

@ -180,8 +180,7 @@ struct fw_driver {
const struct fw_device_id *id_table; const struct fw_device_id *id_table;
}; };
static inline struct fw_driver * static inline struct fw_driver *fw_driver(struct device_driver *drv)
fw_driver(struct device_driver *drv)
{ {
return container_of(drv, struct fw_driver, driver); return container_of(drv, struct fw_driver, driver);
} }

View File

@ -28,9 +28,8 @@
#include "fw-topology.h" #include "fw-topology.h"
#include "fw-device.h" #include "fw-device.h"
int int fw_iso_buffer_init(struct fw_iso_buffer *buffer, struct fw_card *card,
fw_iso_buffer_init(struct fw_iso_buffer *buffer, struct fw_card *card, int page_count, enum dma_data_direction direction)
int page_count, enum dma_data_direction direction)
{ {
int i, j; int i, j;
dma_addr_t address; dma_addr_t address;
@ -105,10 +104,9 @@ void fw_iso_buffer_destroy(struct fw_iso_buffer *buffer,
buffer->pages = NULL; buffer->pages = NULL;
} }
struct fw_iso_context * struct fw_iso_context *fw_iso_context_create(struct fw_card *card,
fw_iso_context_create(struct fw_card *card, int type, int type, int channel, int speed, size_t header_size,
int channel, int speed, size_t header_size, fw_iso_callback_t callback, void *callback_data)
fw_iso_callback_t callback, void *callback_data)
{ {
struct fw_iso_context *ctx; struct fw_iso_context *ctx;
@ -134,25 +132,23 @@ void fw_iso_context_destroy(struct fw_iso_context *ctx)
card->driver->free_iso_context(ctx); card->driver->free_iso_context(ctx);
} }
int int fw_iso_context_start(struct fw_iso_context *ctx,
fw_iso_context_start(struct fw_iso_context *ctx, int cycle, int sync, int tags) int cycle, int sync, int tags)
{ {
return ctx->card->driver->start_iso(ctx, cycle, sync, tags); return ctx->card->driver->start_iso(ctx, cycle, sync, tags);
} }
int int fw_iso_context_queue(struct fw_iso_context *ctx,
fw_iso_context_queue(struct fw_iso_context *ctx, struct fw_iso_packet *packet,
struct fw_iso_packet *packet, struct fw_iso_buffer *buffer,
struct fw_iso_buffer *buffer, unsigned long payload)
unsigned long payload)
{ {
struct fw_card *card = ctx->card; struct fw_card *card = ctx->card;
return card->driver->queue_iso(ctx, packet, buffer, payload); return card->driver->queue_iso(ctx, packet, buffer, payload);
} }
int int fw_iso_context_stop(struct fw_iso_context *ctx)
fw_iso_context_stop(struct fw_iso_context *ctx)
{ {
return ctx->card->driver->stop_iso(ctx); return ctx->card->driver->stop_iso(ctx);
} }

View File

@ -441,9 +441,8 @@ static inline void flush_writes(const struct fw_ohci *ohci)
reg_read(ohci, OHCI1394_Version); reg_read(ohci, OHCI1394_Version);
} }
static int static int ohci_update_phy_reg(struct fw_card *card, int addr,
ohci_update_phy_reg(struct fw_card *card, int addr, int clear_bits, int set_bits)
int clear_bits, int set_bits)
{ {
struct fw_ohci *ohci = fw_ohci(card); struct fw_ohci *ohci = fw_ohci(card);
u32 val, old; u32 val, old;
@ -658,8 +657,8 @@ static void ar_context_tasklet(unsigned long data)
} }
} }
static int static int ar_context_init(struct ar_context *ctx,
ar_context_init(struct ar_context *ctx, struct fw_ohci *ohci, u32 regs) struct fw_ohci *ohci, u32 regs)
{ {
struct ar_buffer ab; struct ar_buffer ab;
@ -690,8 +689,7 @@ static void ar_context_run(struct ar_context *ctx)
flush_writes(ctx->ohci); flush_writes(ctx->ohci);
} }
static struct descriptor * static struct descriptor *find_branch_descriptor(struct descriptor *d, int z)
find_branch_descriptor(struct descriptor *d, int z)
{ {
int b, key; int b, key;
@ -751,8 +749,7 @@ static void context_tasklet(unsigned long data)
* Allocate a new buffer and add it to the list of free buffers for this * Allocate a new buffer and add it to the list of free buffers for this
* context. Must be called with ohci->lock held. * context. Must be called with ohci->lock held.
*/ */
static int static int context_add_buffer(struct context *ctx)
context_add_buffer(struct context *ctx)
{ {
struct descriptor_buffer *desc; struct descriptor_buffer *desc;
dma_addr_t uninitialized_var(bus_addr); dma_addr_t uninitialized_var(bus_addr);
@ -781,9 +778,8 @@ context_add_buffer(struct context *ctx)
return 0; return 0;
} }
static int static int context_init(struct context *ctx, struct fw_ohci *ohci,
context_init(struct context *ctx, struct fw_ohci *ohci, u32 regs, descriptor_callback_t callback)
u32 regs, descriptor_callback_t callback)
{ {
ctx->ohci = ohci; ctx->ohci = ohci;
ctx->regs = regs; ctx->regs = regs;
@ -814,8 +810,7 @@ context_init(struct context *ctx, struct fw_ohci *ohci,
return 0; return 0;
} }
static void static void context_release(struct context *ctx)
context_release(struct context *ctx)
{ {
struct fw_card *card = &ctx->ohci->card; struct fw_card *card = &ctx->ohci->card;
struct descriptor_buffer *desc, *tmp; struct descriptor_buffer *desc, *tmp;
@ -827,8 +822,8 @@ context_release(struct context *ctx)
} }
/* Must be called with ohci->lock held */ /* Must be called with ohci->lock held */
static struct descriptor * static struct descriptor *context_get_descriptors(struct context *ctx,
context_get_descriptors(struct context *ctx, int z, dma_addr_t *d_bus) int z, dma_addr_t *d_bus)
{ {
struct descriptor *d = NULL; struct descriptor *d = NULL;
struct descriptor_buffer *desc = ctx->buffer_tail; struct descriptor_buffer *desc = ctx->buffer_tail;
@ -912,8 +907,8 @@ struct driver_data {
* Must always be called with the ochi->lock held to ensure proper * Must always be called with the ochi->lock held to ensure proper
* generation handling and locking around packet queue manipulation. * generation handling and locking around packet queue manipulation.
*/ */
static int static int at_context_queue_packet(struct context *ctx,
at_context_queue_packet(struct context *ctx, struct fw_packet *packet) struct fw_packet *packet)
{ {
struct fw_ohci *ohci = ctx->ohci; struct fw_ohci *ohci = ctx->ohci;
dma_addr_t d_bus, uninitialized_var(payload_bus); dma_addr_t d_bus, uninitialized_var(payload_bus);
@ -1095,8 +1090,8 @@ static int handle_at_packet(struct context *context,
#define HEADER_GET_DATA_LENGTH(q) (((q) >> 16) & 0xffff) #define HEADER_GET_DATA_LENGTH(q) (((q) >> 16) & 0xffff)
#define HEADER_GET_EXTENDED_TCODE(q) (((q) >> 0) & 0xffff) #define HEADER_GET_EXTENDED_TCODE(q) (((q) >> 0) & 0xffff)
static void static void handle_local_rom(struct fw_ohci *ohci,
handle_local_rom(struct fw_ohci *ohci, struct fw_packet *packet, u32 csr) struct fw_packet *packet, u32 csr)
{ {
struct fw_packet response; struct fw_packet response;
int tcode, length, i; int tcode, length, i;
@ -1122,8 +1117,8 @@ handle_local_rom(struct fw_ohci *ohci, struct fw_packet *packet, u32 csr)
fw_core_handle_response(&ohci->card, &response); fw_core_handle_response(&ohci->card, &response);
} }
static void static void handle_local_lock(struct fw_ohci *ohci,
handle_local_lock(struct fw_ohci *ohci, struct fw_packet *packet, u32 csr) struct fw_packet *packet, u32 csr)
{ {
struct fw_packet response; struct fw_packet response;
int tcode, length, ext_tcode, sel; int tcode, length, ext_tcode, sel;
@ -1164,8 +1159,7 @@ handle_local_lock(struct fw_ohci *ohci, struct fw_packet *packet, u32 csr)
fw_core_handle_response(&ohci->card, &response); fw_core_handle_response(&ohci->card, &response);
} }
static void static void handle_local_request(struct context *ctx, struct fw_packet *packet)
handle_local_request(struct context *ctx, struct fw_packet *packet)
{ {
u64 offset; u64 offset;
u32 csr; u32 csr;
@ -1205,8 +1199,7 @@ handle_local_request(struct context *ctx, struct fw_packet *packet)
} }
} }
static void static void at_context_transmit(struct context *ctx, struct fw_packet *packet)
at_context_transmit(struct context *ctx, struct fw_packet *packet)
{ {
unsigned long flags; unsigned long flags;
int ret; int ret;
@ -1590,8 +1583,8 @@ static int ohci_enable(struct fw_card *card, u32 *config_rom, size_t length)
return 0; return 0;
} }
static int static int ohci_set_config_rom(struct fw_card *card,
ohci_set_config_rom(struct fw_card *card, u32 *config_rom, size_t length) u32 *config_rom, size_t length)
{ {
struct fw_ohci *ohci; struct fw_ohci *ohci;
unsigned long flags; unsigned long flags;
@ -1711,8 +1704,8 @@ static int ohci_cancel_packet(struct fw_card *card, struct fw_packet *packet)
return ret; return ret;
} }
static int static int ohci_enable_phys_dma(struct fw_card *card,
ohci_enable_phys_dma(struct fw_card *card, int node_id, int generation) int node_id, int generation)
{ {
#ifdef CONFIG_FIREWIRE_OHCI_REMOTE_DMA #ifdef CONFIG_FIREWIRE_OHCI_REMOTE_DMA
return 0; return 0;
@ -1752,8 +1745,7 @@ ohci_enable_phys_dma(struct fw_card *card, int node_id, int generation)
#endif /* CONFIG_FIREWIRE_OHCI_REMOTE_DMA */ #endif /* CONFIG_FIREWIRE_OHCI_REMOTE_DMA */
} }
static u64 static u64 ohci_get_bus_time(struct fw_card *card)
ohci_get_bus_time(struct fw_card *card)
{ {
struct fw_ohci *ohci = fw_ohci(card); struct fw_ohci *ohci = fw_ohci(card);
u32 cycle_time; u32 cycle_time;
@ -1884,8 +1876,8 @@ static int handle_it_packet(struct context *context,
return 1; return 1;
} }
static struct fw_iso_context * static struct fw_iso_context *ohci_allocate_iso_context(struct fw_card *card,
ohci_allocate_iso_context(struct fw_card *card, int type, size_t header_size) int type, size_t header_size)
{ {
struct fw_ohci *ohci = fw_ohci(card); struct fw_ohci *ohci = fw_ohci(card);
struct iso_context *ctx, *list; struct iso_context *ctx, *list;
@ -2025,11 +2017,10 @@ static void ohci_free_iso_context(struct fw_iso_context *base)
spin_unlock_irqrestore(&ohci->lock, flags); spin_unlock_irqrestore(&ohci->lock, flags);
} }
static int static int ohci_queue_iso_transmit(struct fw_iso_context *base,
ohci_queue_iso_transmit(struct fw_iso_context *base, struct fw_iso_packet *packet,
struct fw_iso_packet *packet, struct fw_iso_buffer *buffer,
struct fw_iso_buffer *buffer, unsigned long payload)
unsigned long payload)
{ {
struct iso_context *ctx = container_of(base, struct iso_context, base); struct iso_context *ctx = container_of(base, struct iso_context, base);
struct descriptor *d, *last, *pd; struct descriptor *d, *last, *pd;
@ -2124,11 +2115,10 @@ ohci_queue_iso_transmit(struct fw_iso_context *base,
return 0; return 0;
} }
static int static int ohci_queue_iso_receive_dualbuffer(struct fw_iso_context *base,
ohci_queue_iso_receive_dualbuffer(struct fw_iso_context *base, struct fw_iso_packet *packet,
struct fw_iso_packet *packet, struct fw_iso_buffer *buffer,
struct fw_iso_buffer *buffer, unsigned long payload)
unsigned long payload)
{ {
struct iso_context *ctx = container_of(base, struct iso_context, base); struct iso_context *ctx = container_of(base, struct iso_context, base);
struct db_descriptor *db = NULL; struct db_descriptor *db = NULL;
@ -2205,11 +2195,10 @@ ohci_queue_iso_receive_dualbuffer(struct fw_iso_context *base,
return 0; return 0;
} }
static int static int ohci_queue_iso_receive_packet_per_buffer(struct fw_iso_context *base,
ohci_queue_iso_receive_packet_per_buffer(struct fw_iso_context *base, struct fw_iso_packet *packet,
struct fw_iso_packet *packet, struct fw_iso_buffer *buffer,
struct fw_iso_buffer *buffer, unsigned long payload)
unsigned long payload)
{ {
struct iso_context *ctx = container_of(base, struct iso_context, base); struct iso_context *ctx = container_of(base, struct iso_context, base);
struct descriptor *d = NULL, *pd = NULL; struct descriptor *d = NULL, *pd = NULL;
@ -2283,11 +2272,10 @@ ohci_queue_iso_receive_packet_per_buffer(struct fw_iso_context *base,
return 0; return 0;
} }
static int static int ohci_queue_iso(struct fw_iso_context *base,
ohci_queue_iso(struct fw_iso_context *base, struct fw_iso_packet *packet,
struct fw_iso_packet *packet, struct fw_iso_buffer *buffer,
struct fw_iso_buffer *buffer, unsigned long payload)
unsigned long payload)
{ {
struct iso_context *ctx = container_of(base, struct iso_context, base); struct iso_context *ctx = container_of(base, struct iso_context, base);
unsigned long flags; unsigned long flags;
@ -2353,8 +2341,8 @@ static void ohci_pmac_off(struct pci_dev *dev)
#define ohci_pmac_off(dev) #define ohci_pmac_off(dev)
#endif /* CONFIG_PPC_PMAC */ #endif /* CONFIG_PPC_PMAC */
static int __devinit static int __devinit pci_probe(struct pci_dev *dev,
pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) const struct pci_device_id *ent)
{ {
struct fw_ohci *ohci; struct fw_ohci *ohci;
u32 bus_options, max_receive, link_speed, version; u32 bus_options, max_receive, link_speed, version;

View File

@ -392,20 +392,18 @@ static const struct {
} }
}; };
static void static void free_orb(struct kref *kref)
free_orb(struct kref *kref)
{ {
struct sbp2_orb *orb = container_of(kref, struct sbp2_orb, kref); struct sbp2_orb *orb = container_of(kref, struct sbp2_orb, kref);
kfree(orb); kfree(orb);
} }
static void static void sbp2_status_write(struct fw_card *card, struct fw_request *request,
sbp2_status_write(struct fw_card *card, struct fw_request *request, int tcode, int destination, int source,
int tcode, int destination, int source, int generation, int speed,
int generation, int speed, unsigned long long offset,
unsigned long long offset, void *payload, size_t length, void *callback_data)
void *payload, size_t length, void *callback_data)
{ {
struct sbp2_logical_unit *lu = callback_data; struct sbp2_logical_unit *lu = callback_data;
struct sbp2_orb *orb; struct sbp2_orb *orb;
@ -451,9 +449,8 @@ sbp2_status_write(struct fw_card *card, struct fw_request *request,
fw_send_response(card, request, RCODE_COMPLETE); fw_send_response(card, request, RCODE_COMPLETE);
} }
static void static void complete_transaction(struct fw_card *card, int rcode,
complete_transaction(struct fw_card *card, int rcode, void *payload, size_t length, void *data)
void *payload, size_t length, void *data)
{ {
struct sbp2_orb *orb = data; struct sbp2_orb *orb = data;
unsigned long flags; unsigned long flags;
@ -482,9 +479,8 @@ complete_transaction(struct fw_card *card, int rcode,
kref_put(&orb->kref, free_orb); kref_put(&orb->kref, free_orb);
} }
static void static void sbp2_send_orb(struct sbp2_orb *orb, struct sbp2_logical_unit *lu,
sbp2_send_orb(struct sbp2_orb *orb, struct sbp2_logical_unit *lu, int node_id, int generation, u64 offset)
int node_id, int generation, u64 offset)
{ {
struct fw_device *device = fw_device(lu->tgt->unit->device.parent); struct fw_device *device = fw_device(lu->tgt->unit->device.parent);
unsigned long flags; unsigned long flags;
@ -531,8 +527,8 @@ static int sbp2_cancel_orbs(struct sbp2_logical_unit *lu)
return retval; return retval;
} }
static void static void complete_management_orb(struct sbp2_orb *base_orb,
complete_management_orb(struct sbp2_orb *base_orb, struct sbp2_status *status) struct sbp2_status *status)
{ {
struct sbp2_management_orb *orb = struct sbp2_management_orb *orb =
container_of(base_orb, struct sbp2_management_orb, base); container_of(base_orb, struct sbp2_management_orb, base);
@ -542,10 +538,9 @@ complete_management_orb(struct sbp2_orb *base_orb, struct sbp2_status *status)
complete(&orb->done); complete(&orb->done);
} }
static int static int sbp2_send_management_orb(struct sbp2_logical_unit *lu, int node_id,
sbp2_send_management_orb(struct sbp2_logical_unit *lu, int node_id, int generation, int function,
int generation, int function, int lun_or_login_id, int lun_or_login_id, void *response)
void *response)
{ {
struct fw_device *device = fw_device(lu->tgt->unit->device.parent); struct fw_device *device = fw_device(lu->tgt->unit->device.parent);
struct sbp2_management_orb *orb; struct sbp2_management_orb *orb;
@ -652,9 +647,8 @@ static void sbp2_agent_reset(struct sbp2_logical_unit *lu)
&d, sizeof(d)); &d, sizeof(d));
} }
static void static void complete_agent_reset_write_no_wait(struct fw_card *card,
complete_agent_reset_write_no_wait(struct fw_card *card, int rcode, int rcode, void *payload, size_t length, void *data)
void *payload, size_t length, void *data)
{ {
kfree(data); kfree(data);
} }
@ -1299,8 +1293,7 @@ static void sbp2_unmap_scatterlist(struct device *card_device,
sizeof(orb->page_table), DMA_TO_DEVICE); sizeof(orb->page_table), DMA_TO_DEVICE);
} }
static unsigned int static unsigned int sbp2_status_to_sense_data(u8 *sbp2_status, u8 *sense_data)
sbp2_status_to_sense_data(u8 *sbp2_status, u8 *sense_data)
{ {
int sam_status; int sam_status;
@ -1337,8 +1330,8 @@ sbp2_status_to_sense_data(u8 *sbp2_status, u8 *sense_data)
} }
} }
static void static void complete_command_orb(struct sbp2_orb *base_orb,
complete_command_orb(struct sbp2_orb *base_orb, struct sbp2_status *status) struct sbp2_status *status)
{ {
struct sbp2_command_orb *orb = struct sbp2_command_orb *orb =
container_of(base_orb, struct sbp2_command_orb, base); container_of(base_orb, struct sbp2_command_orb, base);
@ -1384,9 +1377,8 @@ complete_command_orb(struct sbp2_orb *base_orb, struct sbp2_status *status)
orb->done(orb->cmd); orb->done(orb->cmd);
} }
static int static int sbp2_map_scatterlist(struct sbp2_command_orb *orb,
sbp2_map_scatterlist(struct sbp2_command_orb *orb, struct fw_device *device, struct fw_device *device, struct sbp2_logical_unit *lu)
struct sbp2_logical_unit *lu)
{ {
struct scatterlist *sg = scsi_sglist(orb->cmd); struct scatterlist *sg = scsi_sglist(orb->cmd);
int i, n; int i, n;
@ -1584,9 +1576,8 @@ static int sbp2_scsi_abort(struct scsi_cmnd *cmd)
* This is the concatenation of target port identifier and logical unit * This is the concatenation of target port identifier and logical unit
* identifier as per SAM-2...SAM-4 annex A. * identifier as per SAM-2...SAM-4 annex A.
*/ */
static ssize_t static ssize_t sbp2_sysfs_ieee1394_id_show(struct device *dev,
sbp2_sysfs_ieee1394_id_show(struct device *dev, struct device_attribute *attr, struct device_attribute *attr, char *buf)
char *buf)
{ {
struct scsi_device *sdev = to_scsi_device(dev); struct scsi_device *sdev = to_scsi_device(dev);
struct sbp2_logical_unit *lu; struct sbp2_logical_unit *lu;

View File

@ -314,9 +314,8 @@ typedef void (*fw_node_callback_t)(struct fw_card * card,
struct fw_node * node, struct fw_node * node,
struct fw_node * parent); struct fw_node * parent);
static void static void for_each_fw_node(struct fw_card *card, struct fw_node *root,
for_each_fw_node(struct fw_card *card, struct fw_node *root, fw_node_callback_t callback)
fw_node_callback_t callback)
{ {
struct list_head list; struct list_head list;
struct fw_node *node, *next, *child, *parent; struct fw_node *node, *next, *child, *parent;
@ -349,9 +348,8 @@ for_each_fw_node(struct fw_card *card, struct fw_node *root,
fw_node_put(node); fw_node_put(node);
} }
static void static void report_lost_node(struct fw_card *card,
report_lost_node(struct fw_card *card, struct fw_node *node, struct fw_node *parent)
struct fw_node *node, struct fw_node *parent)
{ {
fw_node_event(card, node, FW_NODE_DESTROYED); fw_node_event(card, node, FW_NODE_DESTROYED);
fw_node_put(node); fw_node_put(node);
@ -360,9 +358,8 @@ report_lost_node(struct fw_card *card,
card->bm_retries = 0; card->bm_retries = 0;
} }
static void static void report_found_node(struct fw_card *card,
report_found_node(struct fw_card *card, struct fw_node *node, struct fw_node *parent)
struct fw_node *node, struct fw_node *parent)
{ {
int b_path = (node->phy_speed == SCODE_BETA); int b_path = (node->phy_speed == SCODE_BETA);
@ -415,8 +412,7 @@ static void move_tree(struct fw_node *node0, struct fw_node *node1, int port)
* found, lost or updated. Update the nodes in the card topology tree * found, lost or updated. Update the nodes in the card topology tree
* as we go. * as we go.
*/ */
static void static void update_tree(struct fw_card *card, struct fw_node *root)
update_tree(struct fw_card *card, struct fw_node *root)
{ {
struct list_head list0, list1; struct list_head list0, list1;
struct fw_node *node0, *node1, *next1; struct fw_node *node0, *node1, *next1;
@ -497,8 +493,8 @@ update_tree(struct fw_card *card, struct fw_node *root)
} }
} }
static void static void update_topology_map(struct fw_card *card,
update_topology_map(struct fw_card *card, u32 *self_ids, int self_id_count) u32 *self_ids, int self_id_count)
{ {
int node_count; int node_count;
@ -510,10 +506,8 @@ update_topology_map(struct fw_card *card, u32 *self_ids, int self_id_count)
fw_compute_block_crc(card->topology_map); fw_compute_block_crc(card->topology_map);
} }
void void fw_core_handle_bus_reset(struct fw_card *card, int node_id, int generation,
fw_core_handle_bus_reset(struct fw_card *card, int self_id_count, u32 *self_ids)
int node_id, int generation,
int self_id_count, u32 * self_ids)
{ {
struct fw_node *local_node; struct fw_node *local_node;
unsigned long flags; unsigned long flags;

View File

@ -51,26 +51,21 @@ struct fw_node {
struct fw_node *ports[0]; struct fw_node *ports[0];
}; };
static inline struct fw_node * static inline struct fw_node *fw_node_get(struct fw_node *node)
fw_node_get(struct fw_node *node)
{ {
atomic_inc(&node->ref_count); atomic_inc(&node->ref_count);
return node; return node;
} }
static inline void static inline void fw_node_put(struct fw_node *node)
fw_node_put(struct fw_node *node)
{ {
if (atomic_dec_and_test(&node->ref_count)) if (atomic_dec_and_test(&node->ref_count))
kfree(node); kfree(node);
} }
void void fw_destroy_nodes(struct fw_card *card);
fw_destroy_nodes(struct fw_card *card);
int
fw_compute_block_crc(u32 *block);
int fw_compute_block_crc(u32 *block);
#endif /* __fw_topology_h */ #endif /* __fw_topology_h */

View File

@ -64,10 +64,9 @@
#define PHY_CONFIG_ROOT_ID(node_id) ((((node_id) & 0x3f) << 24) | (1 << 23)) #define PHY_CONFIG_ROOT_ID(node_id) ((((node_id) & 0x3f) << 24) | (1 << 23))
#define PHY_IDENTIFIER(id) ((id) << 30) #define PHY_IDENTIFIER(id) ((id) << 30)
static int static int close_transaction(struct fw_transaction *transaction,
close_transaction(struct fw_transaction *transaction, struct fw_card *card, int rcode,
struct fw_card *card, int rcode, u32 *payload, size_t length)
u32 *payload, size_t length)
{ {
struct fw_transaction *t; struct fw_transaction *t;
unsigned long flags; unsigned long flags;
@ -94,9 +93,8 @@ close_transaction(struct fw_transaction *transaction,
* Only valid for transactions that are potentially pending (ie have * Only valid for transactions that are potentially pending (ie have
* been sent). * been sent).
*/ */
int int fw_cancel_transaction(struct fw_card *card,
fw_cancel_transaction(struct fw_card *card, struct fw_transaction *transaction)
struct fw_transaction *transaction)
{ {
/* /*
* Cancel the packet transmission if it's still queued. That * Cancel the packet transmission if it's still queued. That
@ -116,9 +114,8 @@ fw_cancel_transaction(struct fw_card *card,
} }
EXPORT_SYMBOL(fw_cancel_transaction); EXPORT_SYMBOL(fw_cancel_transaction);
static void static void transmit_complete_callback(struct fw_packet *packet,
transmit_complete_callback(struct fw_packet *packet, struct fw_card *card, int status)
struct fw_card *card, int status)
{ {
struct fw_transaction *t = struct fw_transaction *t =
container_of(packet, struct fw_transaction, packet); container_of(packet, struct fw_transaction, packet);
@ -151,8 +148,7 @@ transmit_complete_callback(struct fw_packet *packet,
} }
} }
static void static void fw_fill_request(struct fw_packet *packet, int tcode, int tlabel,
fw_fill_request(struct fw_packet *packet, int tcode, int tlabel,
int destination_id, int source_id, int generation, int speed, int destination_id, int source_id, int generation, int speed,
unsigned long long offset, void *payload, size_t length) unsigned long long offset, void *payload, size_t length)
{ {
@ -247,12 +243,10 @@ fw_fill_request(struct fw_packet *packet, int tcode, int tlabel,
* @param callback_data pointer to arbitrary data, which will be * @param callback_data pointer to arbitrary data, which will be
* passed to the callback * passed to the callback
*/ */
void void fw_send_request(struct fw_card *card, struct fw_transaction *t, int tcode,
fw_send_request(struct fw_card *card, struct fw_transaction *t, int destination_id, int generation, int speed,
int tcode, int destination_id, int generation, int speed, unsigned long long offset, void *payload, size_t length,
unsigned long long offset, fw_transaction_callback_t callback, void *callback_data)
void *payload, size_t length,
fw_transaction_callback_t callback, void *callback_data)
{ {
unsigned long flags; unsigned long flags;
int tlabel; int tlabel;
@ -322,8 +316,8 @@ static void transaction_callback(struct fw_card *card, int rcode,
* Returns the RCODE. * Returns the RCODE.
*/ */
int fw_run_transaction(struct fw_card *card, int tcode, int destination_id, int fw_run_transaction(struct fw_card *card, int tcode, int destination_id,
int generation, int speed, unsigned long long offset, int generation, int speed, unsigned long long offset,
void *data, size_t length) void *data, size_t length)
{ {
struct transaction_callback_data d; struct transaction_callback_data d;
struct fw_transaction t; struct fw_transaction t;
@ -399,9 +393,8 @@ void fw_flush_transactions(struct fw_card *card)
} }
} }
static struct fw_address_handler * static struct fw_address_handler *lookup_overlapping_address_handler(
lookup_overlapping_address_handler(struct list_head *list, struct list_head *list, unsigned long long offset, size_t length)
unsigned long long offset, size_t length)
{ {
struct fw_address_handler *handler; struct fw_address_handler *handler;
@ -414,9 +407,8 @@ lookup_overlapping_address_handler(struct list_head *list,
return NULL; return NULL;
} }
static struct fw_address_handler * static struct fw_address_handler *lookup_enclosing_address_handler(
lookup_enclosing_address_handler(struct list_head *list, struct list_head *list, unsigned long long offset, size_t length)
unsigned long long offset, size_t length)
{ {
struct fw_address_handler *handler; struct fw_address_handler *handler;
@ -463,9 +455,8 @@ const struct fw_address_region fw_unit_space_region =
* The start offset of the handler's address region is determined by * The start offset of the handler's address region is determined by
* fw_core_add_address_handler() and is returned in handler->offset. * fw_core_add_address_handler() and is returned in handler->offset.
*/ */
int int fw_core_add_address_handler(struct fw_address_handler *handler,
fw_core_add_address_handler(struct fw_address_handler *handler, const struct fw_address_region *region)
const struct fw_address_region *region)
{ {
struct fw_address_handler *other; struct fw_address_handler *other;
unsigned long flags; unsigned long flags;
@ -522,9 +513,8 @@ struct fw_request {
u32 data[0]; u32 data[0];
}; };
static void static void free_response_callback(struct fw_packet *packet,
free_response_callback(struct fw_packet *packet, struct fw_card *card, int status)
struct fw_card *card, int status)
{ {
struct fw_request *request; struct fw_request *request;
@ -532,9 +522,8 @@ free_response_callback(struct fw_packet *packet,
kfree(request); kfree(request);
} }
void void fw_fill_response(struct fw_packet *response, u32 *request_header,
fw_fill_response(struct fw_packet *response, u32 *request_header, int rcode, void *payload, size_t length)
int rcode, void *payload, size_t length)
{ {
int tcode, tlabel, extended_tcode, source, destination; int tcode, tlabel, extended_tcode, source, destination;
@ -592,8 +581,7 @@ fw_fill_response(struct fw_packet *response, u32 *request_header,
} }
EXPORT_SYMBOL(fw_fill_response); EXPORT_SYMBOL(fw_fill_response);
static struct fw_request * static struct fw_request *allocate_request(struct fw_packet *p)
allocate_request(struct fw_packet *p)
{ {
struct fw_request *request; struct fw_request *request;
u32 *data, length; u32 *data, length;
@ -653,8 +641,8 @@ allocate_request(struct fw_packet *p)
return request; return request;
} }
void void fw_send_response(struct fw_card *card,
fw_send_response(struct fw_card *card, struct fw_request *request, int rcode) struct fw_request *request, int rcode)
{ {
/* unified transaction or broadcast transaction: don't respond */ /* unified transaction or broadcast transaction: don't respond */
if (request->ack != ACK_PENDING || if (request->ack != ACK_PENDING ||
@ -674,8 +662,7 @@ fw_send_response(struct fw_card *card, struct fw_request *request, int rcode)
} }
EXPORT_SYMBOL(fw_send_response); EXPORT_SYMBOL(fw_send_response);
void void fw_core_handle_request(struct fw_card *card, struct fw_packet *p)
fw_core_handle_request(struct fw_card *card, struct fw_packet *p)
{ {
struct fw_address_handler *handler; struct fw_address_handler *handler;
struct fw_request *request; struct fw_request *request;
@ -723,8 +710,7 @@ fw_core_handle_request(struct fw_card *card, struct fw_packet *p)
} }
EXPORT_SYMBOL(fw_core_handle_request); EXPORT_SYMBOL(fw_core_handle_request);
void void fw_core_handle_response(struct fw_card *card, struct fw_packet *p)
fw_core_handle_response(struct fw_card *card, struct fw_packet *p)
{ {
struct fw_transaction *t; struct fw_transaction *t;
unsigned long flags; unsigned long flags;
@ -797,12 +783,10 @@ static const struct fw_address_region topology_map_region =
{ .start = CSR_REGISTER_BASE | CSR_TOPOLOGY_MAP, { .start = CSR_REGISTER_BASE | CSR_TOPOLOGY_MAP,
.end = CSR_REGISTER_BASE | CSR_TOPOLOGY_MAP_END, }; .end = CSR_REGISTER_BASE | CSR_TOPOLOGY_MAP_END, };
static void static void handle_topology_map(struct fw_card *card, struct fw_request *request,
handle_topology_map(struct fw_card *card, struct fw_request *request, int tcode, int destination, int source, int generation,
int tcode, int destination, int source, int speed, unsigned long long offset,
int generation, int speed, void *payload, size_t length, void *callback_data)
unsigned long long offset,
void *payload, size_t length, void *callback_data)
{ {
int i, start, end; int i, start, end;
__be32 *map; __be32 *map;
@ -836,12 +820,10 @@ static const struct fw_address_region registers_region =
{ .start = CSR_REGISTER_BASE, { .start = CSR_REGISTER_BASE,
.end = CSR_REGISTER_BASE | CSR_CONFIG_ROM, }; .end = CSR_REGISTER_BASE | CSR_CONFIG_ROM, };
static void static void handle_registers(struct fw_card *card, struct fw_request *request,
handle_registers(struct fw_card *card, struct fw_request *request, int tcode, int destination, int source, int generation,
int tcode, int destination, int source, int speed, unsigned long long offset,
int generation, int speed, void *payload, size_t length, void *callback_data)
unsigned long long offset,
void *payload, size_t length, void *callback_data)
{ {
int reg = offset & ~CSR_REGISTER_BASE; int reg = offset & ~CSR_REGISTER_BASE;
unsigned long long bus_time; unsigned long long bus_time;

View File

@ -88,8 +88,7 @@
#define fw_notify(s, args...) printk(KERN_NOTICE KBUILD_MODNAME ": " s, ## args) #define fw_notify(s, args...) printk(KERN_NOTICE KBUILD_MODNAME ": " s, ## args)
#define fw_error(s, args...) printk(KERN_ERR KBUILD_MODNAME ": " s, ## args) #define fw_error(s, args...) printk(KERN_ERR KBUILD_MODNAME ": " s, ## args)
static inline void static inline void fw_memcpy_from_be32(void *_dst, void *_src, size_t size)
fw_memcpy_from_be32(void *_dst, void *_src, size_t size)
{ {
u32 *dst = _dst; u32 *dst = _dst;
__be32 *src = _src; __be32 *src = _src;
@ -99,8 +98,7 @@ fw_memcpy_from_be32(void *_dst, void *_src, size_t size)
dst[i] = be32_to_cpu(src[i]); dst[i] = be32_to_cpu(src[i]);
} }
static inline void static inline void fw_memcpy_to_be32(void *_dst, void *_src, size_t size)
fw_memcpy_to_be32(void *_dst, void *_src, size_t size)
{ {
fw_memcpy_from_be32(_dst, _src, size); fw_memcpy_from_be32(_dst, _src, size);
} }
@ -125,8 +123,7 @@ typedef void (*fw_packet_callback_t)(struct fw_packet *packet,
struct fw_card *card, int status); struct fw_card *card, int status);
typedef void (*fw_transaction_callback_t)(struct fw_card *card, int rcode, typedef void (*fw_transaction_callback_t)(struct fw_card *card, int rcode,
void *data, void *data, size_t length,
size_t length,
void *callback_data); void *callback_data);
/* /*
@ -201,7 +198,6 @@ struct fw_address_handler {
struct list_head link; struct list_head link;
}; };
struct fw_address_region { struct fw_address_region {
u64 start; u64 start;
u64 end; u64 end;
@ -315,10 +311,8 @@ struct fw_iso_packet {
struct fw_iso_context; struct fw_iso_context;
typedef void (*fw_iso_callback_t)(struct fw_iso_context *context, typedef void (*fw_iso_callback_t)(struct fw_iso_context *context,
u32 cycle, u32 cycle, size_t header_length,
size_t header_length, void *header, void *data);
void *header,
void *data);
/* /*
* An iso buffer is just a set of pages mapped for DMA in the * An iso buffer is just a set of pages mapped for DMA in the
@ -344,36 +338,22 @@ struct fw_iso_context {
void *callback_data; void *callback_data;
}; };
int int fw_iso_buffer_init(struct fw_iso_buffer *buffer, struct fw_card *card,
fw_iso_buffer_init(struct fw_iso_buffer *buffer, int page_count, enum dma_data_direction direction);
struct fw_card *card, int fw_iso_buffer_map(struct fw_iso_buffer *buffer, struct vm_area_struct *vma);
int page_count, void fw_iso_buffer_destroy(struct fw_iso_buffer *buffer, struct fw_card *card);
enum dma_data_direction direction);
int
fw_iso_buffer_map(struct fw_iso_buffer *buffer, struct vm_area_struct *vma);
void
fw_iso_buffer_destroy(struct fw_iso_buffer *buffer, struct fw_card *card);
struct fw_iso_context * struct fw_iso_context *fw_iso_context_create(struct fw_card *card,
fw_iso_context_create(struct fw_card *card, int type, int type, int channel, int speed, size_t header_size,
int channel, int speed, size_t header_size, fw_iso_callback_t callback, void *callback_data);
fw_iso_callback_t callback, void *callback_data); int fw_iso_context_queue(struct fw_iso_context *ctx,
struct fw_iso_packet *packet,
void struct fw_iso_buffer *buffer,
fw_iso_context_destroy(struct fw_iso_context *ctx); unsigned long payload);
int fw_iso_context_start(struct fw_iso_context *ctx,
int int cycle, int sync, int tags);
fw_iso_context_queue(struct fw_iso_context *ctx, int fw_iso_context_stop(struct fw_iso_context *ctx);
struct fw_iso_packet *packet, void fw_iso_context_destroy(struct fw_iso_context *ctx);
struct fw_iso_buffer *buffer,
unsigned long payload);
int
fw_iso_context_start(struct fw_iso_context *ctx,
int cycle, int sync, int tags);
int
fw_iso_context_stop(struct fw_iso_context *ctx);
struct fw_card_driver { struct fw_card_driver {
/* /*
@ -429,24 +409,18 @@ struct fw_card_driver {
int (*stop_iso)(struct fw_iso_context *ctx); int (*stop_iso)(struct fw_iso_context *ctx);
}; };
int int fw_core_initiate_bus_reset(struct fw_card *card, int short_reset);
fw_core_initiate_bus_reset(struct fw_card *card, int short_reset);
void void fw_send_request(struct fw_card *card, struct fw_transaction *t,
fw_send_request(struct fw_card *card, struct fw_transaction *t,
int tcode, int destination_id, int generation, int speed, int tcode, int destination_id, int generation, int speed,
unsigned long long offset, void *data, size_t length, unsigned long long offset, void *data, size_t length,
fw_transaction_callback_t callback, void *callback_data); fw_transaction_callback_t callback, void *callback_data);
int fw_cancel_transaction(struct fw_card *card,
struct fw_transaction *transaction);
void fw_flush_transactions(struct fw_card *card);
int fw_run_transaction(struct fw_card *card, int tcode, int destination_id, int fw_run_transaction(struct fw_card *card, int tcode, int destination_id,
int generation, int speed, unsigned long long offset, int generation, int speed, unsigned long long offset,
void *data, size_t length); void *data, size_t length);
int fw_cancel_transaction(struct fw_card *card,
struct fw_transaction *transaction);
void fw_flush_transactions(struct fw_card *card);
void fw_send_phy_config(struct fw_card *card, void fw_send_phy_config(struct fw_card *card,
int node_id, int generation, int gap_count); int node_id, int generation, int gap_count);
@ -454,29 +428,18 @@ void fw_send_phy_config(struct fw_card *card,
* Called by the topology code to inform the device code of node * Called by the topology code to inform the device code of node
* activity; found, lost, or updated nodes. * activity; found, lost, or updated nodes.
*/ */
void void fw_node_event(struct fw_card *card, struct fw_node *node, int event);
fw_node_event(struct fw_card *card, struct fw_node *node, int event);
/* API used by card level drivers */ /* API used by card level drivers */
void void fw_card_initialize(struct fw_card *card,
fw_card_initialize(struct fw_card *card, const struct fw_card_driver *driver, const struct fw_card_driver *driver, struct device *device);
struct device *device); int fw_card_add(struct fw_card *card,
int u32 max_receive, u32 link_speed, u64 guid);
fw_card_add(struct fw_card *card, void fw_core_remove_card(struct fw_card *card);
u32 max_receive, u32 link_speed, u64 guid); void fw_core_handle_bus_reset(struct fw_card *card, int node_id,
int generation, int self_id_count, u32 *self_ids);
void void fw_core_handle_request(struct fw_card *card, struct fw_packet *request);
fw_core_remove_card(struct fw_card *card); void fw_core_handle_response(struct fw_card *card, struct fw_packet *packet);
void
fw_core_handle_bus_reset(struct fw_card *card,
int node_id, int generation,
int self_id_count, u32 *self_ids);
void
fw_core_handle_request(struct fw_card *card, struct fw_packet *request);
void
fw_core_handle_response(struct fw_card *card, struct fw_packet *packet);
#endif /* __fw_transaction_h */ #endif /* __fw_transaction_h */