1 Index: linux-2.6.21/drivers/char/ts0710.h
2 ===================================================================
3 --- linux-2.6.21.orig/drivers/char/ts0710.h 2007-04-27 20:35:44.000000000 -0300
4 +++ linux-2.6.21/drivers/char/ts0710.h 2007-04-27 20:36:03.000000000 -0300
9 -#include <linux/config.h>
10 #include <linux/module.h>
12 #include <linux/errno.h>
14 #include <linux/major.h>
16 #include <linux/init.h>
17 -#include <linux/devfs_fs_kernel.h>
19 #include <asm/uaccess.h>
20 #include <asm/system.h>
21 Index: linux-2.6.21/drivers/char/ts0710_mux.c
22 ===================================================================
23 --- linux-2.6.21.orig/drivers/char/ts0710_mux.c 2007-04-27 20:35:44.000000000 -0300
24 +++ linux-2.6.21/drivers/char/ts0710_mux.c 2007-04-27 20:36:03.000000000 -0300
26 * 11/18/2002 Second version
27 * 04/21/2004 Add GPRS PROC
29 -#include <linux/config.h>
30 #include <linux/module.h>
31 #include <linux/types.h>
35 #include <linux/slab.h>
36 #include <linux/init.h>
37 -#include <linux/devfs_fs_kernel.h>
38 -//#include <syslog.h>
40 #include <asm/uaccess.h>
41 #include <asm/system.h>
42 #include <asm/bitops.h>
45 -//#include <linux/usb.h>
46 #include "ts0710_mux_usb.h"
50 static struct work_struct post_recv_tqueue;
52 static struct tty_struct *mux_table[NR_MUXS];
53 -static struct termios *mux_termios[NR_MUXS];
54 -static struct termios *mux_termios_locked[NR_MUXS];
55 +static struct ktermios *mux_termios[NR_MUXS];
56 +static struct ktermios *mux_termios_locked[NR_MUXS];
57 static volatile short int mux_tty[NR_MUXS];
60 @@ -1894,11 +1890,7 @@
61 if (test_bit(TTY_THROTTLED, &tty->flags)) {
65 - (TTY_DONT_FLIP, &tty->flags)) {
68 - } else if (recv_info->total) {
69 + if (recv_info->total) {
72 } else if (recv_room < uih_len) {
73 @@ -3149,10 +3141,10 @@
75 /*For BP UART problem End*/
77 -static void receive_worker(void *private_)
78 +static void receive_worker(struct work_struct *work)
80 struct tty_struct *tty = COMM_FOR_MUX_TTY;
81 - int i, count, tbuf_free, tbuf_read;
82 + int count, tbuf_free, tbuf_read;
83 static unsigned char tbuf[TS0710MUX_MAX_BUF_SIZE];
84 static unsigned char *tbuf_ptr = &tbuf[0];
85 static unsigned char *start_flag = 0;
88 /*For BP UART problem End */
90 - UNUSED_PARAM(private_);
96 clear_bit(RECV_RUNNING, &mux_recv_flags);
99 -static void post_recv_worker(void *private_)
100 +static void post_recv_worker(struct work_struct *work)
102 ts0710_con *ts0710 = &ts0710_connection;
104 @@ -3453,7 +3445,7 @@
105 mux_recv_packet *recv_packet, *recv_packet2;
108 - UNUSED_PARAM(private_);
109 + UNUSED_PARAM(work);
111 if (test_and_set_bit(RECV_RUNNING, &mux_recv_flags)) {
112 schedule_work(&post_recv_tqueue);
113 @@ -3499,10 +3491,6 @@
114 if (test_bit(TTY_THROTTLED, &tty->flags)) {
115 add_post_recv_queue(&post_recv_q, recv_info);
117 - } else if (test_bit(TTY_DONT_FLIP, &tty->flags)) {
119 - add_post_recv_queue(&post_recv_q, recv_info);
124 @@ -3635,7 +3623,7 @@
128 -static void send_worker(void *private_)
129 +static void send_worker(struct work_struct *work)
131 ts0710_con *ts0710 = &ts0710_connection;
133 @@ -3644,7 +3632,7 @@
134 struct tty_struct *tty;
137 - UNUSED_PARAM(private_);
138 + UNUSED_PARAM(work);
140 TS0710_DEBUG("Enter into send_worker");
142 @@ -3819,7 +3807,8 @@
143 gprsData[TS0710MUX_GPRS_SESSION_MAX - 1].sentBytes =
144 get_count(TS0710MUX_GPRS2_SEND_COUNT_IDX);
146 - copy_to_user(buf, gprsData, bufLen);
147 + if(copy_to_user(buf, gprsData, bufLen))
152 @@ -3836,7 +3825,8 @@
154 memset(gprsData, 0, bufLen);
156 - copy_from_user(gprsData, buf, bufLen);
157 + if(copy_from_user(gprsData, buf, bufLen))
160 set_count(TS0710MUX_GPRS1_RECV_COUNT_IDX, gprsData[0].recvBytes);
161 set_count(TS0710MUX_GPRS1_SEND_COUNT_IDX, gprsData[0].sentBytes);
162 @@ -3893,9 +3883,9 @@
164 post_recv_count_flag = 0;
166 - INIT_WORK(&send_tqueue, send_worker, NULL);
167 - INIT_WORK(&receive_tqueue, receive_worker, NULL);
168 - INIT_WORK(&post_recv_tqueue, post_recv_worker, NULL);
169 + INIT_WORK(&send_tqueue, send_worker);
170 + INIT_WORK(&receive_tqueue, receive_worker);
171 + INIT_WORK(&post_recv_tqueue, post_recv_worker);
173 mux_driver = alloc_tty_driver(NR_MUXS);
175 @@ -3904,12 +3894,11 @@
176 mux_driver->owner = THIS_MODULE;
177 mux_driver->driver_name = "ts0710mux";
178 mux_driver->name = "mux";
179 - mux_driver->devfs_name = "mux";
180 mux_driver->major = TS0710MUX_MAJOR;
181 mux_driver->minor_start = TS0710MUX_MINOR_START;
182 mux_driver->type = TTY_DRIVER_TYPE_SERIAL;
183 mux_driver->subtype = SERIAL_TYPE_NORMAL;
184 - mux_driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW;
185 + mux_driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
187 mux_driver->init_termios = tty_std_termios;
188 mux_driver->init_termios.c_iflag = 0;
189 @@ -3917,10 +3906,10 @@
190 mux_driver->init_termios.c_cflag = B38400 | CS8 | CREAD;
191 mux_driver->init_termios.c_lflag = 0;
193 -// mux_driver.ttys = mux_table;
194 + //mux_driver.ttys = mux_table;
195 mux_driver->termios = mux_termios;
196 mux_driver->termios_locked = mux_termios_locked;
197 -// mux_driver.driver_state = mux_state;
198 + //mux_driver.driver_state = mux_state;
199 mux_driver->other = NULL;
201 mux_driver->open = mux_open;
202 Index: linux-2.6.21/drivers/char/ts0710_mux_usb.c
203 ===================================================================
204 --- linux-2.6.21.orig/drivers/char/ts0710_mux_usb.c 2007-04-27 20:35:44.000000000 -0300
205 +++ linux-2.6.21/drivers/char/ts0710_mux_usb.c 2007-04-27 22:34:31.000000000 -0300
208 int count = urb->actual_length;
210 - inbuf = kmalloc(sizeof(buf_list_t), GFP_KERNEL);
211 + // we are called from interrupt context.
212 + inbuf = kmalloc(sizeof(buf_list_t), GFP_ATOMIC);
214 printk("append_to_inbuf_list: (%d) out of memory!\n",
220 - inbuf->body = kmalloc(sizeof(char)*count, GFP_KERNEL);
221 + inbuf->body = kmalloc(sizeof(char)*count, GFP_ATOMIC);
224 printk("append_to_inbuf_list: (%d) out of memory!\n",
226 inbuf = list_entry(ptr, buf_list_t, list);
227 src_count = inbuf->size;
228 if (dst_count >= src_count) {
229 - memcpy(buf, inbuf->body, src_count);
230 + memcpy((unsigned char *)buf, inbuf->body, src_count);
235 spin_unlock(&bvd_ipc->in_buf_lock);
238 -static void usb_ipc_read_bulk(struct urb *urb, struct pt_regs *regs)
239 +static void usb_ipc_read_bulk(struct urb *urb)
242 int count = urb->actual_length;
243 struct tty_struct *tty = &ipcusb_tty;
246 bvd_dbg("usb_ipc_read_bulk: completed!!!");
249 -static void usb_ipc_write_bulk(struct urb *urb, struct pt_regs *regs)
250 +static void usb_ipc_write_bulk(struct urb *urb)
253 bvd_ipc->write_finished_flag = 1;
256 bvd_ipc->readurb_mux.actual_length = 0;
257 bvd_ipc->readurb_mux.dev = bvd_ipc->ipc_dev;
258 - if (ret = usb_submit_urb(&bvd_ipc->readurb_mux, GFP_ATOMIC))
259 + if ((ret = usb_submit_urb(&bvd_ipc->readurb_mux, GFP_ATOMIC)))
260 printk("ipcusb_xmit_data: usb_submit_urb(read mux bulk)"
261 "failed! status=%d\n", ret);
262 bvd_dbg("ipcusb_xmit_data: Send a IN token successfully!");
264 bvd_ipc->write_finished_flag = 0;
265 //printk("%s: clear write_finished_flag:%d\n", __FUNCTION__, bvd_ipc->write_finished_flag);
266 bvd_ipc->writeurb_mux.dev = bvd_ipc->ipc_dev;
267 - if (result = usb_submit_urb(&bvd_ipc->writeurb_mux, GFP_ATOMIC))
268 + if ((result = usb_submit_urb(&bvd_ipc->writeurb_mux, GFP_ATOMIC)))
269 warn("ipcusb_xmit_data: funky result! result=%d\n", result);
271 bvd_dbg("ipcusb_xmit_data: usb_submit_urb finished! result:%d", result);
275 if (*ipcusb_ap_to_bp != NULL)
276 - (*ipcusb_ap_to_bp)(buf, count);
277 + (*ipcusb_ap_to_bp)((unsigned char *)buf, count);
279 bvd_ipc->suspend_flag = 1;
284 ep_cnt = have_bulk_in_mux = have_bulk_out_mux = 0;
285 + readsize = writesize = 0;
287 while (ep_cnt < interface->bNumEndpoints) {
288 endpoint = &intf->cur_altsetting->endpoint[ep_cnt].desc;
290 bvd_ipc->ipc_dev = NULL;
291 bvd_ipc->xmit.head = bvd_ipc->xmit.tail = 0;
292 bvd_ipc->write_flag = IPC_USB_WRITE_INIT;
293 + spin_lock_init(&bvd_ipc->lock);
294 + spin_lock_init(&bvd_ipc->in_buf_lock);
296 ipcusb_tty_driver.write = usb_ipc_write;
297 ipcusb_tty_driver.chars_in_buffer = usb_ipc_chars_in_buffer;