firewire: trivia
cover firewire: trivia
Following:
1/4 firewire: core: remove obsolete assertions 2/4 firewire: standardize a variable name
3/4 firewire: remove line breaks before function names 4/4 firewire: core: remove unused definitions
drivers/firewire/fw-card.c | 68 ++++--------- drivers/firewire/fw-cdev.c | 132 +++++++++++--------------- drivers/firewire/fw-device.c | 40 +++---- drivers/firewire/fw-device.h | 3 drivers/firewire/fw-iso.c | 40 +++---- drivers/firewire/fw-ohci.c | 151 +++++++++++++----------------- drivers/firewire/fw-sbp2.c | 57 ++++------- drivers/firewire/fw-topology.c | 28 ++--- drivers/firewire/fw-topology.h | 13 -- drivers/firewire/fw-transaction.c | 117 ++++++++--------------- drivers/firewire/fw-transaction.h | 121 +++++++----------------- 11 files changed, 310 insertions(+), 460 deletions(-)
Signature · 3 lines
Stefan Richter -=====-==--- ==-- -===- http://arcgraph.de/sr/
PATCH 1/4 firewire: core: remove obsolete assertions
This code never changes.
--- drivers/firewire/fw-transaction.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)
drivers/firewire/fw-transaction.c +4 -13
@@ -955,19 +955,10 @@ static int __init fw_core_init(void)return fw_cdev_major; } - retval =fw_core_add_address_handler (&topology_map, - &topology_map_region); -BUG_ON (retval <0 ); - - retval =fw_core_add_address_handler (®isters, - ®isters_region); -BUG_ON (retval <0 ); - -/* Add the vendor textual descriptor. */ - retval =fw_core_add_descriptor (&vendor_id_descriptor); -BUG_ON (retval <0 ); - retval =fw_core_add_descriptor (&model_id_descriptor); -BUG_ON (retval <0 ); +fw_core_add_address_handler (&topology_map, &topology_map_region); +fw_core_add_address_handler (®isters, ®isters_region); +fw_core_add_descriptor (&vendor_id_descriptor); +fw_core_add_descriptor (&model_id_descriptor);return 0 ; }
Signature · 3 lines
Stefan Richter -=====-==--- ==-- -===- http://arcgraph.de/sr/
PATCH 2/4 firewire: standardize a variable name
In reply to Stefan Richter"ret" is the new "retval".
--- drivers/firewire/fw-cdev.c | 44 ++++++++++++------------- drivers/firewire/fw-iso.c | 12 +++---- drivers/firewire/fw-ohci.c | 51 ++++++++++++++---------------- drivers/firewire/fw-transaction.c | 8 ++-- 4 files changed, 57 insertions(+), 58 deletions(-)
drivers/firewire/fw-cdev.c +22 -22
@@ -169,13 +169,13 @@ dequeue_event(struct client *client, chaunsigned long flags;struct event *event;size_t size, total; -int i, retval; +int i, ret; - retval =wait_event_interruptible (client->wait, - !list_empty (&client->event_list) || -fw_device_is_shutdown (client->device)); -if (retval <0 ) -return retval; + ret =wait_event_interruptible (client->wait, + !list_empty (&client->event_list) || +fw_device_is_shutdown (client->device)); +if (ret <0 ) +return ret;if (list_empty (&client->event_list) &&fw_device_is_shutdown (client->device))
@@ -190,17 +190,17 @@ dequeue_event(struct client *client, chafor (i =0 ; i <ARRAY_SIZE (event->v) && total < count; i++) { size =min (event->v[i].size, count - total);if (copy_to_user (buffer + total, event->v[i].data, size)) { - retval = -EFAULT ; + ret = -EFAULT ; goto out; } total += size; } - retval = total; + ret = total; out:kfree (event); -return retval; +return ret; } static ssize_t
@@ -958,7 +958,7 @@ static int dispatch_ioctl(struct client *client, unsigned int cmd, void __user *arg) { char buffer[256]; -int retval; +int ret;if (_IOC_TYPE (cmd) !='#' ||_IOC_NR (cmd) >=ARRAY_SIZE (ioctl_handlers))
@@ -970,9 +970,9 @@ dispatch_ioctl(struct client *client, unreturn -EFAULT ; } - retval = ioctl_handlers[_IOC_NR (cmd)](client, buffer); -if (retval <0 ) -return retval; + ret = ioctl_handlers[_IOC_NR (cmd)](client, buffer); +if (ret <0 ) +return ret;if (_IOC_DIR (cmd) & _IOC_READ) { if (_IOC_SIZE(cmd) > sizeof(buffer) ||
@@ -980,7 +980,7 @@ dispatch_ioctl(struct client *client, unreturn -EFAULT ; } -return retval; +return ret; } static long
@@ -1014,7 +1014,7 @@ static int fw_device_op_mmap(struct filestruct client *client = file->private_data;enum dma_data_direction direction;unsigned long size; -int page_count, retval; +int page_count, ret;if (fw_device_is_shutdown (client->device))return -ENODEV ;
@@ -1040,16 +1040,16 @@ static int fw_device_op_mmap(struct fileelse direction =DMA_FROM_DEVICE ; - retval =fw_iso_buffer_init (&client->buffer, client->device->card, - page_count, direction); -if (retval <0 ) -return retval; + ret =fw_iso_buffer_init (&client->buffer, client->device->card, + page_count, direction); +if (ret <0 ) +return ret; - retval =fw_iso_buffer_map (&client->buffer, vma); -if (retval <0 ) + ret =fw_iso_buffer_map (&client->buffer, vma); +if (ret <0 )fw_iso_buffer_destroy (&client->buffer, client->device->card); -return retval; +return ret; }static int shutdown_resource (int id,void *p,void *data)
drivers/firewire/fw-iso.c +6 -6
@@ -32,7 +32,7 @@ int fw_iso_buffer_init(struct fw_iso_buffer *buffer, struct fw_card *card, int page_count, enum dma_data_direction direction) { - int i, j, retval = -ENOMEM; + int i, j;dma_addr_t address; buffer->page_count = page_count;
@@ -69,19 +69,19 @@ fw_iso_buffer_init(struct fw_iso_bufferkfree (buffer->pages); out: buffer->pages =NULL ; -return retval; +return -ENOMEM ; }int fw_iso_buffer_map (struct fw_iso_buffer *buffer,struct vm_area_struct *vma) {unsigned long uaddr; -int i, retval; +int i, ret; uaddr = vma->vm_start;for (i =0 ; i < buffer->page_count; i++) { - retval =vm_insert_page (vma, uaddr, buffer->pages[i]); -if (retval) -return retval; + ret =vm_insert_page (vma, uaddr, buffer->pages[i]); +if (ret) +return ret; uaddr +=PAGE_SIZE ; }
drivers/firewire/fw-transaction.c +4 -4
@@ -943,11 +943,11 @@ static struct fw_descriptor model_id_desstatic int __init fw_core_init (void ) { -int retval; +int ret; - retval =bus_register (&fw_bus_type); -if (retval <0 ) -return retval; + ret =bus_register (&fw_bus_type); +if (ret <0 ) +return ret; fw_cdev_major =register_chrdev (0 ,"firewire" , &fw_device_ops);if (fw_cdev_major <0 ) {
drivers/firewire/fw-ohci.c +25 -26
152 lines not on this page · raw message
Signature · 3 lines
Stefan Richter -=====-==--- ==-- -===- http://arcgraph.de/sr/
PATCH 3/4 firewire: remove line breaks before function names
In reply to Stefan Richter type
function_name(parameters);is nice to look at but was not used consistently.
--- drivers/firewire/fw-card.c | 68 ++++++------------ drivers/firewire/fw-cdev.c | 88 ++++++++++-------------- drivers/firewire/fw-device.c | 40 ++++------- drivers/firewire/fw-device.h | 3 drivers/firewire/fw-iso.c | 28 +++---- drivers/firewire/fw-ohci.c | 100 ++++++++++++--------------- drivers/firewire/fw-sbp2.c | 57 ++++++--------- drivers/firewire/fw-topology.c | 28 +++---- drivers/firewire/fw-topology.h | 13 +-- drivers/firewire/fw-transaction.c | 92 ++++++++++--------------- drivers/firewire/fw-transaction.h | 109 +++++++++--------------------- 11 files changed, 249 insertions(+), 377 deletions(-)
drivers/firewire/fw-card.c +25 -43
@@ -63,8 +63,7 @@ static int descriptor_count;#define BIB_CMC ((1) << 30)#define BIB_IMC ((1) << 31) -static u32 * -generate_config_rom (struct fw_card *card,size_t *config_rom_length) +static u32 *generate_config_rom (struct fw_card *card,size_t *config_rom_length) {struct fw_descriptor *desc;static u32 config_rom[256 ];
@@ -128,8 +127,7 @@ generate_config_rom(struct fw_card *cardreturn config_rom; } -static void -update_config_roms (void ) +static void update_config_roms (void ) {struct fw_card *card;u32 *config_rom;
@@ -141,8 +139,7 @@ update_config_roms(void) } } -int -fw_core_add_descriptor (struct fw_descriptor *desc) +int fw_core_add_descriptor (struct fw_descriptor *desc) {size_t i;
@@ -171,8 +168,7 @@ fw_core_add_descriptor(struct fw_descripreturn 0 ; } -void -fw_core_remove_descriptor (struct fw_descriptor *desc) +void fw_core_remove_descriptor (struct fw_descriptor *desc) {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 }; -void -fw_schedule_bm_work (struct fw_card *card,unsigned long delay) +void fw_schedule_bm_work (struct fw_card *card,unsigned long delay) {int scheduled;
@@ -200,8 +195,7 @@ fw_schedule_bm_work(struct fw_card *cardfw_card_put (card); } -static void -fw_card_bm_work (struct work_struct *work) +static void fw_card_bm_work (struct work_struct *work) { struct fw_card *card = container_of(work, struct fw_card, work.work);struct fw_device *root_device;
@@ -370,17 +364,16 @@ fw_card_bm_work(struct work_struct *workfw_card_put (card); } -static void -flush_timer_callback (unsigned long data) +static void flush_timer_callback (unsigned long data) {struct fw_card *card = (struct fw_card *)data;fw_flush_transactions (card); } -void -fw_card_initialize (struct fw_card *card,const struct fw_card_driver *driver, -struct device *device) +void fw_card_initialize (struct fw_card *card, +const struct fw_card_driver *driver, +struct device *device) {static atomic_t index =ATOMIC_INIT (-1 );
@@ -405,9 +398,8 @@ fw_card_initialize(struct fw_card *card, }EXPORT_SYMBOL (fw_card_initialize); -int -fw_card_add (struct fw_card *card, -u32 max_receive,u32 link_speed,u64 guid) +int fw_card_add (struct fw_card *card, +u32 max_receive,u32 link_speed,u64 guid) {u32 *config_rom;size_t length;
@@ -434,23 +426,20 @@ EXPORT_SYMBOL(fw_card_add);* dummy driver just fails all IO. */ -static int -dummy_enable (struct fw_card *card,u32 *config_rom,size_t length) +static int dummy_enable (struct fw_card *card,u32 *config_rom,size_t length) {BUG ();return -1 ; } -static int -dummy_update_phy_reg (struct fw_card *card,int address, -int clear_bits,int set_bits) +static int dummy_update_phy_reg (struct fw_card *card,int address, +int clear_bits,int set_bits) {return -ENODEV ; } -static int -dummy_set_config_rom (struct fw_card *card, -u32 *config_rom,size_t length) +static int dummy_set_config_rom (struct fw_card *card, +u32 *config_rom,size_t length) {/* * We take the card out of card_list before setting the dummy
@@ -460,27 +449,23 @@ dummy_set_config_rom(struct fw_card *carreturn -1 ; } -static void -dummy_send_request (struct fw_card *card,struct fw_packet *packet) +static void dummy_send_request (struct fw_card *card,struct fw_packet *packet) { packet->callback (packet, card, -ENODEV ); } -static void -dummy_send_response (struct fw_card *card,struct fw_packet *packet) +static void dummy_send_response (struct fw_card *card,struct fw_packet *packet) { packet->callback (packet, card, -ENODEV ); } -static int -dummy_cancel_packet (struct fw_card *card,struct fw_packet *packet) +static int dummy_cancel_packet (struct fw_card *card,struct fw_packet *packet) {return -ENOENT ; } -static int -dummy_enable_phys_dma (struct fw_card *card, -int node_id,int generation) +static int dummy_enable_phys_dma (struct fw_card *card, +int node_id,int generation) {return -ENODEV ; }
@@ -495,16 +480,14 @@ static struct fw_card_driver dummy_drive .enable_phys_dma = dummy_enable_phys_dma, }; -void -fw_card_release (struct kref *kref) +void fw_card_release (struct kref *kref) { struct fw_card *card = container_of(kref, struct fw_card, kref);complete (&card->done); } -void -fw_core_remove_card (struct fw_card *card) +void fw_core_remove_card (struct fw_card *card) { card->driver->update_phy_reg (card,4 ,PHY_LINK_ACTIVE |PHY_CONTENDER ,0 );
@@ -528,8 +511,7 @@ fw_core_remove_card(struct fw_card *card }EXPORT_SYMBOL (fw_core_remove_card); -int -fw_core_initiate_bus_reset (struct fw_card *card,int short_reset) +int fw_core_initiate_bus_reset (struct fw_card *card,int short_reset) {int reg = short_reset ?5 :1 ;int bit = short_reset ?PHY_BUS_SHORT_RESET :PHY_BUS_RESET ;
drivers/firewire/fw-cdev.c +37 -51
194 lines not on this page · raw message
drivers/firewire/fw-device.c +18 -22
@@ -133,8 +133,7 @@ static int get_modalias(struct fw_unit * vendor, model, specifier_id, version); } -static int -fw_unit_uevent (struct device *dev,struct kobj_uevent_env *env) +static int fw_unit_uevent (struct device *dev,struct kobj_uevent_env *env) {struct fw_unit *unit =fw_unit (dev);char modalias[64 ];
@@ -191,8 +190,8 @@ struct config_rom_attribute {u32 key; }; -static ssize_t -show_immediate (struct device *dev,struct device_attribute *dattr,char *buf) +static ssize_t show_immediate (struct device *dev, +struct device_attribute *dattr,char *buf) {struct config_rom_attribute *attr = container_of(dattr, struct config_rom_attribute, attr);
@@ -223,8 +222,8 @@ show_immediate(struct device *dev, struc#define IMMEDIATE_ATTR (name, key) \ { __ATTR(name, S_IRUGO, show_immediate, NULL), key } -static ssize_t -show_text_leaf (struct device *dev,struct device_attribute *dattr,char *buf) +static ssize_t show_text_leaf (struct device *dev, +struct device_attribute *dattr,char *buf) {struct config_rom_attribute *attr = container_of(dattr, struct config_rom_attribute, attr);
@@ -293,10 +292,9 @@ static struct config_rom_attribute confi TEXT_LEAF_ATTR(hardware_version_name, CSR_HARDWARE_VERSION), }; -static void -init_fw_attribute_group (struct device *dev, -struct device_attribute *attrs, -struct fw_attribute_group *group) +static void init_fw_attribute_group (struct device *dev, +struct device_attribute *attrs, +struct fw_attribute_group *group) {struct device_attribute *attr;int i, j;
@@ -319,9 +317,8 @@ init_fw_attribute_group(struct device *d dev->groups = group->groups; } -static ssize_t -modalias_show (struct device *dev, -struct device_attribute *attr,char *buf) +static ssize_t modalias_show (struct device *dev, +struct device_attribute *attr,char *buf) {struct fw_unit *unit =fw_unit (dev);int length;
@@ -332,9 +329,8 @@ modalias_show(struct device *dev,return length +1 ; } -static ssize_t -rom_index_show (struct device *dev, -struct device_attribute *attr,char *buf) +static ssize_t rom_index_show (struct device *dev, +struct device_attribute *attr,char *buf) {struct fw_device *device =fw_device (dev->parent);struct fw_unit *unit =fw_unit (dev);
@@ -349,8 +345,8 @@ static struct device_attribute fw_unit_a __ATTR_NULL, }; -static ssize_t -config_rom_show (struct device *dev,struct device_attribute *attr,char *buf) +static ssize_t config_rom_show (struct device *dev, +struct device_attribute *attr,char *buf) {struct fw_device *device =fw_device (dev);size_t length;
@@ -363,8 +359,8 @@ config_rom_show(struct device *dev, strureturn length; } -static ssize_t -guid_show (struct device *dev,struct device_attribute *attr,char *buf) +static ssize_t guid_show (struct device *dev, +struct device_attribute *attr,char *buf) {struct fw_device *device =fw_device (dev);int ret;
@@ -383,8 +379,8 @@ static struct device_attribute fw_device __ATTR_NULL, }; -static int -read_rom (struct fw_device *device,int generation,int index,u32 *data) +static int read_rom (struct fw_device *device, +int generation,int index,u32 *data) {int rcode;
drivers/firewire/fw-device.h +1 -2
@@ -179,8 +179,7 @@ struct fw_driver {const struct fw_device_id *id_table; }; -static inline struct fw_driver * -fw_driver (struct device_driver *drv) +static inline struct fw_driver *fw_driver (struct device_driver *drv) { return container_of(drv, struct fw_driver, driver); }
drivers/firewire/fw-iso.c +12 -16
@@ -28,9 +28,8 @@#include "fw-topology.h" #include "fw-device.h" -int -fw_iso_buffer_init (struct fw_iso_buffer *buffer,struct fw_card *card, -int page_count,enum dma_data_direction direction) +int fw_iso_buffer_init (struct fw_iso_buffer *buffer,struct fw_card *card, +int page_count,enum dma_data_direction direction) {int i, j;dma_addr_t address;
@@ -105,10 +104,9 @@ void fw_iso_buffer_destroy(struct fw_iso buffer->pages =NULL ; } -struct fw_iso_context * -fw_iso_context_create (struct fw_card *card,int type, -int channel,int speed,size_t header_size, -fw_iso_callback_t callback,void *callback_data) +struct fw_iso_context *fw_iso_context_create (struct fw_card *card, +int type,int channel,int speed,size_t header_size, +fw_iso_callback_t callback,void *callback_data) {struct fw_iso_context *ctx;
@@ -134,25 +132,23 @@ void fw_iso_context_destroy(struct fw_is card->driver->free_iso_context (ctx); } -int -fw_iso_context_start (struct fw_iso_context *ctx,int cycle,int sync,int tags) +int fw_iso_context_start (struct fw_iso_context *ctx, +int cycle,int sync,int tags) {return ctx->card->driver->start_iso (ctx, cycle, sync, tags); } -int -fw_iso_context_queue (struct fw_iso_context *ctx, -struct fw_iso_packet *packet, -struct fw_iso_buffer *buffer, -unsigned long payload) +int fw_iso_context_queue (struct fw_iso_context *ctx, +struct fw_iso_packet *packet, +struct fw_iso_buffer *buffer, +unsigned long payload) {struct fw_card *card = ctx->card;return card->driver->queue_iso (ctx, packet, buffer, payload); } -int -fw_iso_context_stop (struct fw_iso_context *ctx) +int fw_iso_context_stop (struct fw_iso_context *ctx) {return ctx->card->driver->stop_iso (ctx); }
drivers/firewire/fw-ohci.c +44 -56
226 lines not on this page · raw message
drivers/firewire/fw-sbp2.c +24 -33
123 lines not on this page · raw message
drivers/firewire/fw-topology.c +11 -17
@@ -314,9 +314,8 @@ typedef void (*fw_node_callback_t)(strucstruct fw_node * node, struct fw_node * parent); -static void -for_each_fw_node (struct fw_card *card,struct fw_node *root, -fw_node_callback_t callback) +static void for_each_fw_node (struct fw_card *card,struct fw_node *root, +fw_node_callback_t callback) {struct list_head list;struct fw_node *node, *next, *child, *parent;
@@ -349,9 +348,8 @@ for_each_fw_node(struct fw_card *card, sfw_node_put (node); } -static void -report_lost_node (struct fw_card *card, -struct fw_node *node,struct fw_node *parent) +static void report_lost_node (struct fw_card *card, +struct fw_node *node,struct fw_node *parent) {fw_node_event (card, node,FW_NODE_DESTROYED );fw_node_put (node);
@@ -360,9 +358,8 @@ report_lost_node(struct fw_card *card, card->bm_retries =0 ; } -static void -report_found_node (struct fw_card *card, -struct fw_node *node,struct fw_node *parent) +static void report_found_node (struct fw_card *card, +struct fw_node *node,struct fw_node *parent) {int b_path = (node->phy_speed ==SCODE_BETA );
@@ -415,8 +412,7 @@ static void move_tree(struct fw_node *no* found, lost or updated. Update the nodes in the card topology tree * as we go. */ -static void -update_tree (struct fw_card *card,struct fw_node *root) +static void update_tree (struct fw_card *card,struct fw_node *root) {struct list_head list0, list1;struct fw_node *node0, *node1, *next1;
@@ -497,8 +493,8 @@ update_tree(struct fw_card *card, struct } } -static void -update_topology_map (struct fw_card *card,u32 *self_ids,int self_id_count) +static void update_topology_map (struct fw_card *card, +u32 *self_ids,int self_id_count) {int node_count;
@@ -510,10 +506,8 @@ update_topology_map(struct fw_card *cardfw_compute_block_crc (card->topology_map); } -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_bus_reset (struct fw_card *card,int node_id,int generation, +int self_id_count,u32 *self_ids) {struct fw_node *local_node;unsigned long flags;
drivers/firewire/fw-topology.h +4 -9
@@ -51,26 +51,21 @@ struct fw_node { struct fw_node *ports[0]; }; -static inline struct fw_node * -fw_node_get (struct fw_node *node) +static inline struct fw_node *fw_node_get (struct fw_node *node) {atomic_inc (&node->ref_count);return node; } -static inline void -fw_node_put (struct fw_node *node) +static inline void fw_node_put (struct fw_node *node) {if (atomic_dec_and_test (&node->ref_count))kfree (node); } -void -fw_destroy_nodes (struct fw_card *card); - -int -fw_compute_block_crc (u32 *block); +void fw_destroy_nodes (struct fw_card *card); +int fw_compute_block_crc (u32 *block);#endif /* __fw_topology_h */
drivers/firewire/fw-transaction.c +37 -55
194 lines not on this page · raw message
drivers/firewire/fw-transaction.h +36 -73
166 lines not on this page · raw message
Signature · 3 lines
Stefan Richter -=====-==--- ==-- -===- http://arcgraph.de/sr/
PATCH 4/4 firewire: core: remove unused definitions
In reply to Stefan Richter--- drivers/firewire/fw-transaction.h | 12 ------------ 1 file changed, 12 deletions(-)
drivers/firewire/fw-transaction.h +0 -12
@@ -138,12 +138,6 @@ typedef void (*fw_address_callback_t)(st void *data, size_t length, void *callback_data); -typedef void (*fw_bus_reset_callback_t )(struct fw_card *handle, -int node_id,int generation, -u32 *self_ids, -int self_id_count, -void *callback_data); -struct fw_packet {int speed;int generation;
@@ -184,12 +178,6 @@ struct fw_transaction {void *callback_data; }; -static inline struct fw_packet * -fw_packet (struct list_head *l) -{ - return list_entry(l, struct fw_packet, link); -} -struct fw_address_handler {u64 offset;size_t length;
Signature · 3 lines
Stefan Richter -=====-==--- ==-- -===- http://arcgraph.de/sr/