diff options
-rw-r--r-- | drivers/net/hamradio/6pack.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c index e44f8e9055ef..f9e3be96963c 100644 --- a/drivers/net/hamradio/6pack.c +++ b/drivers/net/hamradio/6pack.c | |||
@@ -130,12 +130,11 @@ struct sixpack { | |||
130 | 130 | ||
131 | #define AX25_6PACK_HEADER_LEN 0 | 131 | #define AX25_6PACK_HEADER_LEN 0 |
132 | 132 | ||
133 | static void sp_start_tx_timer(struct sixpack *); | ||
134 | static void sixpack_decode(struct sixpack *, unsigned char[], int); | 133 | static void sixpack_decode(struct sixpack *, unsigned char[], int); |
135 | static int encode_sixpack(unsigned char *, unsigned char *, int, unsigned char); | 134 | static int encode_sixpack(unsigned char *, unsigned char *, int, unsigned char); |
136 | 135 | ||
137 | /* | 136 | /* |
138 | * perform the persistence/slottime algorithm for CSMA access. If the | 137 | * Perform the persistence/slottime algorithm for CSMA access. If the |
139 | * persistence check was successful, write the data to the serial driver. | 138 | * persistence check was successful, write the data to the serial driver. |
140 | * Note that in case of DAMA operation, the data is not sent here. | 139 | * Note that in case of DAMA operation, the data is not sent here. |
141 | */ | 140 | */ |
@@ -143,7 +142,7 @@ static int encode_sixpack(unsigned char *, unsigned char *, int, unsigned char); | |||
143 | static void sp_xmit_on_air(unsigned long channel) | 142 | static void sp_xmit_on_air(unsigned long channel) |
144 | { | 143 | { |
145 | struct sixpack *sp = (struct sixpack *) channel; | 144 | struct sixpack *sp = (struct sixpack *) channel; |
146 | int actual; | 145 | int actual, when = sp->slottime; |
147 | static unsigned char random; | 146 | static unsigned char random; |
148 | 147 | ||
149 | random = random * 17 + 41; | 148 | random = random * 17 + 41; |
@@ -159,20 +158,10 @@ static void sp_xmit_on_air(unsigned long channel) | |||
159 | sp->tty->driver->write(sp->tty, &sp->led_state, 1); | 158 | sp->tty->driver->write(sp->tty, &sp->led_state, 1); |
160 | sp->status2 = 0; | 159 | sp->status2 = 0; |
161 | } else | 160 | } else |
162 | sp_start_tx_timer(sp); | 161 | mod_timer(&sp->tx_t, jiffies + ((when + 1) * HZ) / 100); |
163 | } | 162 | } |
164 | 163 | ||
165 | /* ----> 6pack timer interrupt handler and friends. <---- */ | 164 | /* ----> 6pack timer interrupt handler and friends. <---- */ |
166 | static void sp_start_tx_timer(struct sixpack *sp) | ||
167 | { | ||
168 | int when = sp->slottime; | ||
169 | |||
170 | del_timer(&sp->tx_t); | ||
171 | sp->tx_t.data = (unsigned long) sp; | ||
172 | sp->tx_t.function = sp_xmit_on_air; | ||
173 | sp->tx_t.expires = jiffies + ((when + 1) * HZ) / 100; | ||
174 | add_timer(&sp->tx_t); | ||
175 | } | ||
176 | 165 | ||
177 | /* Encapsulate one AX.25 frame and stuff into a TTY queue. */ | 166 | /* Encapsulate one AX.25 frame and stuff into a TTY queue. */ |
178 | static void sp_encaps(struct sixpack *sp, unsigned char *icp, int len) | 167 | static void sp_encaps(struct sixpack *sp, unsigned char *icp, int len) |
@@ -243,8 +232,7 @@ static void sp_encaps(struct sixpack *sp, unsigned char *icp, int len) | |||
243 | sp->xleft = count; | 232 | sp->xleft = count; |
244 | sp->xhead = sp->xbuff; | 233 | sp->xhead = sp->xbuff; |
245 | sp->status2 = count; | 234 | sp->status2 = count; |
246 | if (sp->duplex == 0) | 235 | sp_xmit_on_air((unsigned long)sp); |
247 | sp_start_tx_timer(sp); | ||
248 | } | 236 | } |
249 | 237 | ||
250 | return; | 238 | return; |