diff options
author | Al Viro <viro@ftp.linux.org.uk> | 2008-11-22 12:36:54 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-11-30 13:03:37 -0500 |
commit | 56d74dd5f7ad8b6b0979ce915d51cf03bcc57267 (patch) | |
tree | 1696aadcb0113e01bc9f8508bae00a3ba7922789 /drivers/isdn | |
parent | 8419641450edc838a6ce7cdf0f99d262bf0af2d5 (diff) |
tricky one: hisax sections
a) hisax_init_pcmcia() needs to be defined only if we have
CONFIG_HOTPLUG (no PCMCIA support otherwise) and can be declared
__devinit.
b) HiSax_inithardware() can go __init
c) hisax_register() is passing to checkcard() full-blown hisax_cs_setup_card():
checkcard(i, id, NULL, hisax_d_if->owner, hisax_cs_setup_card);
The problem with it is that
* hisax_cs_setup_card() is __devinit
* hisax_register() is not
* hisax_cs_setup_card() is a switch from hell, calling a lot of
setup_some_weirdcard() depending on card->typ. _These_ are also
__devinit.
However, in hisax_register() we have card->typ equal to
ISDN_CTYPE_DYNAMIC, which reduces hisax_cs_setup_card() to "nevermind
all that crap, just do nothing and return 2". So we add a
trimmed-down callback doing just that and passed to checkcard() by
hisax_register(). _This_ is non-init (we can stand the impact on
.text size).
Voila - no section warnings from drivers/isdn
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/isdn')
-rw-r--r-- | drivers/isdn/hisax/config.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c index 84d75a3f5d17..ded9d0baf607 100644 --- a/drivers/isdn/hisax/config.c +++ b/drivers/isdn/hisax/config.c | |||
@@ -1213,7 +1213,7 @@ static void HiSax_shiftcards(int idx) | |||
1213 | memcpy(&cards[i], &cards[i + 1], sizeof(cards[i])); | 1213 | memcpy(&cards[i], &cards[i + 1], sizeof(cards[i])); |
1214 | } | 1214 | } |
1215 | 1215 | ||
1216 | static int HiSax_inithardware(int *busy_flag) | 1216 | static int __init HiSax_inithardware(int *busy_flag) |
1217 | { | 1217 | { |
1218 | int foundcards = 0; | 1218 | int foundcards = 0; |
1219 | int i = 0; | 1219 | int i = 0; |
@@ -1542,7 +1542,9 @@ static void __exit HiSax_exit(void) | |||
1542 | printk(KERN_INFO "HiSax module removed\n"); | 1542 | printk(KERN_INFO "HiSax module removed\n"); |
1543 | } | 1543 | } |
1544 | 1544 | ||
1545 | int hisax_init_pcmcia(void *pcm_iob, int *busy_flag, struct IsdnCard *card) | 1545 | #ifdef CONFIG_HOTPLUG |
1546 | |||
1547 | int __devinit hisax_init_pcmcia(void *pcm_iob, int *busy_flag, struct IsdnCard *card) | ||
1546 | { | 1548 | { |
1547 | u_char ids[16]; | 1549 | u_char ids[16]; |
1548 | int ret = -1; | 1550 | int ret = -1; |
@@ -1563,6 +1565,8 @@ error: | |||
1563 | } | 1565 | } |
1564 | 1566 | ||
1565 | EXPORT_SYMBOL(hisax_init_pcmcia); | 1567 | EXPORT_SYMBOL(hisax_init_pcmcia); |
1568 | #endif | ||
1569 | |||
1566 | EXPORT_SYMBOL(HiSax_closecard); | 1570 | EXPORT_SYMBOL(HiSax_closecard); |
1567 | 1571 | ||
1568 | #include "hisax_if.h" | 1572 | #include "hisax_if.h" |
@@ -1580,6 +1584,11 @@ static void hisax_bc_close(struct BCState *bcs); | |||
1580 | static void hisax_bh(struct work_struct *work); | 1584 | static void hisax_bh(struct work_struct *work); |
1581 | static void EChannel_proc_rcv(struct hisax_d_if *d_if); | 1585 | static void EChannel_proc_rcv(struct hisax_d_if *d_if); |
1582 | 1586 | ||
1587 | static int hisax_setup_card_dynamic(struct IsdnCard *card) | ||
1588 | { | ||
1589 | return 2; | ||
1590 | } | ||
1591 | |||
1583 | int hisax_register(struct hisax_d_if *hisax_d_if, struct hisax_b_if *b_if[], | 1592 | int hisax_register(struct hisax_d_if *hisax_d_if, struct hisax_b_if *b_if[], |
1584 | char *name, int protocol) | 1593 | char *name, int protocol) |
1585 | { | 1594 | { |
@@ -1599,7 +1608,8 @@ int hisax_register(struct hisax_d_if *hisax_d_if, struct hisax_b_if *b_if[], | |||
1599 | cards[i].protocol = protocol; | 1608 | cards[i].protocol = protocol; |
1600 | sprintf(id, "%s%d", name, i); | 1609 | sprintf(id, "%s%d", name, i); |
1601 | nrcards++; | 1610 | nrcards++; |
1602 | retval = checkcard(i, id, NULL, hisax_d_if->owner, hisax_cs_setup_card); | 1611 | retval = checkcard(i, id, NULL, hisax_d_if->owner, |
1612 | hisax_setup_card_dynamic); | ||
1603 | if (retval == 0) { // yuck | 1613 | if (retval == 0) { // yuck |
1604 | cards[i].typ = 0; | 1614 | cards[i].typ = 0; |
1605 | nrcards--; | 1615 | nrcards--; |