#include <linux/spinlock.h>
#include <asm/uaccess.h>
#include <linux/usb.h>
-
-#ifdef CONFIG_USB_SERIAL_DEBUG
- static int debug = 1;
-#else
- static int debug;
-#endif
-
#include "usb-serial.h"
+static int debug;
/*
* Version Information
static void omninet_close (struct usb_serial_port *port, struct file *filp);
static void omninet_read_bulk_callback (struct urb *urb, struct pt_regs *regs);
static void omninet_write_bulk_callback (struct urb *urb, struct pt_regs *regs);
-static int omninet_write (struct usb_serial_port *port, int from_user, const unsigned char *buf, int count);
+static int omninet_write (struct usb_serial_port *port, const unsigned char *buf, int count);
static int omninet_write_room (struct usb_serial_port *port);
static void omninet_shutdown (struct usb_serial *serial);
{
struct usb_serial *serial = port->serial;
struct usb_serial_port *wport;
- struct omninet_data *od;
dbg("%s - port %d", __FUNCTION__, port->number);
wport = serial->port[1];
- usb_unlink_urb(wport->write_urb);
- usb_unlink_urb(port->read_urb);
+ usb_kill_urb(wport->write_urb);
+ usb_kill_urb(port->read_urb);
- od = usb_get_serial_port_data(port);
- if (od)
- kfree(od);
+ kfree(usb_get_serial_port_data(port));
}
return;
}
-static int omninet_write (struct usb_serial_port *port, int from_user, const unsigned char *buf, int count)
+static int omninet_write (struct usb_serial_port *port, const unsigned char *buf, int count)
{
struct usb_serial *serial = port->serial;
struct usb_serial_port *wport = serial->port[1];
count = (count > OMNINET_BULKOUTSIZE) ? OMNINET_BULKOUTSIZE : count;
- if (from_user) {
- if (copy_from_user(wport->write_urb->transfer_buffer + OMNINET_DATAOFFSET, buf, count) != 0) {
- result = -EFAULT;
- goto exit;
- }
- }
- else {
- memcpy (wport->write_urb->transfer_buffer + OMNINET_DATAOFFSET, buf, count);
- }
+ memcpy (wport->write_urb->transfer_buffer + OMNINET_DATAOFFSET, buf, count);
- usb_serial_debug_data (__FILE__, __FUNCTION__, count, wport->write_urb->transfer_buffer);
+ usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, wport->write_urb->transfer_buffer);
header->oh_seq = od->od_outseq++;
header->oh_len = count;
else
result = count;
-exit:
return result;
}
MODULE_DESCRIPTION( DRIVER_DESC );
MODULE_LICENSE("GPL");
-MODULE_PARM(debug, "i");
+module_param(debug, bool, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(debug, "Debug enabled or not");
-