diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2007-03-13 19:20:53 -0400 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2007-04-29 18:00:28 -0400 |
commit | c1a37f2c6572031203243dd083585aa4a1c138d5 (patch) | |
tree | c25654f20ed42e5432f4306c90b170d5f0ddc3ae /drivers | |
parent | 64ff712321875c2457d3a77d3fc4ab4989f7a8c0 (diff) |
ieee1394: de-inline some functions
This small reorganization of public csr1212 functions saves one
exported symbol and a few bytes in the driver modules.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ieee1394/csr1212.c | 28 | ||||
-rw-r--r-- | drivers/ieee1394/csr1212.h | 28 | ||||
-rw-r--r-- | drivers/ieee1394/ieee1394_core.c | 9 |
3 files changed, 33 insertions, 32 deletions
diff --git a/drivers/ieee1394/csr1212.c b/drivers/ieee1394/csr1212.c index 54408cbe8f8f..6c2f55bb9463 100644 --- a/drivers/ieee1394/csr1212.c +++ b/drivers/ieee1394/csr1212.c | |||
@@ -518,7 +518,7 @@ void csr1212_detach_keyval_from_directory(struct csr1212_keyval *dir, | |||
518 | * will be destroyed as well if their respective refcnts are 0. By means of | 518 | * will be destroyed as well if their respective refcnts are 0. By means of |
519 | * list manipulation, this routine will descend a directory structure in a | 519 | * list manipulation, this routine will descend a directory structure in a |
520 | * non-recursive manner. */ | 520 | * non-recursive manner. */ |
521 | void _csr1212_destroy_keyval(struct csr1212_keyval *kv) | 521 | static void csr1212_destroy_keyval(struct csr1212_keyval *kv) |
522 | { | 522 | { |
523 | struct csr1212_keyval *k, *a; | 523 | struct csr1212_keyval *k, *a; |
524 | struct csr1212_dentry dentry; | 524 | struct csr1212_dentry dentry; |
@@ -566,6 +566,14 @@ void _csr1212_destroy_keyval(struct csr1212_keyval *kv) | |||
566 | } | 566 | } |
567 | } | 567 | } |
568 | 568 | ||
569 | void csr1212_release_keyval(struct csr1212_keyval *kv) | ||
570 | { | ||
571 | if (kv->refcnt > 1) | ||
572 | kv->refcnt--; | ||
573 | else | ||
574 | csr1212_destroy_keyval(kv); | ||
575 | } | ||
576 | |||
569 | void csr1212_destroy_csr(struct csr1212_csr *csr) | 577 | void csr1212_destroy_csr(struct csr1212_csr *csr) |
570 | { | 578 | { |
571 | struct csr1212_csr_rom_cache *c, *oc; | 579 | struct csr1212_csr_rom_cache *c, *oc; |
@@ -1251,7 +1259,8 @@ fail: | |||
1251 | return ret; | 1259 | return ret; |
1252 | } | 1260 | } |
1253 | 1261 | ||
1254 | int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv) | 1262 | static int |
1263 | csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv) | ||
1255 | { | 1264 | { |
1256 | struct csr1212_cache_region *cr, *ncr, *newcr = NULL; | 1265 | struct csr1212_cache_region *cr, *ncr, *newcr = NULL; |
1257 | struct csr1212_keyval_img *kvi = NULL; | 1266 | struct csr1212_keyval_img *kvi = NULL; |
@@ -1412,6 +1421,17 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv) | |||
1412 | return csr1212_parse_keyval(kv, cache); | 1421 | return csr1212_parse_keyval(kv, cache); |
1413 | } | 1422 | } |
1414 | 1423 | ||
1424 | struct csr1212_keyval * | ||
1425 | csr1212_get_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv) | ||
1426 | { | ||
1427 | if (!kv) | ||
1428 | return NULL; | ||
1429 | if (!kv->valid) | ||
1430 | if (csr1212_read_keyval(csr, kv) != CSR1212_SUCCESS) | ||
1431 | return NULL; | ||
1432 | return kv; | ||
1433 | } | ||
1434 | |||
1415 | int csr1212_parse_csr(struct csr1212_csr *csr) | 1435 | int csr1212_parse_csr(struct csr1212_csr *csr) |
1416 | { | 1436 | { |
1417 | static const int mr_map[] = { 4, 64, 1024, 0 }; | 1437 | static const int mr_map[] = { 4, 64, 1024, 0 }; |
@@ -1443,7 +1463,7 @@ int csr1212_parse_csr(struct csr1212_csr *csr) | |||
1443 | csr->root_kv->valid = 0; | 1463 | csr->root_kv->valid = 0; |
1444 | csr->root_kv->next = csr->root_kv; | 1464 | csr->root_kv->next = csr->root_kv; |
1445 | csr->root_kv->prev = csr->root_kv; | 1465 | csr->root_kv->prev = csr->root_kv; |
1446 | ret = _csr1212_read_keyval(csr, csr->root_kv); | 1466 | ret = csr1212_read_keyval(csr, csr->root_kv); |
1447 | if (ret != CSR1212_SUCCESS) | 1467 | if (ret != CSR1212_SUCCESS) |
1448 | return ret; | 1468 | return ret; |
1449 | 1469 | ||
@@ -1453,7 +1473,7 @@ int csr1212_parse_csr(struct csr1212_csr *csr) | |||
1453 | dentry; dentry = dentry->next) { | 1473 | dentry; dentry = dentry->next) { |
1454 | if (dentry->kv->key.id == CSR1212_KV_ID_EXTENDED_ROM && | 1474 | if (dentry->kv->key.id == CSR1212_KV_ID_EXTENDED_ROM && |
1455 | !dentry->kv->valid) { | 1475 | !dentry->kv->valid) { |
1456 | ret = _csr1212_read_keyval(csr, dentry->kv); | 1476 | ret = csr1212_read_keyval(csr, dentry->kv); |
1457 | if (ret != CSR1212_SUCCESS) | 1477 | if (ret != CSR1212_SUCCESS) |
1458 | return ret; | 1478 | return ret; |
1459 | } | 1479 | } |
diff --git a/drivers/ieee1394/csr1212.h b/drivers/ieee1394/csr1212.h index 4ef0949589c7..655827527ecc 100644 --- a/drivers/ieee1394/csr1212.h +++ b/drivers/ieee1394/csr1212.h | |||
@@ -313,15 +313,11 @@ extern int csr1212_parse_keyval(struct csr1212_keyval *kv, | |||
313 | struct csr1212_csr_rom_cache *cache); | 313 | struct csr1212_csr_rom_cache *cache); |
314 | extern int csr1212_parse_csr(struct csr1212_csr *csr); | 314 | extern int csr1212_parse_csr(struct csr1212_csr *csr); |
315 | 315 | ||
316 | /* These are internal functions referenced by inline functions below. */ | ||
317 | extern int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv); | ||
318 | extern void _csr1212_destroy_keyval(struct csr1212_keyval *kv); | ||
319 | |||
320 | 316 | ||
321 | /* This function allocates a new cache which may be used for either parsing or | 317 | /* This function allocates a new cache which may be used for either parsing or |
322 | * generating sub-sets of Configuration ROM images. */ | 318 | * generating sub-sets of Configuration ROM images. */ |
323 | static inline struct csr1212_csr_rom_cache *csr1212_rom_cache_malloc(u32 offset, | 319 | static inline struct csr1212_csr_rom_cache * |
324 | size_t size) | 320 | csr1212_rom_cache_malloc(u32 offset, size_t size) |
325 | { | 321 | { |
326 | struct csr1212_csr_rom_cache *cache; | 322 | struct csr1212_csr_rom_cache *cache; |
327 | 323 | ||
@@ -345,16 +341,8 @@ static inline struct csr1212_csr_rom_cache *csr1212_rom_cache_malloc(u32 offset, | |||
345 | 341 | ||
346 | /* This function ensures that a keyval contains data when referencing a keyval | 342 | /* This function ensures that a keyval contains data when referencing a keyval |
347 | * created by parsing a Configuration ROM. */ | 343 | * created by parsing a Configuration ROM. */ |
348 | static inline struct csr1212_keyval *csr1212_get_keyval(struct csr1212_csr *csr, | 344 | extern struct csr1212_keyval * |
349 | struct csr1212_keyval *kv) | 345 | csr1212_get_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv); |
350 | { | ||
351 | if (!kv) | ||
352 | return NULL; | ||
353 | if (!kv->valid) | ||
354 | if (_csr1212_read_keyval(csr, kv) != CSR1212_SUCCESS) | ||
355 | return NULL; | ||
356 | return kv; | ||
357 | } | ||
358 | 346 | ||
359 | 347 | ||
360 | /* This function increments the reference count for a keyval should there be a | 348 | /* This function increments the reference count for a keyval should there be a |
@@ -369,13 +357,7 @@ static inline void csr1212_keep_keyval(struct csr1212_keyval *kv) | |||
369 | * keyval when there are no more users of the keyval. This should be called by | 357 | * keyval when there are no more users of the keyval. This should be called by |
370 | * any code that calls csr1212_keep_keyval() or any of the keyval creation | 358 | * any code that calls csr1212_keep_keyval() or any of the keyval creation |
371 | * routines csr1212_new_*(). */ | 359 | * routines csr1212_new_*(). */ |
372 | static inline void csr1212_release_keyval(struct csr1212_keyval *kv) | 360 | extern void csr1212_release_keyval(struct csr1212_keyval *kv); |
373 | { | ||
374 | if (kv->refcnt > 1) | ||
375 | kv->refcnt--; | ||
376 | else | ||
377 | _csr1212_destroy_keyval(kv); | ||
378 | } | ||
379 | 361 | ||
380 | 362 | ||
381 | /* | 363 | /* |
diff --git a/drivers/ieee1394/ieee1394_core.c b/drivers/ieee1394/ieee1394_core.c index 857e46c6e386..270885679df1 100644 --- a/drivers/ieee1394/ieee1394_core.c +++ b/drivers/ieee1394/ieee1394_core.c | |||
@@ -1372,11 +1372,10 @@ EXPORT_SYMBOL(hpsb_iso_wake); | |||
1372 | EXPORT_SYMBOL(hpsb_iso_recv_flush); | 1372 | EXPORT_SYMBOL(hpsb_iso_recv_flush); |
1373 | 1373 | ||
1374 | /** csr1212.c **/ | 1374 | /** csr1212.c **/ |
1375 | EXPORT_SYMBOL(csr1212_new_directory); | ||
1376 | EXPORT_SYMBOL(csr1212_attach_keyval_to_directory); | 1375 | EXPORT_SYMBOL(csr1212_attach_keyval_to_directory); |
1377 | EXPORT_SYMBOL(csr1212_detach_keyval_from_directory); | 1376 | EXPORT_SYMBOL(csr1212_detach_keyval_from_directory); |
1378 | EXPORT_SYMBOL(csr1212_release_keyval); | 1377 | EXPORT_SYMBOL(csr1212_get_keyval); |
1379 | EXPORT_SYMBOL(csr1212_read); | 1378 | EXPORT_SYMBOL(csr1212_new_directory); |
1380 | EXPORT_SYMBOL(csr1212_parse_keyval); | 1379 | EXPORT_SYMBOL(csr1212_parse_keyval); |
1381 | EXPORT_SYMBOL(_csr1212_read_keyval); | 1380 | EXPORT_SYMBOL(csr1212_read); |
1382 | EXPORT_SYMBOL(_csr1212_destroy_keyval); | 1381 | EXPORT_SYMBOL(csr1212_release_keyval); |