From: Jim C. <jim...@gm...> - 2012-05-08 17:14:55
|
struct tx_desc_pair and rx_desc_pair each have 2 sets (host, buf) of 3 fields (start, size, phy). Put these into struct desc_info, and build other structs upon it. One of the 3 fields is an unnamed union of 3 pointers to different types. This script converts almost all field refs correctly, only those in ACX_FREE_QUEUES need tweaking (one too many _dir_s). Also added 2 casts to suppress warning on an assignment (maybe a 2nd unnamed union will fix this). Theyre checked in separately, in next patch. for f in $* ; do perl -pi -e 's/->([tr]x|_dir_)\.(buf)_(start)\b/->$1.$2.$1$3/g' $f perl -pi -e 's/->([tr]x|_dir_)\.(buf)_start(phy)\b/->$1.$2.$3/g' $f perl -pi -e 's/->([tr]x|_dir_)\.(buf)_area_(size)\b/->$1.$2.$3/g' $f perl -pi -e 's/->([tr]x|_dir_)\.(host)desc_(start)\b/->$1.$2.$1$3/g' $f perl -pi -e 's/->([tr]x|_dir_)\.(host)desc_start(phy)\b/->$1.$2.$3/g' $f perl -pi -e 's/->([tr]x|_dir_)\.(host)desc_area_(size)\b/->$1.$2.$3/g' $f done Signed-off-by: Jim Cromie <jim...@gm...> --- acx_struct_dev.h | 44 +++++++++++++++++++++----------------------- 1 files changed, 21 insertions(+), 23 deletions(-) diff --git a/acx_struct_dev.h b/acx_struct_dev.h index d1342f3..7ea1cc6 100644 --- a/acx_struct_dev.h +++ b/acx_struct_dev.h @@ -216,35 +216,33 @@ struct eeprom_cfg { co_manuf_t manufacturer; }; +/* desc allocation info for both rx,tx hostdesc,desc */ +struct desc_info { + union { /* points to PCI-mapped memory */ + txhostdesc_t *txstart; + rxhostdesc_t *rxstart; + void *start; + }; + unsigned int size; // hostdesc_area_size; + dma_addr_t phy; // hostdesc_startphy; +}; + /* tx fields refactored */ -struct tx_desc_pair { +struct tx_desc_pair2 { unsigned int tail; - u8 *buf_start; - txhostdesc_t *hostdesc_start; - txdesc_t *desc_start; /* points to PCI-mapped memory */ - - /* sizes of above host memory areas */ - unsigned int buf_area_size; - unsigned int hostdesc_area_size; + txdesc_t *desc_start; unsigned int desc_size; /* size of txdesc */ - dma_addr_t buf_startphy; - dma_addr_t hostdesc_startphy; + struct desc_info host; + struct desc_info buf; }; -// identical to above, except for field types (and theyre close too) -struct rx_desc_pair { +struct rx_desc_pair2 { unsigned int tail; - rxbuffer_t *buf_start; - rxhostdesc_t *hostdesc_start; rxdesc_t *desc_start; + unsigned int desc_size; /* size of rxdesc */ - /* sizes of above host memory areas */ - unsigned int buf_area_size; - unsigned int hostdesc_area_size; - unsigned int desc_size; /* size of txdesc */ - - dma_addr_t buf_startphy; - dma_addr_t hostdesc_startphy; + struct desc_info host; + struct desc_info buf; }; /* FIXME: this should be named something like struct acx_priv (typedef'd to @@ -482,8 +480,8 @@ struct acx_device { /* pointers to tx buffers, tx host descriptors (in host * memory) and tx descs in device memory, same for rx */ - struct tx_desc_pair tx; - struct rx_desc_pair rx; + struct tx_desc_pair2 tx; + struct rx_desc_pair2 rx; u8 need_radio_fw; u8 irqs_active; /* whether irq sending is activated */ -- 1.7.8.1 |