diff options
author | Paul Fulghum <paulkf@microgate.com> | 2006-12-06 23:40:24 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-07 11:39:45 -0500 |
commit | af69c7f924b272927f9aea378f34f4548d3888d9 (patch) | |
tree | 93333028e018567d85ed94b9192e501ab2f3c58c /drivers/char/synclinkmp.c | |
parent | 3ee6f61ca0720c71086a9eaf3f5bd0f7c51fe139 (diff) |
[PATCH] generic HDLC synclink config mismatch fix
Fix compile errors on mismatch between generic HDLC and synclink drivers.
Notes:
generic HDLC support for synclink drivers is *optional* so you can't just
use depend on in Kconfig
This solution is deemed the best after 7 months of review and criticism by
many developers including AKPM. Read the threads on LKML before posting
about this solution.
Signed-off-by: Paul Fulghum <paulkf@microgate.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/synclinkmp.c')
-rw-r--r-- | drivers/char/synclinkmp.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c index 13a57245cf2e..20a96ef250be 100644 --- a/drivers/char/synclinkmp.c +++ b/drivers/char/synclinkmp.c | |||
@@ -67,8 +67,10 @@ | |||
67 | #include <linux/workqueue.h> | 67 | #include <linux/workqueue.h> |
68 | #include <linux/hdlc.h> | 68 | #include <linux/hdlc.h> |
69 | 69 | ||
70 | #ifdef CONFIG_HDLC_MODULE | 70 | #if defined(CONFIG_HDLC) || (defined(CONFIG_HDLC_MODULE) && defined(CONFIG_SYNCLINKMP_MODULE)) |
71 | #define CONFIG_HDLC 1 | 71 | #define SYNCLINK_GENERIC_HDLC 1 |
72 | #else | ||
73 | #define SYNCLINK_GENERIC_HDLC 0 | ||
72 | #endif | 74 | #endif |
73 | 75 | ||
74 | #define GET_USER(error,value,addr) error = get_user(value,addr) | 76 | #define GET_USER(error,value,addr) error = get_user(value,addr) |
@@ -280,7 +282,7 @@ typedef struct _synclinkmp_info { | |||
280 | int dosyncppp; | 282 | int dosyncppp; |
281 | spinlock_t netlock; | 283 | spinlock_t netlock; |
282 | 284 | ||
283 | #ifdef CONFIG_HDLC | 285 | #if SYNCLINK_GENERIC_HDLC |
284 | struct net_device *netdev; | 286 | struct net_device *netdev; |
285 | #endif | 287 | #endif |
286 | 288 | ||
@@ -536,7 +538,7 @@ static void throttle(struct tty_struct * tty); | |||
536 | static void unthrottle(struct tty_struct * tty); | 538 | static void unthrottle(struct tty_struct * tty); |
537 | static void set_break(struct tty_struct *tty, int break_state); | 539 | static void set_break(struct tty_struct *tty, int break_state); |
538 | 540 | ||
539 | #ifdef CONFIG_HDLC | 541 | #if SYNCLINK_GENERIC_HDLC |
540 | #define dev_to_port(D) (dev_to_hdlc(D)->priv) | 542 | #define dev_to_port(D) (dev_to_hdlc(D)->priv) |
541 | static void hdlcdev_tx_done(SLMP_INFO *info); | 543 | static void hdlcdev_tx_done(SLMP_INFO *info); |
542 | static void hdlcdev_rx(SLMP_INFO *info, char *buf, int size); | 544 | static void hdlcdev_rx(SLMP_INFO *info, char *buf, int size); |
@@ -1607,7 +1609,7 @@ static void set_break(struct tty_struct *tty, int break_state) | |||
1607 | spin_unlock_irqrestore(&info->lock,flags); | 1609 | spin_unlock_irqrestore(&info->lock,flags); |
1608 | } | 1610 | } |
1609 | 1611 | ||
1610 | #ifdef CONFIG_HDLC | 1612 | #if SYNCLINK_GENERIC_HDLC |
1611 | 1613 | ||
1612 | /** | 1614 | /** |
1613 | * called by generic HDLC layer when protocol selected (PPP, frame relay, etc.) | 1615 | * called by generic HDLC layer when protocol selected (PPP, frame relay, etc.) |
@@ -2339,7 +2341,7 @@ static void isr_txeom(SLMP_INFO * info, unsigned char status) | |||
2339 | set_signals(info); | 2341 | set_signals(info); |
2340 | } | 2342 | } |
2341 | 2343 | ||
2342 | #ifdef CONFIG_HDLC | 2344 | #if SYNCLINK_GENERIC_HDLC |
2343 | if (info->netcount) | 2345 | if (info->netcount) |
2344 | hdlcdev_tx_done(info); | 2346 | hdlcdev_tx_done(info); |
2345 | else | 2347 | else |
@@ -2523,7 +2525,7 @@ void isr_io_pin( SLMP_INFO *info, u16 status ) | |||
2523 | info->input_signal_events.dcd_up++; | 2525 | info->input_signal_events.dcd_up++; |
2524 | } else | 2526 | } else |
2525 | info->input_signal_events.dcd_down++; | 2527 | info->input_signal_events.dcd_down++; |
2526 | #ifdef CONFIG_HDLC | 2528 | #if SYNCLINK_GENERIC_HDLC |
2527 | if (info->netcount) { | 2529 | if (info->netcount) { |
2528 | if (status & SerialSignal_DCD) | 2530 | if (status & SerialSignal_DCD) |
2529 | netif_carrier_on(info->netdev); | 2531 | netif_carrier_on(info->netdev); |
@@ -3783,7 +3785,7 @@ void add_device(SLMP_INFO *info) | |||
3783 | info->irq_level, | 3785 | info->irq_level, |
3784 | info->max_frame_size ); | 3786 | info->max_frame_size ); |
3785 | 3787 | ||
3786 | #ifdef CONFIG_HDLC | 3788 | #if SYNCLINK_GENERIC_HDLC |
3787 | hdlcdev_init(info); | 3789 | hdlcdev_init(info); |
3788 | #endif | 3790 | #endif |
3789 | } | 3791 | } |
@@ -3977,7 +3979,7 @@ static void synclinkmp_cleanup(void) | |||
3977 | /* release devices */ | 3979 | /* release devices */ |
3978 | info = synclinkmp_device_list; | 3980 | info = synclinkmp_device_list; |
3979 | while(info) { | 3981 | while(info) { |
3980 | #ifdef CONFIG_HDLC | 3982 | #if SYNCLINK_GENERIC_HDLC |
3981 | hdlcdev_exit(info); | 3983 | hdlcdev_exit(info); |
3982 | #endif | 3984 | #endif |
3983 | free_dma_bufs(info); | 3985 | free_dma_bufs(info); |
@@ -4979,7 +4981,7 @@ CheckAgain: | |||
4979 | info->icount.rxcrc++; | 4981 | info->icount.rxcrc++; |
4980 | 4982 | ||
4981 | framesize = 0; | 4983 | framesize = 0; |
4982 | #ifdef CONFIG_HDLC | 4984 | #if SYNCLINK_GENERIC_HDLC |
4983 | { | 4985 | { |
4984 | struct net_device_stats *stats = hdlc_stats(info->netdev); | 4986 | struct net_device_stats *stats = hdlc_stats(info->netdev); |
4985 | stats->rx_errors++; | 4987 | stats->rx_errors++; |
@@ -5020,7 +5022,7 @@ CheckAgain: | |||
5020 | index = 0; | 5022 | index = 0; |
5021 | } | 5023 | } |
5022 | 5024 | ||
5023 | #ifdef CONFIG_HDLC | 5025 | #if SYNCLINK_GENERIC_HDLC |
5024 | if (info->netcount) | 5026 | if (info->netcount) |
5025 | hdlcdev_rx(info,info->tmp_rx_buf,framesize); | 5027 | hdlcdev_rx(info,info->tmp_rx_buf,framesize); |
5026 | else | 5028 | else |
@@ -5531,7 +5533,7 @@ void tx_timeout(unsigned long context) | |||
5531 | 5533 | ||
5532 | spin_unlock_irqrestore(&info->lock,flags); | 5534 | spin_unlock_irqrestore(&info->lock,flags); |
5533 | 5535 | ||
5534 | #ifdef CONFIG_HDLC | 5536 | #if SYNCLINK_GENERIC_HDLC |
5535 | if (info->netcount) | 5537 | if (info->netcount) |
5536 | hdlcdev_tx_done(info); | 5538 | hdlcdev_tx_done(info); |
5537 | else | 5539 | else |