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/synclink_gt.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/synclink_gt.c')
-rw-r--r-- | drivers/char/synclink_gt.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c index 83b5d37d6c59..e4730a7312b5 100644 --- a/drivers/char/synclink_gt.c +++ b/drivers/char/synclink_gt.c | |||
@@ -83,8 +83,10 @@ | |||
83 | 83 | ||
84 | #include "linux/synclink.h" | 84 | #include "linux/synclink.h" |
85 | 85 | ||
86 | #ifdef CONFIG_HDLC_MODULE | 86 | #if defined(CONFIG_HDLC) || (defined(CONFIG_HDLC_MODULE) && defined(CONFIG_SYNCLINK_GT_MODULE)) |
87 | #define CONFIG_HDLC 1 | 87 | #define SYNCLINK_GENERIC_HDLC 1 |
88 | #else | ||
89 | #define SYNCLINK_GENERIC_HDLC 0 | ||
88 | #endif | 90 | #endif |
89 | 91 | ||
90 | /* | 92 | /* |
@@ -171,7 +173,7 @@ static void set_break(struct tty_struct *tty, int break_state); | |||
171 | /* | 173 | /* |
172 | * generic HDLC support and callbacks | 174 | * generic HDLC support and callbacks |
173 | */ | 175 | */ |
174 | #ifdef CONFIG_HDLC | 176 | #if SYNCLINK_GENERIC_HDLC |
175 | #define dev_to_port(D) (dev_to_hdlc(D)->priv) | 177 | #define dev_to_port(D) (dev_to_hdlc(D)->priv) |
176 | static void hdlcdev_tx_done(struct slgt_info *info); | 178 | static void hdlcdev_tx_done(struct slgt_info *info); |
177 | static void hdlcdev_rx(struct slgt_info *info, char *buf, int size); | 179 | static void hdlcdev_rx(struct slgt_info *info, char *buf, int size); |
@@ -359,7 +361,7 @@ struct slgt_info { | |||
359 | int netcount; | 361 | int netcount; |
360 | int dosyncppp; | 362 | int dosyncppp; |
361 | spinlock_t netlock; | 363 | spinlock_t netlock; |
362 | #ifdef CONFIG_HDLC | 364 | #if SYNCLINK_GENERIC_HDLC |
363 | struct net_device *netdev; | 365 | struct net_device *netdev; |
364 | #endif | 366 | #endif |
365 | 367 | ||
@@ -1354,7 +1356,7 @@ static void set_break(struct tty_struct *tty, int break_state) | |||
1354 | spin_unlock_irqrestore(&info->lock,flags); | 1356 | spin_unlock_irqrestore(&info->lock,flags); |
1355 | } | 1357 | } |
1356 | 1358 | ||
1357 | #ifdef CONFIG_HDLC | 1359 | #if SYNCLINK_GENERIC_HDLC |
1358 | 1360 | ||
1359 | /** | 1361 | /** |
1360 | * called by generic HDLC layer when protocol selected (PPP, frame relay, etc.) | 1362 | * called by generic HDLC layer when protocol selected (PPP, frame relay, etc.) |
@@ -2002,7 +2004,7 @@ static void dcd_change(struct slgt_info *info) | |||
2002 | } else { | 2004 | } else { |
2003 | info->input_signal_events.dcd_down++; | 2005 | info->input_signal_events.dcd_down++; |
2004 | } | 2006 | } |
2005 | #ifdef CONFIG_HDLC | 2007 | #if SYNCLINK_GENERIC_HDLC |
2006 | if (info->netcount) { | 2008 | if (info->netcount) { |
2007 | if (info->signals & SerialSignal_DCD) | 2009 | if (info->signals & SerialSignal_DCD) |
2008 | netif_carrier_on(info->netdev); | 2010 | netif_carrier_on(info->netdev); |
@@ -2180,7 +2182,7 @@ static void isr_txeom(struct slgt_info *info, unsigned short status) | |||
2180 | set_signals(info); | 2182 | set_signals(info); |
2181 | } | 2183 | } |
2182 | 2184 | ||
2183 | #ifdef CONFIG_HDLC | 2185 | #if SYNCLINK_GENERIC_HDLC |
2184 | if (info->netcount) | 2186 | if (info->netcount) |
2185 | hdlcdev_tx_done(info); | 2187 | hdlcdev_tx_done(info); |
2186 | else | 2188 | else |
@@ -3306,7 +3308,7 @@ static void add_device(struct slgt_info *info) | |||
3306 | devstr, info->device_name, info->phys_reg_addr, | 3308 | devstr, info->device_name, info->phys_reg_addr, |
3307 | info->irq_level, info->max_frame_size); | 3309 | info->irq_level, info->max_frame_size); |
3308 | 3310 | ||
3309 | #ifdef CONFIG_HDLC | 3311 | #if SYNCLINK_GENERIC_HDLC |
3310 | hdlcdev_init(info); | 3312 | hdlcdev_init(info); |
3311 | #endif | 3313 | #endif |
3312 | } | 3314 | } |
@@ -3488,7 +3490,7 @@ static void slgt_cleanup(void) | |||
3488 | /* release devices */ | 3490 | /* release devices */ |
3489 | info = slgt_device_list; | 3491 | info = slgt_device_list; |
3490 | while(info) { | 3492 | while(info) { |
3491 | #ifdef CONFIG_HDLC | 3493 | #if SYNCLINK_GENERIC_HDLC |
3492 | hdlcdev_exit(info); | 3494 | hdlcdev_exit(info); |
3493 | #endif | 3495 | #endif |
3494 | free_dma_bufs(info); | 3496 | free_dma_bufs(info); |
@@ -4434,7 +4436,7 @@ check_again: | |||
4434 | framesize = 0; | 4436 | framesize = 0; |
4435 | } | 4437 | } |
4436 | 4438 | ||
4437 | #ifdef CONFIG_HDLC | 4439 | #if SYNCLINK_GENERIC_HDLC |
4438 | if (framesize == 0) { | 4440 | if (framesize == 0) { |
4439 | struct net_device_stats *stats = hdlc_stats(info->netdev); | 4441 | struct net_device_stats *stats = hdlc_stats(info->netdev); |
4440 | stats->rx_errors++; | 4442 | stats->rx_errors++; |
@@ -4477,7 +4479,7 @@ check_again: | |||
4477 | framesize++; | 4479 | framesize++; |
4478 | } | 4480 | } |
4479 | 4481 | ||
4480 | #ifdef CONFIG_HDLC | 4482 | #if SYNCLINK_GENERIC_HDLC |
4481 | if (info->netcount) | 4483 | if (info->netcount) |
4482 | hdlcdev_rx(info,info->tmp_rbuf, framesize); | 4484 | hdlcdev_rx(info,info->tmp_rbuf, framesize); |
4483 | else | 4485 | else |
@@ -4780,7 +4782,7 @@ static void tx_timeout(unsigned long context) | |||
4780 | info->tx_count = 0; | 4782 | info->tx_count = 0; |
4781 | spin_unlock_irqrestore(&info->lock,flags); | 4783 | spin_unlock_irqrestore(&info->lock,flags); |
4782 | 4784 | ||
4783 | #ifdef CONFIG_HDLC | 4785 | #if SYNCLINK_GENERIC_HDLC |
4784 | if (info->netcount) | 4786 | if (info->netcount) |
4785 | hdlcdev_tx_done(info); | 4787 | hdlcdev_tx_done(info); |
4786 | else | 4788 | else |