summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2007-03-11 22:49:34 +0100
committerStefan Richter <stefanr@s5r6.in-berlin.de>2007-04-30 00:00:28 +0200
commit982610bd0d8e64baff36099f6dc456ea52d22257 (patch)
tree23e74575c2e8cb11b84de9e2f685e87d4f28dbe8
parent7fb9addba8ebd67306099e7fa629ff76c1be2105 (diff)
ieee1394: csr1212: rename some types
Use u8, u32 etc. instead of u_int8_t, csr1212_quad_t etc. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
-rw-r--r--drivers/ieee1394/csr1212.c93
-rw-r--r--drivers/ieee1394/csr1212.h62
2 files changed, 74 insertions, 81 deletions
diff --git a/drivers/ieee1394/csr1212.c b/drivers/ieee1394/csr1212.c
index f5867236255b..65be507f4ee3 100644
--- a/drivers/ieee1394/csr1212.c
+++ b/drivers/ieee1394/csr1212.c
@@ -45,7 +45,7 @@
#define __C (1 << CSR1212_KV_TYPE_CSR_OFFSET)
#define __D (1 << CSR1212_KV_TYPE_DIRECTORY)
#define __L (1 << CSR1212_KV_TYPE_LEAF)
-static const u_int8_t csr1212_key_id_type_map[0x30] = {
+static const u8 csr1212_key_id_type_map[0x30] = {
__C, /* used by Apple iSight */
__D | __L, /* Descriptor */
__I | __D | __L, /* Bus_Dependent_Info */
@@ -81,8 +81,8 @@ static const u_int8_t csr1212_key_id_type_map[0x30] = {
#undef __L
-#define quads_to_bytes(_q) ((_q) * sizeof(u_int32_t))
-#define bytes_to_quads(_b) (((_b) + sizeof(u_int32_t) - 1) / sizeof(u_int32_t))
+#define quads_to_bytes(_q) ((_q) * sizeof(u32))
+#define bytes_to_quads(_b) (((_b) + sizeof(u32) - 1) / sizeof(u32))
static void free_keyval(struct csr1212_keyval *kv)
{
@@ -93,11 +93,11 @@ static void free_keyval(struct csr1212_keyval *kv)
CSR1212_FREE(kv);
}
-static u_int16_t csr1212_crc16(const u_int32_t *buffer, size_t length)
+static u16 csr1212_crc16(const u32 *buffer, size_t length)
{
int shift;
- u_int32_t data;
- u_int16_t sum, crc = 0;
+ u32 data;
+ u16 sum, crc = 0;
for (; length; length--) {
data = be32_to_cpu(*buffer);
@@ -116,11 +116,11 @@ static u_int16_t csr1212_crc16(const u_int32_t *buffer, size_t length)
/* Microsoft computes the CRC with the bytes in reverse order. Therefore we
* have a special version of the CRC algorithm to account for their buggy
* software. */
-static u_int16_t csr1212_msft_crc16(const u_int32_t *buffer, size_t length)
+static u16 csr1212_msft_crc16(const u32 *buffer, size_t length)
{
int shift;
- u_int32_t data;
- u_int16_t sum, crc = 0;
+ u32 data;
+ u16 sum, crc = 0;
for (; length; length--) {
data = le32_to_cpu(*buffer);
@@ -150,7 +150,7 @@ csr1212_find_keyval(struct csr1212_keyval *dir, struct csr1212_keyval *kv)
}
static struct csr1212_keyval *
-csr1212_find_keyval_offset(struct csr1212_keyval *kv_list, u_int32_t offset)
+csr1212_find_keyval_offset(struct csr1212_keyval *kv_list, u32 offset)
{
struct csr1212_keyval *kv;
@@ -202,7 +202,7 @@ struct csr1212_csr *csr1212_create_csr(struct csr1212_bus_ops *ops,
}
void csr1212_init_local_csr(struct csr1212_csr *csr,
- const u_int32_t *bus_info_data, int max_rom)
+ const u32 *bus_info_data, int max_rom)
{
static const int mr_map[] = { 4, 64, 1024, 0 };
@@ -211,7 +211,7 @@ void csr1212_init_local_csr(struct csr1212_csr *csr,
memcpy(csr->bus_info_data, bus_info_data, csr->bus_info_len);
}
-static struct csr1212_keyval *csr1212_new_keyval(u_int8_t type, u_int8_t key)
+static struct csr1212_keyval *csr1212_new_keyval(u8 type, u8 key)
{
struct csr1212_keyval *kv;
@@ -235,7 +235,7 @@ static struct csr1212_keyval *csr1212_new_keyval(u_int8_t type, u_int8_t key)
return kv;
}
-struct csr1212_keyval *csr1212_new_immediate(u_int8_t key, u_int32_t value)
+struct csr1212_keyval *csr1212_new_immediate(u8 key, u32 value)
{
struct csr1212_keyval *kv = csr1212_new_keyval(CSR1212_KV_TYPE_IMMEDIATE, key);
@@ -248,7 +248,7 @@ struct csr1212_keyval *csr1212_new_immediate(u_int8_t key, u_int32_t value)
}
static struct csr1212_keyval *
-csr1212_new_leaf(u_int8_t key, const void *data, size_t data_len)
+csr1212_new_leaf(u8 key, const void *data, size_t data_len)
{
struct csr1212_keyval *kv = csr1212_new_keyval(CSR1212_KV_TYPE_LEAF, key);
@@ -276,7 +276,7 @@ csr1212_new_leaf(u_int8_t key, const void *data, size_t data_len)
}
static struct csr1212_keyval *
-csr1212_new_csr_offset(u_int8_t key, u_int32_t csr_offset)
+csr1212_new_csr_offset(u8 key, u32 csr_offset)
{
struct csr1212_keyval *kv = csr1212_new_keyval(CSR1212_KV_TYPE_CSR_OFFSET, key);
@@ -290,7 +290,7 @@ csr1212_new_csr_offset(u_int8_t key, u_int32_t csr_offset)
return kv;
}
-struct csr1212_keyval *csr1212_new_directory(u_int8_t key)
+struct csr1212_keyval *csr1212_new_directory(u8 key)
{
struct csr1212_keyval *kv = csr1212_new_keyval(CSR1212_KV_TYPE_DIRECTORY, key);
@@ -387,7 +387,7 @@ int csr1212_attach_keyval_to_directory(struct csr1212_keyval *dir,
((spec_id) & CSR1212_DESCRIPTOR_LEAF_SPECIFIER_ID_MASK)))
static struct csr1212_keyval *
-csr1212_new_descriptor_leaf(u_int8_t dtype, u_int32_t specifier_id,
+csr1212_new_descriptor_leaf(u8 dtype, u32 specifier_id,
const void *data, size_t data_len)
{
struct csr1212_keyval *kv;
@@ -432,9 +432,8 @@ csr1212_new_descriptor_leaf(u_int8_t dtype, u_int32_t specifier_id,
CSR1212_TEXTUAL_DESCRIPTOR_LEAF_LANGUAGE_MASK)))
static struct csr1212_keyval *
-csr1212_new_textual_descriptor_leaf(u_int8_t cwidth, u_int16_t cset,
- u_int16_t language, const void *data,
- size_t data_len)
+csr1212_new_textual_descriptor_leaf(u8 cwidth, u16 cset, u16 language,
+ const void *data, size_t data_len)
{
struct csr1212_keyval *kv;
char *lstr;
@@ -451,7 +450,7 @@ csr1212_new_textual_descriptor_leaf(u_int8_t cwidth, u_int16_t cset,
lstr = (char*)CSR1212_TEXTUAL_DESCRIPTOR_LEAF_DATA(kv);
/* make sure last quadlet is zeroed out */
- *((u_int32_t*)&(lstr[(data_len - 1) & ~0x3])) = 0;
+ *((u32*)&(lstr[(data_len - 1) & ~0x3])) = 0;
/* don't copy the NUL terminator */
memcpy(lstr, data, data_len);
@@ -610,7 +609,7 @@ void csr1212_destroy_csr(struct csr1212_csr *csr)
static int csr1212_append_new_cache(struct csr1212_csr *csr, size_t romsize)
{
struct csr1212_csr_rom_cache *cache;
- u_int64_t csr_addr;
+ u64 csr_addr;
if (!csr || !csr->ops || !csr->ops->allocate_addr_range ||
!csr->ops->release_addr || csr->max_rom < 1)
@@ -824,7 +823,7 @@ csr1212_generate_positions(struct csr1212_csr_rom_cache *cache,
#define CSR1212_KV_KEY_TYPE_MASK 0x3 /* after shift */
static void
-csr1212_generate_tree_subdir(struct csr1212_keyval *dir, u_int32_t *data_buffer)
+csr1212_generate_tree_subdir(struct csr1212_keyval *dir, u32 *data_buffer)
{
struct csr1212_dentry *dentry;
struct csr1212_keyval *last_extkey_spec = NULL;
@@ -835,7 +834,7 @@ csr1212_generate_tree_subdir(struct csr1212_keyval *dir, u_int32_t *data_buffer)
struct csr1212_keyval *a;
for (a = dentry->kv; a; a = a->associate) {
- u_int32_t value = 0;
+ u32 value = 0;
/* Special Case: Extended Key Specifier_ID */
if (a->key.id == CSR1212_KV_ID_EXTENDED_KEY_SPECIFIER_ID) {
@@ -889,11 +888,11 @@ csr1212_generate_tree_subdir(struct csr1212_keyval *dir, u_int32_t *data_buffer)
}
struct csr1212_keyval_img {
- u_int16_t length;
- u_int16_t crc;
+ u16 length;
+ u16 crc;
/* Must be last */
- csr1212_quad_t data[0]; /* older gcc can't handle [] which is standard */
+ u32 data[0]; /* older gcc can't handle [] which is standard */
};
static void csr1212_fill_cache(struct csr1212_csr_rom_cache *cache)
@@ -940,7 +939,7 @@ static void csr1212_fill_cache(struct csr1212_csr_rom_cache *cache)
}
}
-#define CSR1212_EXTENDED_ROM_SIZE (0x10000 * sizeof(u_int32_t))
+#define CSR1212_EXTENDED_ROM_SIZE (0x10000 * sizeof(u32))
int csr1212_generate_csr_image(struct csr1212_csr *csr)
{
@@ -975,7 +974,7 @@ int csr1212_generate_csr_image(struct csr1212_csr *csr)
* regions needed (it assumes that the cache holding
* the first 1K Config ROM space always exists). */
int est_c = agg_size / (CSR1212_EXTENDED_ROM_SIZE -
- (2 * sizeof(u_int32_t))) + 1;
+ (2 * sizeof(u32))) + 1;
/* Add additional cache regions, extras will be
* removed later */
@@ -992,7 +991,7 @@ int csr1212_generate_csr_image(struct csr1212_csr *csr)
}
kv = csr1212_generate_positions(cache, kv, init_offset);
agg_size -= cache->len;
- init_offset = sizeof(u_int32_t);
+ init_offset = sizeof(u32);
}
/* Remove unused, excess cache regions */
@@ -1022,7 +1021,7 @@ int csr1212_generate_csr_image(struct csr1212_csr *csr)
leaf_size - cache->len);
/* Subtract leaf header */
- leaf_size -= sizeof(u_int32_t);
+ leaf_size -= sizeof(u32);
/* Update the Extended ROM leaf length */
cache->ext_rom->value.leaf.len =
@@ -1040,7 +1039,7 @@ int csr1212_generate_csr_image(struct csr1212_csr *csr)
/* Set the length and CRC of the extended ROM. */
struct csr1212_keyval_img *kvi =
(struct csr1212_keyval_img*)cache->data;
- u_int16_t len = bytes_to_quads(cache->len) - 1;
+ u16 len = bytes_to_quads(cache->len) - 1;
kvi->length = cpu_to_be16(len);
kvi->crc = csr1212_crc16(kvi->data, len);
@@ -1050,7 +1049,7 @@ int csr1212_generate_csr_image(struct csr1212_csr *csr)
return CSR1212_SUCCESS;
}
-int csr1212_read(struct csr1212_csr *csr, u_int32_t offset, void *buffer, u_int32_t len)
+int csr1212_read(struct csr1212_csr *csr, u32 offset, void *buffer, u32 len)
{
struct csr1212_csr_rom_cache *cache;
@@ -1081,9 +1080,9 @@ static int csr1212_parse_bus_info_block(struct csr1212_csr *csr)
* Unfortunately, many IEEE 1394 devices do not abide by that, so the
* bus info block will be read 1 quadlet at a time. The rest of the
* ConfigROM will be read according to the max_rom field. */
- for (i = 0; i < csr->bus_info_len; i += sizeof(csr1212_quad_t)) {
+ for (i = 0; i < csr->bus_info_len; i += sizeof(u32)) {
ret = csr->ops->bus_read(csr, CSR1212_CONFIG_ROM_SPACE_BASE + i,
- sizeof(csr1212_quad_t),
+ sizeof(u32),
&csr->cache_head->data[bytes_to_quads(i)],
csr->private);
if (ret != CSR1212_SUCCESS)
@@ -1101,9 +1100,9 @@ static int csr1212_parse_bus_info_block(struct csr1212_csr *csr)
/* IEEE 1212 recommends that crc_len be equal to bus_info_len, but that is not
* always the case, so read the rest of the crc area 1 quadlet at a time. */
- for (i = csr->bus_info_len; i <= csr->crc_len; i += sizeof(csr1212_quad_t)) {
+ for (i = csr->bus_info_len; i <= csr->crc_len; i += sizeof(u32)) {
ret = csr->ops->bus_read(csr, CSR1212_CONFIG_ROM_SPACE_BASE + i,
- sizeof(csr1212_quad_t),
+ sizeof(u32),
&csr->cache_head->data[bytes_to_quads(i)],
csr->private);
if (ret != CSR1212_SUCCESS)
@@ -1140,12 +1139,11 @@ static int csr1212_parse_bus_info_block(struct csr1212_csr *csr)
#define CSR1212_KV_VAL(q) (be32_to_cpu(q) & CSR1212_KV_VAL_MASK)
static int csr1212_parse_dir_entry(struct csr1212_keyval *dir,
- csr1212_quad_t ki,
- u_int32_t kv_pos)
+ u32 ki, u32 kv_pos)
{
int ret = CSR1212_SUCCESS;
struct csr1212_keyval *k = NULL;
- u_int32_t offset;
+ u32 offset;
switch(CSR1212_KV_KEY_TYPE(ki)) {
case CSR1212_KV_TYPE_IMMEDIATE:
@@ -1236,7 +1234,7 @@ int csr1212_parse_keyval(struct csr1212_keyval *kv,
switch(kv->key.type) {
case CSR1212_KV_TYPE_DIRECTORY:
for (i = 0; i < kvi_len; i++) {
- csr1212_quad_t ki = kvi->data[i];
+ u32 ki = kvi->data[i];
/* Some devices put null entries in their unit
* directories. If we come across such an entry,
@@ -1276,9 +1274,9 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv)
struct csr1212_keyval_img *kvi = NULL;
struct csr1212_csr_rom_cache *cache;
int cache_index;
- u_int64_t addr;
- u_int32_t *cache_ptr;
- u_int16_t kv_len = 0;
+ u64 addr;
+ u32 *cache_ptr;
+ u16 kv_len = 0;
if (!csr || !kv || csr->max_rom < 1)
return -EINVAL;
@@ -1292,8 +1290,7 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv)
}
if (!cache) {
- csr1212_quad_t q;
- u_int32_t cache_size;
+ u32 q, cache_size;
/* Only create a new cache for Extended ROM leaves. */
if (kv->key.id != CSR1212_KV_ID_EXTENDED_ROM)
@@ -1301,7 +1298,7 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv)
if (csr->ops->bus_read(csr,
CSR1212_REGISTER_SPACE_BASE + kv->offset,
- sizeof(csr1212_quad_t), &q, csr->private)) {
+ sizeof(u32), &q, csr->private)) {
return -EIO;
}
@@ -1326,7 +1323,7 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv)
}
cache->filled_head->offset_start = 0;
- cache->filled_head->offset_end = sizeof(csr1212_quad_t);
+ cache->filled_head->offset_end = sizeof(u32);
cache->filled_tail = cache->filled_head;
cache->filled_head->next = NULL;
cache->filled_head->prev = NULL;
diff --git a/drivers/ieee1394/csr1212.h b/drivers/ieee1394/csr1212.h
index f42e12e58ae7..aa9e924fd189 100644
--- a/drivers/ieee1394/csr1212.h
+++ b/drivers/ieee1394/csr1212.h
@@ -114,19 +114,17 @@
/* Config ROM image structures */
struct csr1212_bus_info_block_img {
- u_int8_t length;
- u_int8_t crc_length;
- u_int16_t crc;
+ u8 length;
+ u8 crc_length;
+ u16 crc;
/* Must be last */
- u_int32_t data[0]; /* older gcc can't handle [] which is standard */
+ u32 data[0]; /* older gcc can't handle [] which is standard */
};
-typedef u_int32_t csr1212_quad_t;
-
struct csr1212_leaf {
int len;
- u_int32_t *data;
+ u32 *data;
};
struct csr1212_dentry {
@@ -141,12 +139,12 @@ struct csr1212_directory {
struct csr1212_keyval {
struct {
- u_int8_t type;
- u_int8_t id;
+ u8 type;
+ u8 id;
} key;
union {
- u_int32_t immediate;
- u_int32_t csr_offset;
+ u32 immediate;
+ u32 csr_offset;
struct csr1212_leaf leaf;
struct csr1212_directory directory;
} value;
@@ -155,15 +153,15 @@ struct csr1212_keyval {
/* used in generating and/or parsing CSR image */
struct csr1212_keyval *next, *prev; /* flat list of CSR elements */
- u_int32_t offset; /* position in CSR from 0xffff f000 0000 */
- u_int8_t valid; /* flag indicating keyval has valid data*/
+ u32 offset; /* position in CSR from 0xffff f000 0000 */
+ u8 valid; /* flag indicating keyval has valid data*/
};
struct csr1212_cache_region {
struct csr1212_cache_region *next, *prev;
- u_int32_t offset_start; /* inclusive */
- u_int32_t offset_end; /* exclusive */
+ u32 offset_start; /* inclusive */
+ u32 offset_end; /* exclusive */
};
struct csr1212_csr_rom_cache {
@@ -171,18 +169,18 @@ struct csr1212_csr_rom_cache {
struct csr1212_cache_region *filled_head, *filled_tail;
struct csr1212_keyval *layout_head, *layout_tail;
size_t size;
- u_int32_t offset;
+ u32 offset;
struct csr1212_keyval *ext_rom;
size_t len;
/* Must be last */
- u_int32_t data[0]; /* older gcc can't handle [] which is standard */
+ u32 data[0]; /* older gcc can't handle [] which is standard */
};
struct csr1212_csr {
size_t bus_info_len; /* bus info block length in bytes */
size_t crc_len; /* crc length in bytes */
- u_int32_t *bus_info_data; /* bus info data incl bus name and EUI */
+ u32 *bus_info_data; /* bus info data incl bus name and EUI */
void *private; /* private, bus specific data */
struct csr1212_bus_ops *ops;
@@ -200,32 +198,30 @@ struct csr1212_bus_ops {
* from remote nodes when parsing a Config ROM (i.e., read Config ROM
* entries located in the Units Space. Must return 0 on success
* anything else indicates an error. */
- int (*bus_read) (struct csr1212_csr *csr, u_int64_t addr,
- u_int16_t length, void *buffer, void *private);
+ int (*bus_read) (struct csr1212_csr *csr, u64 addr,
+ u16 length, void *buffer, void *private);
/* This function is used by csr1212 to allocate a region in units space
* in the event that Config ROM entries don't all fit in the predefined
* 1K region. The void *private parameter is private member of struct
* csr1212_csr. */
- u_int64_t (*allocate_addr_range) (u_int64_t size, u_int32_t alignment,
- void *private);
-
+ u64 (*allocate_addr_range) (u64 size, u32 alignment, void *private);
/* This function is used by csr1212 to release a region in units space
* that is no longer needed. */
- void (*release_addr) (u_int64_t addr, void *private);
+ void (*release_addr) (u64 addr, void *private);
/* This function is used by csr1212 to determine the max read request
* supported by a remote node when reading the ConfigROM space. Must
* return 0, 1, or 2 per IEEE 1212. */
- int (*get_max_rom) (u_int32_t *bus_info, void *private);
+ int (*get_max_rom) (u32 *bus_info, void *private);
};
/* Descriptor Leaf manipulation macros */
#define CSR1212_DESCRIPTOR_LEAF_TYPE_SHIFT 24
#define CSR1212_DESCRIPTOR_LEAF_SPECIFIER_ID_MASK 0xffffff
-#define CSR1212_DESCRIPTOR_LEAF_OVERHEAD (1 * sizeof(u_int32_t))
+#define CSR1212_DESCRIPTOR_LEAF_OVERHEAD (1 * sizeof(u32))
#define CSR1212_DESCRIPTOR_LEAF_TYPE(kv) \
(be32_to_cpu((kv)->value.leaf.data[0]) >> CSR1212_DESCRIPTOR_LEAF_TYPE_SHIFT)
@@ -240,7 +236,7 @@ struct csr1212_bus_ops {
#define CSR1212_TEXTUAL_DESCRIPTOR_LEAF_CHAR_SET_SHIFT 16
#define CSR1212_TEXTUAL_DESCRIPTOR_LEAF_CHAR_SET_MASK 0xfff /* after shift */
#define CSR1212_TEXTUAL_DESCRIPTOR_LEAF_LANGUAGE_MASK 0xffff
-#define CSR1212_TEXTUAL_DESCRIPTOR_LEAF_OVERHEAD (1 * sizeof(u_int32_t))
+#define CSR1212_TEXTUAL_DESCRIPTOR_LEAF_OVERHEAD (1 * sizeof(u32))
#define CSR1212_TEXTUAL_DESCRIPTOR_LEAF_WIDTH(kv) \
(be32_to_cpu((kv)->value.leaf.data[1]) >> \
@@ -264,7 +260,7 @@ extern struct csr1212_csr *csr1212_create_csr(struct csr1212_bus_ops *ops,
size_t bus_info_size,
void *private);
extern void csr1212_init_local_csr(struct csr1212_csr *csr,
- const u_int32_t *bus_info_data, int max_rom);
+ const u32 *bus_info_data, int max_rom);
/* Destroy a Configuration ROM tree and release all memory taken by the tree. */
@@ -275,8 +271,8 @@ extern void csr1212_destroy_csr(struct csr1212_csr *csr);
* a Configuration ROM tree. Code that creates new keyvals with these functions
* must release those keyvals with csr1212_release_keyval() when they are no
* longer needed. */
-extern struct csr1212_keyval *csr1212_new_immediate(u_int8_t key, u_int32_t value);
-extern struct csr1212_keyval *csr1212_new_directory(u_int8_t key);
+extern struct csr1212_keyval *csr1212_new_immediate(u8 key, u32 value);
+extern struct csr1212_keyval *csr1212_new_directory(u8 key);
extern struct csr1212_keyval *csr1212_new_string_descriptor_leaf(const char *s);
@@ -306,8 +302,8 @@ extern int csr1212_generate_csr_image(struct csr1212_csr *csr);
/* This is a convience function for reading a block of data out of one of the
* caches in the csr->cache_head list. */
-extern int csr1212_read(struct csr1212_csr *csr, u_int32_t offset, void *buffer,
- u_int32_t len);
+extern int csr1212_read(struct csr1212_csr *csr, u32 offset, void *buffer,
+ u32 len);
/* The following functions are in place for parsing Configuration ROM images.
@@ -324,7 +320,7 @@ extern void _csr1212_destroy_keyval(struct csr1212_keyval *kv);
/* This function allocates a new cache which may be used for either parsing or
* generating sub-sets of Configuration ROM images. */
-static inline struct csr1212_csr_rom_cache *csr1212_rom_cache_malloc(u_int32_t offset,
+static inline struct csr1212_csr_rom_cache *csr1212_rom_cache_malloc(u32 offset,
size_t size)
{
struct csr1212_csr_rom_cache *cache;