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.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.c')
-rw-r--r-- | drivers/char/synclink.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index 147c30da81ea..645187b9141e 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c | |||
@@ -101,8 +101,10 @@ | |||
101 | #include <linux/hdlc.h> | 101 | #include <linux/hdlc.h> |
102 | #include <linux/dma-mapping.h> | 102 | #include <linux/dma-mapping.h> |
103 | 103 | ||
104 | #ifdef CONFIG_HDLC_MODULE | 104 | #if defined(CONFIG_HDLC) || (defined(CONFIG_HDLC_MODULE) && defined(CONFIG_SYNCLINK_MODULE)) |
105 | #define CONFIG_HDLC 1 | 105 | #define SYNCLINK_GENERIC_HDLC 1 |
106 | #else | ||
107 | #define SYNCLINK_GENERIC_HDLC 0 | ||
106 | #endif | 108 | #endif |
107 | 109 | ||
108 | #define GET_USER(error,value,addr) error = get_user(value,addr) | 110 | #define GET_USER(error,value,addr) error = get_user(value,addr) |
@@ -320,7 +322,7 @@ struct mgsl_struct { | |||
320 | int dosyncppp; | 322 | int dosyncppp; |
321 | spinlock_t netlock; | 323 | spinlock_t netlock; |
322 | 324 | ||
323 | #ifdef CONFIG_HDLC | 325 | #if SYNCLINK_GENERIC_HDLC |
324 | struct net_device *netdev; | 326 | struct net_device *netdev; |
325 | #endif | 327 | #endif |
326 | }; | 328 | }; |
@@ -728,7 +730,7 @@ static void usc_loopmode_send_done( struct mgsl_struct * info ); | |||
728 | 730 | ||
729 | static int mgsl_ioctl_common(struct mgsl_struct *info, unsigned int cmd, unsigned long arg); | 731 | static int mgsl_ioctl_common(struct mgsl_struct *info, unsigned int cmd, unsigned long arg); |
730 | 732 | ||
731 | #ifdef CONFIG_HDLC | 733 | #if SYNCLINK_GENERIC_HDLC |
732 | #define dev_to_port(D) (dev_to_hdlc(D)->priv) | 734 | #define dev_to_port(D) (dev_to_hdlc(D)->priv) |
733 | static void hdlcdev_tx_done(struct mgsl_struct *info); | 735 | static void hdlcdev_tx_done(struct mgsl_struct *info); |
734 | static void hdlcdev_rx(struct mgsl_struct *info, char *buf, int size); | 736 | static void hdlcdev_rx(struct mgsl_struct *info, char *buf, int size); |
@@ -1277,7 +1279,7 @@ static void mgsl_isr_transmit_status( struct mgsl_struct *info ) | |||
1277 | info->drop_rts_on_tx_done = 0; | 1279 | info->drop_rts_on_tx_done = 0; |
1278 | } | 1280 | } |
1279 | 1281 | ||
1280 | #ifdef CONFIG_HDLC | 1282 | #if SYNCLINK_GENERIC_HDLC |
1281 | if (info->netcount) | 1283 | if (info->netcount) |
1282 | hdlcdev_tx_done(info); | 1284 | hdlcdev_tx_done(info); |
1283 | else | 1285 | else |
@@ -1342,7 +1344,7 @@ static void mgsl_isr_io_pin( struct mgsl_struct *info ) | |||
1342 | info->input_signal_events.dcd_up++; | 1344 | info->input_signal_events.dcd_up++; |
1343 | } else | 1345 | } else |
1344 | info->input_signal_events.dcd_down++; | 1346 | info->input_signal_events.dcd_down++; |
1345 | #ifdef CONFIG_HDLC | 1347 | #if SYNCLINK_GENERIC_HDLC |
1346 | if (info->netcount) { | 1348 | if (info->netcount) { |
1347 | if (status & MISCSTATUS_DCD) | 1349 | if (status & MISCSTATUS_DCD) |
1348 | netif_carrier_on(info->netdev); | 1350 | netif_carrier_on(info->netdev); |
@@ -4313,7 +4315,7 @@ static void mgsl_add_device( struct mgsl_struct *info ) | |||
4313 | info->max_frame_size ); | 4315 | info->max_frame_size ); |
4314 | } | 4316 | } |
4315 | 4317 | ||
4316 | #ifdef CONFIG_HDLC | 4318 | #if SYNCLINK_GENERIC_HDLC |
4317 | hdlcdev_init(info); | 4319 | hdlcdev_init(info); |
4318 | #endif | 4320 | #endif |
4319 | 4321 | ||
@@ -4471,7 +4473,7 @@ static void synclink_cleanup(void) | |||
4471 | 4473 | ||
4472 | info = mgsl_device_list; | 4474 | info = mgsl_device_list; |
4473 | while(info) { | 4475 | while(info) { |
4474 | #ifdef CONFIG_HDLC | 4476 | #if SYNCLINK_GENERIC_HDLC |
4475 | hdlcdev_exit(info); | 4477 | hdlcdev_exit(info); |
4476 | #endif | 4478 | #endif |
4477 | mgsl_release_resources(info); | 4479 | mgsl_release_resources(info); |
@@ -6645,7 +6647,7 @@ static int mgsl_get_rx_frame(struct mgsl_struct *info) | |||
6645 | return_frame = 1; | 6647 | return_frame = 1; |
6646 | } | 6648 | } |
6647 | framesize = 0; | 6649 | framesize = 0; |
6648 | #ifdef CONFIG_HDLC | 6650 | #if SYNCLINK_GENERIC_HDLC |
6649 | { | 6651 | { |
6650 | struct net_device_stats *stats = hdlc_stats(info->netdev); | 6652 | struct net_device_stats *stats = hdlc_stats(info->netdev); |
6651 | stats->rx_errors++; | 6653 | stats->rx_errors++; |
@@ -6721,7 +6723,7 @@ static int mgsl_get_rx_frame(struct mgsl_struct *info) | |||
6721 | *ptmp); | 6723 | *ptmp); |
6722 | } | 6724 | } |
6723 | 6725 | ||
6724 | #ifdef CONFIG_HDLC | 6726 | #if SYNCLINK_GENERIC_HDLC |
6725 | if (info->netcount) | 6727 | if (info->netcount) |
6726 | hdlcdev_rx(info,info->intermediate_rxbuffer,framesize); | 6728 | hdlcdev_rx(info,info->intermediate_rxbuffer,framesize); |
6727 | else | 6729 | else |
@@ -7625,7 +7627,7 @@ static void mgsl_tx_timeout(unsigned long context) | |||
7625 | 7627 | ||
7626 | spin_unlock_irqrestore(&info->irq_spinlock,flags); | 7628 | spin_unlock_irqrestore(&info->irq_spinlock,flags); |
7627 | 7629 | ||
7628 | #ifdef CONFIG_HDLC | 7630 | #if SYNCLINK_GENERIC_HDLC |
7629 | if (info->netcount) | 7631 | if (info->netcount) |
7630 | hdlcdev_tx_done(info); | 7632 | hdlcdev_tx_done(info); |
7631 | else | 7633 | else |
@@ -7701,7 +7703,7 @@ static int usc_loopmode_active( struct mgsl_struct * info) | |||
7701 | return usc_InReg( info, CCSR ) & BIT7 ? 1 : 0 ; | 7703 | return usc_InReg( info, CCSR ) & BIT7 ? 1 : 0 ; |
7702 | } | 7704 | } |
7703 | 7705 | ||
7704 | #ifdef CONFIG_HDLC | 7706 | #if SYNCLINK_GENERIC_HDLC |
7705 | 7707 | ||
7706 | /** | 7708 | /** |
7707 | * called by generic HDLC layer when protocol selected (PPP, frame relay, etc.) | 7709 | * called by generic HDLC layer when protocol selected (PPP, frame relay, etc.) |