Loading drivers/ieee1394/config_roms.c +8 −6 Original line number Diff line number Diff line Loading @@ -63,9 +63,9 @@ int hpsb_default_host_entry(struct hpsb_host *host) return -ENOMEM; } ret = csr1212_associate_keyval(vend_id, text); csr1212_associate_keyval(vend_id, text); csr1212_release_keyval(text); ret |= csr1212_attach_keyval_to_directory(root, vend_id); ret = csr1212_attach_keyval_to_directory(root, vend_id); csr1212_release_keyval(vend_id); if (ret != CSR1212_SUCCESS) { csr1212_destroy_csr(host->csr.rom); Loading Loading @@ -103,10 +103,12 @@ static int config_rom_ip1394_init(void) if (!ip1394_ud || !spec_id || !spec_desc || !ver || !ver_desc) goto ip1394_fail; if (csr1212_associate_keyval(spec_id, spec_desc) == CSR1212_SUCCESS && csr1212_associate_keyval(ver, ver_desc) == CSR1212_SUCCESS && csr1212_attach_keyval_to_directory(ip1394_ud, spec_id) == CSR1212_SUCCESS && csr1212_attach_keyval_to_directory(ip1394_ud, ver) == CSR1212_SUCCESS) csr1212_associate_keyval(spec_id, spec_desc); csr1212_associate_keyval(ver, ver_desc); if (csr1212_attach_keyval_to_directory(ip1394_ud, spec_id) == CSR1212_SUCCESS && csr1212_attach_keyval_to_directory(ip1394_ud, ver) == CSR1212_SUCCESS) ret = 0; ip1394_fail: Loading drivers/ieee1394/csr1212.c +24 −43 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ #include <linux/errno.h> #include <linux/string.h> #include <asm/bug.h> #include <asm/byteorder.h> #include "csr1212.h" Loading Loading @@ -305,43 +306,29 @@ struct csr1212_keyval *csr1212_new_directory(u8 key) return kv; } int csr1212_associate_keyval(struct csr1212_keyval *kv, void csr1212_associate_keyval(struct csr1212_keyval *kv, struct csr1212_keyval *associate) { if (!kv || !associate) return -EINVAL; if (kv->key.id == CSR1212_KV_ID_DESCRIPTOR || BUG_ON(!kv || !associate || kv->key.id == CSR1212_KV_ID_DESCRIPTOR || (associate->key.id != CSR1212_KV_ID_DESCRIPTOR && associate->key.id != CSR1212_KV_ID_DEPENDENT_INFO && associate->key.id != CSR1212_KV_ID_EXTENDED_KEY && associate->key.id != CSR1212_KV_ID_EXTENDED_DATA && associate->key.id < 0x30)) return -EINVAL; if (kv->key.id == CSR1212_KV_ID_EXTENDED_KEY_SPECIFIER_ID && associate->key.id != CSR1212_KV_ID_EXTENDED_KEY) return -EINVAL; if (kv->key.id == CSR1212_KV_ID_EXTENDED_KEY && associate->key.id != CSR1212_KV_ID_EXTENDED_DATA) return -EINVAL; if (associate->key.id == CSR1212_KV_ID_EXTENDED_KEY && kv->key.id != CSR1212_KV_ID_EXTENDED_KEY_SPECIFIER_ID) return -EINVAL; if (associate->key.id == CSR1212_KV_ID_EXTENDED_DATA && kv->key.id != CSR1212_KV_ID_EXTENDED_KEY) return -EINVAL; associate->key.id < 0x30) || (kv->key.id == CSR1212_KV_ID_EXTENDED_KEY_SPECIFIER_ID && associate->key.id != CSR1212_KV_ID_EXTENDED_KEY) || (kv->key.id == CSR1212_KV_ID_EXTENDED_KEY && associate->key.id != CSR1212_KV_ID_EXTENDED_DATA) || (associate->key.id == CSR1212_KV_ID_EXTENDED_KEY && kv->key.id != CSR1212_KV_ID_EXTENDED_KEY_SPECIFIER_ID) || (associate->key.id == CSR1212_KV_ID_EXTENDED_DATA && kv->key.id != CSR1212_KV_ID_EXTENDED_KEY)); if (kv->associate) csr1212_release_keyval(kv->associate); associate->refcnt++; kv->associate = associate; return CSR1212_SUCCESS; } int csr1212_attach_keyval_to_directory(struct csr1212_keyval *dir, Loading @@ -349,8 +336,7 @@ int csr1212_attach_keyval_to_directory(struct csr1212_keyval *dir, { struct csr1212_dentry *dentry; if (!kv || !dir || dir->key.type != CSR1212_KV_TYPE_DIRECTORY) return -EINVAL; BUG_ON(!kv || !dir || dir->key.type != CSR1212_KV_TYPE_DIRECTORY); dentry = CSR1212_MALLOC(sizeof(*dentry)); if (!dentry) Loading Loading @@ -611,9 +597,8 @@ static int csr1212_append_new_cache(struct csr1212_csr *csr, size_t romsize) struct csr1212_csr_rom_cache *cache; u64 csr_addr; if (!csr || !csr->ops || !csr->ops->allocate_addr_range || !csr->ops->release_addr || csr->max_rom < 1) return -EINVAL; BUG_ON(!csr || !csr->ops || !csr->ops->allocate_addr_range || !csr->ops->release_addr || csr->max_rom < 1); /* ROM size must be a multiple of csr->max_rom */ romsize = (romsize + (csr->max_rom - 1)) & ~(csr->max_rom - 1); Loading Loading @@ -950,8 +935,7 @@ int csr1212_generate_csr_image(struct csr1212_csr *csr) int ret; int init_offset; if (!csr) return -EINVAL; BUG_ON(!csr); cache = csr->cache_head; Loading Loading @@ -1011,8 +995,7 @@ int csr1212_generate_csr_image(struct csr1212_csr *csr) /* Make sure the Extended ROM leaf is a multiple of * max_rom in size. */ if (csr->max_rom < 1) return -EINVAL; BUG_ON(csr->max_rom < 1); leaf_size = (cache->len + (csr->max_rom - 1)) & ~(csr->max_rom - 1); Loading Loading @@ -1278,8 +1261,7 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv) u32 *cache_ptr; u16 kv_len = 0; if (!csr || !kv || csr->max_rom < 1) return -EINVAL; BUG_ON(!csr || !kv || csr->max_rom < 1); /* First find which cache the data should be in (or go in if not read * yet). */ Loading Loading @@ -1436,8 +1418,7 @@ int csr1212_parse_csr(struct csr1212_csr *csr) struct csr1212_dentry *dentry; int ret; if (!csr || !csr->ops || !csr->ops->bus_read) return -EINVAL; BUG_ON(!csr || !csr->ops || !csr->ops->bus_read); ret = csr1212_parse_bus_info_block(csr); if (ret != CSR1212_SUCCESS) Loading drivers/ieee1394/csr1212.h +2 −2 Original line number Diff line number Diff line Loading @@ -283,7 +283,7 @@ extern struct csr1212_keyval *csr1212_new_string_descriptor_leaf(const char *s); * Take care with subsequent ROM modifications: There is no function to remove * previously specified associations. */ extern int csr1212_associate_keyval(struct csr1212_keyval *kv, extern void csr1212_associate_keyval(struct csr1212_keyval *kv, struct csr1212_keyval *associate); Loading Loading
drivers/ieee1394/config_roms.c +8 −6 Original line number Diff line number Diff line Loading @@ -63,9 +63,9 @@ int hpsb_default_host_entry(struct hpsb_host *host) return -ENOMEM; } ret = csr1212_associate_keyval(vend_id, text); csr1212_associate_keyval(vend_id, text); csr1212_release_keyval(text); ret |= csr1212_attach_keyval_to_directory(root, vend_id); ret = csr1212_attach_keyval_to_directory(root, vend_id); csr1212_release_keyval(vend_id); if (ret != CSR1212_SUCCESS) { csr1212_destroy_csr(host->csr.rom); Loading Loading @@ -103,10 +103,12 @@ static int config_rom_ip1394_init(void) if (!ip1394_ud || !spec_id || !spec_desc || !ver || !ver_desc) goto ip1394_fail; if (csr1212_associate_keyval(spec_id, spec_desc) == CSR1212_SUCCESS && csr1212_associate_keyval(ver, ver_desc) == CSR1212_SUCCESS && csr1212_attach_keyval_to_directory(ip1394_ud, spec_id) == CSR1212_SUCCESS && csr1212_attach_keyval_to_directory(ip1394_ud, ver) == CSR1212_SUCCESS) csr1212_associate_keyval(spec_id, spec_desc); csr1212_associate_keyval(ver, ver_desc); if (csr1212_attach_keyval_to_directory(ip1394_ud, spec_id) == CSR1212_SUCCESS && csr1212_attach_keyval_to_directory(ip1394_ud, ver) == CSR1212_SUCCESS) ret = 0; ip1394_fail: Loading
drivers/ieee1394/csr1212.c +24 −43 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ #include <linux/errno.h> #include <linux/string.h> #include <asm/bug.h> #include <asm/byteorder.h> #include "csr1212.h" Loading Loading @@ -305,43 +306,29 @@ struct csr1212_keyval *csr1212_new_directory(u8 key) return kv; } int csr1212_associate_keyval(struct csr1212_keyval *kv, void csr1212_associate_keyval(struct csr1212_keyval *kv, struct csr1212_keyval *associate) { if (!kv || !associate) return -EINVAL; if (kv->key.id == CSR1212_KV_ID_DESCRIPTOR || BUG_ON(!kv || !associate || kv->key.id == CSR1212_KV_ID_DESCRIPTOR || (associate->key.id != CSR1212_KV_ID_DESCRIPTOR && associate->key.id != CSR1212_KV_ID_DEPENDENT_INFO && associate->key.id != CSR1212_KV_ID_EXTENDED_KEY && associate->key.id != CSR1212_KV_ID_EXTENDED_DATA && associate->key.id < 0x30)) return -EINVAL; if (kv->key.id == CSR1212_KV_ID_EXTENDED_KEY_SPECIFIER_ID && associate->key.id != CSR1212_KV_ID_EXTENDED_KEY) return -EINVAL; if (kv->key.id == CSR1212_KV_ID_EXTENDED_KEY && associate->key.id != CSR1212_KV_ID_EXTENDED_DATA) return -EINVAL; if (associate->key.id == CSR1212_KV_ID_EXTENDED_KEY && kv->key.id != CSR1212_KV_ID_EXTENDED_KEY_SPECIFIER_ID) return -EINVAL; if (associate->key.id == CSR1212_KV_ID_EXTENDED_DATA && kv->key.id != CSR1212_KV_ID_EXTENDED_KEY) return -EINVAL; associate->key.id < 0x30) || (kv->key.id == CSR1212_KV_ID_EXTENDED_KEY_SPECIFIER_ID && associate->key.id != CSR1212_KV_ID_EXTENDED_KEY) || (kv->key.id == CSR1212_KV_ID_EXTENDED_KEY && associate->key.id != CSR1212_KV_ID_EXTENDED_DATA) || (associate->key.id == CSR1212_KV_ID_EXTENDED_KEY && kv->key.id != CSR1212_KV_ID_EXTENDED_KEY_SPECIFIER_ID) || (associate->key.id == CSR1212_KV_ID_EXTENDED_DATA && kv->key.id != CSR1212_KV_ID_EXTENDED_KEY)); if (kv->associate) csr1212_release_keyval(kv->associate); associate->refcnt++; kv->associate = associate; return CSR1212_SUCCESS; } int csr1212_attach_keyval_to_directory(struct csr1212_keyval *dir, Loading @@ -349,8 +336,7 @@ int csr1212_attach_keyval_to_directory(struct csr1212_keyval *dir, { struct csr1212_dentry *dentry; if (!kv || !dir || dir->key.type != CSR1212_KV_TYPE_DIRECTORY) return -EINVAL; BUG_ON(!kv || !dir || dir->key.type != CSR1212_KV_TYPE_DIRECTORY); dentry = CSR1212_MALLOC(sizeof(*dentry)); if (!dentry) Loading Loading @@ -611,9 +597,8 @@ static int csr1212_append_new_cache(struct csr1212_csr *csr, size_t romsize) struct csr1212_csr_rom_cache *cache; u64 csr_addr; if (!csr || !csr->ops || !csr->ops->allocate_addr_range || !csr->ops->release_addr || csr->max_rom < 1) return -EINVAL; BUG_ON(!csr || !csr->ops || !csr->ops->allocate_addr_range || !csr->ops->release_addr || csr->max_rom < 1); /* ROM size must be a multiple of csr->max_rom */ romsize = (romsize + (csr->max_rom - 1)) & ~(csr->max_rom - 1); Loading Loading @@ -950,8 +935,7 @@ int csr1212_generate_csr_image(struct csr1212_csr *csr) int ret; int init_offset; if (!csr) return -EINVAL; BUG_ON(!csr); cache = csr->cache_head; Loading Loading @@ -1011,8 +995,7 @@ int csr1212_generate_csr_image(struct csr1212_csr *csr) /* Make sure the Extended ROM leaf is a multiple of * max_rom in size. */ if (csr->max_rom < 1) return -EINVAL; BUG_ON(csr->max_rom < 1); leaf_size = (cache->len + (csr->max_rom - 1)) & ~(csr->max_rom - 1); Loading Loading @@ -1278,8 +1261,7 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv) u32 *cache_ptr; u16 kv_len = 0; if (!csr || !kv || csr->max_rom < 1) return -EINVAL; BUG_ON(!csr || !kv || csr->max_rom < 1); /* First find which cache the data should be in (or go in if not read * yet). */ Loading Loading @@ -1436,8 +1418,7 @@ int csr1212_parse_csr(struct csr1212_csr *csr) struct csr1212_dentry *dentry; int ret; if (!csr || !csr->ops || !csr->ops->bus_read) return -EINVAL; BUG_ON(!csr || !csr->ops || !csr->ops->bus_read); ret = csr1212_parse_bus_info_block(csr); if (ret != CSR1212_SUCCESS) Loading
drivers/ieee1394/csr1212.h +2 −2 Original line number Diff line number Diff line Loading @@ -283,7 +283,7 @@ extern struct csr1212_keyval *csr1212_new_string_descriptor_leaf(const char *s); * Take care with subsequent ROM modifications: There is no function to remove * previously specified associations. */ extern int csr1212_associate_keyval(struct csr1212_keyval *kv, extern void csr1212_associate_keyval(struct csr1212_keyval *kv, struct csr1212_keyval *associate); Loading