Merge tag 'usb-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 1 Oct 2012 20:23:01 +0000 (13:23 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 1 Oct 2012 20:23:01 +0000 (13:23 -0700)
Pull USB changes from Greg Kroah-Hartman:
 "Here is the big USB pull request for 3.7-rc1

  There are lots of gadget driver changes (including copying a bunch of
  files into the drivers/staging/ccg/ directory so that the other gadget
  drivers can be fixed up properly without breaking that driver), and we
  remove the old obsolete ub.c driver from the tree.

  There are also the usual XHCI set of updates, and other various driver
  changes and updates.  We also are trying hard to remove the old dbg()
  macro, but the final bits of that removal will be coming in through
  the networking tree before we can delete it for good.

  All of these patches have been in the linux-next tree.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"
Fix up several annoying - but fairly mindless - conflicts due to the
termios structure having moved into the tty device, and often clashing
with dbg -> dev_dbg conversion.

* tag 'usb-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (339 commits)
  USB: ezusb: move ezusb.c from drivers/usb/serial to drivers/usb/misc
  USB: uas: fix gcc warning
  USB: uas: fix locking
  USB: Fix race condition when removing host controllers
  USB: uas: add locking
  USB: uas: fix abort
  USB: uas: remove aborted field, replace with status bit.
  USB: uas: fix task management
  USB: uas: keep track of command urbs
  xhci: Intel Panther Point BEI quirk.
  powerpc/usb: remove checking PHY_CLK_VALID for UTMI PHY
  USB: ftdi_sio: add TIAO USB Multi-Protocol Adapter (TUMPA) support
  Revert "usb : Add sysfs files to control port power."
  USB: serial: remove vizzini driver
  usb: host: xhci: Fix Null pointer dereferencing with 71c731a for non-x86 systems
  Increase XHCI suspend timeout to 16ms
  USB: ohci-at91: fix null pointer in ohci_hcd_at91_overcurrent_irq
  USB: sierra_ms: don't keep unused variable
  fsl/usb: Add support for USB controller version 2.4
  USB: qcaux: add Pantech vendor class match
  ...

37 files changed:
1  2 
Documentation/feature-removal-schedule.txt
drivers/staging/ccg/Kconfig
drivers/staging/ccg/ccg.c
drivers/staging/serqt_usb2/serqt_usb2.c
drivers/staging/usbip/usbip_common.c
drivers/usb/class/cdc-acm.c
drivers/usb/serial/ark3116.c
drivers/usb/serial/belkin_sa.c
drivers/usb/serial/console.c
drivers/usb/serial/cp210x.c
drivers/usb/serial/cypress_m8.c
drivers/usb/serial/digi_acceleport.c
drivers/usb/serial/empeg.c
drivers/usb/serial/f81232.c
drivers/usb/serial/ftdi_sio.c
drivers/usb/serial/io_edgeport.c
drivers/usb/serial/io_ti.c
drivers/usb/serial/ir-usb.c
drivers/usb/serial/iuu_phoenix.c
drivers/usb/serial/keyspan.c
drivers/usb/serial/keyspan_pda.c
drivers/usb/serial/kl5kusb105.c
drivers/usb/serial/kobil_sct.c
drivers/usb/serial/mct_u232.c
drivers/usb/serial/metro-usb.c
drivers/usb/serial/mos7720.c
drivers/usb/serial/mos7840.c
drivers/usb/serial/oti6858.c
drivers/usb/serial/pl2303.c
drivers/usb/serial/quatech2.c
drivers/usb/serial/sierra.c
drivers/usb/serial/spcp8x5.c
drivers/usb/serial/ssu100.c
drivers/usb/serial/ti_usb_3410_5052.c
drivers/usb/serial/usb-serial.c
drivers/usb/serial/usb_wwan.c
drivers/usb/serial/whiteheat.c

@@@ -253,6 -253,38 +253,6 @@@ Who:      Dave Jones <davej@redhat.com>, Mat
  
  -----------------------------
  
 -What: fakephp and associated sysfs files in /sys/bus/pci/slots/
 -When: 2011
 -Why:  In 2.6.27, the semantics of /sys/bus/pci/slots was redefined to
 -      represent a machine's physical PCI slots. The change in semantics
 -      had userspace implications, as the hotplug core no longer allowed
 -      drivers to create multiple sysfs files per physical slot (required
 -      for multi-function devices, e.g.). fakephp was seen as a developer's
 -      tool only, and its interface changed. Too late, we learned that
 -      there were some users of the fakephp interface.
 -
 -      In 2.6.30, the original fakephp interface was restored. At the same
 -      time, the PCI core gained the ability that fakephp provided, namely
 -      function-level hot-remove and hot-add.
 -
 -      Since the PCI core now provides the same functionality, exposed in:
 -
 -              /sys/bus/pci/rescan
 -              /sys/bus/pci/devices/.../remove
 -              /sys/bus/pci/devices/.../rescan
 -
 -      there is no functional reason to maintain fakephp as well.
 -
 -      We will keep the existing module so that 'modprobe fakephp' will
 -      present the old /sys/bus/pci/slots/... interface for compatibility,
 -      but users are urged to migrate their applications to the API above.
 -
 -      After a reasonable transition period, we will remove the legacy
 -      fakephp interface.
 -Who:  Alex Chiang <achiang@hp.com>
 -
 ----------------------------
 -
  What: CONFIG_RFKILL_INPUT
  When: 2.6.33
  Why:  Should be implemented in userspace, policy daemon.
@@@ -463,17 -495,6 +463,6 @@@ Who:      Bjorn Helgaas <bhelgaas@google.com
  
  ----------------------------
  
- What: Low Performance USB Block driver ("CONFIG_BLK_DEV_UB")
- When: 3.6
- Why:  This driver provides support for USB storage devices like "USB
-       sticks". As of now, it is deactivated in Debian, Fedora and
-         Ubuntu. All current users can switch over to usb-storage
-         (CONFIG_USB_STORAGE) which only drawback is the additional SCSI
-         stack.
- Who:  Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
- ----------------------------
  What: get_robust_list syscall
  When: 2013
  Why:  There appear to be no production users of the get_robust_list syscall,
@@@ -2,7 -2,7 +2,7 @@@ if USB_GADGE
  
  config USB_G_CCG
        tristate "Configurable Composite Gadget (STAGING)"
 -      depends on STAGING && BLOCK && !USB_ZERO && !USB_ZERO_HNPTEST && !USB_AUDIO && !GADGET_UAC1 && !USB_ETH && !USB_ETH_RNDIS && !USB_ETH_EEM && !USB_G_NCM && !USB_GADGETFS && !USB_FUNCTIONFS && !USB_FUNCTIONFS_ETH && !USB_FUNCTIONFS_RNDIS && !USB_FUNCTIONFS_GENERIC && !USB_FILE_STORAGE && !USB_FILE_STORAGE_TEST && !USB_MASS_STORAGE && !USB_G_SERIAL && !USB_MIDI_GADGET && !USB_G_PRINTER && !USB_CDC_COMPOSITE && !USB_G_NOKIA && !USB_G_ACM_MS && !USB_G_MULTI && !USB_G_MULTI_RNDIS && !USB_G_MULTI_CDC && !USB_G_HID && !USB_G_DBGP && !USB_G_WEBCAM
 +      depends on STAGING && BLOCK && NET && !USB_ZERO && !USB_ZERO_HNPTEST && !USB_AUDIO && !GADGET_UAC1 && !USB_ETH && !USB_ETH_RNDIS && !USB_ETH_EEM && !USB_G_NCM && !USB_GADGETFS && !USB_FUNCTIONFS && !USB_FUNCTIONFS_ETH && !USB_FUNCTIONFS_RNDIS && !USB_FUNCTIONFS_GENERIC && !USB_FILE_STORAGE && !USB_FILE_STORAGE_TEST && !USB_MASS_STORAGE && !USB_G_SERIAL && !USB_MIDI_GADGET && !USB_G_PRINTER && !USB_CDC_COMPOSITE && !USB_G_NOKIA && !USB_G_ACM_MS && !USB_G_MULTI && !USB_G_MULTI_RNDIS && !USB_G_MULTI_CDC && !USB_G_HID && !USB_G_DBGP && !USB_G_WEBCAM
        help
          The Configurable Composite Gadget supports multiple USB
          functions: acm, mass storage, rndis and FunctionFS.
@@@ -17,4 -17,9 +17,9 @@@
          Configurable Composite Gadget can be compiled "M" only
          or not at all.
  
+         BIG FAT NOTE: DON'T RELY ON THIS USERINTERFACE HERE! AS PART
+         OF THE REWORK DONE HERE WILL BE A NEW USER INTERFACE WITHOUT ANY
+         COMPATIBILITY TO THIS SYSFS INTERFACE HERE. BE AWARE OF THIS
+         BEFORE SELECTING THIS.
  endif # USB_GADGET
@@@ -32,7 -32,7 +32,7 @@@
  #include <linux/platform_device.h>
  
  #include <linux/usb/ch9.h>
- #include <linux/usb/composite.h>
+ #include "composite.h"
  #include <linux/usb/gadget.h>
  
  #include "gadget_chips.h"
   * the runtime footprint, and giving us at least some parts of what
   * a "gcc --combine ... part1.c part2.c part3.c ... " build would.
   */
- #include "../../usb/gadget/usbstring.c"
- #include "../../usb/gadget/config.c"
- #include "../../usb/gadget/epautoconf.c"
- #include "../../usb/gadget/composite.c"
- #include "../../usb/gadget/f_mass_storage.c"
- #include "../../usb/gadget/u_serial.c"
- #include "../../usb/gadget/f_acm.c"
+ #include "usbstring.c"
+ #include "config.c"
+ #include "epautoconf.c"
+ #include "composite.c"
+ #include "f_mass_storage.c"
+ #include "u_serial.c"
+ #include "f_acm.c"
  #define USB_ETH_RNDIS y
- #include "../../usb/gadget/f_rndis.c"
- #include "../../usb/gadget/rndis.c"
- #include "../../usb/gadget/u_ether.c"
- #include "../../usb/gadget/f_fs.c"
+ #include "f_rndis.c"
+ #include "rndis.c"
+ #include "u_ether.c"
+ #include "f_fs.c"
  
  MODULE_AUTHOR("Mike Lockwood, Andrzej Pietrasiewicz");
  MODULE_DESCRIPTION("Configurable Composite USB Gadget");
@@@ -728,7 -728,7 +728,7 @@@ static int mass_storage_function_init(s
        struct fsg_common *common;
        int err;
  
 -      memset(&fsg, 0, sizeof fsg);
 +      memset(&fsg, 0, sizeof(fsg));
        fsg.nluns = 1;
        fsg.luns[0].removable = 1;
        fsg.vendor_name = iManufacturer;
@@@ -1101,7 -1101,13 +1101,7 @@@ static struct device_attribute *ccg_usb
  static int ccg_bind_config(struct usb_configuration *c)
  {
        struct ccg_dev *dev = _ccg_dev;
 -      int ret = 0;
 -
 -      ret = ccg_bind_enabled_functions(dev, c);
 -      if (ret)
 -              return ret;
 -
 -      return 0;
 +      return ccg_bind_enabled_functions(dev, c);
  }
  
  static void ccg_unbind_config(struct usb_configuration *c)
@@@ -1156,6 -1162,7 +1156,7 @@@ static int ccg_usb_unbind(struct usb_co
  static struct usb_composite_driver ccg_usb_driver = {
        .name           = "configurable_usb",
        .dev            = &device_desc,
+       .bind           = ccg_bind,
        .unbind         = ccg_usb_unbind,
        .needs_serial   = true,
        .iManufacturer  = "Linux Foundation",
@@@ -1248,10 -1255,8 +1249,10 @@@ static int __init init(void
                return PTR_ERR(ccg_class);
  
        dev = kzalloc(sizeof(*dev), GFP_KERNEL);
 -      if (!dev)
 +      if (!dev) {
 +              class_destroy(ccg_class);
                return -ENOMEM;
 +      }
  
        dev->functions = supported_functions;
        INIT_LIST_HEAD(&dev->enabled_functions);
        composite_driver.setup = ccg_setup;
        composite_driver.disconnect = ccg_disconnect;
  
-       err = usb_composite_probe(&ccg_usb_driver, ccg_bind);
+       err = usb_composite_probe(&ccg_usb_driver);
        if (err) {
                class_destroy(ccg_class);
                kfree(dev);
@@@ -16,8 -16,6 +16,6 @@@
  #include <linux/usb/serial.h>
  #include <linux/uaccess.h>
  
- static bool debug;
  /* Version Information */
  #define DRIVER_VERSION "v2.14"
  #define DRIVER_AUTHOR "Tim Gobeli, Quatech, Inc"
@@@ -184,11 -182,11 +182,11 @@@ static int port_paranoia_check(struct u
                               const char *function)
  {
        if (!port) {
-               dbg("%s - port == NULL", function);
+               pr_debug("%s - port == NULL", function);
                return -1;
        }
        if (!port->serial) {
-               dbg("%s - port->serial == NULL\n", function);
+               pr_debug("%s - port->serial == NULL\n", function);
                return -1;
        }
  
@@@ -199,12 -197,12 +197,12 @@@ static int serial_paranoia_check(struc
                                 const char *function)
  {
        if (!serial) {
-               dbg("%s - serial == NULL\n", function);
+               pr_debug("%s - serial == NULL\n", function);
                return -1;
        }
  
        if (!serial->type) {
-               dbg("%s - serial->type == NULL!", function);
+               pr_debug("%s - serial->type == NULL!", function);
                return -1;
        }
  
@@@ -247,6 -245,7 +245,6 @@@ static void ProcessLineStatus(struct qu
        qt_port->shadowLSR =
            line_status & (SERIAL_LSR_OE | SERIAL_LSR_PE | SERIAL_LSR_FE |
                           SERIAL_LSR_BI);
 -      return;
  }
  
  static void ProcessModemStatus(struct quatech_port *qt_port,
  
        qt_port->shadowMSR = modem_status;
        wake_up_interruptible(&qt_port->wait);
 -      return;
  }
  
  static void ProcessRxChar(struct tty_struct *tty, struct usb_serial_port *port,
@@@ -274,7 -274,7 +272,7 @@@ static void qt_write_bulk_callback(stru
        status = urb->status;
  
        if (status) {
-               dbg("nonzero write bulk status received:%d\n", status);
+               dev_dbg(&urb->dev->dev, "nonzero write bulk status received:%d\n", status);
                return;
        }
  
@@@ -307,8 -307,8 +305,8 @@@ static void qt_read_bulk_callback(struc
  
        if (urb->status) {
                qt_port->ReadBulkStopped = 1;
-               dbg("%s - nonzero write bulk status received: %d\n",
-                   __func__, urb->status);
+               dev_dbg(&urb->dev->dev, "%s - nonzero write bulk status received: %d\n",
+                       __func__, urb->status);
                return;
        }
  
        /* index = MINOR(port->tty->device) - serial->minor; */
        index = tty->index - serial->minor;
  
-       dbg("%s - port->RxHolding = %d\n", __func__, qt_port->RxHolding);
+       dev_dbg(&port->dev, "%s - port->RxHolding = %d\n", __func__, qt_port->RxHolding);
  
        if (port_paranoia_check(port, __func__) != 0) {
-               dbg("%s - port_paranoia_check, exiting\n", __func__);
                qt_port->ReadBulkStopped = 1;
                goto exit;
        }
  
-       if (!serial) {
-               dbg("%s - bad serial pointer, exiting\n", __func__);
+       if (!serial)
                goto exit;
-       }
        if (qt_port->closePending == 1) {
                /* Were closing , stop reading */
-               dbg("%s - (qt_port->closepending == 1\n", __func__);
+               dev_dbg(&port->dev, "%s - (qt_port->closepending == 1\n", __func__);
                qt_port->ReadBulkStopped = 1;
                goto exit;
        }
        if (urb->status) {
                qt_port->ReadBulkStopped = 1;
  
-               dbg("%s - nonzero read bulk status received: %d\n",
-                   __func__, urb->status);
+               dev_dbg(&port->dev, "%s - nonzero read bulk status received: %d\n",
+                       __func__, urb->status);
                goto exit;
        }
  
 -      if (tty && RxCount) {
 +      if (RxCount) {
                flag_data = 0;
                for (i = 0; i < RxCount; ++i) {
                        /* Look ahead code here */
                                case 0x00:
                                        /* line status change 4th byte must follow */
                                        if (i > (RxCount - 4)) {
-                                               dbg("Illegal escape seuences in received data\n");
+                                               dev_dbg(&port->dev, "Illegal escape seuences in received data\n");
                                                break;
                                        }
                                        ProcessLineStatus(qt_port, data[i + 3]);
  
                                case 0x01:
                                        /* Modem status status change 4th byte must follow */
-                                       dbg("Modem status status.\n");
+                                       dev_dbg(&port->dev, "Modem status status.\n");
                                        if (i > (RxCount - 4)) {
-                                               dbg("Illegal escape sequences in received data\n");
+                                               dev_dbg(&port->dev, "Illegal escape sequences in received data\n");
                                                break;
                                        }
                                        ProcessModemStatus(qt_port,
                                        flag = 1;
                                        break;
                                case 0xff:
-                                       dbg("No status sequence.\n");
+                                       dev_dbg(&port->dev, "No status sequence.\n");
  
                                        if (tty) {
                                                ProcessRxChar(tty, port, data[i]);
                          qt_read_bulk_callback, port);
        result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
        if (result)
-               dbg("%s - failed resubmitting read urb, error %d",
-                   __func__, result);
+               dev_dbg(&port->dev, "%s - failed resubmitting read urb, error %d",
+                       __func__, result);
        else {
 -              if (tty && RxCount) {
 +              if (RxCount) {
                        tty_flip_buffer_push(tty);
                        tty_schedule_flip(tty);
                }
@@@ -517,7 -515,6 +513,6 @@@ static int qt_set_device(struct usb_ser
        PortSettings += ((__u16) (device_data->porta));
  
        length = sizeof(struct qt_get_device_data);
-       dbg("%s - PortSettings = 0x%x\n", __func__, PortSettings);
  
        result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
                                 QT_SET_GET_DEVICE, 0x40, PortSettings,
@@@ -691,6 -688,7 +686,7 @@@ static int BoxDisable_SW_FlowCtrl(struc
  
  static int qt_startup(struct usb_serial *serial)
  {
+       struct device *dev = &serial->dev->dev;
        struct usb_serial_port *port;
        struct quatech_port *qt_port;
        struct qt_get_device_data DeviceData;
                port = serial->port[i];
                qt_port = kzalloc(sizeof(*qt_port), GFP_KERNEL);
                if (!qt_port) {
-                       dbg("%s: kzalloc for quatech_port (%d) failed!.",
-                           __func__, i);
                        for (--i; i >= 0; i--) {
                                port = serial->port[i];
                                kfree(usb_get_serial_port_data(port));
        }
  
        status = qt_get_device(serial, &DeviceData);
-       if (status < 0) {
-               dbg(__FILE__ "box_get_device failed");
+       if (status < 0)
                goto startup_error;
-       }
  
-       dbg(__FILE__ "DeviceData.portb = 0x%x", DeviceData.portb);
+       dev_dbg(dev, "DeviceData.portb = 0x%x\n", DeviceData.portb);
  
        DeviceData.portb &= ~FULLPWRBIT;
-       dbg(__FILE__ "Changing DeviceData.portb to 0x%x", DeviceData.portb);
+       dev_dbg(dev, "Changing DeviceData.portb to 0x%x\n", DeviceData.portb);
  
        status = qt_set_device(serial, &DeviceData);
        if (status < 0) {
-               dbg(__FILE__ "qt_set_device failed\n");
+               dev_dbg(dev, "qt_set_device failed\n");
                goto startup_error;
        }
  
        status = qt_get_device(serial, &DeviceData);
        if (status < 0) {
-               dbg(__FILE__ "qt_get_device failed");
+               dev_dbg(dev, "qt_get_device failed\n");
                goto startup_error;
        }
  
  
        status = BoxSetPrebufferLevel(serial);  /* sets to default value */
        if (status < 0) {
-               dbg(__FILE__ "BoxSetPrebufferLevel failed\n");
+               dev_dbg(dev, "BoxSetPrebufferLevel failed\n");
                goto startup_error;
        }
  
        status = BoxSetATC(serial, ATC_DISABLED);
        if (status < 0) {
-               dbg(__FILE__ "BoxSetATC failed\n");
+               dev_dbg(dev, "BoxSetATC failed\n");
                goto startup_error;
        }
  
-       dbg(__FILE__ "DeviceData.portb = 0x%x", DeviceData.portb);
+       dev_dbg(dev, "DeviceData.portb = 0x%x\n", DeviceData.portb);
  
        DeviceData.portb |= NEXT_BOARD_POWER_BIT;
-       dbg(__FILE__ "Changing DeviceData.portb to 0x%x", DeviceData.portb);
+       dev_dbg(dev, "Changing DeviceData.portb to 0x%x\n", DeviceData.portb);
  
        status = qt_set_device(serial, &DeviceData);
        if (status < 0) {
-               dbg(__FILE__ "qt_set_device failed\n");
+               dev_dbg(dev, "qt_set_device failed\n");
                goto startup_error;
        }
  
-       dbg("Exit Success %s\n", __func__);
        return 0;
  
  startup_error:
                usb_set_serial_port_data(port, NULL);
        }
  
-       dbg("Exit fail %s\n", __func__);
        return -EIO;
  }
  
@@@ -869,10 -859,10 +857,10 @@@ static int qt_open(struct tty_struct *t
        /* Port specific setups */
        result = qt_open_channel(serial, port->number, &ChannelData);
        if (result < 0) {
-               dbg(__FILE__ "qt_open_channel failed\n");
+               dev_dbg(&port->dev, "qt_open_channel failed\n");
                return result;
        }
-       dbg(__FILE__ "qt_open_channel completed.\n");
+       dev_dbg(&port->dev, "qt_open_channel completed.\n");
  
  /* FIXME: are these needed?  Does it even do anything useful? */
        quatech_port->shadowLSR = ChannelData.line_status &
        /* Set Baud rate to default and turn off (default)flow control here */
        result = qt_setuart(serial, port->number, DEFAULT_DIVISOR, DEFAULT_LCR);
        if (result < 0) {
-               dbg(__FILE__ "qt_setuart failed\n");
+               dev_dbg(&port->dev, "qt_setuart failed\n");
                return result;
        }
-       dbg(__FILE__ "qt_setuart completed.\n");
+       dev_dbg(&port->dev, "qt_setuart completed.\n");
  
        /*
         * Put this here to make it responsive to stty and defaults set by
         * the tty layer
         */
 -      /* FIXME: is this needed? */
 -      /* qt_set_termios(tty, port, NULL); */
  
        /*  Check to see if we've set up our endpoint info yet */
        if (port0->open_ports == 1) {
  
        }
  
-       dbg("port number is %d\n", port->number);
-       dbg("serial number is %d\n", port->serial->minor);
-       dbg("Bulkin endpoint is %d\n", port->bulk_in_endpointAddress);
-       dbg("BulkOut endpoint is %d\n", port->bulk_out_endpointAddress);
-       dbg("Interrupt endpoint is %d\n", port->interrupt_in_endpointAddress);
-       dbg("port's number in the device is %d\n", quatech_port->port_num);
+       dev_dbg(&port->dev, "port number is %d\n", port->number);
+       dev_dbg(&port->dev, "serial number is %d\n", port->serial->minor);
+       dev_dbg(&port->dev, "Bulkin endpoint is %d\n", port->bulk_in_endpointAddress);
+       dev_dbg(&port->dev, "BulkOut endpoint is %d\n", port->bulk_out_endpointAddress);
+       dev_dbg(&port->dev, "Interrupt endpoint is %d\n", port->interrupt_in_endpointAddress);
+       dev_dbg(&port->dev, "port's number in the device is %d\n", quatech_port->port_num);
        quatech_port->read_urb = port->read_urb;
  
        /* set up our bulk in urb */
                          quatech_port->read_urb->transfer_buffer_length,
                          qt_read_bulk_callback, quatech_port);
  
-       dbg("qt_open: bulkin endpoint is %d\n", port->bulk_in_endpointAddress);
+       dev_dbg(&port->dev, "qt_open: bulkin endpoint is %d\n", port->bulk_in_endpointAddress);
        quatech_port->read_urb_busy = true;
        result = usb_submit_urb(quatech_port->read_urb, GFP_KERNEL);
        if (result) {
@@@ -974,8 -966,6 +962,6 @@@ static int qt_chars_in_buffer(struct tt
                        chars = port->write_urb->transfer_buffer_length;
        }
  
-       dbg("%s - returns %d\n", __func__, chars);
        return chars;
  }
  
@@@ -997,7 -987,7 +983,7 @@@ static void qt_block_until_empty(struc
  
                wait--;
                if (wait == 0) {
-                       dbg("%s - TIMEOUT", __func__);
+                       dev_dbg(&qt_port->port->dev, "%s - TIMEOUT", __func__);
                        return;
                } else {
                        wait = 30;
@@@ -1035,17 -1025,15 +1021,15 @@@ static void qt_close(struct usb_serial_
        /* Close uart channel */
        status = qt_close_channel(serial, index);
        if (status < 0)
-               dbg("%s - port %d qt_close_channel failed.\n",
-                   __func__, port->number);
+               dev_dbg(&port->dev, "%s - port %d qt_close_channel failed.\n", __func__, port->number);
  
        port0->open_ports--;
  
-       dbg("qt_num_open_ports in close%d:in port%d\n",
-           port0->open_ports, port->number);
+       dev_dbg(&port->dev, "qt_num_open_ports in close%d:in port%d\n", port0->open_ports, port->number);
  
        if (port0->open_ports == 0) {
                if (serial->port[0]->interrupt_in_urb) {
-                       dbg("%s", "Shutdown interrupt_in_urb\n");
+                       dev_dbg(&port->dev, "%s", "Shutdown interrupt_in_urb\n");
                        usb_kill_urb(serial->port[0]->interrupt_in_urb);
                }
  
@@@ -1069,14 -1057,14 +1053,14 @@@ static int qt_write(struct tty_struct *
                return -ENODEV;
  
        if (count == 0) {
-               dbg("%s - write request of 0 bytes\n", __func__);
+               dev_dbg(&port->dev, "%s - write request of 0 bytes\n", __func__);
                return 0;
        }
  
        /* only do something if we have a bulk out endpoint */
        if (serial->num_bulk_out) {
                if (port->write_urb->status == -EINPROGRESS) {
-                       dbg("%s - already writing\n", __func__);
+                       dev_dbg(&port->dev, "%s - already writing\n", __func__);
                        return 0;
                }
  
                /* send the data out the bulk port */
                result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
                if (result)
-                       dbg("%s - failed submitting write urb, error %d\n",
-                           __func__, result);
+                       dev_dbg(&port->dev, "%s - failed submitting write urb, error %d\n",
+                               __func__, result);
                else
                        result = count;
  
@@@ -1116,10 -1104,8 +1100,8 @@@ static int qt_write_room(struct tty_str
  
        int retval = -EINVAL;
  
-       if (port_paranoia_check(port, __func__)) {
-               dbg("%s", "Invalid port\n");
+       if (port_paranoia_check(port, __func__))
                return -1;
-       }
  
        serial = get_usb_serial(port, __func__);
  
@@@ -1148,7 -1134,7 +1130,7 @@@ static int qt_ioctl(struct tty_struct *
        struct usb_serial *serial = get_usb_serial(port, __func__);
        unsigned int index;
  
-       dbg("%s cmd 0x%04x", __func__, cmd);
+       dev_dbg(&port->dev, "%s cmd 0x%04x\n", __func__, cmd);
  
        index = tty->index - serial->minor;
  
                return 0;
        }
  
-       dbg("%s -No ioctl for that one.  port = %d\n", __func__, port->number);
+       dev_dbg(&port->dev, "%s -No ioctl for that one.  port = %d\n", __func__, port->number);
        return -ENOIOCTLCMD;
  }
  
@@@ -1189,7 -1175,7 +1171,7 @@@ static void qt_set_termios(struct tty_s
                           struct usb_serial_port *port,
                           struct ktermios *old_termios)
  {
 -      struct ktermios *termios = tty->termios;
 +      struct ktermios *termios = &tty->termios;
        unsigned char new_LCR = 0;
        unsigned int cflag = termios->c_cflag;
        unsigned int index;
  
        index = tty->index - port->serial->minor;
  
 -      switch (cflag) {
 +      switch (cflag & CSIZE) {
        case CS5:
                new_LCR |= SERIAL_5_DATA;
                break;
                new_LCR |= SERIAL_7_DATA;
                break;
        default:
 +              termios->c_cflag &= ~CSIZE;
 +              termios->c_cflag |= CS8;
        case CS8:
                new_LCR |= SERIAL_8_DATA;
                break;
        else
                new_LCR |= SERIAL_ONE_STOPB;
  
-       dbg("%s - 4\n", __func__);
+       dev_dbg(&port->dev, "%s - 4\n", __func__);
  
        /* Thats the LCR stuff, go ahead and set it */
        baud = tty_get_baud_rate(tty);
                /* pick a default, any default... */
                baud = 9600;
  
-       dbg("%s - got baud = %d\n", __func__, baud);
+       dev_dbg(&port->dev, "%s - got baud = %d\n", __func__, baud);
  
        divisor = MAX_BAUD_RATE / baud;
        remainder = MAX_BAUD_RATE % baud;
        status =
            qt_setuart(port->serial, index, (unsigned short)divisor, new_LCR);
        if (status < 0) {
-               dbg(__FILE__ "qt_setuart failed\n");
+               dev_dbg(&port->dev, "qt_setuart failed\n");
                return;
        }
  
        /* Now determine flow control */
        if (cflag & CRTSCTS) {
-               dbg("%s - Enabling HW flow control port %d\n", __func__,
-                   port->number);
+               dev_dbg(&port->dev, "%s - Enabling HW flow control port %d\n", __func__, port->number);
  
                /* Enable RTS/CTS flow control */
                status = BoxSetHW_FlowCtrl(port->serial, index, 1);
  
                if (status < 0) {
-                       dbg(__FILE__ "BoxSetHW_FlowCtrl failed\n");
+                       dev_dbg(&port->dev, "BoxSetHW_FlowCtrl failed\n");
                        return;
                }
        } else {
                /* Disable RTS/CTS flow control */
-               dbg("%s - disabling HW flow control port %d\n", __func__,
-                   port->number);
+               dev_dbg(&port->dev, "%s - disabling HW flow control port %d\n", __func__, port->number);
  
                status = BoxSetHW_FlowCtrl(port->serial, index, 0);
                if (status < 0) {
-                       dbg(__FILE__ "BoxSetHW_FlowCtrl failed\n");
+                       dev_dbg(&port->dev, "BoxSetHW_FlowCtrl failed\n");
                        return;
                }
  
                    BoxSetSW_FlowCtrl(port->serial, index, stop_char,
                                      start_char);
                if (status < 0)
-                       dbg(__FILE__ "BoxSetSW_FlowCtrl (enabled) failed\n");
+                       dev_dbg(&port->dev, "BoxSetSW_FlowCtrl (enabled) failed\n");
  
        } else {
                /* disable SW flow control */
                status = BoxDisable_SW_FlowCtrl(port->serial, index);
                if (status < 0)
-                       dbg(__FILE__ "BoxSetSW_FlowCtrl (diabling) failed\n");
+                       dev_dbg(&port->dev, "BoxSetSW_FlowCtrl (diabling) failed\n");
  
        }
 -      tty->termios->c_cflag &= ~CMSPAR;
 +      termios->c_cflag &= ~CMSPAR;
        /* FIXME: Error cases should be returning the actual bits changed only */
  }
  
@@@ -1408,7 -1390,7 +1388,7 @@@ static int qt_tiocmget(struct tty_struc
        struct usb_serial_port *port = tty->driver_data;
        struct usb_serial *serial = get_usb_serial(port, __func__);
        struct quatech_port *qt_port = qt_get_port_private(port);
 -      int retval = -ENODEV;
 +      int retval;
  
        if (!serial)
                return -ENODEV;
@@@ -1426,7 -1408,7 +1406,7 @@@ static int qt_tiocmset(struct tty_struc
        struct usb_serial_port *port = tty->driver_data;
        struct usb_serial *serial = get_usb_serial(port, __func__);
        struct quatech_port *qt_port = qt_get_port_private(port);
 -      int retval = -ENODEV;
 +      int retval;
  
        if (!serial)
                return -ENODEV;
@@@ -1454,6 -1436,7 +1434,6 @@@ static void qt_throttle(struct tty_stru
        qt_port->RxHolding = 1;
  
        mutex_unlock(&qt_port->lock);
 -      return;
  }
  
  static void qt_unthrottle(struct tty_struct *tty)
        mutex_lock(&qt_port->lock);
  
        if (qt_port->RxHolding == 1) {
-               dbg("%s -qt_port->RxHolding == 1\n", __func__);
+               dev_dbg(&port->dev, "%s -qt_port->RxHolding == 1\n", __func__);
  
                qt_port->RxHolding = 0;
-               dbg("%s - qt_port->RxHolding = 0\n", __func__);
+               dev_dbg(&port->dev, "%s - qt_port->RxHolding = 0\n", __func__);
  
                /* if we have a bulk endpoint, start it up */
                if ((serial->num_bulk_in) && (qt_port->ReadBulkStopped == 1)) {
                }
        }
        mutex_unlock(&qt_port->lock);
 -      return;
 -
  }
  
  static int qt_calc_num_ports(struct usb_serial *serial)
  {
        int num_ports;
  
-       dbg("numberofendpoints: %d\n",
-           (int)serial->interface->cur_altsetting->desc.bNumEndpoints);
-       dbg("numberofendpoints: %d\n",
-           (int)serial->interface->altsetting->desc.bNumEndpoints);
        num_ports =
            (serial->interface->cur_altsetting->desc.bNumEndpoints - 1) / 2;
  
@@@ -1545,6 -1525,3 +1520,3 @@@ module_usb_serial_driver(serial_drivers
  MODULE_AUTHOR(DRIVER_AUTHOR);
  MODULE_DESCRIPTION(DRIVER_DESC);
  MODULE_LICENSE("GPL");
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug enabled or not");
@@@ -22,9 -22,7 +22,9 @@@
  #include <linux/fs.h>
  #include <linux/kernel.h>
  #include <linux/slab.h>
 +#include <linux/stat.h>
  #include <linux/module.h>
 +#include <linux/moduleparam.h>
  #include <net/sock.h>
  
  #include "usbip_common.h"
@@@ -38,8 -36,6 +38,8 @@@ unsigned long usbip_debug_flag = 0xffff
  unsigned long usbip_debug_flag;
  #endif
  EXPORT_SYMBOL_GPL(usbip_debug_flag);
 +module_param(usbip_debug_flag, ulong, S_IRUGO|S_IWUSR);
 +MODULE_PARM_DESC(usbip_debug_flag, "debug flags (defined in usbip_common.h)");
  
  /* FIXME */
  struct device_attribute dev_attr_usbip_debug;
@@@ -161,8 -157,7 +161,7 @@@ static void usbip_dump_usb_device(struc
        dev_dbg(dev, "have_langid %d, string_langid %d\n",
                udev->have_langid, udev->string_langid);
  
-       dev_dbg(dev, "maxchild %d, children %p\n",
-               udev->maxchild, udev->children);
+       dev_dbg(dev, "maxchild %d\n", udev->maxchild);
  }
  
  static void usbip_dump_request_type(__u8 rt)
@@@ -39,7 -39,6 +39,6 @@@
  #include <linux/serial.h>
  #include <linux/tty_driver.h>
  #include <linux/tty_flip.h>
- #include <linux/serial.h>
  #include <linux/module.h>
  #include <linux/mutex.h>
  #include <linux/uaccess.h>
@@@ -826,7 -825,7 +825,7 @@@ static void acm_tty_set_termios(struct 
                                                struct ktermios *termios_old)
  {
        struct acm *acm = tty->driver_data;
 -      struct ktermios *termios = tty->termios;
 +      struct ktermios *termios = &tty->termios;
        struct usb_cdc_line_coding newline;
        int newctrl = acm->ctrlout;
  
@@@ -1299,8 -1298,7 +1298,8 @@@ skip_countries
        usb_set_intfdata(data_interface, acm);
  
        usb_get_intf(control_interface);
 -      tty_register_device(acm_tty_driver, minor, &control_interface->dev);
 +      tty_port_register_device(&acm->port, acm_tty_driver, minor,
 +                      &control_interface->dev);
  
        return 0;
  alloc_fail7:
@@@ -37,7 -37,6 +37,6 @@@
  #include <linux/mutex.h>
  #include <linux/spinlock.h>
  
- static bool debug;
  /*
   * Version information
   */
@@@ -215,7 -214,7 +214,7 @@@ static void ark3116_release(struct usb_
  
  static void ark3116_init_termios(struct tty_struct *tty)
  {
 -      struct ktermios *termios = tty->termios;
 +      struct ktermios *termios = &tty->termios;
        *termios = tty_std_termios;
        termios->c_cflag = B9600 | CS8
                                      | CREAD | HUPCL | CLOCAL;
@@@ -229,7 -228,7 +228,7 @@@ static void ark3116_set_termios(struct 
  {
        struct usb_serial *serial = port->serial;
        struct ark3116_private *priv = usb_get_serial_port_data(port);
 -      struct ktermios *termios = tty->termios;
 +      struct ktermios *termios = &tty->termios;
        unsigned int cflag = termios->c_cflag;
        int bps = tty_get_baud_rate(tty);
        int quot;
@@@ -650,8 -649,7 +649,7 @@@ static void ark3116_read_int_callback(s
                /*
                 * Not sure what this data meant...
                 */
-               usb_serial_debug_data(debug, &port->dev,
-                                     __func__,
+               usb_serial_debug_data(&port->dev, __func__,
                                      urb->actual_length,
                                      urb->transfer_buffer);
                break;
@@@ -750,9 -748,6 +748,6 @@@ MODULE_LICENSE("GPL")
  MODULE_AUTHOR(DRIVER_AUTHOR);
  MODULE_DESCRIPTION(DRIVER_DESC);
  
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Enable debug");
  /*
   * The following describes what I learned from studying the old
   * ark3116.c driver, disassembling the windows driver, and some lucky
@@@ -37,8 -37,6 +37,6 @@@
  #include <linux/usb/serial.h>
  #include "belkin_sa.h"
  
- static bool debug;
  /*
   * Version Information
   */
@@@ -206,8 -204,7 +204,7 @@@ static void belkin_sa_read_int_callback
                goto exit;
        }
  
-       usb_serial_debug_data(debug, &port->dev, __func__,
-                                       urb->actual_length, data);
+       usb_serial_debug_data(&port->dev, __func__, urb->actual_length, data);
  
        /* Handle known interrupt data */
        /* ignore data[0] and data[1] */
@@@ -307,7 -304,7 +304,7 @@@ static void belkin_sa_set_termios(struc
        unsigned long control_state;
        int bad_flow_control;
        speed_t baud;
 -      struct ktermios *termios = tty->termios;
 +      struct ktermios *termios = &tty->termios;
  
        iflag = termios->c_iflag;
        cflag = termios->c_cflag;
@@@ -515,6 -512,3 +512,3 @@@ MODULE_AUTHOR(DRIVER_AUTHOR)
  MODULE_DESCRIPTION(DRIVER_DESC);
  MODULE_VERSION(DRIVER_VERSION);
  MODULE_LICENSE("GPL");
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug enabled or not");
@@@ -11,6 -11,8 +11,8 @@@
   *
   */
  
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/slab.h>
@@@ -20,8 -22,6 +22,6 @@@
  #include <linux/usb.h>
  #include <linux/usb/serial.h>
  
- static int debug;
  struct usbcons_info {
        int                     magic;
        int                     break_flag;
@@@ -68,8 -68,6 +68,6 @@@ static int usb_console_setup(struct con
        struct tty_struct *tty = NULL;
        struct ktermios dummy;
  
-       dbg("%s", __func__);
        if (options) {
                baud = simple_strtoul(options, NULL, 10);
                s = options;
        serial = usb_serial_get_by_index(co->index);
        if (serial == NULL) {
                /* no device is connected yet, sorry :( */
-               printk(KERN_ERR "No USB device connected to ttyUSB%i\n",
-                      co->index);
+               pr_err("No USB device connected to ttyUSB%i\n", co->index);
                return -ENODEV;
        }
  
                }
  
                if (serial->type->set_termios) {
 -                      tty->termios->c_cflag = cflag;
 -                      tty_termios_encode_baud_rate(tty->termios, baud, baud);
 +                      tty->termios.c_cflag = cflag;
 +                      tty_termios_encode_baud_rate(&tty->termios, baud, baud);
                        memset(&dummy, 0, sizeof(struct ktermios));
                        serial->type->set_termios(tty, port, &dummy);
  
@@@ -213,10 -210,10 +210,10 @@@ static void usb_console_write(struct co
        if (count == 0)
                return;
  
-       dbg("%s - port %d, %d byte(s)", __func__, port->number, count);
+       pr_debug("%s - port %d, %d byte(s)\n", __func__, port->number, count);
  
        if (!port->port.console) {
-               dbg("%s - port not opened", __func__);
+               pr_debug("%s - port not opened\n", __func__);
                return;
        }
  
                        retval = serial->type->write(NULL, port, buf, i);
                else
                        retval = usb_serial_generic_write(NULL, port, buf, i);
-               dbg("%s - return value : %d", __func__, retval);
+               pr_debug("%s - return value : %d\n", __func__, retval);
                if (lf) {
                        /* append CR after LF */
                        unsigned char cr = 13;
                        else
                                retval = usb_serial_generic_write(NULL,
                                                                port, &cr, 1);
-                       dbg("%s - return value : %d", __func__, retval);
+                       pr_debug("%s - return value : %d\n", __func__, retval);
                }
                buf += i;
                count -= i;
@@@ -284,10 -281,8 +281,8 @@@ void usb_serial_console_disconnect(stru
        }
  }
  
- void usb_serial_console_init(int serial_debug, int minor)
+ void usb_serial_console_init(int minor)
  {
-       debug = serial_debug;
        if (minor == 0) {
                /*
                 * Call register_console() if this is the first device plugged
                 * register_console). console_write() is called immediately
                 * from register_console iff CON_PRINTBUFFER is set in flags.
                 */
-               dbg("registering the USB serial console.");
+               pr_debug("registering the USB serial console.\n");
                register_console(&usbcons);
        }
  }
@@@ -52,8 -52,6 +52,6 @@@ static int cp210x_startup(struct usb_se
  static void cp210x_release(struct usb_serial *);
  static void cp210x_dtr_rts(struct usb_serial_port *p, int on);
  
- static bool debug;
  static const struct usb_device_id id_table[] = {
        { USB_DEVICE(0x045B, 0x0053) }, /* Renesas RX610 RX-Stick */
        { USB_DEVICE(0x0471, 0x066A) }, /* AKTAKOM ACE-1001 cable */
@@@ -304,9 -302,8 +302,8 @@@ static int cp210x_get_config(struct usb
        kfree(buf);
  
        if (result != size) {
-               dbg("%s - Unable to send config request, "
-                               "request=0x%x size=%d result=%d",
-                               __func__, request, size, result);
+               dev_dbg(&port->dev, "%s - Unable to send config request, request=0x%x size=%d result=%d\n",
+                       __func__, request, size, result);
                if (result > 0)
                        result = -EPROTO;
  
@@@ -361,9 -358,8 +358,8 @@@ static int cp210x_set_config(struct usb
        kfree(buf);
  
        if ((size > 2 && result != size) || result < 0) {
-               dbg("%s - Unable to send request, "
-                               "request=0x%x size=%d result=%d",
-                               __func__, request, size, result);
+               dev_dbg(&port->dev, "%s - Unable to send request, request=0x%x size=%d result=%d\n",
+                       __func__, request, size, result);
                if (result > 0)
                        result = -EPROTO;
  
@@@ -469,7 -465,7 +465,7 @@@ static void cp210x_get_termios(struct t
  
        if (tty) {
                cp210x_get_termios_port(tty->driver_data,
 -                      &tty->termios->c_cflag, &baud);
 +                      &tty->termios.c_cflag, &baud);
                tty_encode_baud_rate(tty, baud, baud);
        }
  
  static void cp210x_get_termios_port(struct usb_serial_port *port,
        unsigned int *cflagp, unsigned int *baudp)
  {
+       struct device *dev = &port->dev;
        unsigned int cflag, modem_ctl[4];
        unsigned int baud;
        unsigned int bits;
  
        cp210x_get_config(port, CP210X_GET_BAUDRATE, &baud, 4);
  
-       dbg("%s - baud rate = %d", __func__, baud);
+       dev_dbg(dev, "%s - baud rate = %d\n", __func__, baud);
        *baudp = baud;
  
        cflag = *cflagp;
        cflag &= ~CSIZE;
        switch (bits & BITS_DATA_MASK) {
        case BITS_DATA_5:
-               dbg("%s - data bits = 5", __func__);
+               dev_dbg(dev, "%s - data bits = 5\n", __func__);
                cflag |= CS5;
                break;
        case BITS_DATA_6:
-               dbg("%s - data bits = 6", __func__);
+               dev_dbg(dev, "%s - data bits = 6\n", __func__);
                cflag |= CS6;
                break;
        case BITS_DATA_7:
-               dbg("%s - data bits = 7", __func__);
+               dev_dbg(dev, "%s - data bits = 7\n", __func__);
                cflag |= CS7;
                break;
        case BITS_DATA_8:
-               dbg("%s - data bits = 8", __func__);
+               dev_dbg(dev, "%s - data bits = 8\n", __func__);
                cflag |= CS8;
                break;
        case BITS_DATA_9:
-               dbg("%s - data bits = 9 (not supported, using 8 data bits)",
-                                                               __func__);
+               dev_dbg(dev, "%s - data bits = 9 (not supported, using 8 data bits)\n", __func__);
                cflag |= CS8;
                bits &= ~BITS_DATA_MASK;
                bits |= BITS_DATA_8;
                cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2);
                break;
        default:
-               dbg("%s - Unknown number of data bits, using 8", __func__);
+               dev_dbg(dev, "%s - Unknown number of data bits, using 8\n", __func__);
                cflag |= CS8;
                bits &= ~BITS_DATA_MASK;
                bits |= BITS_DATA_8;
  
        switch (bits & BITS_PARITY_MASK) {
        case BITS_PARITY_NONE:
-               dbg("%s - parity = NONE", __func__);
+               dev_dbg(dev, "%s - parity = NONE\n", __func__);
                cflag &= ~PARENB;
                break;
        case BITS_PARITY_ODD:
-               dbg("%s - parity = ODD", __func__);
+               dev_dbg(dev, "%s - parity = ODD\n", __func__);
                cflag |= (PARENB|PARODD);
                break;
        case BITS_PARITY_EVEN:
-               dbg("%s - parity = EVEN", __func__);
+               dev_dbg(dev, "%s - parity = EVEN\n", __func__);
                cflag &= ~PARODD;
                cflag |= PARENB;
                break;
        case BITS_PARITY_MARK:
-               dbg("%s - parity = MARK", __func__);
+               dev_dbg(dev, "%s - parity = MARK\n", __func__);
                cflag |= (PARENB|PARODD|CMSPAR);
                break;
        case BITS_PARITY_SPACE:
-               dbg("%s - parity = SPACE", __func__);
+               dev_dbg(dev, "%s - parity = SPACE\n", __func__);
                cflag &= ~PARODD;
                cflag |= (PARENB|CMSPAR);
                break;
        default:
-               dbg("%s - Unknown parity mode, disabling parity", __func__);
+               dev_dbg(dev, "%s - Unknown parity mode, disabling parity\n", __func__);
                cflag &= ~PARENB;
                bits &= ~BITS_PARITY_MASK;
                cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2);
        cflag &= ~CSTOPB;
        switch (bits & BITS_STOP_MASK) {
        case BITS_STOP_1:
-               dbg("%s - stop bits = 1", __func__);
+               dev_dbg(dev, "%s - stop bits = 1\n", __func__);
                break;
        case BITS_STOP_1_5:
-               dbg("%s - stop bits = 1.5 (not supported, using 1 stop bit)",
-                                                               __func__);
+               dev_dbg(dev, "%s - stop bits = 1.5 (not supported, using 1 stop bit)\n", __func__);
                bits &= ~BITS_STOP_MASK;
                cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2);
                break;
        case BITS_STOP_2:
-               dbg("%s - stop bits = 2", __func__);
+               dev_dbg(dev, "%s - stop bits = 2\n", __func__);
                cflag |= CSTOPB;
                break;
        default:
-               dbg("%s - Unknown number of stop bits, using 1 stop bit",
-                                                               __func__);
+               dev_dbg(dev, "%s - Unknown number of stop bits, using 1 stop bit\n", __func__);
                bits &= ~BITS_STOP_MASK;
                cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2);
                break;
  
        cp210x_get_config(port, CP210X_GET_FLOW, modem_ctl, 16);
        if (modem_ctl[0] & 0x0008) {
-               dbg("%s - flow control = CRTSCTS", __func__);
+               dev_dbg(dev, "%s - flow control = CRTSCTS\n", __func__);
                cflag |= CRTSCTS;
        } else {
-               dbg("%s - flow control = NONE", __func__);
+               dev_dbg(dev, "%s - flow control = NONE\n", __func__);
                cflag &= ~CRTSCTS;
        }
  
@@@ -631,7 -625,7 +625,7 @@@ static void cp210x_change_speed(struct 
  {
        u32 baud;
  
 -      baud = tty->termios->c_ospeed;
 +      baud = tty->termios.c_ospeed;
  
        /* This maps the requested rate to a rate valid on cp2102 or cp2103,
         * or to an arbitrary rate in [1M,2M].
         */
        baud = cp210x_quantise_baudrate(baud);
  
-       dbg("%s - setting baud rate to %u", __func__, baud);
+       dev_dbg(&port->dev, "%s - setting baud rate to %u\n", __func__, baud);
        if (cp210x_set_config(port, CP210X_SET_BAUDRATE, &baud,
                                                        sizeof(baud))) {
                dev_warn(&port->dev, "failed to set baud rate to %u\n", baud);
  static void cp210x_set_termios(struct tty_struct *tty,
                struct usb_serial_port *port, struct ktermios *old_termios)
  {
+       struct device *dev = &port->dev;
        unsigned int cflag, old_cflag;
        unsigned int bits;
        unsigned int modem_ctl[4];
  
-       dbg("%s - port %d", __func__, port->number);
+       dev_dbg(dev, "%s - port %d\n", __func__, port->number);
  
        if (!tty)
                return;
  
 -      cflag = tty->termios->c_cflag;
 +      cflag = tty->termios.c_cflag;
        old_cflag = old_termios->c_cflag;
  
 -      if (tty->termios->c_ospeed != old_termios->c_ospeed)
 +      if (tty->termios.c_ospeed != old_termios->c_ospeed)
                cp210x_change_speed(tty, port, old_termios);
  
        /* If the number of data bits is to be updated */
                switch (cflag & CSIZE) {
                case CS5:
                        bits |= BITS_DATA_5;
-                       dbg("%s - data bits = 5", __func__);
+                       dev_dbg(dev, "%s - data bits = 5\n", __func__);
                        break;
                case CS6:
                        bits |= BITS_DATA_6;
-                       dbg("%s - data bits = 6", __func__);
+                       dev_dbg(dev, "%s - data bits = 6\n", __func__);
                        break;
                case CS7:
                        bits |= BITS_DATA_7;
-                       dbg("%s - data bits = 7", __func__);
+                       dev_dbg(dev, "%s - data bits = 7\n", __func__);
                        break;
                case CS8:
                        bits |= BITS_DATA_8;
-                       dbg("%s - data bits = 8", __func__);
+                       dev_dbg(dev, "%s - data bits = 8\n", __func__);
                        break;
                /*case CS9:
                        bits |= BITS_DATA_9;
-                       dbg("%s - data bits = 9", __func__);
+                       dev_dbg(dev, "%s - data bits = 9\n", __func__);
                        break;*/
                default:
-                       dbg("cp210x driver does not "
-                                       "support the number of bits requested,"
-                                       " using 8 bit mode");
+                       dev_dbg(dev, "cp210x driver does not support the number of bits requested, using 8 bit mode\n");
                                bits |= BITS_DATA_8;
                                break;
                }
                if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2))
-                       dbg("Number of data bits requested "
-                                       "not supported by device");
+                       dev_dbg(dev, "Number of data bits requested not supported by device\n");
        }
  
        if ((cflag     & (PARENB|PARODD|CMSPAR)) !=
                bits &= ~BITS_PARITY_MASK;
                if (cflag & PARENB) {
                        if (cflag & CMSPAR) {
-                           if (cflag & PARODD) {
-                                   bits |= BITS_PARITY_MARK;
-                                   dbg("%s - parity = MARK", __func__);
-                           } else {
-                                   bits |= BITS_PARITY_SPACE;
-                                   dbg("%s - parity = SPACE", __func__);
-                           }
+                               if (cflag & PARODD) {
+                                       bits |= BITS_PARITY_MARK;
+                                       dev_dbg(dev, "%s - parity = MARK\n", __func__);
+                               } else {
+                                       bits |= BITS_PARITY_SPACE;
+                                       dev_dbg(dev, "%s - parity = SPACE\n", __func__);
+                               }
                        } else {
-                           if (cflag & PARODD) {
-                                   bits |= BITS_PARITY_ODD;
-                                   dbg("%s - parity = ODD", __func__);
-                           } else {
-                                   bits |= BITS_PARITY_EVEN;
-                                   dbg("%s - parity = EVEN", __func__);
-                           }
+                               if (cflag & PARODD) {
+                                       bits |= BITS_PARITY_ODD;
+                                       dev_dbg(dev, "%s - parity = ODD\n", __func__);
+                               } else {
+                                       bits |= BITS_PARITY_EVEN;
+                                       dev_dbg(dev, "%s - parity = EVEN\n", __func__);
+                               }
                        }
                }
                if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2))
-                       dbg("Parity mode not supported by device");
+                       dev_dbg(dev, "Parity mode not supported by device\n");
        }
  
        if ((cflag & CSTOPB) != (old_cflag & CSTOPB)) {
                bits &= ~BITS_STOP_MASK;
                if (cflag & CSTOPB) {
                        bits |= BITS_STOP_2;
-                       dbg("%s - stop bits = 2", __func__);
+                       dev_dbg(dev, "%s - stop bits = 2\n", __func__);
                } else {
                        bits |= BITS_STOP_1;
-                       dbg("%s - stop bits = 1", __func__);
+                       dev_dbg(dev, "%s - stop bits = 1\n", __func__);
                }
                if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2))
-                       dbg("Number of stop bits requested "
-                                       "not supported by device");
+                       dev_dbg(dev, "Number of stop bits requested not supported by device\n");
        }
  
        if ((cflag & CRTSCTS) != (old_cflag & CRTSCTS)) {
                cp210x_get_config(port, CP210X_GET_FLOW, modem_ctl, 16);
-               dbg("%s - read modem controls = 0x%.4x 0x%.4x 0x%.4x 0x%.4x",
-                               __func__, modem_ctl[0], modem_ctl[1],
-                               modem_ctl[2], modem_ctl[3]);
+               dev_dbg(dev, "%s - read modem controls = 0x%.4x 0x%.4x 0x%.4x 0x%.4x\n",
+                       __func__, modem_ctl[0], modem_ctl[1],
+                       modem_ctl[2], modem_ctl[3]);
  
                if (cflag & CRTSCTS) {
                        modem_ctl[0] &= ~0x7B;
                        modem_ctl[0] |= 0x09;
                        modem_ctl[1] = 0x80;
-                       dbg("%s - flow control = CRTSCTS", __func__);
+                       dev_dbg(dev, "%s - flow control = CRTSCTS\n", __func__);
                } else {
                        modem_ctl[0] &= ~0x7B;
                        modem_ctl[0] |= 0x01;
                        modem_ctl[1] |= 0x40;
-                       dbg("%s - flow control = NONE", __func__);
+                       dev_dbg(dev, "%s - flow control = NONE\n", __func__);
                }
  
-               dbg("%s - write modem controls = 0x%.4x 0x%.4x 0x%.4x 0x%.4x",
-                               __func__, modem_ctl[0], modem_ctl[1],
-                               modem_ctl[2], modem_ctl[3]);
+               dev_dbg(dev, "%s - write modem controls = 0x%.4x 0x%.4x 0x%.4x 0x%.4x\n",
+                       __func__, modem_ctl[0], modem_ctl[1],
+                       modem_ctl[2], modem_ctl[3]);
                cp210x_set_config(port, CP210X_SET_FLOW, modem_ctl, 16);
        }
  
@@@ -805,7 -796,7 +796,7 @@@ static int cp210x_tiocmset_port(struct 
                control |= CONTROL_WRITE_DTR;
        }
  
-       dbg("%s - control = 0x%.4x", __func__, control);
+       dev_dbg(&port->dev, "%s - control = 0x%.4x\n", __func__, control);
  
        return cp210x_set_config(port, CP210X_SET_MHS, &control, 2);
  }
@@@ -833,7 -824,7 +824,7 @@@ static int cp210x_tiocmget (struct tty_
                |((control & CONTROL_RING)? TIOCM_RI  : 0)
                |((control & CONTROL_DCD) ? TIOCM_CD  : 0);
  
-       dbg("%s - control = 0x%.2x", __func__, control);
+       dev_dbg(&port->dev, "%s - control = 0x%.2x\n", __func__, control);
  
        return result;
  }
@@@ -847,8 -838,8 +838,8 @@@ static void cp210x_break_ctl (struct tt
                state = BREAK_OFF;
        else
                state = BREAK_ON;
-       dbg("%s - turning break %s", __func__,
-                       state == BREAK_OFF ? "off" : "on");
+       dev_dbg(&port->dev, "%s - turning break %s\n", __func__,
+               state == BREAK_OFF ? "off" : "on");
        cp210x_set_config(port, CP210X_SET_BREAK, &state, 2);
  }
  
@@@ -865,7 -856,6 +856,6 @@@ static int cp210x_startup(struct usb_se
                if (!port_priv)
                        return -ENOMEM;
  
-               memset(port_priv, 0x00, sizeof(*port_priv));
                port_priv->bInterfaceNumber =
                    serial->interface->cur_altsetting->desc.bInterfaceNumber;
  
@@@ -892,6 -882,3 +882,3 @@@ module_usb_serial_driver(serial_drivers
  MODULE_DESCRIPTION(DRIVER_DESC);
  MODULE_VERSION(DRIVER_VERSION);
  MODULE_LICENSE("GPL");
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Enable verbose debugging messages");
@@@ -46,7 -46,6 +46,6 @@@
  #include "cypress_m8.h"
  
  
- static bool debug;
  static bool stats;
  static int interval;
  static bool unstable_bauds;
@@@ -263,8 -262,9 +262,9 @@@ static int analyze_baud_rate(struct usb
                 * safest speed for a part like that.
                 */
                if (new_rate > 4800) {
-                       dbg("%s - failed setting baud rate, device incapable "
-                           "speed %d", __func__, new_rate);
+                       dev_dbg(&port->dev,
+                               "%s - failed setting baud rate, device incapable speed %d\n",
+                               __func__, new_rate);
                        return -1;
                }
        }
                        /* 300 and 600 baud rates are supported under
                         * the generic firmware, but are not used with
                         * NMEA and SiRF protocols */
-                       dbg("%s - failed setting baud rate, unsupported speed "
-                           "of %d on Earthmate GPS", __func__, new_rate);
+                       dev_dbg(&port->dev,
+                               "%s - failed setting baud rate, unsupported speed of %d on Earthmate GPS",
+                               __func__, new_rate);
                        return -1;
                }
                break;
@@@ -294,6 -295,7 +295,7 @@@ static int cypress_serial_control(struc
  {
        int new_baudrate = 0, retval = 0, tries = 0;
        struct cypress_private *priv;
+       struct device *dev = &port->dev;
        u8 *feature_buffer;
        const unsigned int feature_len = 5;
        unsigned long flags;
                /* 0 means 'Hang up' so doesn't change the true bit rate */
                new_baudrate = priv->baud_rate;
                if (baud_rate && baud_rate != priv->baud_rate) {
-                       dbg("%s - baud rate is changing", __func__);
+                       dev_dbg(dev, "%s - baud rate is changing\n", __func__);
                        retval = analyze_baud_rate(port, baud_rate);
                        if (retval >= 0) {
                                new_baudrate = retval;
-                               dbg("%s - New baud rate set to %d",
-                                   __func__, new_baudrate);
+                               dev_dbg(dev, "%s - New baud rate set to %d\n",
+                                       __func__, new_baudrate);
                        }
                }
-               dbg("%s - baud rate is being sent as %d",
-                                       __func__, new_baudrate);
+               dev_dbg(dev, "%s - baud rate is being sent as %d\n", __func__,
+                       new_baudrate);
  
                /* fill the feature_buffer with new configuration */
                put_unaligned_le32(new_baudrate, feature_buffer);
                /* 1 bit gap */
                feature_buffer[4] |= (reset << 7);   /* assign reset at end of byte, 1 bit space */
  
-               dbg("%s - device is being sent this feature report:",
-                                                               __func__);
-               dbg("%s - %02X - %02X - %02X - %02X - %02X", __func__,
+               dev_dbg(dev, "%s - device is being sent this feature report:\n", __func__);
+               dev_dbg(dev, "%s - %02X - %02X - %02X - %02X - %02X\n", __func__,
                        feature_buffer[0], feature_buffer[1],
                        feature_buffer[2], feature_buffer[3],
                        feature_buffer[4]);
                         retval != -ENODEV);
  
                if (retval != feature_len) {
-                       dev_err(&port->dev, "%s - failed sending serial "
-                               "line settings - %d\n", __func__, retval);
+                       dev_err(dev, "%s - failed sending serial line settings - %d\n",
+                               __func__, retval);
                        cypress_set_dead(port);
                } else {
                        spin_lock_irqsave(&priv->lock, flags);
                        retval = -ENOTTY;
                        goto out;
                }
-               dbg("%s - retreiving serial line settings", __func__);
+               dev_dbg(dev, "%s - retreiving serial line settings\n", __func__);
                do {
                        retval = usb_control_msg(port->serial->dev,
                                        usb_rcvctrlpipe(port->serial->dev, 0),
                                                && retval != -ENODEV);
  
                if (retval != feature_len) {
-                       dev_err(&port->dev, "%s - failed to retrieve serial "
-                               "line settings - %d\n", __func__, retval);
+                       dev_err(dev, "%s - failed to retrieve serial line settings - %d\n",
+                               __func__, retval);
                        cypress_set_dead(port);
                        goto out;
                } else {
@@@ -474,14 -475,14 +475,14 @@@ static int generic_startup(struct usb_s
        if (interval > 0) {
                priv->write_urb_interval = interval;
                priv->read_urb_interval = interval;
-               dbg("%s - port %d read & write intervals forced to %d",
-                   __func__, port->number, interval);
+               dev_dbg(&port->dev, "%s - read & write intervals forced to %d\n",
+                       __func__, interval);
        } else {
                priv->write_urb_interval = port->interrupt_out_urb->interval;
                priv->read_urb_interval = port->interrupt_in_urb->interval;
-               dbg("%s - port %d intervals: read=%d write=%d",
-                   __func__, port->number,
-                   priv->read_urb_interval, priv->write_urb_interval);
+               dev_dbg(&port->dev, "%s - intervals: read=%d write=%d\n",
+                       __func__, priv->read_urb_interval,
+                       priv->write_urb_interval);
        }
        usb_set_serial_port_data(port, priv);
  
@@@ -495,8 -496,7 +496,7 @@@ static int cypress_earthmate_startup(st
        struct usb_serial_port *port = serial->port[0];
  
        if (generic_startup(serial)) {
-               dbg("%s - Failed setting up port %d", __func__,
-                               port->number);
+               dev_dbg(&port->dev, "%s - Failed setting up port\n", __func__);
                return 1;
        }
  
                   handle GET_CONFIG requests; everything they've
                   produced since that time crashes if this command is
                   attempted :-( */
-               dbg("%s - Marking this device as unsafe for GET_CONFIG "
-                   "commands", __func__);
+               dev_dbg(&port->dev,
+                       "%s - Marking this device as unsafe for GET_CONFIG commands\n",
+                       __func__);
                priv->get_cfg_unsafe = !0;
        }
  
  static int cypress_hidcom_startup(struct usb_serial *serial)
  {
        struct cypress_private *priv;
+       struct usb_serial_port *port = serial->port[0];
  
        if (generic_startup(serial)) {
-               dbg("%s - Failed setting up port %d", __func__,
-                               serial->port[0]->number);
+               dev_dbg(&port->dev, "%s - Failed setting up port\n", __func__);
                return 1;
        }
  
-       priv = usb_get_serial_port_data(serial->port[0]);
+       priv = usb_get_serial_port_data(port);
        priv->chiptype = CT_CYPHIDCOM;
  
        return 0;
  static int cypress_ca42v2_startup(struct usb_serial *serial)
  {
        struct cypress_private *priv;
+       struct usb_serial_port *port = serial->port[0];
  
        if (generic_startup(serial)) {
-               dbg("%s - Failed setting up port %d", __func__,
-                               serial->port[0]->number);
+               dev_dbg(&port->dev, "%s - Failed setting up port\n", __func__);
                return 1;
        }
  
-       priv = usb_get_serial_port_data(serial->port[0]);
+       priv = usb_get_serial_port_data(port);
        priv->chiptype = CT_CA42V2;
  
        return 0;
@@@ -649,7 -650,7 +650,7 @@@ static void cypress_close(struct usb_se
        kfifo_reset_out(&priv->write_fifo);
        spin_unlock_irqrestore(&priv->lock, flags);
  
-       dbg("%s - stopping urbs", __func__);
+       dev_dbg(&port->dev, "%s - stopping urbs\n", __func__);
        usb_kill_urb(port->interrupt_in_urb);
        usb_kill_urb(port->interrupt_out_urb);
  
@@@ -665,7 -666,7 +666,7 @@@ static int cypress_write(struct tty_str
  {
        struct cypress_private *priv = usb_get_serial_port_data(port);
  
-       dbg("%s - port %d, %d bytes", __func__, port->number, count);
+       dev_dbg(&port->dev, "%s - port %d, %d bytes\n", __func__, port->number, count);
  
        /* line control commands, which need to be executed immediately,
           are not put into the buffer for obvious reasons.
@@@ -691,17 -692,18 +692,18 @@@ static void cypress_send(struct usb_ser
  {
        int count = 0, result, offset, actual_size;
        struct cypress_private *priv = usb_get_serial_port_data(port);
+       struct device *dev = &port->dev;
        unsigned long flags;
  
        if (!priv->comm_is_ok)
                return;
  
-       dbg("%s - interrupt out size is %d", __func__,
-                                               port->interrupt_out_size);
+       dev_dbg(dev, "%s - interrupt out size is %d\n", __func__,
+               port->interrupt_out_size);
  
        spin_lock_irqsave(&priv->lock, flags);
        if (priv->write_urb_in_use) {
-               dbg("%s - can't write, urb in use", __func__);
+               dev_dbg(dev, "%s - can't write, urb in use\n", __func__);
                spin_unlock_irqrestore(&priv->lock, flags);
                return;
        }
  
        if (priv->cmd_ctrl) {
                priv->cmd_count++;
-               dbg("%s - line control command being issued", __func__);
+               dev_dbg(dev, "%s - line control command being issued\n", __func__);
                spin_unlock_irqrestore(&priv->lock, flags);
                goto send;
        } else
                port->interrupt_out_buffer[0] |= count;
        }
  
-       dbg("%s - count is %d", __func__, count);
+       dev_dbg(dev, "%s - count is %d\n", __func__, count);
  
  send:
        spin_lock_irqsave(&priv->lock, flags);
                actual_size = count +
                              (priv->pkt_fmt == packet_format_1 ? 2 : 1);
  
-       usb_serial_debug_data(debug, &port->dev, __func__,
-               port->interrupt_out_size,
-               port->interrupt_out_urb->transfer_buffer);
+       usb_serial_debug_data(dev, __func__, port->interrupt_out_size,
+                             port->interrupt_out_urb->transfer_buffer);
  
        usb_fill_int_urb(port->interrupt_out_urb, port->serial->dev,
                usb_sndintpipe(port->serial->dev, port->interrupt_out_endpointAddress),
@@@ -807,7 -808,7 +808,7 @@@ static int cypress_write_room(struct tt
        room = kfifo_avail(&priv->write_fifo);
        spin_unlock_irqrestore(&priv->lock, flags);
  
-       dbg("%s - returns %d", __func__, room);
+       dev_dbg(&port->dev, "%s - returns %d\n", __func__, room);
        return room;
  }
  
@@@ -832,7 -833,7 +833,7 @@@ static int cypress_tiocmget(struct tty_
                | ((status & UART_RI)         ? TIOCM_RI  : 0)
                | ((status & UART_CD)         ? TIOCM_CD  : 0);
  
-       dbg("%s - result = %x", __func__, result);
+       dev_dbg(&port->dev, "%s - result = %x\n", __func__, result);
  
        return result;
  }
@@@ -867,7 -868,7 +868,7 @@@ static int cypress_ioctl(struct tty_str
        struct usb_serial_port *port = tty->driver_data;
        struct cypress_private *priv = usb_get_serial_port_data(port);
  
-       dbg("%s - port %d, cmd 0x%.4x", __func__, port->number, cmd);
+       dev_dbg(&port->dev, "%s - port %d, cmd 0x%.4x\n", __func__, port->number, cmd);
  
        switch (cmd) {
        /* This code comes from drivers/char/serial.c and ftdi_sio.c */
        default:
                break;
        }
-       dbg("%s - arg not supported - it was 0x%04x - check include/asm/ioctls.h", __func__, cmd);
+       dev_dbg(&port->dev, "%s - arg not supported - it was 0x%04x - check include/asm/ioctls.h\n", __func__, cmd);
        return -ENOIOCTLCMD;
  } /* cypress_ioctl */
  
@@@ -911,6 -912,7 +912,7 @@@ static void cypress_set_termios(struct 
        struct usb_serial_port *port, struct ktermios *old_termios)
  {
        struct cypress_private *priv = usb_get_serial_port_data(port);
+       struct device *dev = &port->dev;
        int data_bits, stop_bits, parity_type, parity_enable;
        unsigned cflag, iflag;
        unsigned long flags;
           early enough */
        if (!priv->termios_initialized) {
                if (priv->chiptype == CT_EARTHMATE) {
 -                      *(tty->termios) = tty_std_termios;
 -                      tty->termios->c_cflag = B4800 | CS8 | CREAD | HUPCL |
 +                      tty->termios = tty_std_termios;
 +                      tty->termios.c_cflag = B4800 | CS8 | CREAD | HUPCL |
                                CLOCAL;
 -                      tty->termios->c_ispeed = 4800;
 -                      tty->termios->c_ospeed = 4800;
 +                      tty->termios.c_ispeed = 4800;
 +                      tty->termios.c_ospeed = 4800;
                } else if (priv->chiptype == CT_CYPHIDCOM) {
 -                      *(tty->termios) = tty_std_termios;
 -                      tty->termios->c_cflag = B9600 | CS8 | CREAD | HUPCL |
 +                      tty->termios = tty_std_termios;
 +                      tty->termios.c_cflag = B9600 | CS8 | CREAD | HUPCL |
                                CLOCAL;
 -                      tty->termios->c_ispeed = 9600;
 -                      tty->termios->c_ospeed = 9600;
 +                      tty->termios.c_ispeed = 9600;
 +                      tty->termios.c_ospeed = 9600;
                } else if (priv->chiptype == CT_CA42V2) {
 -                      *(tty->termios) = tty_std_termios;
 -                      tty->termios->c_cflag = B9600 | CS8 | CREAD | HUPCL |
 +                      tty->termios = tty_std_termios;
 +                      tty->termios.c_cflag = B9600 | CS8 | CREAD | HUPCL |
                                CLOCAL;
 -                      tty->termios->c_ispeed = 9600;
 -                      tty->termios->c_ospeed = 9600;
 +                      tty->termios.c_ispeed = 9600;
 +                      tty->termios.c_ospeed = 9600;
                }
                priv->termios_initialized = 1;
        }
        spin_unlock_irqrestore(&priv->lock, flags);
  
        /* Unsupported features need clearing */
 -      tty->termios->c_cflag &= ~(CMSPAR|CRTSCTS);
 +      tty->termios.c_cflag &= ~(CMSPAR|CRTSCTS);
  
 -      cflag = tty->termios->c_cflag;
 -      iflag = tty->termios->c_iflag;
 +      cflag = tty->termios.c_cflag;
 +      iflag = tty->termios.c_iflag;
  
        /* check if there are new settings */
        if (old_termios) {
                spin_lock_irqsave(&priv->lock, flags);
 -              priv->tmp_termios = *(tty->termios);
 +              priv->tmp_termios = tty->termios;
                spin_unlock_irqrestore(&priv->lock, flags);
        }
  
                data_bits = 3;
                break;
        default:
-               dev_err(&port->dev, "%s - CSIZE was set, but not CS5-CS8\n",
-                       __func__);
+               dev_err(dev, "%s - CSIZE was set, but not CS5-CS8\n", __func__);
                data_bits = 3;
        }
        spin_lock_irqsave(&priv->lock, flags);
        oldlines = priv->line_control;
        if ((cflag & CBAUD) == B0) {
                /* drop dtr and rts */
-               dbg("%s - dropping the lines, baud rate 0bps", __func__);
+               dev_dbg(dev, "%s - dropping the lines, baud rate 0bps\n", __func__);
                priv->line_control &= ~(CONTROL_DTR | CONTROL_RTS);
        } else
                priv->line_control = (CONTROL_DTR | CONTROL_RTS);
        spin_unlock_irqrestore(&priv->lock, flags);
  
-       dbg("%s - sending %d stop_bits, %d parity_enable, %d parity_type, "
-                       "%d data_bits (+5)", __func__, stop_bits,
-                       parity_enable, parity_type, data_bits);
+       dev_dbg(dev, "%s - sending %d stop_bits, %d parity_enable, %d parity_type, %d data_bits (+5)\n",
+               __func__, stop_bits, parity_enable, parity_type, data_bits);
  
        cypress_serial_control(tty, port, tty_get_baud_rate(tty),
                        data_bits, stop_bits,
  
        spin_lock_irqsave(&priv->lock, flags);
        if (priv->chiptype == CT_EARTHMATE && priv->baud_rate == 4800) {
-               dbg("Using custom termios settings for a baud rate of "
-                               "4800bps.");
+               dev_dbg(dev, "Using custom termios settings for a baud rate of 4800bps.\n");
                /* define custom termios settings for NMEA protocol */
  
 -              tty->termios->c_iflag /* input modes - */
 +              tty->termios.c_iflag /* input modes - */
                        &= ~(IGNBRK  /* disable ignore break */
                        | BRKINT     /* disable break causes interrupt */
                        | PARMRK     /* disable mark parity errors */
                        | ICRNL      /* disable translate CR to NL */
                        | IXON);     /* disable enable XON/XOFF flow control */
  
 -              tty->termios->c_oflag /* output modes */
 +              tty->termios.c_oflag /* output modes */
                        &= ~OPOST;    /* disable postprocess output char */
  
 -              tty->termios->c_lflag /* line discipline modes */
 +              tty->termios.c_lflag /* line discipline modes */
                        &= ~(ECHO     /* disable echo input characters */
                        | ECHONL      /* disable echo new line */
                        | ICANON      /* disable erase, kill, werase, and rprnt
@@@ -1067,7 -1066,7 +1066,7 @@@ static int cypress_chars_in_buffer(stru
        chars = kfifo_len(&priv->write_fifo);
        spin_unlock_irqrestore(&priv->lock, flags);
  
-       dbg("%s - returns %d", __func__, chars);
+       dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars);
        return chars;
  }
  
@@@ -1112,6 -1111,7 +1111,7 @@@ static void cypress_read_int_callback(s
  {
        struct usb_serial_port *port = urb->context;
        struct cypress_private *priv = usb_get_serial_port_data(port);
+       struct device *dev = &urb->dev->dev;
        struct tty_struct *tty;
        unsigned char *data = urb->transfer_buffer;
        unsigned long flags;
                /* FALLS THROUGH */
        default:
                /* something ugly is going on... */
-               dev_err(&urb->dev->dev,
-                       "%s - unexpected nonzero read status received: %d\n",
-                                                       __func__, status);
+               dev_err(dev, "%s - unexpected nonzero read status received: %d\n",
+                       __func__, status);
                cypress_set_dead(port);
                return;
        }
  
        spin_lock_irqsave(&priv->lock, flags);
        if (priv->rx_flags & THROTTLED) {
-               dbg("%s - now throttling", __func__);
+               dev_dbg(dev, "%s - now throttling\n", __func__);
                priv->rx_flags |= ACTUALLY_THROTTLED;
                spin_unlock_irqrestore(&priv->lock, flags);
                return;
  
        tty = tty_port_tty_get(&port->port);
        if (!tty) {
-               dbg("%s - bad tty pointer - exiting", __func__);
+               dev_dbg(dev, "%s - bad tty pointer - exiting\n", __func__);
                return;
        }
  
        }
        spin_unlock_irqrestore(&priv->lock, flags);
        if (result < bytes) {
-               dbg("%s - wrong packet size - received %d bytes but packet "
-                   "said %d bytes", __func__, result, bytes);
+               dev_dbg(dev,
+                       "%s - wrong packet size - received %d bytes but packet said %d bytes\n",
+                       __func__, result, bytes);
                goto continue_read;
        }
  
-       usb_serial_debug_data(debug, &port->dev, __func__,
-                                               urb->actual_length, data);
+       usb_serial_debug_data(&port->dev, __func__, urb->actual_length, data);
  
        spin_lock_irqsave(&priv->lock, flags);
        /* check to see if status has changed */
  
        /* hangup, as defined in acm.c... this might be a bad place for it
         * though */
 -      if (tty && !(tty->termios->c_cflag & CLOCAL) &&
 +      if (tty && !(tty->termios.c_cflag & CLOCAL) &&
                        !(priv->current_status & UART_CD)) {
-               dbg("%s - calling hangup", __func__);
+               dev_dbg(dev, "%s - calling hangup\n", __func__);
                tty_hangup(tty);
                goto continue_read;
        }
        if (priv->current_status & CYP_ERROR) {
                spin_unlock_irqrestore(&priv->lock, flags);
                tty_flag = TTY_PARITY;
-               dbg("%s - Parity Error detected", __func__);
+               dev_dbg(dev, "%s - Parity Error detected\n", __func__);
        } else
                spin_unlock_irqrestore(&priv->lock, flags);
  
@@@ -1246,9 -1245,8 +1245,8 @@@ continue_read
                                priv->read_urb_interval);
                result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);
                if (result && result != -EPERM) {
-                       dev_err(&urb->dev->dev, "%s - failed resubmitting "
-                                       "read urb, error %d\n", __func__,
-                                       result);
+                       dev_err(dev, "%s - failed resubmitting read urb, error %d\n",
+                               __func__, result);
                        cypress_set_dead(port);
                }
        }
@@@ -1259,6 -1257,7 +1257,7 @@@ static void cypress_write_int_callback(
  {
        struct usb_serial_port *port = urb->context;
        struct cypress_private *priv = usb_get_serial_port_data(port);
+       struct device *dev = &urb->dev->dev;
        int result;
        int status = urb->status;
  
        case -ENOENT:
        case -ESHUTDOWN:
                /* this urb is terminated, clean up */
-               dbg("%s - urb shutting down with status: %d",
-                                               __func__, status);
+               dev_dbg(dev, "%s - urb shutting down with status: %d\n",
+                       __func__, status);
                priv->write_urb_in_use = 0;
                return;
        case -EPIPE: /* no break needed; clear halt and resubmit */
                        break;
                usb_clear_halt(port->serial->dev, 0x02);
                /* error in the urb, so we have to resubmit it */
-               dbg("%s - nonzero write bulk status received: %d",
+               dev_dbg(dev, "%s - nonzero write bulk status received: %d\n",
                        __func__, status);
                port->interrupt_out_urb->transfer_buffer_length = 1;
                result = usb_submit_urb(port->interrupt_out_urb, GFP_ATOMIC);
                if (!result)
                        return;
-               dev_err(&urb->dev->dev,
-                       "%s - failed resubmitting write urb, error %d\n",
-                                                       __func__, result);
+               dev_err(dev, "%s - failed resubmitting write urb, error %d\n",
+                       __func__, result);
                cypress_set_dead(port);
                break;
        default:
-               dev_err(&urb->dev->dev,
-                        "%s - unexpected nonzero write status received: %d\n",
-                                                       __func__, status);
+               dev_err(dev, "%s - unexpected nonzero write status received: %d\n",
+                       __func__, status);
                cypress_set_dead(port);
                break;
        }
@@@ -1310,8 -1307,6 +1307,6 @@@ MODULE_DESCRIPTION(DRIVER_DESC)
  MODULE_VERSION(DRIVER_VERSION);
  MODULE_LICENSE("GPL");
  
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug enabled or not");
  module_param(stats, bool, S_IRUGO | S_IWUSR);
  MODULE_PARM_DESC(stats, "Enable statistics or not");
  module_param(interval, int, S_IRUGO | S_IWUSR);
@@@ -249,10 -249,6 +249,6 @@@ static int digi_read_inb_callback(struc
  static int digi_read_oob_callback(struct urb *urb);
  
  
- /* Statics */
- static bool debug;
  static const struct usb_device_id id_table_combined[] = {
        { USB_DEVICE(DIGI_VENDOR_ID, DIGI_2_ID) },
        { USB_DEVICE(DIGI_VENDOR_ID, DIGI_4_ID) },
@@@ -404,14 -400,15 +400,15 @@@ static void digi_wakeup_write(struct us
  static int digi_write_oob_command(struct usb_serial_port *port,
        unsigned char *buf, int count, int interruptible)
  {
        int ret = 0;
        int len;
        struct usb_serial_port *oob_port = (struct usb_serial_port *)((struct digi_serial *)(usb_get_serial_data(port->serial)))->ds_oob_port;
        struct digi_port *oob_priv = usb_get_serial_port_data(oob_port);
        unsigned long flags = 0;
  
-       dbg("digi_write_oob_command: TOP: port=%d, count=%d", oob_priv->dp_port_num, count);
+       dev_dbg(&port->dev,
+               "digi_write_oob_command: TOP: port=%d, count=%d\n",
+               oob_priv->dp_port_num, count);
  
        spin_lock_irqsave(&oob_priv->dp_port_lock, flags);
        while (count > 0) {
@@@ -467,7 -464,7 +464,7 @@@ static int digi_write_inb_command(struc
        unsigned char *data = port->write_urb->transfer_buffer;
        unsigned long flags = 0;
  
-       dbg("digi_write_inb_command: TOP: port=%d, count=%d",
+       dev_dbg(&port->dev, "digi_write_inb_command: TOP: port=%d, count=%d\n",
                priv->dp_port_num, count);
  
        if (timeout)
@@@ -549,7 -546,8 +546,8 @@@ static int digi_set_modem_signals(struc
        unsigned long flags = 0;
  
  
-       dbg("digi_set_modem_signals: TOP: port=%d, modem_signals=0x%x",
+       dev_dbg(&port->dev,
+               "digi_set_modem_signals: TOP: port=%d, modem_signals=0x%x\n",
                port_priv->dp_port_num, modem_signals);
  
        spin_lock_irqsave(&oob_priv->dp_port_lock, flags);
@@@ -687,8 -685,9 +685,9 @@@ static void digi_set_termios(struct tty
                struct usb_serial_port *port, struct ktermios *old_termios)
  {
        struct digi_port *priv = usb_get_serial_port_data(port);
 -      unsigned int iflag = tty->termios->c_iflag;
 -      unsigned int cflag = tty->termios->c_cflag;
+       struct device *dev = &port->dev;
 +      unsigned int iflag = tty->termios.c_iflag;
 +      unsigned int cflag = tty->termios.c_cflag;
        unsigned int old_iflag = old_termios->c_iflag;
        unsigned int old_cflag = old_termios->c_cflag;
        unsigned char buf[32];
        int i = 0;
        speed_t baud;
  
-       dbg("digi_set_termios: TOP: port=%d, iflag=0x%x, old_iflag=0x%x, cflag=0x%x, old_cflag=0x%x", priv->dp_port_num, iflag, old_iflag, cflag, old_cflag);
+       dev_dbg(dev,
+               "digi_set_termios: TOP: port=%d, iflag=0x%x, old_iflag=0x%x, cflag=0x%x, old_cflag=0x%x\n",
+               priv->dp_port_num, iflag, old_iflag, cflag, old_cflag);
  
        /* set baud rate */
        baud = tty_get_baud_rate(tty);
                        /* don't set RTS if using hardware flow control */
                        /* and throttling input */
                        modem_signals = TIOCM_DTR;
 -                      if (!(tty->termios->c_cflag & CRTSCTS) ||
 +                      if (!(tty->termios.c_cflag & CRTSCTS) ||
                            !test_bit(TTY_THROTTLED, &tty->flags))
                                modem_signals |= TIOCM_RTS;
                        digi_set_modem_signals(port, modem_signals, 1);
                }
        }
        /* set parity */
 -      tty->termios->c_cflag &= ~CMSPAR;
 +      tty->termios.c_cflag &= ~CMSPAR;
  
        if ((cflag&(PARENB|PARODD)) != (old_cflag&(PARENB|PARODD))) {
                if (cflag&PARENB) {
                case CS7: arg = DIGI_WORD_SIZE_7; break;
                case CS8: arg = DIGI_WORD_SIZE_8; break;
                default:
-                       dbg("digi_set_termios: can't handle word size %d",
+                       dev_dbg(dev,
+                               "digi_set_termios: can't handle word size %d\n",
                                (cflag&CSIZE));
                        break;
                }
        }
        ret = digi_write_oob_command(port, buf, i, 1);
        if (ret != 0)
-               dbg("digi_set_termios: write oob failed, ret=%d", ret);
+               dev_dbg(dev, "digi_set_termios: write oob failed, ret=%d\n", ret);
        tty_encode_baud_rate(tty, baud, baud);
  }
  
@@@ -922,7 -924,8 +924,8 @@@ static int digi_write(struct tty_struc
        unsigned char *data = port->write_urb->transfer_buffer;
        unsigned long flags = 0;
  
-       dbg("digi_write: TOP: port=%d, count=%d, in_interrupt=%ld",
+       dev_dbg(&port->dev,
+               "digi_write: TOP: port=%d, count=%d, in_interrupt=%ld\n",
                priv->dp_port_num, count, in_interrupt());
  
        /* copy user data (which can sleep) before getting spin lock */
                dev_err_console(port,
                        "%s: usb_submit_urb failed, ret=%d, port=%d\n",
                        __func__, ret, priv->dp_port_num);
-       dbg("digi_write: returning %d", ret);
+       dev_dbg(&port->dev, "digi_write: returning %d\n", ret);
        return ret;
  
  }
@@@ -1012,7 -1015,7 +1015,7 @@@ static void digi_write_bulk_callback(st
  
        /* handle oob callback */
        if (priv->dp_port_num == serial_priv->ds_oob_port_num) {
-               dbg("digi_write_bulk_callback: oob callback");
+               dev_dbg(&port->dev, "digi_write_bulk_callback: oob callback\n");
                spin_lock(&priv->dp_port_lock);
                priv->dp_write_urb_in_use = 0;
                wake_up_interruptible(&port->write_wait);
@@@ -1066,7 -1069,7 +1069,7 @@@ static int digi_write_room(struct tty_s
                room = port->bulk_out_size - 2 - priv->dp_out_buf_len;
  
        spin_unlock_irqrestore(&priv->dp_port_lock, flags);
-       dbg("digi_write_room: port=%d, room=%d", priv->dp_port_num, room);
+       dev_dbg(&port->dev, "digi_write_room: port=%d, room=%d\n", priv->dp_port_num, room);
        return room;
  
  }
@@@ -1077,12 -1080,12 +1080,12 @@@ static int digi_chars_in_buffer(struct 
        struct digi_port *priv = usb_get_serial_port_data(port);
  
        if (priv->dp_write_urb_in_use) {
-               dbg("digi_chars_in_buffer: port=%d, chars=%d",
+               dev_dbg(&port->dev, "digi_chars_in_buffer: port=%d, chars=%d\n",
                        priv->dp_port_num, port->bulk_out_size - 2);
                /* return(port->bulk_out_size - 2); */
                return 256;
        } else {
-               dbg("digi_chars_in_buffer: port=%d, chars=%d",
+               dev_dbg(&port->dev, "digi_chars_in_buffer: port=%d, chars=%d\n",
                        priv->dp_port_num, priv->dp_out_buf_len);
                return priv->dp_out_buf_len;
        }
@@@ -1120,12 -1123,12 +1123,12 @@@ static int digi_open(struct tty_struct 
  
        ret = digi_write_oob_command(port, buf, 8, 1);
        if (ret != 0)
-               dbg("digi_open: write oob failed, ret=%d", ret);
+               dev_dbg(&port->dev, "digi_open: write oob failed, ret=%d\n", ret);
  
        /* set termios settings */
        if (tty) {
 -              not_termios.c_cflag = ~tty->termios->c_cflag;
 -              not_termios.c_iflag = ~tty->termios->c_iflag;
 +              not_termios.c_cflag = ~tty->termios.c_cflag;
 +              not_termios.c_iflag = ~tty->termios.c_iflag;
                digi_set_termios(tty, port, &not_termios);
        }
        return 0;
@@@ -1180,7 -1183,7 +1183,7 @@@ static void digi_close(struct usb_seria
  
                ret = digi_write_oob_command(port, buf, 20, 0);
                if (ret != 0)
-                       dbg("digi_close: write oob failed, ret=%d", ret);
+                       dev_dbg(&port->dev, "digi_close: write oob failed, ret=%d\n", ret);
  
                /* wait for final commands on oob port to complete */
                prepare_to_wait(&priv->dp_flush_wait, &wait,
@@@ -1448,9 -1451,9 +1451,9 @@@ static int digi_read_inb_callback(struc
        tty_kref_put(tty);
  
        if (opcode == DIGI_CMD_RECEIVE_DISABLE)
-               dbg("%s: got RECEIVE_DISABLE", __func__);
+               dev_dbg(&port->dev, "%s: got RECEIVE_DISABLE\n", __func__);
        else if (opcode != DIGI_CMD_RECEIVE_DATA)
-               dbg("%s: unknown opcode: %d", __func__, opcode);
+               dev_dbg(&port->dev, "%s: unknown opcode: %d\n", __func__, opcode);
  
        return throttled ? 1 : 0;
  
@@@ -1484,7 -1487,7 +1487,7 @@@ static int digi_read_oob_callback(struc
                status = ((unsigned char *)urb->transfer_buffer)[i++];
                val = ((unsigned char *)urb->transfer_buffer)[i++];
  
-               dbg("digi_read_oob_callback: opcode=%d, line=%d, status=%d, val=%d",
+               dev_dbg(&port->dev, "digi_read_oob_callback: opcode=%d, line=%d, status=%d, val=%d\n",
                        opcode, line, status, val);
  
                if (status != 0 || line >= serial->type->num_ports)
  
                rts = 0;
                if (tty)
 -                      rts = tty->termios->c_cflag & CRTSCTS;
 +                      rts = tty->termios.c_cflag & CRTSCTS;
                
                if (tty && opcode == DIGI_CMD_READ_INPUT_SIGNALS) {
                        spin_lock(&priv->dp_port_lock);
@@@ -1552,6 -1555,3 +1555,3 @@@ module_usb_serial_driver(serial_drivers
  MODULE_AUTHOR(DRIVER_AUTHOR);
  MODULE_DESCRIPTION(DRIVER_DESC);
  MODULE_LICENSE("GPL");
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug enabled or not");
@@@ -28,8 -28,6 +28,6 @@@
  #include <linux/usb.h>
  #include <linux/usb/serial.h>
  
- static bool debug;
  /*
   * Version Information
   */
@@@ -87,7 -85,7 +85,7 @@@ static int empeg_startup(struct usb_ser
  
  static void empeg_init_termios(struct tty_struct *tty)
  {
 -      struct ktermios *termios = tty->termios;
 +      struct ktermios *termios = &tty->termios;
  
        /*
         * The empeg-car player wants these particular tty settings.
@@@ -134,6 -132,3 +132,3 @@@ module_usb_serial_driver(serial_drivers
  MODULE_AUTHOR(DRIVER_AUTHOR);
  MODULE_DESCRIPTION(DRIVER_DESC);
  MODULE_LICENSE("GPL");
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug enabled or not");
@@@ -25,8 -25,6 +25,6 @@@
  #include <linux/usb.h>
  #include <linux/usb/serial.h>
  
- static bool debug;
  static const struct usb_device_id id_table[] = {
        { USB_DEVICE(0x1934, 0x0706) },
        { }                                     /* Terminating entry */
@@@ -85,7 -83,7 +83,7 @@@ static void f81232_read_int_callback(st
                goto exit;
        }
  
-       usb_serial_debug_data(debug, &port->dev, __func__,
+       usb_serial_debug_data(&port->dev, __func__,
                              urb->actual_length, urb->transfer_buffer);
  
        f81232_update_line_status(port, data, actual_length);
@@@ -173,11 -171,10 +171,11 @@@ static void f81232_set_termios(struct t
        /* FIXME - Stubbed out for now */
  
        /* Don't change anything if nothing has changed */
 -      if (!tty_termios_hw_change(tty->termios, old_termios))
 +      if (!tty_termios_hw_change(&tty->termios, old_termios))
                return;
  
        /* Do the real work here... */
 +      tty_termios_copy_hw(&tty->termios, old_termios);
  }
  
  static int f81232_tiocmget(struct tty_struct *tty)
@@@ -389,7 -386,3 +387,3 @@@ module_usb_serial_driver(serial_drivers
  MODULE_DESCRIPTION("Fintek F81232 USB to serial adaptor driver");
  MODULE_AUTHOR("Greg Kroah-Hartman <gregkh@linuxfoundation.org");
  MODULE_LICENSE("GPL v2");
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug enabled or not");
  #include "ftdi_sio.h"
  #include "ftdi_sio_ids.h"
  
- /*
-  * Version Information
-  */
- #define DRIVER_VERSION "v1.6.0"
  #define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>, Bill Ryder <bryder@sgi.com>, Kuba Ober <kuba@mareimbrium.org>, Andreas Mohr, Johan Hovold <jhovold@gmail.com>"
  #define DRIVER_DESC "USB FTDI Serial Converters Driver"
  
- static bool debug;
  static __u16 vendor = FTDI_VID;
  static __u16 product;
  
@@@ -584,6 -579,8 +579,8 @@@ static struct usb_device_id id_table_co
        { USB_DEVICE(FTDI_VID, FTDI_IBS_PEDO_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_IBS_PROD_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_TAVIR_STK500_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_TIAO_UMPA_PID),
+               .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
        /*
         * ELV devices:
         */
@@@ -1063,11 -1060,12 +1060,12 @@@ static int update_mctrl(struct usb_seri
                                                        unsigned int clear)
  {
        struct ftdi_private *priv = usb_get_serial_port_data(port);
+       struct device *dev = &port->dev;
        unsigned urb_value;
        int rv;
  
        if (((set | clear) & (TIOCM_DTR | TIOCM_RTS)) == 0) {
-               dbg("%s - DTR|RTS not being set|cleared", __func__);
+               dev_dbg(dev, "%s - DTR|RTS not being set|cleared\n", __func__);
                return 0;       /* no change */
        }
  
                               urb_value, priv->interface,
                               NULL, 0, WDR_TIMEOUT);
        if (rv < 0) {
-               dbg("%s Error from MODEM_CTRL urb: DTR %s, RTS %s",
-                               __func__,
-                               (set & TIOCM_DTR) ? "HIGH" :
-                               (clear & TIOCM_DTR) ? "LOW" : "unchanged",
-                               (set & TIOCM_RTS) ? "HIGH" :
-                               (clear & TIOCM_RTS) ? "LOW" : "unchanged");
+               dev_dbg(dev, "%s Error from MODEM_CTRL urb: DTR %s, RTS %s\n",
+                       __func__,
+                       (set & TIOCM_DTR) ? "HIGH" : (clear & TIOCM_DTR) ? "LOW" : "unchanged",
+                       (set & TIOCM_RTS) ? "HIGH" : (clear & TIOCM_RTS) ? "LOW" : "unchanged");
        } else {
-               dbg("%s - DTR %s, RTS %s", __func__,
-                               (set & TIOCM_DTR) ? "HIGH" :
-                               (clear & TIOCM_DTR) ? "LOW" : "unchanged",
-                               (set & TIOCM_RTS) ? "HIGH" :
-                               (clear & TIOCM_RTS) ? "LOW" : "unchanged");
+               dev_dbg(dev, "%s - DTR %s, RTS %s\n", __func__,
+                       (set & TIOCM_DTR) ? "HIGH" : (clear & TIOCM_DTR) ? "LOW" : "unchanged",
+                       (set & TIOCM_RTS) ? "HIGH" : (clear & TIOCM_RTS) ? "LOW" : "unchanged");
                /* FIXME: locking on last_dtr_rts */
                priv->last_dtr_rts = (priv->last_dtr_rts & ~clear) | set;
        }
@@@ -1111,6 -1105,7 +1105,7 @@@ static __u32 get_ftdi_divisor(struct tt
                                                struct usb_serial_port *port)
  {
        struct ftdi_private *priv = usb_get_serial_port_data(port);
+       struct device *dev = &port->dev;
        __u32 div_value = 0;
        int div_okay = 1;
        int baud;
              alt_speed hack */
  
        baud = tty_get_baud_rate(tty);
-       dbg("%s - tty_get_baud_rate reports speed %d", __func__, baud);
+       dev_dbg(dev, "%s - tty_get_baud_rate reports speed %d\n", __func__, baud);
  
        /* 2. Observe async-compatible custom_divisor hack, update baudrate
           if needed */
            ((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) &&
             (priv->custom_divisor)) {
                baud = priv->baud_base / priv->custom_divisor;
-               dbg("%s - custom divisor %d sets baud rate to %d",
-                               __func__, priv->custom_divisor, baud);
+               dev_dbg(dev, "%s - custom divisor %d sets baud rate to %d\n",
+                       __func__, priv->custom_divisor, baud);
        }
  
        /* 3. Convert baudrate to device-specific divisor */
                case 115200: div_value = ftdi_sio_b115200; break;
                } /* baud */
                if (div_value == 0) {
-                       dbg("%s - Baudrate (%d) requested is not supported",
-                                                       __func__,  baud);
+                       dev_dbg(dev, "%s - Baudrate (%d) requested is not supported\n",
+                               __func__,  baud);
                        div_value = ftdi_sio_b9600;
                        baud = 9600;
                        div_okay = 0;
                if (baud <= 3000000) {
                        div_value = ftdi_232am_baud_to_divisor(baud);
                } else {
-                       dbg("%s - Baud rate too high!", __func__);
+                       dev_dbg(dev, "%s - Baud rate too high!\n", __func__);
                        baud = 9600;
                        div_value = ftdi_232am_baud_to_divisor(9600);
                        div_okay = 0;
                        }
                        div_value = ftdi_232bm_baud_to_divisor(baud);
                } else {
-                       dbg("%s - Baud rate too high!", __func__);
+                       dev_dbg(dev, "%s - Baud rate too high!\n", __func__);
                        div_value = ftdi_232bm_baud_to_divisor(9600);
                        div_okay = 0;
                        baud = 9600;
                } else if (baud < 1200) {
                        div_value = ftdi_232bm_baud_to_divisor(baud);
                } else {
-                       dbg("%s - Baud rate too high!", __func__);
+                       dev_dbg(dev, "%s - Baud rate too high!\n", __func__);
                        div_value = ftdi_232bm_baud_to_divisor(9600);
                        div_okay = 0;
                        baud = 9600;
        } /* priv->chip_type */
  
        if (div_okay) {
-               dbg("%s - Baud rate set to %d (divisor 0x%lX) on chip %s",
+               dev_dbg(dev, "%s - Baud rate set to %d (divisor 0x%lX) on chip %s\n",
                        __func__, baud, (unsigned long)div_value,
                        ftdi_chip_name[priv->chip_type]);
        }
@@@ -1281,7 -1276,7 +1276,7 @@@ static int write_latency_timer(struct u
        if (priv->flags & ASYNC_LOW_LATENCY)
                l = 1;
  
-       dbg("%s: setting latency timer = %i", __func__, l);
+       dev_dbg(&port->dev, "%s: setting latency timer = %i\n", __func__, l);
  
        rv = usb_control_msg(udev,
                             usb_sndctrlpipe(udev, 0),
@@@ -1436,8 -1431,8 +1431,8 @@@ static void ftdi_determine_type(struct 
  
        version = le16_to_cpu(udev->descriptor.bcdDevice);
        interfaces = udev->actconfig->desc.bNumInterfaces;
-       dbg("%s: bcdDevice = 0x%x, bNumInterfaces = %u", __func__,
-                       version, interfaces);
+       dev_dbg(&port->dev, "%s: bcdDevice = 0x%x, bNumInterfaces = %u\n", __func__,
+               version, interfaces);
        if (interfaces > 1) {
                int inter;
  
                /* BM-type devices have a bug where bcdDevice gets set
                 * to 0x200 when iSerialNumber is 0.  */
                if (version < 0x500) {
-                       dbg("%s: something fishy - bcdDevice too low for multi-interface device",
-                                       __func__);
+                       dev_dbg(&port->dev,
+                               "%s: something fishy - bcdDevice too low for multi-interface device\n",
+                               __func__);
                }
        } else if (version < 0x200) {
                /* Old device.  Assume it's the original SIO. */
@@@ -1582,7 -1578,7 +1578,7 @@@ static ssize_t store_event_char(struct 
        int v = simple_strtoul(valbuf, NULL, 10);
        int rv;
  
-       dbg("%s: setting event char = %i", __func__, v);
+       dev_dbg(&port->dev, "%s: setting event char = %i\n", __func__, v);
  
        rv = usb_control_msg(udev,
                             usb_sndctrlpipe(udev, 0),
                             v, priv->interface,
                             NULL, 0, WDR_TIMEOUT);
        if (rv < 0) {
-               dbg("Unable to write event character: %i", rv);
+               dev_dbg(&port->dev, "Unable to write event character: %i\n", rv);
                return -EIO;
        }
  
@@@ -1610,7 -1606,7 +1606,7 @@@ static int create_sysfs_attrs(struct us
        /* XXX I've no idea if the original SIO supports the event_char
         * sysfs parameter, so I'm playing it safe.  */
        if (priv->chip_type != SIO) {
-               dbg("sysfs attributes for %s", ftdi_chip_name[priv->chip_type]);
+               dev_dbg(&port->dev, "sysfs attributes for %s\n", ftdi_chip_name[priv->chip_type]);
                retval = device_create_file(&port->dev, &dev_attr_event_char);
                if ((!retval) &&
                    (priv->chip_type == FT232BM ||
@@@ -1750,8 -1746,8 +1746,8 @@@ static int ftdi_NDI_device_setup(struc
        if (latency > 99)
                latency = 99;
  
-       dbg("%s setting NDI device latency to %d", __func__, latency);
-       dev_info(&udev->dev, "NDI device with a latency value of %d", latency);
+       dev_dbg(&udev->dev, "%s setting NDI device latency to %d\n", __func__, latency);
+       dev_info(&udev->dev, "NDI device with a latency value of %d\n", latency);
  
        /* FIXME: errors are not returned */
        usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
@@@ -1969,7 -1965,7 +1965,7 @@@ static int ftdi_process_packet(struct t
        char *ch;
  
        if (len < 2) {
-               dbg("malformed packet");
+               dev_dbg(&port->dev, "malformed packet\n");
                return 0;
        }
  
@@@ -2084,12 -2080,12 +2080,12 @@@ static void ftdi_break_ctl(struct tty_s
                        FTDI_SIO_SET_DATA_REQUEST_TYPE,
                        urb_value , priv->interface,
                        NULL, 0, WDR_TIMEOUT) < 0) {
-               dev_err(&port->dev, "%s FAILED to enable/disable break state "
-                       "(state was %d)\n", __func__, break_state);
+               dev_err(&port->dev, "%s FAILED to enable/disable break state (state was %d)\n",
+                       __func__, break_state);
        }
  
-       dbg("%s break state is %d - urb is %d", __func__,
-                                               break_state, urb_value);
+       dev_dbg(&port->dev, "%s break state is %d - urb is %d\n", __func__,
+               break_state, urb_value);
  
  }
  
@@@ -2101,8 -2097,9 +2097,9 @@@ static void ftdi_set_termios(struct tty
                struct usb_serial_port *port, struct ktermios *old_termios)
  {
        struct usb_device *dev = port->serial->dev;
+       struct device *ddev = &port->dev;
        struct ftdi_private *priv = usb_get_serial_port_data(port);
 -      struct ktermios *termios = tty->termios;
 +      struct ktermios *termios = &tty->termios;
        unsigned int cflag = termios->c_cflag;
        __u16 urb_value; /* will hold the new flags */
  
        /* Force baud rate if this device requires it, unless it is set to
           B0. */
        if (priv->force_baud && ((termios->c_cflag & CBAUD) != B0)) {
-               dbg("%s: forcing baud rate for this device", __func__);
+               dev_dbg(ddev, "%s: forcing baud rate for this device\n", __func__);
                tty_encode_baud_rate(tty, priv->force_baud,
                                        priv->force_baud);
        }
  
        /* Force RTS-CTS if this device requires it. */
        if (priv->force_rtscts) {
-               dbg("%s: forcing rtscts for this device", __func__);
+               dev_dbg(ddev, "%s: forcing rtscts for this device\n", __func__);
                termios->c_cflag |= CRTSCTS;
        }
  
        cflag = termios->c_cflag;
  
-       if (old_termios == 0)
+       if (!old_termios)
                goto no_skip;
  
        if (old_termios->c_cflag == termios->c_cflag
@@@ -2163,10 -2160,16 +2160,16 @@@ no_skip
        }
        if (cflag & CSIZE) {
                switch (cflag & CSIZE) {
-               case CS7: urb_value |= 7; dbg("Setting CS7"); break;
-               case CS8: urb_value |= 8; dbg("Setting CS8"); break;
+               case CS7:
+                       urb_value |= 7;
+                       dev_dbg(ddev, "Setting CS7\n");
+                       break;
+               case CS8:
+                       urb_value |= 8;
+                       dev_dbg(ddev, "Setting CS8\n");
+                       break;
                default:
-                       dev_err(&port->dev, "CSIZE was set but not CS7-CS8\n");
+                       dev_err(ddev, "CSIZE was set but not CS7-CS8\n");
                }
        }
  
                            FTDI_SIO_SET_DATA_REQUEST_TYPE,
                            urb_value , priv->interface,
                            NULL, 0, WDR_SHORT_TIMEOUT) < 0) {
-               dev_err(&port->dev, "%s FAILED to set "
-                       "databits/stopbits/parity\n", __func__);
+               dev_err(ddev, "%s FAILED to set databits/stopbits/parity\n",
+                       __func__);
        }
  
        /* Now do the baudrate */
@@@ -2192,8 -2195,7 +2195,7 @@@ no_data_parity_stop_changes
                                    FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
                                    0, priv->interface,
                                    NULL, 0, WDR_TIMEOUT) < 0) {
-                       dev_err(&port->dev,
-                               "%s error from disable flowcontrol urb\n",
+                       dev_err(ddev, "%s error from disable flowcontrol urb\n",
                                __func__);
                }
                /* Drop RTS and DTR */
                /* set the baudrate determined before */
                mutex_lock(&priv->cfg_lock);
                if (change_speed(tty, port))
-                       dev_err(&port->dev, "%s urb failed to set baudrate\n",
-                               __func__);
+                       dev_err(ddev, "%s urb failed to set baudrate\n", __func__);
                mutex_unlock(&priv->cfg_lock);
                /* Ensure RTS and DTR are raised when baudrate changed from 0 */
                if (!old_termios || (old_termios->c_cflag & CBAUD) == B0)
        /* Note device also supports DTR/CD (ugh) and Xon/Xoff in hardware */
  no_c_cflag_changes:
        if (cflag & CRTSCTS) {
-               dbg("%s Setting to CRTSCTS flow control", __func__);
+               dev_dbg(ddev, "%s Setting to CRTSCTS flow control\n", __func__);
                if (usb_control_msg(dev,
                                    usb_sndctrlpipe(dev, 0),
                                    FTDI_SIO_SET_FLOW_CTRL_REQUEST,
                                    FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
                                    0 , (FTDI_SIO_RTS_CTS_HS | priv->interface),
                                    NULL, 0, WDR_TIMEOUT) < 0) {
-                       dev_err(&port->dev,
-                               "urb failed to set to rts/cts flow control\n");
+                       dev_err(ddev, "urb failed to set to rts/cts flow control\n");
                }
        } else {
                /*
                 * Xon/Xoff code
                 * code is executed.
                 */
                if (iflag & IXOFF) {
-                       dbg("%s  request to enable xonxoff iflag=%04x",
-                                                       __func__, iflag);
+                       dev_dbg(ddev, "%s  request to enable xonxoff iflag=%04x\n",
+                               __func__, iflag);
                        /* Try to enable the XON/XOFF on the ftdi_sio
                         * Set the vstart and vstop -- could have been done up
                         * above where a lot of other dereferencing is done but
                        /* else clause to only run if cflag ! CRTSCTS and iflag
                         * ! XOFF. CHECKME Assuming XON/XOFF handled by tty
                         * stack - not by device */
-                       dbg("%s Turning off hardware flow control", __func__);
+                       dev_dbg(ddev, "%s Turning off hardware flow control\n", __func__);
                        if (usb_control_msg(dev,
                                            usb_sndctrlpipe(dev, 0),
                                            FTDI_SIO_SET_FLOW_CTRL_REQUEST,
                                            FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
                                            0, priv->interface,
                                            NULL, 0, WDR_TIMEOUT) < 0) {
-                               dev_err(&port->dev,
-                                       "urb failed to clear flow control\n");
+                               dev_err(ddev, "urb failed to clear flow control\n");
                        }
                }
        }
  }
  
@@@ -2365,7 -2362,7 +2362,7 @@@ static int ftdi_ioctl(struct tty_struc
        struct async_icount cnow;
        struct async_icount cprev;
  
-       dbg("%s cmd 0x%04x", __func__, cmd);
+       dev_dbg(&port->dev, "%s cmd 0x%04x\n", __func__, cmd);
  
        /* Based on code from acm.c and others */
        switch (cmd) {
        /* This is not necessarily an error - turns out the higher layers
         * will do some ioctls themselves (see comment above)
         */
-       dbg("%s arg not supported - it was 0x%04x - check /usr/include/asm/ioctls.h", __func__, cmd);
+       dev_dbg(&port->dev, "%s arg not supported - it was 0x%04x - check /usr/include/asm/ioctls.h\n",
+               __func__, cmd);
        return -ENOIOCTLCMD;
  }
  
  static int __init ftdi_init(void)
  {
-       int retval;
        if (vendor > 0 && product > 0) {
                /* Add user specified VID/PID to reserved element of table. */
                int i;
                id_table_combined[i].idVendor = vendor;
                id_table_combined[i].idProduct = product;
        }
-       retval = usb_serial_register_drivers(serial_drivers, KBUILD_MODNAME, id_table_combined);
-       if (retval == 0)
-               printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
-                              DRIVER_DESC "\n");
-       return retval;
+       return usb_serial_register_drivers(serial_drivers, KBUILD_MODNAME, id_table_combined);
  }
  
  static void __exit ftdi_exit(void)
@@@ -2450,8 -2442,6 +2442,6 @@@ MODULE_AUTHOR(DRIVER_AUTHOR)
  MODULE_DESCRIPTION(DRIVER_DESC);
  MODULE_LICENSE("GPL");
  
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug enabled or not");
  module_param(vendor, ushort, 0);
  MODULE_PARM_DESC(vendor, "User specified vendor ID (default="
                __MODULE_STRING(FTDI_VID)")");
@@@ -190,9 -190,6 +190,6 @@@ static const struct divisor_table_entr
        {   230400,     1},
  };
  
- /* local variables */
- static bool debug;
  /* Number of outstanding Command Write Urbs */
  static atomic_t CmdUrbs = ATOMIC_INIT(0);
  
@@@ -244,7 -241,7 +241,7 @@@ static void handle_new_lsr(struct edgep
                                __u8 lsr, __u8 data);
  static int  send_iosp_ext_cmd(struct edgeport_port *edge_port, __u8 command,
                                __u8 param);
- static int  calc_baud_rate_divisor(int baud_rate, int *divisor);
+ static int  calc_baud_rate_divisor(struct device *dev, int baud_rate, int *divisor);
  static int  send_cmd_write_baud_rate(struct edgeport_port *edge_port,
                                int baudRate);
  static void change_port_settings(struct tty_struct *tty,
@@@ -286,6 -283,7 +283,7 @@@ static void unicode_to_ascii(char *stri
   ************************************************************************/
  static void update_edgeport_E2PROM(struct edgeport_serial *edge_serial)
  {
+       struct device *dev = &edge_serial->serial->dev->dev;
        __u32 BootCurVer;
        __u32 BootNewVer;
        __u8 BootMajorVersion;
        response = request_ihex_firmware(&fw, fw_name,
                                         &edge_serial->serial->dev->dev);
        if (response) {
-               printk(KERN_ERR "Failed to load image \"%s\" err %d\n",
+               dev_err(dev, "Failed to load image \"%s\" err %d\n",
                       fw_name, response);
                return;
        }
                     (BootMinorVersion << 16) +
                      BootBuildNumber;
  
-       dbg("Current Boot Image version %d.%d.%d",
+       dev_dbg(dev, "Current Boot Image version %d.%d.%d\n",
            edge_serial->boot_descriptor.MajorVersion,
            edge_serial->boot_descriptor.MinorVersion,
            le16_to_cpu(edge_serial->boot_descriptor.BuildNumber));
  
  
        if (BootNewVer > BootCurVer) {
-               dbg("**Update Boot Image from %d.%d.%d to %d.%d.%d",
+               dev_dbg(dev, "**Update Boot Image from %d.%d.%d to %d.%d.%d\n",
                    edge_serial->boot_descriptor.MajorVersion,
                    edge_serial->boot_descriptor.MinorVersion,
                    le16_to_cpu(edge_serial->boot_descriptor.BuildNumber),
                    BootMajorVersion, BootMinorVersion, BootBuildNumber);
  
-               dbg("Downloading new Boot Image");
+               dev_dbg(dev, "Downloading new Boot Image\n");
  
                for (rec = ihex_next_binrec(rec); rec;
                     rec = ihex_next_binrec(rec)) {
                        }
                }
        } else {
-               dbg("Boot Image -- already up to date");
+               dev_dbg(dev, "Boot Image -- already up to date\n");
        }
        release_firmware(fw);
  }
@@@ -379,7 -377,7 +377,7 @@@ static int get_string_desc(struct usb_d
        struct usb_string_descriptor StringDesc;
        struct usb_string_descriptor *pStringDesc;
  
-       dbg("%s - USB String ID = %d", __func__, Id);
+       dev_dbg(&dev->dev, "%s - USB String ID = %d\n", __func__, Id);
  
        if (!usb_get_descriptor(dev, USB_DT_STRING, Id, &StringDesc,
                                                sizeof(StringDesc)))
  }
  #endif
  
- static void dump_product_info(struct edgeport_product_info *product_info)
+ static void dump_product_info(struct edgeport_serial *edge_serial,
+                             struct edgeport_product_info *product_info)
  {
+       struct device *dev = &edge_serial->serial->dev->dev;
        /* Dump Product Info structure */
-       dbg("**Product Information:");
-       dbg("  ProductId             %x", product_info->ProductId);
-       dbg("  NumPorts              %d", product_info->NumPorts);
-       dbg("  ProdInfoVer           %d", product_info->ProdInfoVer);
-       dbg("  IsServer              %d", product_info->IsServer);
-       dbg("  IsRS232               %d", product_info->IsRS232);
-       dbg("  IsRS422               %d", product_info->IsRS422);
-       dbg("  IsRS485               %d", product_info->IsRS485);
-       dbg("  RomSize               %d", product_info->RomSize);
-       dbg("  RamSize               %d", product_info->RamSize);
-       dbg("  CpuRev                %x", product_info->CpuRev);
-       dbg("  BoardRev              %x", product_info->BoardRev);
-       dbg("  BootMajorVersion      %d.%d.%d", product_info->BootMajorVersion,
-           product_info->BootMinorVersion,
-           le16_to_cpu(product_info->BootBuildNumber));
-       dbg("  FirmwareMajorVersion  %d.%d.%d",
-                       product_info->FirmwareMajorVersion,
-                       product_info->FirmwareMinorVersion,
-                       le16_to_cpu(product_info->FirmwareBuildNumber));
-       dbg("  ManufactureDescDate   %d/%d/%d",
-                       product_info->ManufactureDescDate[0],
-                       product_info->ManufactureDescDate[1],
-                       product_info->ManufactureDescDate[2]+1900);
-       dbg("  iDownloadFile         0x%x", product_info->iDownloadFile);
-       dbg("  EpicVer               %d", product_info->EpicVer);
+       dev_dbg(dev, "**Product Information:\n");
+       dev_dbg(dev, "  ProductId             %x\n", product_info->ProductId);
+       dev_dbg(dev, "  NumPorts              %d\n", product_info->NumPorts);
+       dev_dbg(dev, "  ProdInfoVer           %d\n", product_info->ProdInfoVer);
+       dev_dbg(dev, "  IsServer              %d\n", product_info->IsServer);
+       dev_dbg(dev, "  IsRS232               %d\n", product_info->IsRS232);
+       dev_dbg(dev, "  IsRS422               %d\n", product_info->IsRS422);
+       dev_dbg(dev, "  IsRS485               %d\n", product_info->IsRS485);
+       dev_dbg(dev, "  RomSize               %d\n", product_info->RomSize);
+       dev_dbg(dev, "  RamSize               %d\n", product_info->RamSize);
+       dev_dbg(dev, "  CpuRev                %x\n", product_info->CpuRev);
+       dev_dbg(dev, "  BoardRev              %x\n", product_info->BoardRev);
+       dev_dbg(dev, "  BootMajorVersion      %d.%d.%d\n",
+               product_info->BootMajorVersion,
+               product_info->BootMinorVersion,
+               le16_to_cpu(product_info->BootBuildNumber));
+       dev_dbg(dev, "  FirmwareMajorVersion  %d.%d.%d\n",
+               product_info->FirmwareMajorVersion,
+               product_info->FirmwareMinorVersion,
+               le16_to_cpu(product_info->FirmwareBuildNumber));
+       dev_dbg(dev, "  ManufactureDescDate   %d/%d/%d\n",
+               product_info->ManufactureDescDate[0],
+               product_info->ManufactureDescDate[1],
+               product_info->ManufactureDescDate[2]+1900);
+       dev_dbg(dev, "  iDownloadFile         0x%x\n",
+               product_info->iDownloadFile);
+       dev_dbg(dev, "  EpicVer               %d\n", product_info->EpicVer);
  }
  
  static void get_product_info(struct edgeport_serial *edge_serial)
                product_info->iDownloadFile = EDGE_DOWNLOAD_FILE_80251;
        else
                product_info->iDownloadFile = EDGE_DOWNLOAD_FILE_I930;
-  
        /* Determine Product type and set appropriate flags */
        switch (DEVICE_ID_FROM_USB_PRODUCT_ID(product_info->ProductId)) {
        case ION_DEVICE_ID_EDGEPORT_COMPATIBLE:
                break;
        }
  
-       dump_product_info(product_info);
+       dump_product_info(edge_serial, product_info);
  }
  
  static int get_epic_descriptor(struct edgeport_serial *ep)
        struct edgeport_product_info *product_info = &ep->product_info;
        struct edge_compatibility_descriptor *epic = &ep->epic_descriptor;
        struct edge_compatibility_bits *bits;
+       struct device *dev = &serial->dev->dev;
  
        ep->is_epic = 0;
        result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
                                 sizeof(struct edge_compatibility_descriptor),
                                 300);
  
-       dbg("%s result = %d", __func__, result);
        if (result > 0) {
                ep->is_epic = 1;
                memset(product_info, 0, sizeof(struct edgeport_product_info));
                product_info->EpicVer = epic->EpicVer;
                product_info->Epic = epic->Supports;
                product_info->ProductId = ION_DEVICE_ID_EDGEPORT_COMPATIBLE;
-               dump_product_info(product_info);
+               dump_product_info(ep, product_info);
  
                bits = &ep->epic_descriptor.Supports;
-               dbg("**EPIC descriptor:");
-               dbg("  VendEnableSuspend: %s", bits->VendEnableSuspend  ? "TRUE": "FALSE");
-               dbg("  IOSPOpen         : %s", bits->IOSPOpen           ? "TRUE": "FALSE");
-               dbg("  IOSPClose        : %s", bits->IOSPClose          ? "TRUE": "FALSE");
-               dbg("  IOSPChase        : %s", bits->IOSPChase          ? "TRUE": "FALSE");
-               dbg("  IOSPSetRxFlow    : %s", bits->IOSPSetRxFlow      ? "TRUE": "FALSE");
-               dbg("  IOSPSetTxFlow    : %s", bits->IOSPSetTxFlow      ? "TRUE": "FALSE");
-               dbg("  IOSPSetXChar     : %s", bits->IOSPSetXChar       ? "TRUE": "FALSE");
-               dbg("  IOSPRxCheck      : %s", bits->IOSPRxCheck        ? "TRUE": "FALSE");
-               dbg("  IOSPSetClrBreak  : %s", bits->IOSPSetClrBreak    ? "TRUE": "FALSE");
-               dbg("  IOSPWriteMCR     : %s", bits->IOSPWriteMCR       ? "TRUE": "FALSE");
-               dbg("  IOSPWriteLCR     : %s", bits->IOSPWriteLCR       ? "TRUE": "FALSE");
-               dbg("  IOSPSetBaudRate  : %s", bits->IOSPSetBaudRate    ? "TRUE": "FALSE");
-               dbg("  TrueEdgeport     : %s", bits->TrueEdgeport       ? "TRUE": "FALSE");
+               dev_dbg(dev, "**EPIC descriptor:\n");
+               dev_dbg(dev, "  VendEnableSuspend: %s\n", bits->VendEnableSuspend ? "TRUE": "FALSE");
+               dev_dbg(dev, "  IOSPOpen         : %s\n", bits->IOSPOpen        ? "TRUE": "FALSE");
+               dev_dbg(dev, "  IOSPClose        : %s\n", bits->IOSPClose       ? "TRUE": "FALSE");
+               dev_dbg(dev, "  IOSPChase        : %s\n", bits->IOSPChase       ? "TRUE": "FALSE");
+               dev_dbg(dev, "  IOSPSetRxFlow    : %s\n", bits->IOSPSetRxFlow   ? "TRUE": "FALSE");
+               dev_dbg(dev, "  IOSPSetTxFlow    : %s\n", bits->IOSPSetTxFlow   ? "TRUE": "FALSE");
+               dev_dbg(dev, "  IOSPSetXChar     : %s\n", bits->IOSPSetXChar    ? "TRUE": "FALSE");
+               dev_dbg(dev, "  IOSPRxCheck      : %s\n", bits->IOSPRxCheck     ? "TRUE": "FALSE");
+               dev_dbg(dev, "  IOSPSetClrBreak  : %s\n", bits->IOSPSetClrBreak ? "TRUE": "FALSE");
+               dev_dbg(dev, "  IOSPWriteMCR     : %s\n", bits->IOSPWriteMCR    ? "TRUE": "FALSE");
+               dev_dbg(dev, "  IOSPWriteLCR     : %s\n", bits->IOSPWriteLCR    ? "TRUE": "FALSE");
+               dev_dbg(dev, "  IOSPSetBaudRate  : %s\n", bits->IOSPSetBaudRate ? "TRUE": "FALSE");
+               dev_dbg(dev, "  TrueEdgeport     : %s\n", bits->TrueEdgeport    ? "TRUE": "FALSE");
        }
  
        return result;
   *****************************************************************************/
  static void edge_interrupt_callback(struct urb *urb)
  {
-       struct edgeport_serial  *edge_serial = urb->context;
+       struct edgeport_serial *edge_serial = urb->context;
+       struct device *dev;
        struct edgeport_port *edge_port;
        struct usb_serial_port *port;
        struct tty_struct *tty;
        int result;
        int status = urb->status;
  
-       dbg("%s", __func__);
        switch (status) {
        case 0:
                /* success */
        case -ENOENT:
        case -ESHUTDOWN:
                /* this urb is terminated, clean up */
-               dbg("%s - urb shutting down with status: %d",
-                                               __func__, status);
+               dev_dbg(&urb->dev->dev, "%s - urb shutting down with status: %d\n", __func__, status);
                return;
        default:
-               dbg("%s - nonzero urb status received: %d", __func__, status);
+               dev_dbg(&urb->dev->dev, "%s - nonzero urb status received: %d\n", __func__, status);
                goto exit;
        }
  
+       dev = &edge_serial->serial->dev->dev;
        /* process this interrupt-read even if there are no ports open */
        if (length) {
-               usb_serial_debug_data(debug, &edge_serial->serial->dev->dev,
-                                               __func__, length, data);
+               usb_serial_debug_data(dev, __func__, length, data);
  
                if (length > 1) {
                        bytes_avail = data[0] | (data[1] << 8);
                        if (bytes_avail) {
                                spin_lock(&edge_serial->es_lock);
                                edge_serial->rxBytesAvail += bytes_avail;
-                               dbg("%s - bytes_avail=%d, rxBytesAvail=%d, read_in_progress=%d", __func__, bytes_avail, edge_serial->rxBytesAvail, edge_serial->read_in_progress);
+                               dev_dbg(dev,
+                                       "%s - bytes_avail=%d, rxBytesAvail=%d, read_in_progress=%d\n",
+                                       __func__, bytes_avail,
+                                       edge_serial->rxBytesAvail,
+                                       edge_serial->read_in_progress);
  
                                if (edge_serial->rxBytesAvail > 0 &&
                                    !edge_serial->read_in_progress) {
-                                       dbg("%s - posting a read", __func__);
+                                       dev_dbg(dev, "%s - posting a read\n", __func__);
                                        edge_serial->read_in_progress = true;
  
                                        /* we have pending bytes on the
                                           bulk in pipe, send a request */
                                        result = usb_submit_urb(edge_serial->read_urb, GFP_ATOMIC);
                                        if (result) {
-                                               dev_err(&edge_serial->serial->dev->dev, "%s - usb_submit_urb(read bulk) failed with result = %d\n", __func__, result);
+                                               dev_err(dev,
+                                                       "%s - usb_submit_urb(read bulk) failed with result = %d\n",
+                                                       __func__, result);
                                                edge_serial->read_in_progress = false;
                                        }
                                }
                                        spin_lock(&edge_port->ep_lock);
                                        edge_port->txCredits += txCredits;
                                        spin_unlock(&edge_port->ep_lock);
-                                       dbg("%s - txcredits for port%d = %d",
-                                                       __func__, portNumber,
-                                                       edge_port->txCredits);
+                                       dev_dbg(dev, "%s - txcredits for port%d = %d\n",
+                                               __func__, portNumber,
+                                               edge_port->txCredits);
  
                                        /* tell the tty driver that something
                                           has changed */
@@@ -673,49 -680,48 +680,48 @@@ exit
  static void edge_bulk_in_callback(struct urb *urb)
  {
        struct edgeport_serial  *edge_serial = urb->context;
+       struct device *dev;
        unsigned char           *data = urb->transfer_buffer;
        int                     retval;
        __u16                   raw_data_length;
        int status = urb->status;
  
-       dbg("%s", __func__);
        if (status) {
-               dbg("%s - nonzero read bulk status received: %d",
-                   __func__, status);
+               dev_dbg(&urb->dev->dev, "%s - nonzero read bulk status received: %d\n",
+                       __func__, status);
                edge_serial->read_in_progress = false;
                return;
        }
  
        if (urb->actual_length == 0) {
-               dbg("%s - read bulk callback with no data", __func__);
+               dev_dbg(&urb->dev->dev, "%s - read bulk callback with no data\n", __func__);
                edge_serial->read_in_progress = false;
                return;
        }
  
+       dev = &edge_serial->serial->dev->dev;
        raw_data_length = urb->actual_length;
  
-       usb_serial_debug_data(debug, &edge_serial->serial->dev->dev,
-                                       __func__, raw_data_length, data);
+       usb_serial_debug_data(dev, __func__, raw_data_length, data);
  
        spin_lock(&edge_serial->es_lock);
  
        /* decrement our rxBytes available by the number that we just got */
        edge_serial->rxBytesAvail -= raw_data_length;
  
-       dbg("%s - Received = %d, rxBytesAvail %d", __func__,
-                               raw_data_length, edge_serial->rxBytesAvail);
+       dev_dbg(dev, "%s - Received = %d, rxBytesAvail %d\n", __func__,
+               raw_data_length, edge_serial->rxBytesAvail);
  
        process_rcvd_data(edge_serial, data, urb->actual_length);
  
        /* check to see if there's any more data for us to read */
        if (edge_serial->rxBytesAvail > 0) {
-               dbg("%s - posting a read", __func__);
+               dev_dbg(dev, "%s - posting a read\n", __func__);
                retval = usb_submit_urb(edge_serial->read_urb, GFP_ATOMIC);
                if (retval) {
-                       dev_err(&urb->dev->dev,
-                               "%s - usb_submit_urb(read bulk) failed, "
-                               "retval = %d\n", __func__, retval);
+                       dev_err(dev,
+                               "%s - usb_submit_urb(read bulk) failed, retval = %d\n",
+                               __func__, retval);
                        edge_serial->read_in_progress = false;
                }
        } else {
@@@ -737,11 -743,10 +743,10 @@@ static void edge_bulk_out_data_callback
        struct tty_struct *tty;
        int status = urb->status;
  
-       dbg("%s", __func__);
        if (status) {
-               dbg("%s - nonzero write bulk status received: %d",
-                   __func__, status);
+               dev_dbg(&urb->dev->dev,
+                       "%s - nonzero write bulk status received: %d\n",
+                       __func__, status);
        }
  
        tty = tty_port_tty_get(&edge_port->port->port);
@@@ -773,11 -778,9 +778,9 @@@ static void edge_bulk_out_cmd_callback(
        struct tty_struct *tty;
        int status = urb->status;
  
-       dbg("%s", __func__);
        atomic_dec(&CmdUrbs);
-       dbg("%s - FREE URB %p (outstanding %d)", __func__,
-                                       urb, atomic_read(&CmdUrbs));
+       dev_dbg(&urb->dev->dev, "%s - FREE URB %p (outstanding %d)\n",
+               __func__, urb, atomic_read(&CmdUrbs));
  
  
        /* clean up the transfer buffer */
        usb_free_urb(urb);
  
        if (status) {
-               dbg("%s - nonzero write bulk status received: %d",
-                                                       __func__, status);
+               dev_dbg(&urb->dev->dev,
+                       "%s - nonzero write bulk status received: %d\n",
+                       __func__, status);
                return;
        }
  
  static int edge_open(struct tty_struct *tty, struct usb_serial_port *port)
  {
        struct edgeport_port *edge_port = usb_get_serial_port_data(port);
+       struct device *dev = &port->dev;
        struct usb_serial *serial;
        struct edgeport_serial *edge_serial;
        int response;
  
-       dbg("%s - port %d", __func__, port->number);
        if (edge_port == NULL)
                return -ENODEV;
  
                response = usb_submit_urb(edge_serial->interrupt_read_urb,
                                                                GFP_KERNEL);
                if (response) {
-                       dev_err(&port->dev,
-                               "%s - Error %d submitting control urb\n",
-                                                       __func__, response);
+                       dev_err(dev, "%s - Error %d submitting control urb\n",
+                               __func__, response);
                }
        }
  
        response = send_iosp_ext_cmd(edge_port, IOSP_CMD_OPEN_PORT, 0);
  
        if (response < 0) {
-               dev_err(&port->dev, "%s - error sending open port command\n",
-                                                               __func__);
+               dev_err(dev, "%s - error sending open port command\n", __func__);
                edge_port->openPending = false;
                return -ENODEV;
        }
  
        if (!edge_port->open) {
                /* open timed out */
-               dbg("%s - open timedout", __func__);
+               dev_dbg(dev, "%s - open timedout\n", __func__);
                edge_port->openPending = false;
                return -ENODEV;
        }
        edge_port->txfifo.fifo  = kmalloc(edge_port->maxTxCredits, GFP_KERNEL);
  
        if (!edge_port->txfifo.fifo) {
-               dbg("%s - no memory", __func__);
+               dev_dbg(dev, "%s - no memory\n", __func__);
                edge_close(port);
                return -ENOMEM;
        }
        edge_port->write_in_progress = false;
  
        if (!edge_port->write_urb) {
-               dbg("%s - no memory", __func__);
+               dev_dbg(dev, "%s - no memory\n", __func__);
                edge_close(port);
                return -ENOMEM;
        }
  
-       dbg("%s(%d) - Initialize TX fifo to %d bytes",
-                       __func__, port->number, edge_port->maxTxCredits);
-       dbg("%s exited", __func__);
+       dev_dbg(dev, "%s(%d) - Initialize TX fifo to %d bytes\n",
+               __func__, port->number, edge_port->maxTxCredits);
  
        return 0;
  }
   ************************************************************************/
  static void block_until_chase_response(struct edgeport_port *edge_port)
  {
+       struct device *dev = &edge_port->port->dev;
        DEFINE_WAIT(wait);
        __u16 lastCredits;
        int timeout = 1*HZ;
  
                /* Did we get our Chase response */
                if (!edge_port->chaseResponsePending) {
-                       dbg("%s - Got Chase Response", __func__);
+                       dev_dbg(dev, "%s - Got Chase Response\n", __func__);
  
                        /* did we get all of our credit back? */
                        if (edge_port->txCredits == edge_port->maxTxCredits) {
-                               dbg("%s - Got all credits", __func__);
+                               dev_dbg(dev, "%s - Got all credits\n", __func__);
                                return;
                        }
                }
                        loop--;
                        if (loop == 0) {
                                edge_port->chaseResponsePending = false;
-                               dbg("%s - Chase TIMEOUT", __func__);
+                               dev_dbg(dev, "%s - Chase TIMEOUT\n", __func__);
                                return;
                        }
                } else {
                        /* Reset timeout value back to 10 seconds */
-                       dbg("%s - Last %d, Current %d", __func__,
+                       dev_dbg(dev, "%s - Last %d, Current %d\n", __func__,
                                        lastCredits, edge_port->txCredits);
                        loop = 10;
                }
   ************************************************************************/
  static void block_until_tx_empty(struct edgeport_port *edge_port)
  {
+       struct device *dev = &edge_port->port->dev;
        DEFINE_WAIT(wait);
        struct TxFifo *fifo = &edge_port->txfifo;
        __u32 lastCount;
  
                /* Is the Edgeport Buffer empty? */
                if (lastCount == 0) {
-                       dbg("%s - TX Buffer Empty", __func__);
+                       dev_dbg(dev, "%s - TX Buffer Empty\n", __func__);
                        return;
                }
  
                schedule_timeout(timeout);
                finish_wait(&edge_port->wait_chase, &wait);
  
-               dbg("%s wait", __func__);
+               dev_dbg(dev, "%s wait\n", __func__);
  
                if (lastCount == fifo->count) {
                        /* No activity.. count down. */
                        loop--;
                        if (loop == 0) {
-                               dbg("%s - TIMEOUT", __func__);
+                               dev_dbg(dev, "%s - TIMEOUT\n", __func__);
                                return;
                        }
                } else {
@@@ -1068,8 -1069,6 +1069,6 @@@ static void edge_close(struct usb_seria
        struct edgeport_port *edge_port;
        int status;
  
-       dbg("%s - port %d", __func__, port->number);
        edge_serial = usb_get_serial_data(port->serial);
        edge_port = usb_get_serial_port_data(port);
        if (edge_serial == NULL || edge_port == NULL)
                /* flush and chase */
                edge_port->chaseResponsePending = true;
  
-               dbg("%s - Sending IOSP_CMD_CHASE_PORT", __func__);
+               dev_dbg(&port->dev, "%s - Sending IOSP_CMD_CHASE_PORT\n", __func__);
                status = send_iosp_ext_cmd(edge_port, IOSP_CMD_CHASE_PORT, 0);
                if (status == 0)
                        /* block until chase finished */
            ((edge_serial->is_epic) &&
             (edge_serial->epic_descriptor.Supports.IOSPClose))) {
               /* close the port */
-               dbg("%s - Sending IOSP_CMD_CLOSE_PORT", __func__);
+               dev_dbg(&port->dev, "%s - Sending IOSP_CMD_CLOSE_PORT\n", __func__);
                send_iosp_ext_cmd(edge_port, IOSP_CMD_CLOSE_PORT, 0);
        }
  
        }
        kfree(edge_port->txfifo.fifo);
        edge_port->txfifo.fifo = NULL;
-       dbg("%s exited", __func__);
  }
  
  /*****************************************************************************
@@@ -1141,8 -1138,6 +1138,6 @@@ static int edge_write(struct tty_struc
        int secondhalf;
        unsigned long flags;
  
-       dbg("%s - port %d", __func__, port->number);
        if (edge_port == NULL)
                return -ENODEV;
  
        copySize = min((unsigned int)count,
                                (edge_port->txCredits - fifo->count));
  
-       dbg("%s(%d) of %d byte(s) Fifo room  %d -- will copy %d bytes",
-                       __func__, port->number, count,
+       dev_dbg(&port->dev, "%s(%d) of %d byte(s) Fifo room  %d -- will copy %d bytes\n",
+               __func__, port->number, count,
                        edge_port->txCredits - fifo->count, copySize);
  
        /* catch writes of 0 bytes which the tty driver likes to give us,
           and when txCredits is empty */
        if (copySize == 0) {
-               dbg("%s - copySize = Zero", __func__);
+               dev_dbg(&port->dev, "%s - copySize = Zero\n", __func__);
                goto finish_write;
        }
  
         */
        bytesleft = fifo->size - fifo->head;
        firsthalf = min(bytesleft, copySize);
-       dbg("%s - copy %d bytes of %d into fifo ", __func__,
-                                       firsthalf, bytesleft);
+       dev_dbg(&port->dev, "%s - copy %d bytes of %d into fifo \n", __func__,
+               firsthalf, bytesleft);
  
        /* now copy our data */
        memcpy(&fifo->fifo[fifo->head], data, firsthalf);
-       usb_serial_debug_data(debug, &port->dev, __func__,
-                                       firsthalf, &fifo->fifo[fifo->head]);
+       usb_serial_debug_data(&port->dev, __func__, firsthalf, &fifo->fifo[fifo->head]);
  
        /* update the index and size */
        fifo->head  += firsthalf;
        secondhalf = copySize-firsthalf;
  
        if (secondhalf) {
-               dbg("%s - copy rest of data %d", __func__, secondhalf);
+               dev_dbg(&port->dev, "%s - copy rest of data %d\n", __func__, secondhalf);
                memcpy(&fifo->fifo[fifo->head], &data[firsthalf], secondhalf);
-               usb_serial_debug_data(debug, &port->dev, __func__,
-                                       secondhalf, &fifo->fifo[fifo->head]);
+               usb_serial_debug_data(&port->dev, __func__, secondhalf, &fifo->fifo[fifo->head]);
                /* update the index and size */
                fifo->count += secondhalf;
                fifo->head  += secondhalf;
@@@ -1212,8 -1205,8 +1205,8 @@@ finish_write
        send_more_port_data((struct edgeport_serial *)
                        usb_get_serial_data(port->serial), edge_port);
  
-       dbg("%s wrote %d byte(s) TxCredits %d, Fifo %d", __func__,
-                               copySize, edge_port->txCredits, fifo->count);
+       dev_dbg(&port->dev, "%s wrote %d byte(s) TxCredits %d, Fifo %d\n",
+               __func__, copySize, edge_port->txCredits, fifo->count);
  
        return copySize;
  }
@@@ -1236,6 -1229,7 +1229,7 @@@ static void send_more_port_data(struct 
                                        struct edgeport_port *edge_port)
  {
        struct TxFifo   *fifo = &edge_port->txfifo;
+       struct device   *dev = &edge_port->port->dev;
        struct urb      *urb;
        unsigned char   *buffer;
        int             status;
        int             secondhalf;
        unsigned long   flags;
  
-       dbg("%s(%d)", __func__, edge_port->port->number);
        spin_lock_irqsave(&edge_port->ep_lock, flags);
  
        if (edge_port->write_in_progress ||
            !edge_port->open             ||
            (fifo->count == 0)) {
-               dbg("%s(%d) EXIT - fifo %d, PendingWrite = %d",
-                               __func__, edge_port->port->number,
-                               fifo->count, edge_port->write_in_progress);
+               dev_dbg(dev, "%s(%d) EXIT - fifo %d, PendingWrite = %d\n",
+                       __func__, edge_port->port->number,
+                       fifo->count, edge_port->write_in_progress);
                goto exit_send;
        }
  
         * it's better to wait for more credits so we can do a larger write.
         */
        if (edge_port->txCredits < EDGE_FW_GET_TX_CREDITS_SEND_THRESHOLD(edge_port->maxTxCredits, EDGE_FW_BULK_MAX_PACKET_SIZE)) {
-               dbg("%s(%d) Not enough credit - fifo %d TxCredit %d",
+               dev_dbg(dev, "%s(%d) Not enough credit - fifo %d TxCredit %d\n",
                        __func__, edge_port->port->number, fifo->count,
                        edge_port->txCredits);
                goto exit_send;
        }
  
        if (count)
-               usb_serial_debug_data(debug, &edge_port->port->dev,
-                                               __func__, count, &buffer[2]);
+               usb_serial_debug_data(&edge_port->port->dev, __func__, count, &buffer[2]);
  
        /* fill up the urb with all of our data and submit it */
        usb_fill_bulk_urb(urb, edge_serial->serial->dev,
                edge_port->txCredits += count;
                edge_port->icount.tx -= count;
        }
-       dbg("%s wrote %d byte(s) TxCredit %d, Fifo %d",
-                       __func__, count, edge_port->txCredits, fifo->count);
+       dev_dbg(dev, "%s wrote %d byte(s) TxCredit %d, Fifo %d\n",
+               __func__, count, edge_port->txCredits, fifo->count);
  
  exit_send:
        spin_unlock_irqrestore(&edge_port->ep_lock, flags);
@@@ -1363,17 -1354,13 +1354,13 @@@ static int edge_write_room(struct tty_s
        int room;
        unsigned long flags;
  
-       dbg("%s", __func__);
        if (edge_port == NULL)
                return 0;
        if (edge_port->closePending)
                return 0;
  
-       dbg("%s - port %d", __func__, port->number);
        if (!edge_port->open) {
-               dbg("%s - port not opened", __func__);
+               dev_dbg(&port->dev, "%s - port not opened\n", __func__);
                return 0;
        }
  
        room = edge_port->txCredits - edge_port->txfifo.count;
        spin_unlock_irqrestore(&edge_port->ep_lock, flags);
  
-       dbg("%s - returns %d", __func__, room);
+       dev_dbg(&port->dev, "%s - returns %d\n", __func__, room);
        return room;
  }
  
@@@ -1403,15 -1390,13 +1390,13 @@@ static int edge_chars_in_buffer(struct 
        int num_chars;
        unsigned long flags;
  
-       dbg("%s", __func__);
        if (edge_port == NULL)
                return 0;
        if (edge_port->closePending)
                return 0;
  
        if (!edge_port->open) {
-               dbg("%s - port not opened", __func__);
+               dev_dbg(&port->dev, "%s - port not opened\n", __func__);
                return 0;
        }
  
                                                edge_port->txfifo.count;
        spin_unlock_irqrestore(&edge_port->ep_lock, flags);
        if (num_chars) {
-               dbg("%s(port %d) - returns %d", __func__,
-                                               port->number, num_chars);
+               dev_dbg(&port->dev, "%s(port %d) - returns %d\n", __func__,
+                       port->number, num_chars);
        }
  
        return num_chars;
@@@ -1439,13 -1424,11 +1424,11 @@@ static void edge_throttle(struct tty_st
        struct edgeport_port *edge_port = usb_get_serial_port_data(port);
        int status;
  
-       dbg("%s - port %d", __func__, port->number);
        if (edge_port == NULL)
                return;
  
        if (!edge_port->open) {
-               dbg("%s - port not opened", __func__);
+               dev_dbg(&port->dev, "%s - port not opened\n", __func__);
                return;
        }
  
        }
  
        /* if we are implementing RTS/CTS, toggle that line */
 -      if (tty->termios->c_cflag & CRTSCTS) {
 +      if (tty->termios.c_cflag & CRTSCTS) {
                edge_port->shadowMCR &= ~MCR_RTS;
                status = send_cmd_write_uart_register(edge_port, MCR,
                                                        edge_port->shadowMCR);
@@@ -1479,13 -1462,11 +1462,11 @@@ static void edge_unthrottle(struct tty_
        struct edgeport_port *edge_port = usb_get_serial_port_data(port);
        int status;
  
-       dbg("%s - port %d", __func__, port->number);
        if (edge_port == NULL)
                return;
  
        if (!edge_port->open) {
-               dbg("%s - port not opened", __func__);
+               dev_dbg(&port->dev, "%s - port not opened\n", __func__);
                return;
        }
  
                        return;
        }
        /* if we are implementing RTS/CTS, toggle that line */
 -      if (tty->termios->c_cflag & CRTSCTS) {
 +      if (tty->termios.c_cflag & CRTSCTS) {
                edge_port->shadowMCR |= MCR_RTS;
                send_cmd_write_uart_register(edge_port, MCR,
                                                edge_port->shadowMCR);
@@@ -1516,19 -1497,15 +1497,15 @@@ static void edge_set_termios(struct tty
        struct edgeport_port *edge_port = usb_get_serial_port_data(port);
        unsigned int cflag;
  
 -      cflag = tty->termios->c_cflag;
 -      dev_dbg(&port->dev, "%s - clfag %08x iflag %08x\n", __func__, tty->termios->c_cflag, tty->termios->c_iflag);
 +      cflag = tty->termios.c_cflag;
-       dbg("%s - clfag %08x iflag %08x", __func__,
-           tty->termios.c_cflag, tty->termios.c_iflag);
-       dbg("%s - old clfag %08x old iflag %08x", __func__,
-           old_termios->c_cflag, old_termios->c_iflag);
-       dbg("%s - port %d", __func__, port->number);
++      dev_dbg(&port->dev, "%s - clfag %08x iflag %08x\n", __func__, tty->termios.c_cflag, tty->termios.c_iflag);
+       dev_dbg(&port->dev, "%s - old clfag %08x old iflag %08x\n", __func__, old_termios->c_cflag, old_termios->c_iflag);
  
        if (edge_port == NULL)
                return;
  
        if (!edge_port->open) {
-               dbg("%s - port not opened", __func__);
+               dev_dbg(&port->dev, "%s - port not opened\n", __func__);
                return;
        }
  
@@@ -1556,7 -1533,7 +1533,7 @@@ static int get_lsr_info(struct edgeport
        spin_lock_irqsave(&edge_port->ep_lock, flags);
        if (edge_port->maxTxCredits == edge_port->txCredits &&
            edge_port->txfifo.count == 0) {
-               dbg("%s -- Empty", __func__);
+               dev_dbg(&edge_port->port->dev, "%s -- Empty\n", __func__);
                result = TIOCSER_TEMT;
        }
        spin_unlock_irqrestore(&edge_port->ep_lock, flags);
@@@ -1573,8 -1550,6 +1550,6 @@@ static int edge_tiocmset(struct tty_str
        struct edgeport_port *edge_port = usb_get_serial_port_data(port);
        unsigned int mcr;
  
-       dbg("%s - port %d", __func__, port->number);
        mcr = edge_port->shadowMCR;
        if (set & TIOCM_RTS)
                mcr |= MCR_RTS;
@@@ -1605,8 -1580,6 +1580,6 @@@ static int edge_tiocmget(struct tty_str
        unsigned int msr;
        unsigned int mcr;
  
-       dbg("%s - port %d", __func__, port->number);
        msr = edge_port->shadowMSR;
        mcr = edge_port->shadowMCR;
        result = ((mcr & MCR_DTR)       ? TIOCM_DTR: 0)   /* 0x002 */
                  | ((msr & EDGEPORT_MSR_RI)    ? TIOCM_RI:  0)   /* 0x080 */
                  | ((msr & EDGEPORT_MSR_DSR)   ? TIOCM_DSR: 0);  /* 0x100 */
  
-       dbg("%s -- %x", __func__, result);
        return result;
  }
  
@@@ -1642,8 -1612,8 +1612,8 @@@ static int edge_get_icount(struct tty_s
        icount->brk = cnow.brk;
        icount->buf_overrun = cnow.buf_overrun;
  
-       dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d",
-                       __func__,  port->number, icount->rx, icount->tx);
+       dev_dbg(&port->dev, "%s (%d) TIOCGICOUNT RX=%d, TX=%d\n", __func__,
+               port->number, icount->rx, icount->tx);
        return 0;
  }
  
@@@ -1686,19 -1656,19 +1656,19 @@@ static int edge_ioctl(struct tty_struc
        struct async_icount cnow;
        struct async_icount cprev;
  
-       dbg("%s - port %d, cmd = 0x%x", __func__, port->number, cmd);
+       dev_dbg(&port->dev, "%s - port %d, cmd = 0x%x\n", __func__, port->number, cmd);
  
        switch (cmd) {
        case TIOCSERGETLSR:
-               dbg("%s (%d) TIOCSERGETLSR", __func__,  port->number);
+               dev_dbg(&port->dev, "%s (%d) TIOCSERGETLSR\n", __func__,  port->number);
                return get_lsr_info(edge_port, (unsigned int __user *) arg);
  
        case TIOCGSERIAL:
-               dbg("%s (%d) TIOCGSERIAL", __func__,  port->number);
+               dev_dbg(&port->dev, "%s (%d) TIOCGSERIAL\n", __func__,  port->number);
                return get_serial_info(edge_port, (struct serial_struct __user *) arg);
  
        case TIOCMIWAIT:
-               dbg("%s (%d) TIOCMIWAIT", __func__,  port->number);
+               dev_dbg(&port->dev, "%s (%d) TIOCMIWAIT\n", __func__,  port->number);
                cprev = edge_port->icount;
                while (1) {
                        prepare_to_wait(&edge_port->delta_msr_wait,
@@@ -1745,7 -1715,7 +1715,7 @@@ static void edge_break(struct tty_struc
                /* flush and chase */
                edge_port->chaseResponsePending = true;
  
-               dbg("%s - Sending IOSP_CMD_CHASE_PORT", __func__);
+               dev_dbg(&port->dev, "%s - Sending IOSP_CMD_CHASE_PORT\n", __func__);
                status = send_iosp_ext_cmd(edge_port, IOSP_CMD_CHASE_PORT, 0);
                if (status == 0) {
                        /* block until chase finished */
            ((edge_serial->is_epic) &&
             (edge_serial->epic_descriptor.Supports.IOSPSetClrBreak))) {
                if (break_state == -1) {
-                       dbg("%s - Sending IOSP_CMD_SET_BREAK", __func__);
+                       dev_dbg(&port->dev, "%s - Sending IOSP_CMD_SET_BREAK\n", __func__);
                        status = send_iosp_ext_cmd(edge_port,
                                                IOSP_CMD_SET_BREAK, 0);
                } else {
-                       dbg("%s - Sending IOSP_CMD_CLEAR_BREAK", __func__);
+                       dev_dbg(&port->dev, "%s - Sending IOSP_CMD_CLEAR_BREAK\n", __func__);
                        status = send_iosp_ext_cmd(edge_port,
                                                IOSP_CMD_CLEAR_BREAK, 0);
                }
                if (status)
-                       dbg("%s - error sending break set/clear command.",
+                       dev_dbg(&port->dev, "%s - error sending break set/clear command.\n",
                                __func__);
        }
  }
  static void process_rcvd_data(struct edgeport_serial *edge_serial,
                                unsigned char *buffer, __u16 bufferLength)
  {
+       struct device *dev = &edge_serial->serial->dev->dev;
        struct usb_serial_port *port;
        struct edgeport_port *edge_port;
        struct tty_struct *tty;
        __u16 lastBufferLength;
        __u16 rxLen;
  
-       dbg("%s", __func__);
        lastBufferLength = bufferLength + 1;
  
        while (bufferLength > 0) {
                /* failsafe incase we get a message that we don't understand */
                if (lastBufferLength == bufferLength) {
-                       dbg("%s - stuck in loop, exiting it.", __func__);
+                       dev_dbg(dev, "%s - stuck in loop, exiting it.\n", __func__);
                        break;
                }
                lastBufferLength = bufferLength;
                        ++buffer;
                        --bufferLength;
  
-                       dbg("%s - Hdr1=%02X Hdr2=%02X", __func__,
-                           edge_serial->rxHeader1, edge_serial->rxHeader2);
+                       dev_dbg(dev, "%s - Hdr1=%02X Hdr2=%02X\n", __func__,
+                               edge_serial->rxHeader1, edge_serial->rxHeader2);
                        /* Process depending on whether this header is
                         * data or status */
  
                                    IOSP_GET_HDR_DATA_LEN(
                                                edge_serial->rxHeader1,
                                                edge_serial->rxHeader2);
-                               dbg("%s - Data for Port %u Len %u",
-                                               __func__,
-                                               edge_serial->rxPort,
-                                               edge_serial->rxBytesRemaining);
+                               dev_dbg(dev, "%s - Data for Port %u Len %u\n",
+                                       __func__,
+                                       edge_serial->rxPort,
+                                       edge_serial->rxBytesRemaining);
  
                                /* ASSERT(DevExt->RxPort < DevExt->NumPorts);
                                 * ASSERT(DevExt->RxBytesRemaining <
                                        tty = tty_port_tty_get(
                                                &edge_port->port->port);
                                        if (tty) {
-                                               dbg("%s - Sending %d bytes to TTY for port %d",
+                                               dev_dbg(dev, "%s - Sending %d bytes to TTY for port %d\n",
                                                        __func__, rxLen, edge_serial->rxPort);
                                                edge_tty_recv(&edge_serial->serial->dev->dev, tty, buffer, rxLen);
                                                tty_kref_put(tty);
@@@ -1935,6 -1904,7 +1904,7 @@@ static void process_rcvd_status(struct 
        struct usb_serial_port *port;
        struct edgeport_port *edge_port;
        struct tty_struct *tty;
+       struct device *dev;
        __u8 code = edge_serial->rxStatusCode;
  
        /* switch the port pointer to the one being currently talked about */
                                        __func__, edge_serial->rxPort);
                return;
        }
-       dbg("%s - port %d", __func__, edge_serial->rxPort);
+       dev = &port->dev;
  
        if (code == IOSP_EXT_STATUS) {
                switch (byte2) {
                case IOSP_EXT_STATUS_CHASE_RSP:
                        /* we want to do EXT status regardless of port
                         * open/closed */
-                       dbg("%s - Port %u EXT CHASE_RSP Data = %02x",
-                                       __func__, edge_serial->rxPort, byte3);
+                       dev_dbg(dev, "%s - Port %u EXT CHASE_RSP Data = %02x\n",
+                               __func__, edge_serial->rxPort, byte3);
                        /* Currently, the only EXT_STATUS is Chase, so process
                         * here instead of one more call to one more subroutine
                         * If/when more EXT_STATUS, there'll be more work to do
                        return;
  
                case IOSP_EXT_STATUS_RX_CHECK_RSP:
-                       dbg("%s ========== Port %u CHECK_RSP Sequence = %02x =============", __func__, edge_serial->rxPort, byte3);
+                       dev_dbg(dev, "%s ========== Port %u CHECK_RSP Sequence = %02x =============\n",
+                               __func__, edge_serial->rxPort, byte3);
                        /* Port->RxCheckRsp = true; */
                        return;
                }
        if (code == IOSP_STATUS_OPEN_RSP) {
                edge_port->txCredits = GET_TX_BUFFER_SIZE(byte3);
                edge_port->maxTxCredits = edge_port->txCredits;
-               dbg("%s - Port %u Open Response Initial MSR = %02x TxBufferSize = %d", __func__, edge_serial->rxPort, byte2, edge_port->txCredits);
+               dev_dbg(dev, "%s - Port %u Open Response Initial MSR = %02x TxBufferSize = %d\n",
+                       __func__, edge_serial->rxPort, byte2, edge_port->txCredits);
                handle_new_msr(edge_port, byte2);
  
                /* send the current line settings to the port so we are
                tty = tty_port_tty_get(&edge_port->port->port);
                if (tty) {
                        change_port_settings(tty,
 -                              edge_port, tty->termios);
 +                              edge_port, &tty->termios);
                        tty_kref_put(tty);
                }
  
        switch (code) {
        /* Not currently sent by Edgeport */
        case IOSP_STATUS_LSR:
-               dbg("%s - Port %u LSR Status = %02x",
-                                       __func__, edge_serial->rxPort, byte2);
+               dev_dbg(dev, "%s - Port %u LSR Status = %02x\n",
+                       __func__, edge_serial->rxPort, byte2);
                handle_new_lsr(edge_port, false, byte2, 0);
                break;
  
        case IOSP_STATUS_LSR_DATA:
-               dbg("%s - Port %u LSR Status = %02x, Data = %02x",
-                               __func__, edge_serial->rxPort, byte2, byte3);
+               dev_dbg(dev, "%s - Port %u LSR Status = %02x, Data = %02x\n",
+                       __func__, edge_serial->rxPort, byte2, byte3);
                /* byte2 is LSR Register */
                /* byte3 is broken data byte */
                handle_new_lsr(edge_port, true, byte2, byte3);
                break;
        /*
         *      case IOSP_EXT_4_STATUS:
-        *              dbg("%s - Port %u LSR Status = %02x Data = %02x",
+        *              dev_dbg(dev, "%s - Port %u LSR Status = %02x Data = %02x\n",
         *                      __func__, edge_serial->rxPort, byte2, byte3);
         *              break;
         */
        case IOSP_STATUS_MSR:
-               dbg("%s - Port %u MSR Status = %02x",
-                                       __func__, edge_serial->rxPort, byte2);
+               dev_dbg(dev, "%s - Port %u MSR Status = %02x\n",
+                       __func__, edge_serial->rxPort, byte2);
                /*
                 * Process this new modem status and generate appropriate
                 * events, etc, based on the new status. This routine
                break;
  
        default:
-               dbg("%s - Unrecognized IOSP status code %u", __func__, code);
+               dev_dbg(dev, "%s - Unrecognized IOSP status code %u\n", __func__, code);
                break;
        }
  }
@@@ -2073,8 -2044,6 +2044,6 @@@ static void handle_new_msr(struct edgep
  {
        struct  async_icount *icount;
  
-       dbg("%s %02x", __func__, newMsr);
        if (newMsr & (EDGEPORT_MSR_DELTA_CTS | EDGEPORT_MSR_DELTA_DSR |
                        EDGEPORT_MSR_DELTA_RI | EDGEPORT_MSR_DELTA_CD)) {
                icount = &edge_port->icount;
@@@ -2107,8 -2076,6 +2076,6 @@@ static void handle_new_lsr(struct edgep
                (LSR_OVER_ERR | LSR_PAR_ERR | LSR_FRM_ERR | LSR_BREAK));
        struct async_icount *icount;
  
-       dbg("%s - %02x", __func__, newLsr);
        edge_port->shadowLSR = lsr;
  
        if (newLsr & LSR_BREAK) {
@@@ -2156,7 -2123,7 +2123,7 @@@ static int sram_write(struct usb_seria
        __u16 current_length;
        unsigned char *transfer_buffer;
  
-       dbg("%s - %x, %x, %d", __func__, extAddr, addr, length);
+       dev_dbg(&serial->dev->dev, "%s - %x, %x, %d\n", __func__, extAddr, addr, length);
  
        transfer_buffer =  kmalloc(64, GFP_KERNEL);
        if (!transfer_buffer) {
                else
                        current_length = length;
  
- /*            dbg("%s - writing %x, %x, %d", __func__,
-                                       extAddr, addr, current_length); */
+ /*            dev_dbg(&serial->dev->dev, "%s - writing %x, %x, %d\n", __func__, extAddr, addr, current_length); */
                memcpy(transfer_buffer, data, current_length);
                result = usb_control_msg(serial->dev,
                                        usb_sndctrlpipe(serial->dev, 0),
@@@ -2207,8 -2173,6 +2173,6 @@@ static int rom_write(struct usb_serial 
        __u16 current_length;
        unsigned char *transfer_buffer;
  
- /*    dbg("%s - %x, %x, %d", __func__, extAddr, addr, length); */
        transfer_buffer =  kmalloc(64, GFP_KERNEL);
        if (!transfer_buffer) {
                dev_err(&serial->dev->dev, "%s - kmalloc(%d) failed.\n",
                        current_length = 64;
                else
                        current_length = length;
- /*            dbg("%s - writing %x, %x, %d", __func__,
-                                       extAddr, addr, current_length); */
                memcpy(transfer_buffer, data, current_length);
                result = usb_control_msg(serial->dev,
                                        usb_sndctrlpipe(serial->dev, 0),
@@@ -2257,8 -2219,6 +2219,6 @@@ static int rom_read(struct usb_serial *
        __u16 current_length;
        unsigned char *transfer_buffer;
  
-       dbg("%s - %x, %x, %d", __func__, extAddr, addr, length);
        transfer_buffer =  kmalloc(64, GFP_KERNEL);
        if (!transfer_buffer) {
                dev_err(&serial->dev->dev,
                        current_length = 64;
                else
                        current_length = length;
- /*            dbg("%s - %x, %x, %d", __func__,
-                               extAddr, addr, current_length); */
                result = usb_control_msg(serial->dev,
                                        usb_rcvctrlpipe(serial->dev, 0),
                                        USB_REQUEST_ION_READ_ROM,
@@@ -2305,8 -2263,6 +2263,6 @@@ static int send_iosp_ext_cmd(struct edg
        int             length = 0;
        int             status = 0;
  
-       dbg("%s - %d, %d", __func__, command, param);
        buffer = kmalloc(10, GFP_ATOMIC);
        if (!buffer) {
                dev_err(&edge_port->port->dev,
@@@ -2339,11 -2295,11 +2295,11 @@@ static int write_cmd_usb(struct edgepor
  {
        struct edgeport_serial *edge_serial =
                                usb_get_serial_data(edge_port->port->serial);
+       struct device *dev = &edge_port->port->dev;
        int status = 0;
        struct urb *urb;
  
-       usb_serial_debug_data(debug, &edge_port->port->dev,
-                                               __func__, length, buffer);
+       usb_serial_debug_data(dev, __func__, length, buffer);
  
        /* Allocate our next urb */
        urb = usb_alloc_urb(0, GFP_ATOMIC);
                return -ENOMEM;
  
        atomic_inc(&CmdUrbs);
-       dbg("%s - ALLOCATE URB %p (outstanding %d)",
-                               __func__, urb, atomic_read(&CmdUrbs));
+       dev_dbg(dev, "%s - ALLOCATE URB %p (outstanding %d)\n",
+               __func__, urb, atomic_read(&CmdUrbs));
  
        usb_fill_bulk_urb(urb, edge_serial->serial->dev,
                        usb_sndbulkpipe(edge_serial->serial->dev,
  
        if (status) {
                /* something went wrong */
-               dev_err(&edge_port->port->dev,
-                   "%s - usb_submit_urb(write command) failed, status = %d\n",
-                                                       __func__, status);
+               dev_err(dev, "%s - usb_submit_urb(write command) failed, status = %d\n",
+                       __func__, status);
                usb_kill_urb(urb);
                usb_free_urb(urb);
                atomic_dec(&CmdUrbs);
  
        if (edge_port->commandPending) {
                /* command timed out */
-               dbg("%s - command timed out", __func__);
+               dev_dbg(dev, "%s - command timed out\n", __func__);
                status = -EINVAL;
        }
  #endif
@@@ -2396,6 -2351,7 +2351,7 @@@ static int send_cmd_write_baud_rate(str
  {
        struct edgeport_serial *edge_serial =
                                usb_get_serial_data(edge_port->port->serial);
+       struct device *dev = &edge_port->port->dev;
        unsigned char *cmdBuffer;
        unsigned char *currCmd;
        int cmdLen = 0;
  
        if (edge_serial->is_epic &&
            !edge_serial->epic_descriptor.Supports.IOSPSetBaudRate) {
-               dbg("SendCmdWriteBaudRate - NOT Setting baud rate for port = %d, baud = %d",
-                   edge_port->port->number, baudRate);
+               dev_dbg(dev, "SendCmdWriteBaudRate - NOT Setting baud rate for port = %d, baud = %d\n",
+                       edge_port->port->number, baudRate);
                return 0;
        }
  
-       dbg("%s - port = %d, baud = %d", __func__,
-                                       edge_port->port->number, baudRate);
+       dev_dbg(dev, "%s - port = %d, baud = %d\n", __func__,
+               edge_port->port->number, baudRate);
  
-       status = calc_baud_rate_divisor(baudRate, &divisor);
+       status = calc_baud_rate_divisor(dev, baudRate, &divisor);
        if (status) {
-               dev_err(&edge_port->port->dev, "%s - bad baud rate\n",
-                                                               __func__);
+               dev_err(dev, "%s - bad baud rate\n", __func__);
                return status;
        }
  
        /* Alloc memory for the string of commands. */
        cmdBuffer =  kmalloc(0x100, GFP_ATOMIC);
        if (!cmdBuffer) {
-               dev_err(&edge_port->port->dev,
-                       "%s - kmalloc(%d) failed.\n", __func__, 0x100);
+               dev_err(dev, "%s - kmalloc(%d) failed.\n", __func__, 0x100);
                return -ENOMEM;
        }
        currCmd = cmdBuffer;
   *    this function calculates the proper baud rate divisor for the specified
   *    baud rate.
   *****************************************************************************/
- static int calc_baud_rate_divisor(int baudrate, int *divisor)
+ static int calc_baud_rate_divisor(struct device *dev, int baudrate, int *divisor)
  {
        int i;
        __u16 custom;
  
-       dbg("%s - %d", __func__, baudrate);
        for (i = 0; i < ARRAY_SIZE(divisor_table); i++) {
                if (divisor_table[i].BaudRate == baudrate) {
                        *divisor = divisor_table[i].Divisor;
  
                *divisor = custom;
  
-               dbg("%s - Baud %d = %d", __func__, baudrate, custom);
+               dev_dbg(dev, "%s - Baud %d = %d\n", __func__, baudrate, custom);
                return 0;
        }
  
@@@ -2497,25 -2448,26 +2448,26 @@@ static int send_cmd_write_uart_register
  {
        struct edgeport_serial *edge_serial =
                                usb_get_serial_data(edge_port->port->serial);
+       struct device *dev = &edge_port->port->dev;
        unsigned char *cmdBuffer;
        unsigned char *currCmd;
        unsigned long cmdLen = 0;
        int status;
  
-       dbg("%s - write to %s register 0x%02x",
-                       (regNum == MCR) ? "MCR" : "LCR", __func__, regValue);
+       dev_dbg(dev, "%s - write to %s register 0x%02x\n",
+               (regNum == MCR) ? "MCR" : "LCR", __func__, regValue);
  
        if (edge_serial->is_epic &&
            !edge_serial->epic_descriptor.Supports.IOSPWriteMCR &&
            regNum == MCR) {
-               dbg("SendCmdWriteUartReg - Not writing to MCR Register");
+               dev_dbg(dev, "SendCmdWriteUartReg - Not writing to MCR Register\n");
                return 0;
        }
  
        if (edge_serial->is_epic &&
            !edge_serial->epic_descriptor.Supports.IOSPWriteLCR &&
            regNum == LCR) {
-               dbg("SendCmdWriteUartReg - Not writing to LCR Register");
+               dev_dbg(dev, "SendCmdWriteUartReg - Not writing to LCR Register\n");
                return 0;
        }
  
  static void change_port_settings(struct tty_struct *tty,
        struct edgeport_port *edge_port, struct ktermios *old_termios)
  {
+       struct device *dev = &edge_port->port->dev;
        struct edgeport_serial *edge_serial =
                        usb_get_serial_data(edge_port->port->serial);
        int baud;
        __u8 txFlow;
        int status;
  
-       dbg("%s - port %d", __func__, edge_port->port->number);
+       dev_dbg(dev, "%s - port %d\n", __func__, edge_port->port->number);
  
        if (!edge_port->open &&
            !edge_port->openPending) {
-               dbg("%s - port not opened", __func__);
+               dev_dbg(dev, "%s - port not opened\n", __func__);
                return;
        }
  
 -      cflag = tty->termios->c_cflag;
 +      cflag = tty->termios.c_cflag;
  
        switch (cflag & CSIZE) {
        case CS5:
                lData = LCR_BITS_5; mask = 0x1f;
-               dbg("%s - data bits = 5", __func__);
+               dev_dbg(dev, "%s - data bits = 5\n", __func__);
                break;
        case CS6:
                lData = LCR_BITS_6; mask = 0x3f;
-               dbg("%s - data bits = 6", __func__);
+               dev_dbg(dev, "%s - data bits = 6\n", __func__);
                break;
        case CS7:
                lData = LCR_BITS_7; mask = 0x7f;
-               dbg("%s - data bits = 7", __func__);
+               dev_dbg(dev, "%s - data bits = 7\n", __func__);
                break;
        default:
        case CS8:
                lData = LCR_BITS_8;
-               dbg("%s - data bits = 8", __func__);
+               dev_dbg(dev, "%s - data bits = 8\n", __func__);
                break;
        }
  
                if (cflag & CMSPAR) {
                        if (cflag & PARODD) {
                                lParity = LCR_PAR_MARK;
-                               dbg("%s - parity = mark", __func__);
+                               dev_dbg(dev, "%s - parity = mark\n", __func__);
                        } else {
                                lParity = LCR_PAR_SPACE;
-                               dbg("%s - parity = space", __func__);
+                               dev_dbg(dev, "%s - parity = space\n", __func__);
                        }
                } else if (cflag & PARODD) {
                        lParity = LCR_PAR_ODD;
-                       dbg("%s - parity = odd", __func__);
+                       dev_dbg(dev, "%s - parity = odd\n", __func__);
                } else {
                        lParity = LCR_PAR_EVEN;
-                       dbg("%s - parity = even", __func__);
+                       dev_dbg(dev, "%s - parity = even\n", __func__);
                }
        } else {
-               dbg("%s - parity = none", __func__);
+               dev_dbg(dev, "%s - parity = none\n", __func__);
        }
  
        if (cflag & CSTOPB) {
                lStop = LCR_STOP_2;
-               dbg("%s - stop bits = 2", __func__);
+               dev_dbg(dev, "%s - stop bits = 2\n", __func__);
        } else {
                lStop = LCR_STOP_1;
-               dbg("%s - stop bits = 1", __func__);
+               dev_dbg(dev, "%s - stop bits = 1\n", __func__);
        }
  
        /* figure out the flow control settings */
        if (cflag & CRTSCTS) {
                rxFlow |= IOSP_RX_FLOW_RTS;
                txFlow |= IOSP_TX_FLOW_CTS;
-               dbg("%s - RTS/CTS is enabled", __func__);
+               dev_dbg(dev, "%s - RTS/CTS is enabled\n", __func__);
        } else {
-               dbg("%s - RTS/CTS is disabled", __func__);
+               dev_dbg(dev, "%s - RTS/CTS is disabled\n", __func__);
        }
  
        /* if we are implementing XON/XOFF, set the start and stop character
                /* if we are implementing INBOUND XON/XOFF */
                if (I_IXOFF(tty)) {
                        rxFlow |= IOSP_RX_FLOW_XON_XOFF;
-                       dbg("%s - INBOUND XON/XOFF is enabled, XON = %2x, XOFF = %2x",
-                                       __func__, start_char, stop_char);
+                       dev_dbg(dev, "%s - INBOUND XON/XOFF is enabled, XON = %2x, XOFF = %2x\n",
+                               __func__, start_char, stop_char);
                } else {
-                       dbg("%s - INBOUND XON/XOFF is disabled", __func__);
+                       dev_dbg(dev, "%s - INBOUND XON/XOFF is disabled\n", __func__);
                }
  
                /* if we are implementing OUTBOUND XON/XOFF */
                if (I_IXON(tty)) {
                        txFlow |= IOSP_TX_FLOW_XON_XOFF;
-                       dbg("%s - OUTBOUND XON/XOFF is enabled, XON = %2x, XOFF = %2x",
-                                       __func__, start_char, stop_char);
+                       dev_dbg(dev, "%s - OUTBOUND XON/XOFF is enabled, XON = %2x, XOFF = %2x\n",
+                               __func__, start_char, stop_char);
                } else {
-                       dbg("%s - OUTBOUND XON/XOFF is disabled", __func__);
+                       dev_dbg(dev, "%s - OUTBOUND XON/XOFF is disabled\n", __func__);
                }
        }
  
                baud = 9600;
        }
  
-       dbg("%s - baud rate = %d", __func__, baud);
+       dev_dbg(dev, "%s - baud rate = %d\n", __func__, baud);
        status = send_cmd_write_baud_rate(edge_port, baud);
        if (status == -1) {
                /* Speed change was not possible - put back the old speed */
@@@ -2746,9 -2699,10 +2699,10 @@@ static void unicode_to_ascii(char *stri
   ****************************************************************************/
  static void get_manufacturing_desc(struct edgeport_serial *edge_serial)
  {
+       struct device *dev = &edge_serial->serial->dev->dev;
        int response;
  
-       dbg("getting manufacturer descriptor");
+       dev_dbg(dev, "getting manufacturer descriptor\n");
  
        response = rom_read(edge_serial->serial,
                                (EDGE_MANUF_DESC_ADDR & 0xffff0000) >> 16,
                                (__u8 *)(&edge_serial->manuf_descriptor));
  
        if (response < 1)
-               dev_err(&edge_serial->serial->dev->dev,
-                       "error in getting manufacturer descriptor\n");
+               dev_err(dev, "error in getting manufacturer descriptor\n");
        else {
                char string[30];
-               dbg("**Manufacturer Descriptor");
-               dbg("  RomSize:        %dK",
+               dev_dbg(dev, "**Manufacturer Descriptor\n");
+               dev_dbg(dev, "  RomSize:        %dK\n",
                        edge_serial->manuf_descriptor.RomSize);
-               dbg("  RamSize:        %dK",
+               dev_dbg(dev, "  RamSize:        %dK\n",
                        edge_serial->manuf_descriptor.RamSize);
-               dbg("  CpuRev:         %d",
+               dev_dbg(dev, "  CpuRev:         %d\n",
                        edge_serial->manuf_descriptor.CpuRev);
-               dbg("  BoardRev:       %d",
+               dev_dbg(dev, "  BoardRev:       %d\n",
                        edge_serial->manuf_descriptor.BoardRev);
-               dbg("  NumPorts:       %d",
+               dev_dbg(dev, "  NumPorts:       %d\n",
                        edge_serial->manuf_descriptor.NumPorts);
-               dbg("  DescDate:       %d/%d/%d",
+               dev_dbg(dev, "  DescDate:       %d/%d/%d\n",
                        edge_serial->manuf_descriptor.DescDate[0],
                        edge_serial->manuf_descriptor.DescDate[1],
                        edge_serial->manuf_descriptor.DescDate[2]+1900);
                unicode_to_ascii(string, sizeof(string),
                        edge_serial->manuf_descriptor.SerialNumber,
                        edge_serial->manuf_descriptor.SerNumLength/2);
-               dbg("  SerialNumber: %s", string);
+               dev_dbg(dev, "  SerialNumber: %s\n", string);
                unicode_to_ascii(string, sizeof(string),
                        edge_serial->manuf_descriptor.AssemblyNumber,
                        edge_serial->manuf_descriptor.AssemblyNumLength/2);
-               dbg("  AssemblyNumber: %s", string);
+               dev_dbg(dev, "  AssemblyNumber: %s\n", string);
                unicode_to_ascii(string, sizeof(string),
                    edge_serial->manuf_descriptor.OemAssyNumber,
                    edge_serial->manuf_descriptor.OemAssyNumLength/2);
-               dbg("  OemAssyNumber:  %s", string);
-               dbg("  UartType:       %d",
+               dev_dbg(dev, "  OemAssyNumber:  %s\n", string);
+               dev_dbg(dev, "  UartType:       %d\n",
                        edge_serial->manuf_descriptor.UartType);
-               dbg("  IonPid:         %d",
+               dev_dbg(dev, "  IonPid:         %d\n",
                        edge_serial->manuf_descriptor.IonPid);
-               dbg("  IonConfig:      %d",
+               dev_dbg(dev, "  IonConfig:      %d\n",
                        edge_serial->manuf_descriptor.IonConfig);
        }
  }
   ****************************************************************************/
  static void get_boot_desc(struct edgeport_serial *edge_serial)
  {
+       struct device *dev = &edge_serial->serial->dev->dev;
        int response;
  
-       dbg("getting boot descriptor");
+       dev_dbg(dev, "getting boot descriptor\n");
  
        response = rom_read(edge_serial->serial,
                                (EDGE_BOOT_DESC_ADDR & 0xffff0000) >> 16,
                                (__u8 *)(&edge_serial->boot_descriptor));
  
        if (response < 1)
-               dev_err(&edge_serial->serial->dev->dev,
-                               "error in getting boot descriptor\n");
+               dev_err(dev, "error in getting boot descriptor\n");
        else {
-               dbg("**Boot Descriptor:");
-               dbg("  BootCodeLength: %d",
-                   le16_to_cpu(edge_serial->boot_descriptor.BootCodeLength));
-               dbg("  MajorVersion:   %d",
+               dev_dbg(dev, "**Boot Descriptor:\n");
+               dev_dbg(dev, "  BootCodeLength: %d\n",
+                       le16_to_cpu(edge_serial->boot_descriptor.BootCodeLength));
+               dev_dbg(dev, "  MajorVersion:   %d\n",
                        edge_serial->boot_descriptor.MajorVersion);
-               dbg("  MinorVersion:   %d",
+               dev_dbg(dev, "  MinorVersion:   %d\n",
                        edge_serial->boot_descriptor.MinorVersion);
-               dbg("  BuildNumber:    %d",
+               dev_dbg(dev, "  BuildNumber:    %d\n",
                        le16_to_cpu(edge_serial->boot_descriptor.BuildNumber));
-               dbg("  Capabilities:   0x%x",
+               dev_dbg(dev, "  Capabilities:   0x%x\n",
                      le16_to_cpu(edge_serial->boot_descriptor.Capabilities));
-               dbg("  UConfig0:       %d",
+               dev_dbg(dev, "  UConfig0:       %d\n",
                        edge_serial->boot_descriptor.UConfig0);
-               dbg("  UConfig1:       %d",
+               dev_dbg(dev, "  UConfig1:       %d\n",
                        edge_serial->boot_descriptor.UConfig1);
        }
  }
   ****************************************************************************/
  static void load_application_firmware(struct edgeport_serial *edge_serial)
  {
+       struct device *dev = &edge_serial->serial->dev->dev;
        const struct ihex_binrec *rec;
        const struct firmware *fw;
        const char *fw_name;
                        break;
  
                case EDGE_DOWNLOAD_FILE_NONE:
-                       dbg("No download file specified, skipping download");
+                       dev_dbg(dev, "No download file specified, skipping download\n");
                        return;
  
                default:
        response = request_ihex_firmware(&fw, fw_name,
                                    &edge_serial->serial->dev->dev);
        if (response) {
-               printk(KERN_ERR "Failed to load image \"%s\" err %d\n",
+               dev_err(dev, "Failed to load image \"%s\" err %d\n",
                       fw_name, response);
                return;
        }
        rec = (const struct ihex_binrec *)fw->data;
        build = (rec->data[2] << 8) | rec->data[3];
  
-       dbg("%s %d.%d.%d", fw_info, rec->data[0], rec->data[1], build);
+       dev_dbg(dev, "%s %d.%d.%d\n", fw_info, rec->data[0], rec->data[1], build);
  
        edge_serial->product_info.FirmwareMajorVersion = rec->data[0];
        edge_serial->product_info.FirmwareMinorVersion = rec->data[1];
                }
        }
  
-       dbg("sending exec_dl_code");
-       response = usb_control_msg (edge_serial->serial->dev, 
-                                   usb_sndctrlpipe(edge_serial->serial->dev, 0), 
-                                   USB_REQUEST_ION_EXEC_DL_CODE, 
+       dev_dbg(dev, "sending exec_dl_code\n");
+       response = usb_control_msg (edge_serial->serial->dev,
+                                   usb_sndctrlpipe(edge_serial->serial->dev, 0),
+                                   USB_REQUEST_ION_EXEC_DL_CODE,
                                    0x40, 0x4000, 0x0001, NULL, 0, 3000);
  
        release_firmware(fw);
@@@ -2923,6 -2877,7 +2877,7 @@@ static int edge_startup(struct usb_seri
        struct edgeport_serial *edge_serial;
        struct edgeport_port *edge_port;
        struct usb_device *dev;
+       struct device *ddev = &serial->dev->dev;
        int i, j;
        int response;
        bool interrupt_in_found;
        /* serial->num_ports = serial->product_info.NumPorts; */
        if ((!edge_serial->is_epic) &&
            (edge_serial->product_info.NumPorts != serial->num_ports)) {
-               dev_warn(&serial->dev->dev, "Device Reported %d serial ports "
-                        "vs. core thinking we have %d ports, email "
-                        "greg@kroah.com this information.\n",
+               dev_warn(ddev,
+                       "Device Reported %d serial ports vs. core thinking we have %d ports, email greg@kroah.com this information.\n",
                         edge_serial->product_info.NumPorts,
                         serial->num_ports);
        }
  
-       dbg("%s - time 1 %ld", __func__, jiffies);
+       dev_dbg(ddev, "%s - time 1 %ld\n", __func__, jiffies);
  
        /* If not an EPiC device */
        if (!edge_serial->is_epic) {
                /* now load the application firmware into this device */
                load_application_firmware(edge_serial);
  
-               dbg("%s - time 2 %ld", __func__, jiffies);
+               dev_dbg(ddev, "%s - time 2 %ld\n", __func__, jiffies);
  
                /* Check current Edgeport EEPROM and update if necessary */
                update_edgeport_E2PROM(edge_serial);
  
-               dbg("%s - time 3 %ld", __func__, jiffies);
+               dev_dbg(ddev, "%s - time 3 %ld\n", __func__, jiffies);
  
                /* set the configuration to use #1 */
- /*            dbg("set_configuration 1"); */
+ /*            dev_dbg(ddev, "set_configuration 1\n"); */
  /*            usb_set_configuration (dev, 1); */
        }
-       dbg("  FirmwareMajorVersion  %d.%d.%d",
+       dev_dbg(ddev, "  FirmwareMajorVersion  %d.%d.%d\n",
            edge_serial->product_info.FirmwareMajorVersion,
            edge_serial->product_info.FirmwareMinorVersion,
            le16_to_cpu(edge_serial->product_info.FirmwareBuildNumber));
        for (i = 0; i < serial->num_ports; ++i) {
                edge_port = kzalloc(sizeof(struct edgeport_port), GFP_KERNEL);
                if (edge_port == NULL) {
-                       dev_err(&serial->dev->dev, "%s - Out of memory\n",
-                                                                  __func__);
+                       dev_err(ddev, "%s - Out of memory\n", __func__);
                        for (j = 0; j < i; ++j) {
                                kfree(usb_get_serial_port_data(serial->port[j]));
                                usb_set_serial_port_data(serial->port[j],
                        if (!interrupt_in_found &&
                            (usb_endpoint_is_int_in(endpoint))) {
                                /* we found a interrupt in endpoint */
-                               dbg("found interrupt in");
+                               dev_dbg(ddev, "found interrupt in\n");
  
                                /* not set up yet, so do it now */
                                edge_serial->interrupt_read_urb =
                                                usb_alloc_urb(0, GFP_KERNEL);
                                if (!edge_serial->interrupt_read_urb) {
-                                       dev_err(&dev->dev, "out of memory\n");
+                                       dev_err(ddev, "out of memory\n");
                                        return -ENOMEM;
                                }
                                edge_serial->interrupt_in_buffer =
                                        kmalloc(buffer_size, GFP_KERNEL);
                                if (!edge_serial->interrupt_in_buffer) {
-                                       dev_err(&dev->dev, "out of memory\n");
+                                       dev_err(ddev, "out of memory\n");
                                        usb_free_urb(edge_serial->interrupt_read_urb);
                                        return -ENOMEM;
                                }
                        if (!bulk_in_found &&
                                (usb_endpoint_is_bulk_in(endpoint))) {
                                /* we found a bulk in endpoint */
-                               dbg("found bulk in");
+                               dev_dbg(ddev, "found bulk in\n");
  
                                /* not set up yet, so do it now */
                                edge_serial->read_urb =
                                                usb_alloc_urb(0, GFP_KERNEL);
                                if (!edge_serial->read_urb) {
-                                       dev_err(&dev->dev, "out of memory\n");
+                                       dev_err(ddev, "out of memory\n");
                                        return -ENOMEM;
                                }
                                edge_serial->bulk_in_buffer =
                        if (!bulk_out_found &&
                            (usb_endpoint_is_bulk_out(endpoint))) {
                                /* we found a bulk out endpoint */
-                               dbg("found bulk out");
+                               dev_dbg(ddev, "found bulk out\n");
                                edge_serial->bulk_out_endpoint =
                                                endpoint->bEndpointAddress;
                                bulk_out_found = true;
                }
  
                if (!interrupt_in_found || !bulk_in_found || !bulk_out_found) {
-                       dev_err(&dev->dev, "Error - the proper endpoints "
-                               "were not found!\n");
+                       dev_err(ddev, "Error - the proper endpoints were not found!\n");
                        return -ENODEV;
                }
  
                response = usb_submit_urb(edge_serial->interrupt_read_urb,
                                                                GFP_KERNEL);
                if (response)
-                       dev_err(&dev->dev,
-                               "%s - Error %d submitting control urb\n",
+                       dev_err(ddev, "%s - Error %d submitting control urb\n",
                                __func__, response);
        }
        return response;
@@@ -3148,8 -3099,6 +3099,6 @@@ static void edge_disconnect(struct usb_
  {
        struct edgeport_serial *edge_serial = usb_get_serial_data(serial);
  
-       dbg("%s", __func__);
        /* stop reads and writes on all ports */
        /* free up our endpoint stuff */
        if (edge_serial->is_epic) {
@@@ -3173,8 -3122,6 +3122,6 @@@ static void edge_release(struct usb_ser
        struct edgeport_serial *edge_serial = usb_get_serial_data(serial);
        int i;
  
-       dbg("%s", __func__);
        for (i = 0; i < serial->num_ports; ++i)
                kfree(usb_get_serial_port_data(serial->port[i]));
  
@@@ -3190,6 -3137,3 +3137,3 @@@ MODULE_FIRMWARE("edgeport/boot.fw")
  MODULE_FIRMWARE("edgeport/boot2.fw");
  MODULE_FIRMWARE("edgeport/down.fw");
  MODULE_FIRMWARE("edgeport/down2.fw");
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug enabled or not");
@@@ -201,8 -201,6 +201,6 @@@ static unsigned char OperationalMajorVe
  static unsigned char OperationalMinorVersion;
  static unsigned short OperationalBuildNumber;
  
- static bool debug;
  static int closing_wait = EDGE_CLOSING_WAIT;
  static bool ignore_cpu_rev;
  static int default_uart_mode;         /* RS232 */
@@@ -233,8 -231,8 +231,8 @@@ static int ti_vread_sync(struct usb_dev
        if (status < 0)
                return status;
        if (status != size) {
-               dbg("%s - wanted to write %d, but only wrote %d",
-                                            __func__, size, status);
+               dev_dbg(&dev->dev, "%s - wanted to write %d, but only wrote %d\n",
+                       __func__, size, status);
                return -ECOMM;
        }
        return 0;
@@@ -251,8 -249,8 +249,8 @@@ static int ti_vsend_sync(struct usb_dev
        if (status < 0)
                return status;
        if (status != size) {
-               dbg("%s - wanted to write %d, but only wrote %d",
-                    __func__, size, status);
+               dev_dbg(&dev->dev, "%s - wanted to write %d, but only wrote %d\n",
+                       __func__, size, status);
                return -ECOMM;
        }
        return 0;
@@@ -270,7 -268,7 +268,7 @@@ static int purge_port(struct usb_serial
  {
        int port_number = port->number - port->serial->minor;
  
-       dbg("%s - port %d, mask %x", __func__, port_number, mask);
+       dev_dbg(&port->dev, "%s - port %d, mask %x\n", __func__, port_number, mask);
  
        return send_cmd(port->serial->dev,
                                        UMPC_PURGE_PORT,
@@@ -295,7 -293,7 +293,7 @@@ static int read_download_mem(struct usb
        __u8 read_length;
        __be16 be_start_address;
  
-       dbg("%s - @ %x for %d", __func__, start_address, length);
+       dev_dbg(&dev->dev, "%s - @ %x for %d\n", __func__, start_address, length);
  
        /* Read in blocks of 64 bytes
         * (TI firmware can't handle more than 64 byte reads)
                        read_length = (__u8)length;
  
                if (read_length > 1) {
-                       dbg("%s - @ %x for %d", __func__,
-                            start_address, read_length);
+                       dev_dbg(&dev->dev, "%s - @ %x for %d\n", __func__, start_address, read_length);
                }
                be_start_address = cpu_to_be16(start_address);
                status = ti_vread_sync(dev, UMPC_MEMORY_READ,
                                        buffer, read_length);
  
                if (status) {
-                       dbg("%s - ERROR %x", __func__, status);
+                       dev_dbg(&dev->dev, "%s - ERROR %x\n", __func__, status);
                        return status;
                }
  
                if (read_length > 1)
-                       usb_serial_debug_data(debug, &dev->dev, __func__,
-                                             read_length, buffer);
+                       usb_serial_debug_data(&dev->dev, __func__, read_length, buffer);
  
                /* Update pointers/length */
                start_address += read_length;
@@@ -353,15 -349,14 +349,14 @@@ static int read_boot_mem(struct edgepor
                                UMPC_MEMORY_READ, serial->TI_I2C_Type,
                                (__u16)(start_address+i), &buffer[i], 0x01);
                if (status) {
-                       dbg("%s - ERROR %x", __func__, status);
+                       dev_dbg(&serial->serial->dev->dev, "%s - ERROR %x\n", __func__, status);
                        return status;
                }
        }
  
-       dbg("%s - start_address = %x, length = %d",
-                                       __func__, start_address, length);
-       usb_serial_debug_data(debug, &serial->serial->dev->dev,
-                                       __func__, length, buffer);
+       dev_dbg(&serial->serial->dev->dev, "%s - start_address = %x, length = %d\n",
+               __func__, start_address, length);
+       usb_serial_debug_data(&serial->serial->dev->dev, __func__, length, buffer);
  
        serial->TiReadI2C = 1;
  
@@@ -398,10 -393,8 +393,8 @@@ static int write_boot_mem(struct edgepo
                        return status;
        }
  
-       dbg("%s - start_sddr = %x, length = %d",
-                                       __func__, start_address, length);
-       usb_serial_debug_data(debug, &serial->serial->dev->dev,
-                                       __func__, length, buffer);
+       dev_dbg(&serial->serial->dev->dev, "%s - start_sddr = %x, length = %d\n", __func__, start_address, length);
+       usb_serial_debug_data(&serial->serial->dev->dev, __func__, length, buffer);
  
        return status;
  }
  static int write_i2c_mem(struct edgeport_serial *serial,
                int start_address, int length, __u8 address_type, __u8 *buffer)
  {
+       struct device *dev = &serial->serial->dev->dev;
        int status = 0;
        int write_length;
        __be16 be_start_address;
        if (write_length > length)
                write_length = length;
  
-       dbg("%s - BytesInFirstPage Addr = %x, length = %d",
-                                       __func__, start_address, write_length);
-       usb_serial_debug_data(debug, &serial->serial->dev->dev,
-                                               __func__, write_length, buffer);
+       dev_dbg(dev, "%s - BytesInFirstPage Addr = %x, length = %d\n",
+               __func__, start_address, write_length);
+       usb_serial_debug_data(dev, __func__, write_length, buffer);
  
        /* Write first page */
        be_start_address = cpu_to_be16(start_address);
                                (__force __u16)be_start_address,
                                buffer, write_length);
        if (status) {
-               dbg("%s - ERROR %d", __func__, status);
+               dev_dbg(dev, "%s - ERROR %d\n", __func__, status);
                return status;
        }
  
                else
                        write_length = length;
  
-               dbg("%s - Page Write Addr = %x, length = %d",
-                                       __func__, start_address, write_length);
-               usb_serial_debug_data(debug, &serial->serial->dev->dev,
-                                       __func__, write_length, buffer);
+               dev_dbg(dev, "%s - Page Write Addr = %x, length = %d\n",
+                       __func__, start_address, write_length);
+               usb_serial_debug_data(dev, __func__, write_length, buffer);
  
                /* Write next page */
                be_start_address = cpu_to_be16(start_address);
                                (__force __u16)be_start_address,
                                buffer, write_length);
                if (status) {
-                       dev_err(&serial->serial->dev->dev, "%s - ERROR %d\n",
-                                       __func__, status);
+                       dev_err(dev, "%s - ERROR %d\n", __func__, status);
                        return status;
                }
  
@@@ -508,7 -499,7 +499,7 @@@ static int tx_active(struct edgeport_po
        if (status)
                goto exit_is_tx_active;
  
-       dbg("%s - XByteCount    0x%X", __func__, oedb->XByteCount);
+       dev_dbg(&port->port->dev, "%s - XByteCount    0x%X\n", __func__, oedb->XByteCount);
  
        /* and the LSR */
        status = read_ram(port->port->serial->dev,
  
        if (status)
                goto exit_is_tx_active;
-       dbg("%s - LSR = 0x%X", __func__, *lsr);
+       dev_dbg(&port->port->dev, "%s - LSR = 0x%X\n", __func__, *lsr);
  
        /* If either buffer has data or we are transmitting then return TRUE */
        if ((oedb->XByteCount & 0x80) != 0)
  
        /* We return Not Active if we get any kind of error */
  exit_is_tx_active:
-       dbg("%s - return %d", __func__, bytes_left);
+       dev_dbg(&port->port->dev, "%s - return %d\n", __func__, bytes_left);
  
        kfree(lsr);
        kfree(oedb);
@@@ -599,14 -590,13 +590,13 @@@ static int choose_config(struct usb_dev
         * configuration # 1, which is Config Descriptor 0.
         */
  
-       dbg("%s - Number of Interfaces = %d",
-                               __func__, dev->config->desc.bNumInterfaces);
-       dbg("%s - MAX Power            = %d",
-                               __func__, dev->config->desc.bMaxPower * 2);
+       dev_dbg(&dev->dev, "%s - Number of Interfaces = %d\n",
+               __func__, dev->config->desc.bNumInterfaces);
+       dev_dbg(&dev->dev, "%s - MAX Power            = %d\n",
+               __func__, dev->config->desc.bMaxPower * 2);
  
        if (dev->config->desc.bNumInterfaces != 1) {
-               dev_err(&dev->dev, "%s - bNumInterfaces is not 1, ERROR!\n",
-                                                               __func__);
+               dev_err(&dev->dev, "%s - bNumInterfaces is not 1, ERROR!\n", __func__);
                return -ENODEV;
        }
  
@@@ -684,7 -674,7 +674,7 @@@ static int valid_csum(struct ti_i2c_des
                cs = (__u8)(cs + buffer[i]);
  
        if (cs != rom_desc->CheckSum) {
-               dbg("%s - Mismatch %x - %x", __func__, rom_desc->CheckSum, cs);
+               pr_debug("%s - Mismatch %x - %x", __func__, rom_desc->CheckSum, cs);
                return -EINVAL;
        }
        return 0;
@@@ -736,11 -726,11 +726,11 @@@ static int check_i2c_image(struct edgep
                if ((start_address + sizeof(struct ti_i2c_desc) +
                                        rom_desc->Size) > TI_MAX_I2C_SIZE) {
                        status = -ENODEV;
-                       dbg("%s - structure too big, erroring out.", __func__);
+                       dev_dbg(dev, "%s - structure too big, erroring out.\n", __func__);
                        break;
                }
  
-               dbg("%s Type = 0x%x", __func__, rom_desc->Type);
+               dev_dbg(dev, "%s Type = 0x%x\n", __func__, rom_desc->Type);
  
                /* Skip type 2 record */
                ttype = rom_desc->Type & 0x0f;
@@@ -779,18 -769,18 +769,18 @@@ static int get_manuf_info(struct edgepo
        int start_address;
        struct ti_i2c_desc *rom_desc;
        struct edge_ti_manuf_descriptor *desc;
+       struct device *dev = &serial->serial->dev->dev;
  
        rom_desc = kmalloc(sizeof(*rom_desc), GFP_KERNEL);
        if (!rom_desc) {
-               dev_err(&serial->serial->dev->dev, "%s - out of memory\n",
-                                                               __func__);
+               dev_err(dev, "%s - out of memory\n", __func__);
                return -ENOMEM;
        }
        start_address = get_descriptor_addr(serial, I2C_DESC_TYPE_ION,
                                                                rom_desc);
  
        if (!start_address) {
-               dbg("%s - Edge Descriptor not found in I2C", __func__);
+               dev_dbg(dev, "%s - Edge Descriptor not found in I2C\n", __func__);
                status = -ENODEV;
                goto exit;
        }
        status = valid_csum(rom_desc, buffer);
  
        desc = (struct edge_ti_manuf_descriptor *)buffer;
-       dbg("%s - IonConfig      0x%x", __func__, desc->IonConfig);
-       dbg("%s - Version          %d", __func__, desc->Version);
-       dbg("%s - Cpu/Board      0x%x", __func__, desc->CpuRev_BoardRev);
-       dbg("%s - NumPorts         %d", __func__, desc->NumPorts);
-       dbg("%s - NumVirtualPorts  %d", __func__, desc->NumVirtualPorts);
-       dbg("%s - TotalPorts       %d", __func__, desc->TotalPorts);
+       dev_dbg(dev, "%s - IonConfig      0x%x\n", __func__, desc->IonConfig);
+       dev_dbg(dev, "%s - Version          %d\n", __func__, desc->Version);
+       dev_dbg(dev, "%s - Cpu/Board      0x%x\n", __func__, desc->CpuRev_BoardRev);
+       dev_dbg(dev, "%s - NumPorts         %d\n", __func__, desc->NumPorts);
+       dev_dbg(dev, "%s - NumVirtualPorts  %d\n", __func__, desc->NumVirtualPorts);
+       dev_dbg(dev, "%s - TotalPorts       %d\n", __func__, desc->TotalPorts);
  
  exit:
        kfree(rom_desc);
@@@ -855,8 -845,8 +845,8 @@@ static int build_i2c_fw_hdr(__u8 *heade
  
        err = request_firmware(&fw, fw_name, dev);
        if (err) {
-               printk(KERN_ERR "Failed to load image \"%s\" err %d\n",
-                      fw_name, err);
+               dev_err(dev, "Failed to load image \"%s\" err %d\n",
+                       fw_name, err);
                kfree(buffer);
                return err;
        }
  /* Try to figure out what type of I2c we have */
  static int i2c_type_bootmode(struct edgeport_serial *serial)
  {
+       struct device *dev = &serial->serial->dev->dev;
        int status;
        u8 *data;
  
        data = kmalloc(1, GFP_KERNEL);
        if (!data) {
-               dev_err(&serial->serial->dev->dev,
-                               "%s - out of memory\n", __func__);
+               dev_err(dev, "%s - out of memory\n", __func__);
                return -ENOMEM;
        }
  
        status = ti_vread_sync(serial->serial->dev, UMPC_MEMORY_READ,
                                DTK_ADDR_SPACE_I2C_TYPE_II, 0, data, 0x01);
        if (status)
-               dbg("%s - read 2 status error = %d", __func__, status);
+               dev_dbg(dev, "%s - read 2 status error = %d\n", __func__, status);
        else
-               dbg("%s - read 2 data = 0x%x", __func__, *data);
+               dev_dbg(dev, "%s - read 2 data = 0x%x\n", __func__, *data);
        if ((!status) && (*data == UMP5152 || *data == UMP3410)) {
-               dbg("%s - ROM_TYPE_II", __func__);
+               dev_dbg(dev, "%s - ROM_TYPE_II\n", __func__);
                serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_II;
                goto out;
        }
        status = ti_vread_sync(serial->serial->dev, UMPC_MEMORY_READ,
                                DTK_ADDR_SPACE_I2C_TYPE_III, 0, data, 0x01);
        if (status)
-               dbg("%s - read 3 status error = %d", __func__, status);
+               dev_dbg(dev, "%s - read 3 status error = %d\n", __func__, status);
        else
-               dbg("%s - read 2 data = 0x%x", __func__, *data);
+               dev_dbg(dev, "%s - read 2 data = 0x%x\n", __func__, *data);
        if ((!status) && (*data == UMP5152 || *data == UMP3410)) {
-               dbg("%s - ROM_TYPE_III", __func__);
+               dev_dbg(dev, "%s - ROM_TYPE_III\n", __func__);
                serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_III;
                goto out;
        }
  
-       dbg("%s - Unknown", __func__);
+       dev_dbg(dev, "%s - Unknown\n", __func__);
        serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_II;
        status = -ENODEV;
  out:
@@@ -1050,11 -1040,11 +1040,11 @@@ static int download_fw(struct edgeport_
        if (serial->product_info.TiMode == TI_MODE_DOWNLOAD) {
                struct ti_i2c_desc *rom_desc;
  
-               dbg("%s - RUNNING IN DOWNLOAD MODE", __func__);
+               dev_dbg(dev, "%s - RUNNING IN DOWNLOAD MODE\n", __func__);
  
                status = check_i2c_image(serial);
                if (status) {
-                       dbg("%s - DOWNLOAD MODE -- BAD I2C", __func__);
+                       dev_dbg(dev, "%s - DOWNLOAD MODE -- BAD I2C\n", __func__);
                        return status;
                }
  
  
                /* Check version number of ION descriptor */
                if (!ignore_cpu_rev && ti_cpu_rev(ti_manuf_desc) < 2) {
-                       dbg("%s - Wrong CPU Rev %d (Must be 2)",
+                       dev_dbg(dev, "%s - Wrong CPU Rev %d (Must be 2)\n",
                                __func__, ti_cpu_rev(ti_manuf_desc));
                        kfree(ti_manuf_desc);
                        return -EINVAL;
                        struct ti_i2c_firmware_rec *firmware_version;
                        u8 *record;
  
-                       dbg("%s - Found Type FIRMWARE (Type 2) record",
-                                                               __func__);
+                       dev_dbg(dev, "%s - Found Type FIRMWARE (Type 2) record\n", __func__);
  
                        firmware_version = kmalloc(sizeof(*firmware_version),
                                                                GFP_KERNEL);
                        download_new_ver = (OperationalMajorVersion << 8) +
                                           (OperationalMinorVersion);
  
-                       dbg("%s - >> FW Versions Device %d.%d  Driver %d.%d",
-                           __func__,
-                           firmware_version->Ver_Major,
-                           firmware_version->Ver_Minor,
-                           OperationalMajorVersion,
-                           OperationalMinorVersion);
+                       dev_dbg(dev, "%s - >> FW Versions Device %d.%d  Driver %d.%d\n",
+                               __func__, firmware_version->Ver_Major,
+                               firmware_version->Ver_Minor,
+                               OperationalMajorVersion,
+                               OperationalMinorVersion);
  
                        /* Check if we have an old version in the I2C and
                           update if necessary */
                        if (download_cur_ver < download_new_ver) {
-                               dbg("%s - Update I2C dld from %d.%d to %d.%d",
-                                   __func__,
-                                   firmware_version->Ver_Major,
-                                   firmware_version->Ver_Minor,
-                                   OperationalMajorVersion,
-                                   OperationalMinorVersion);
+                               dev_dbg(dev, "%s - Update I2C dld from %d.%d to %d.%d\n",
+                                       __func__,
+                                       firmware_version->Ver_Major,
+                                       firmware_version->Ver_Minor,
+                                       OperationalMajorVersion,
+                                       OperationalMinorVersion);
  
                                record = kmalloc(1, GFP_KERNEL);
                                if (!record) {
                                }
  
                                if (*record != I2C_DESC_TYPE_FIRMWARE_BLANK) {
-                                       dev_err(dev,
-                                               "%s - error resetting device\n",
-                                               __func__);
+                                       dev_err(dev, "%s - error resetting device\n", __func__);
                                        kfree(record);
                                        kfree(firmware_version);
                                        kfree(rom_desc);
                                        return -ENODEV;
                                }
  
-                               dbg("%s - HARDWARE RESET", __func__);
+                               dev_dbg(dev, "%s - HARDWARE RESET\n", __func__);
  
                                /* Reset UMP -- Back to BOOT MODE */
                                status = ti_vsend_sync(serial->serial->dev,
                                                UMPC_HARDWARE_RESET,
                                                0, 0, NULL, 0);
  
-                               dbg("%s - HARDWARE RESET return %d",
-                                               __func__, status);
+                               dev_dbg(dev, "%s - HARDWARE RESET return %d\n", __func__, status);
  
                                /* return an error on purpose. */
                                kfree(record);
                                return -ENOMEM;
                        }
  
-                       dbg("%s - Found Type BLANK FIRMWARE (Type F2) record",
-                                                               __func__);
+                       dev_dbg(dev, "%s - Found Type BLANK FIRMWARE (Type F2) record\n", __func__);
  
                        /*
                         * In order to update the I2C firmware we must change
                                                        HEADER_SIZE, vheader);
  
                        if (status) {
-                               dbg("%s - can't read header back", __func__);
+                               dev_dbg(dev, "%s - can't read header back\n", __func__);
                                kfree(vheader);
                                kfree(header);
                                kfree(rom_desc);
                                return status;
                        }
                        if (memcmp(vheader, header, HEADER_SIZE)) {
-                               dbg("%s - write download record failed",
-                                       __func__);
+                               dev_dbg(dev, "%s - write download record failed\n", __func__);
                                kfree(vheader);
                                kfree(header);
                                kfree(rom_desc);
                        kfree(vheader);
                        kfree(header);
  
-                       dbg("%s - Start firmware update", __func__);
+                       dev_dbg(dev, "%s - Start firmware update\n", __func__);
  
                        /* Tell firmware to copy download image into I2C */
                        status = ti_vsend_sync(serial->serial->dev,
                                        UMPC_COPY_DNLD_TO_I2C, 0, 0, NULL, 0);
  
-                       dbg("%s - Update complete 0x%x", __func__, status);
+                       dev_dbg(dev, "%s - Update complete 0x%x\n", __func__, status);
                        if (status) {
                                dev_err(dev,
                                        "%s - UMPC_COPY_DNLD_TO_I2C failed\n",
        /********************************************************************/
        /* Boot Mode */
        /********************************************************************/
-       dbg("%s - RUNNING IN BOOT MODE", __func__);
+       dev_dbg(dev, "%s - RUNNING IN BOOT MODE\n", __func__);
  
        /* Configure the TI device so we can use the BULK pipes for download */
        status = config_boot_dev(serial->serial->dev);
  
        if (le16_to_cpu(serial->serial->dev->descriptor.idVendor)
                                                        != USB_VENDOR_ID_ION) {
-               dbg("%s - VID = 0x%x", __func__,
-                    le16_to_cpu(serial->serial->dev->descriptor.idVendor));
+               dev_dbg(dev, "%s - VID = 0x%x\n", __func__,
+                       le16_to_cpu(serial->serial->dev->descriptor.idVendor));
                serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_II;
                goto stayinbootmode;
        }
  
                /* Check for version 2 */
                if (!ignore_cpu_rev && ti_cpu_rev(ti_manuf_desc) < 2) {
-                       dbg("%s - Wrong CPU Rev %d (Must be 2)",
-                                       __func__, ti_cpu_rev(ti_manuf_desc));
+                       dev_dbg(dev, "%s - Wrong CPU Rev %d (Must be 2)\n",
+                               __func__, ti_cpu_rev(ti_manuf_desc));
                        kfree(ti_manuf_desc);
                        goto stayinbootmode;
                }
  
                err = request_firmware(&fw, fw_name, dev);
                if (err) {
-                       printk(KERN_ERR "Failed to load image \"%s\" err %d\n",
-                              fw_name, err);
+                       dev_err(dev, "Failed to load image \"%s\" err %d\n",
+                               fw_name, err);
                        kfree(buffer);
                        return err;
                }
                header->CheckSum = cs;
  
                /* Download the operational code  */
-               dbg("%s - Downloading operational code image (TI UMP)",
-                                                               __func__);
+               dev_dbg(dev, "%s - Downloading operational code image (TI UMP)\n", __func__);
                status = download_code(serial, buffer, buffer_size);
  
                kfree(buffer);
  
                if (status) {
-                       dbg("%s - Error downloading operational code image",
-                                                               __func__);
+                       dev_dbg(dev, "%s - Error downloading operational code image\n", __func__);
                        return status;
                }
  
                /* Device will reboot */
                serial->product_info.TiMode = TI_MODE_TRANSITIONING;
  
-               dbg("%s - Download successful -- Device rebooting...",
-                                                               __func__);
+               dev_dbg(dev, "%s - Download successful -- Device rebooting...\n", __func__);
  
                /* return an error on purpose */
                return -ENODEV;
  
  stayinbootmode:
        /* Eprom is invalid or blank stay in boot mode */
-       dbg("%s - STAYING IN BOOT MODE", __func__);
+       dev_dbg(dev, "%s - STAYING IN BOOT MODE\n", __func__);
        serial->product_info.TiMode = TI_MODE_BOOT;
  
        return 0;
@@@ -1487,7 -1467,7 +1467,7 @@@ static int restore_mcr(struct edgeport_
  {
        int status = 0;
  
-       dbg("%s - %x", __func__, mcr);
+       dev_dbg(&port->port->dev, "%s - %x\n", __func__, mcr);
  
        status = ti_do_config(port, UMPC_SET_CLR_DTR, mcr & MCR_DTR);
        if (status)
@@@ -1524,7 -1504,7 +1504,7 @@@ static void handle_new_msr(struct edgep
        struct async_icount *icount;
        struct tty_struct *tty;
  
-       dbg("%s - %02x", __func__, msr);
+       dev_dbg(&edge_port->port->dev, "%s - %02x\n", __func__, msr);
  
        if (msr & (EDGEPORT_MSR_DELTA_CTS | EDGEPORT_MSR_DELTA_DSR |
                        EDGEPORT_MSR_DELTA_RI | EDGEPORT_MSR_DELTA_CD)) {
@@@ -1566,7 -1546,7 +1546,7 @@@ static void handle_new_lsr(struct edgep
                                                LSR_FRM_ERR | LSR_BREAK));
        struct tty_struct *tty;
  
-       dbg("%s - %02x", __func__, new_lsr);
+       dev_dbg(&edge_port->port->dev, "%s - %02x\n", __func__, new_lsr);
  
        edge_port->shadow_lsr = lsr;
  
@@@ -1604,6 -1584,7 +1584,7 @@@ static void edge_interrupt_callback(str
        struct edgeport_serial *edge_serial = urb->context;
        struct usb_serial_port *port;
        struct edgeport_port *edge_port;
+       struct device *dev;
        unsigned char *data = urb->transfer_buffer;
        int length = urb->actual_length;
        int port_number;
        __u8 msr;
        int status = urb->status;
  
-       dbg("%s", __func__);
        switch (status) {
        case 0:
                /* success */
        case -ENOENT:
        case -ESHUTDOWN:
                /* this urb is terminated, clean up */
-               dbg("%s - urb shutting down with status: %d",
+               dev_dbg(&urb->dev->dev, "%s - urb shutting down with status: %d\n",
                    __func__, status);
                return;
        default:
        }
  
        if (!length) {
-               dbg("%s - no data in urb", __func__);
+               dev_dbg(&urb->dev->dev, "%s - no data in urb\n", __func__);
                goto exit;
        }
  
-       usb_serial_debug_data(debug, &edge_serial->serial->dev->dev,
-                                               __func__, length, data);
+       dev = &edge_serial->serial->dev->dev;
+       usb_serial_debug_data(dev, __func__, length, data);
  
        if (length != 2) {
-               dbg("%s - expecting packet of size 2, got %d",
-                                                       __func__, length);
+               dev_dbg(dev, "%s - expecting packet of size 2, got %d\n", __func__, length);
                goto exit;
        }
  
        port_number = TIUMP_GET_PORT_FROM_CODE(data[0]);
        function    = TIUMP_GET_FUNC_FROM_CODE(data[0]);
-       dbg("%s - port_number %d, function %d, info 0x%x",
-            __func__, port_number, function, data[1]);
+       dev_dbg(dev, "%s - port_number %d, function %d, info 0x%x\n", __func__,
+               port_number, function, data[1]);
        port = edge_serial->serial->port[port_number];
        edge_port = usb_get_serial_port_data(port);
        if (!edge_port) {
-               dbg("%s - edge_port not found", __func__);
+               dev_dbg(dev, "%s - edge_port not found\n", __func__);
                return;
        }
        switch (function) {
                if (lsr & UMP_UART_LSR_DATA_MASK) {
                        /* Save the LSR event for bulk read
                           completion routine */
-                       dbg("%s - LSR Event Port %u LSR Status = %02x",
-                            __func__, port_number, lsr);
+                       dev_dbg(dev, "%s - LSR Event Port %u LSR Status = %02x\n",
+                               __func__, port_number, lsr);
                        edge_port->lsr_event = 1;
                        edge_port->lsr_mask = lsr;
                } else {
-                       dbg("%s - ===== Port %d LSR Status = %02x ======",
-                            __func__, port_number, lsr);
+                       dev_dbg(dev, "%s - ===== Port %d LSR Status = %02x ======\n",
+                               __func__, port_number, lsr);
                        handle_new_lsr(edge_port, 0, lsr, 0);
                }
                break;
        case TIUMP_INTERRUPT_CODE_MSR:  /* MSR */
                /* Copy MSR from UMP */
                msr = data[1];
-               dbg("%s - ===== Port %u MSR Status = %02x ======",
-                    __func__, port_number, msr);
+               dev_dbg(dev, "%s - ===== Port %u MSR Status = %02x ======\n",
+                       __func__, port_number, msr);
                handle_new_msr(edge_port, msr);
                break;
  
@@@ -1700,14 -1678,13 +1678,13 @@@ exit
  static void edge_bulk_in_callback(struct urb *urb)
  {
        struct edgeport_port *edge_port = urb->context;
+       struct device *dev = &edge_port->port->dev;
        unsigned char *data = urb->transfer_buffer;
        struct tty_struct *tty;
        int retval = 0;
        int port_number;
        int status = urb->status;
  
-       dbg("%s", __func__);
        switch (status) {
        case 0:
                /* success */
        case -ENOENT:
        case -ESHUTDOWN:
                /* this urb is terminated, clean up */
-               dbg("%s - urb shutting down with status: %d",
-                   __func__, status);
+               dev_dbg(&urb->dev->dev, "%s - urb shutting down with status: %d\n", __func__, status);
                return;
        default:
-               dev_err(&urb->dev->dev,
-                       "%s - nonzero read bulk status received: %d\n",
-                            __func__, status);
+               dev_err(&urb->dev->dev, "%s - nonzero read bulk status received: %d\n", __func__, status);
        }
  
        if (status == -EPIPE)
  
        if (edge_port->lsr_event) {
                edge_port->lsr_event = 0;
-               dbg("%s ===== Port %u LSR Status = %02x, Data = %02x ======",
-                    __func__, port_number, edge_port->lsr_mask, *data);
+               dev_dbg(dev, "%s ===== Port %u LSR Status = %02x, Data = %02x ======\n",
+                       __func__, port_number, edge_port->lsr_mask, *data);
                handle_new_lsr(edge_port, 1, edge_port->lsr_mask, *data);
                /* Adjust buffer length/pointer */
                --urb->actual_length;
  
        tty = tty_port_tty_get(&edge_port->port->port);
        if (tty && urb->actual_length) {
-               usb_serial_debug_data(debug, &edge_port->port->dev,
-                                       __func__, urb->actual_length, data);
+               usb_serial_debug_data(dev, __func__, urb->actual_length, data);
                if (edge_port->close_pending)
-                       dbg("%s - close pending, dropping data on the floor",
+                       dev_dbg(dev, "%s - close pending, dropping data on the floor\n",
                                                                __func__);
                else
-                       edge_tty_recv(&edge_port->port->dev, tty, data,
-                                                       urb->actual_length);
+                       edge_tty_recv(dev, tty, data, urb->actual_length);
                edge_port->icount.rx += urb->actual_length;
        }
        tty_kref_put(tty);
@@@ -1769,9 -1741,7 +1741,7 @@@ exit
  
        spin_unlock(&edge_port->ep_lock);
        if (retval)
-               dev_err(&urb->dev->dev,
-                       "%s - usb_submit_urb failed with result %d\n",
-                        __func__, retval);
+               dev_err(dev, "%s - usb_submit_urb failed with result %d\n", __func__, retval);
  }
  
  static void edge_tty_recv(struct device *dev, struct tty_struct *tty,
@@@ -1793,8 -1763,6 +1763,6 @@@ static void edge_bulk_out_callback(stru
        int status = urb->status;
        struct tty_struct *tty;
  
-       dbg("%s - port %d", __func__, port->number);
        edge_port->ep_write_urb_in_use = 0;
  
        switch (status) {
        case -ENOENT:
        case -ESHUTDOWN:
                /* this urb is terminated, clean up */
-               dbg("%s - urb shutting down with status: %d",
+               dev_dbg(&urb->dev->dev, "%s - urb shutting down with status: %d\n",
                    __func__, status);
                return;
        default:
@@@ -1830,8 -1798,6 +1798,6 @@@ static int edge_open(struct tty_struct 
        u16 open_settings;
        u8 transaction_timeout;
  
-       dbg("%s - port %d", __func__, port->number);
        if (edge_port == NULL)
                return -ENODEV;
  
                return -ENODEV;
        }
  
-       dbg("%s - port_number = %d, uart_base = %04x, dma_address = %04x",
-                               __func__, port_number, edge_port->uart_base,
-                               edge_port->dma_address);
+       dev_dbg(&port->dev, "%s - port_number = %d, uart_base = %04x, dma_address = %04x\n",
+               __func__, port_number, edge_port->uart_base, edge_port->dma_address);
  
        dev = port->serial->dev;
  
  
        /* set up the port settings */
        if (tty)
 -              edge_set_termios(tty, port, tty->termios);
 +              edge_set_termios(tty, port, &tty->termios);
  
        /* open up the port */
  
                             UMP_PIPE_TRANS_TIMEOUT_ENA |
                             (transaction_timeout << 2));
  
-       dbg("%s - Sending UMPC_OPEN_PORT", __func__);
+       dev_dbg(&port->dev, "%s - Sending UMPC_OPEN_PORT\n", __func__);
  
        /* Tell TI to open and start the port */
        status = send_cmd(dev, UMPC_OPEN_PORT,
                return status;
        }
  
-       dbg("ShadowMSR 0x%X", edge_port->shadow_msr);
+       dev_dbg(&port->dev, "ShadowMSR 0x%X\n", edge_port->shadow_msr);
  
        /* Set Initial MCR */
        edge_port->shadow_mcr = MCR_RTS | MCR_DTR;
-       dbg("ShadowMCR 0x%X", edge_port->shadow_mcr);
+       dev_dbg(&port->dev, "ShadowMCR 0x%X\n", edge_port->shadow_mcr);
  
        edge_serial = edge_port->edge_serial;
        if (mutex_lock_interruptible(&edge_serial->es_lock))
  
        ++edge_serial->num_ports_open;
  
-       dbg("%s - exited", __func__);
        goto release_es_lock;
  
  unlink_int_urb:
@@@ -1999,8 -1962,6 +1962,6 @@@ static void edge_close(struct usb_seria
        struct usb_serial *serial = port->serial;
        int port_number;
  
-       dbg("%s - port %d", __func__, port->number);
        edge_serial = usb_get_serial_data(port->serial);
        edge_port = usb_get_serial_port_data(port);
        if (edge_serial == NULL || edge_port == NULL)
  
        /* assuming we can still talk to the device,
         * send a close port command to it */
-       dbg("%s - send umpc_close_port", __func__);
+       dev_dbg(&port->dev, "%s - send umpc_close_port\n", __func__);
        port_number = port->number - port->serial->minor;
  
        mutex_lock(&serial->disc_mutex);
        }
        mutex_unlock(&edge_serial->es_lock);
        edge_port->close_pending = 0;
-       dbg("%s - exited", __func__);
  }
  
  static int edge_write(struct tty_struct *tty, struct usb_serial_port *port,
  {
        struct edgeport_port *edge_port = usb_get_serial_port_data(port);
  
-       dbg("%s - port %d", __func__, port->number);
        if (count == 0) {
-               dbg("%s - write request of 0 bytes", __func__);
+               dev_dbg(&port->dev, "%s - write request of 0 bytes\n", __func__);
                return 0;
        }
  
@@@ -2077,9 -2034,6 +2034,6 @@@ static void edge_send(struct tty_struc
        struct edgeport_port *edge_port = usb_get_serial_port_data(port);
        unsigned long flags;
  
-       dbg("%s - port %d", __func__, port->number);
        spin_lock_irqsave(&edge_port->ep_lock, flags);
  
        if (edge_port->ep_write_urb_in_use) {
  
        spin_unlock_irqrestore(&edge_port->ep_lock, flags);
  
-       usb_serial_debug_data(debug, &port->dev, __func__, count,
-                               port->write_urb->transfer_buffer);
+       usb_serial_debug_data(&port->dev, __func__, count, port->write_urb->transfer_buffer);
  
        /* set up our urb */
        port->write_urb->transfer_buffer_length = count;
@@@ -2130,8 -2083,6 +2083,6 @@@ static int edge_write_room(struct tty_s
        int room = 0;
        unsigned long flags;
  
-       dbg("%s - port %d", __func__, port->number);
        if (edge_port == NULL)
                return 0;
        if (edge_port->close_pending == 1)
        room = kfifo_avail(&edge_port->write_fifo);
        spin_unlock_irqrestore(&edge_port->ep_lock, flags);
  
-       dbg("%s - returns %d", __func__, room);
+       dev_dbg(&port->dev, "%s - returns %d\n", __func__, room);
        return room;
  }
  
@@@ -2152,8 -2103,6 +2103,6 @@@ static int edge_chars_in_buffer(struct 
        int chars = 0;
        unsigned long flags;
  
-       dbg("%s - port %d", __func__, port->number);
        if (edge_port == NULL)
                return 0;
        if (edge_port->close_pending == 1)
        chars = kfifo_len(&edge_port->write_fifo);
        spin_unlock_irqrestore(&edge_port->ep_lock, flags);
  
-       dbg("%s - returns %d", __func__, chars);
+       dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars);
        return chars;
  }
  
@@@ -2173,8 -2122,6 +2122,6 @@@ static void edge_throttle(struct tty_st
        struct edgeport_port *edge_port = usb_get_serial_port_data(port);
        int status;
  
-       dbg("%s - port %d", __func__, port->number);
        if (edge_port == NULL)
                return;
  
@@@ -2200,8 -2147,6 +2147,6 @@@ static void edge_unthrottle(struct tty_
        struct edgeport_port *edge_port = usb_get_serial_port_data(port);
        int status;
  
-       dbg("%s - port %d", __func__, port->number);
        if (edge_port == NULL)
                return;
  
@@@ -2261,6 -2206,7 +2206,7 @@@ static int restart_read(struct edgeport
  static void change_port_settings(struct tty_struct *tty,
                struct edgeport_port *edge_port, struct ktermios *old_termios)
  {
+       struct device *dev = &edge_port->port->dev;
        struct ump_uart_config *config;
        int baud;
        unsigned cflag;
        int port_number = edge_port->port->number -
                                        edge_port->port->serial->minor;
  
-       dbg("%s - port %d", __func__, edge_port->port->number);
+       dev_dbg(dev, "%s - port %d\n", __func__, edge_port->port->number);
  
        config = kmalloc (sizeof (*config), GFP_KERNEL);
        if (!config) {
 -              *tty->termios = *old_termios;
 +              tty->termios = *old_termios;
-               dev_err(&edge_port->port->dev, "%s - out of memory\n",
-                                                               __func__);
+               dev_err(dev, "%s - out of memory\n", __func__);
                return;
        }
  
 -      cflag = tty->termios->c_cflag;
 +      cflag = tty->termios.c_cflag;
  
        config->wFlags = 0;
  
        switch (cflag & CSIZE) {
        case CS5:
                    config->bDataBits = UMP_UART_CHAR5BITS;
-                   dbg("%s - data bits = 5", __func__);
+                   dev_dbg(dev, "%s - data bits = 5\n", __func__);
                    break;
        case CS6:
                    config->bDataBits = UMP_UART_CHAR6BITS;
-                   dbg("%s - data bits = 6", __func__);
+                   dev_dbg(dev, "%s - data bits = 6\n", __func__);
                    break;
        case CS7:
                    config->bDataBits = UMP_UART_CHAR7BITS;
-                   dbg("%s - data bits = 7", __func__);
+                   dev_dbg(dev, "%s - data bits = 7\n", __func__);
                    break;
        default:
        case CS8:
                    config->bDataBits = UMP_UART_CHAR8BITS;
-                   dbg("%s - data bits = 8", __func__);
+                   dev_dbg(dev, "%s - data bits = 8\n", __func__);
                            break;
        }
  
                if (cflag & PARODD) {
                        config->wFlags |= UMP_MASK_UART_FLAGS_PARITY;
                        config->bParity = UMP_UART_ODDPARITY;
-                       dbg("%s - parity = odd", __func__);
+                       dev_dbg(dev, "%s - parity = odd\n", __func__);
                } else {
                        config->wFlags |= UMP_MASK_UART_FLAGS_PARITY;
                        config->bParity = UMP_UART_EVENPARITY;
-                       dbg("%s - parity = even", __func__);
+                       dev_dbg(dev, "%s - parity = even\n", __func__);
                }
        } else {
                config->bParity = UMP_UART_NOPARITY;
-               dbg("%s - parity = none", __func__);
+               dev_dbg(dev, "%s - parity = none\n", __func__);
        }
  
        if (cflag & CSTOPB) {
                config->bStopBits = UMP_UART_STOPBIT2;
-               dbg("%s - stop bits = 2", __func__);
+               dev_dbg(dev, "%s - stop bits = 2\n", __func__);
        } else {
                config->bStopBits = UMP_UART_STOPBIT1;
-               dbg("%s - stop bits = 1", __func__);
+               dev_dbg(dev, "%s - stop bits = 1\n", __func__);
        }
  
        /* figure out the flow control settings */
        if (cflag & CRTSCTS) {
                config->wFlags |= UMP_MASK_UART_FLAGS_OUT_X_CTS_FLOW;
                config->wFlags |= UMP_MASK_UART_FLAGS_RTS_FLOW;
-               dbg("%s - RTS/CTS is enabled", __func__);
+               dev_dbg(dev, "%s - RTS/CTS is enabled\n", __func__);
        } else {
-               dbg("%s - RTS/CTS is disabled", __func__);
+               dev_dbg(dev, "%s - RTS/CTS is disabled\n", __func__);
                tty->hw_stopped = 0;
                restart_read(edge_port);
        }
        /* if we are implementing INBOUND XON/XOFF */
        if (I_IXOFF(tty)) {
                config->wFlags |= UMP_MASK_UART_FLAGS_IN_X;
-               dbg("%s - INBOUND XON/XOFF is enabled, XON = %2x, XOFF = %2x",
-                    __func__, config->cXon, config->cXoff);
+               dev_dbg(dev, "%s - INBOUND XON/XOFF is enabled, XON = %2x, XOFF = %2x\n",
+                       __func__, config->cXon, config->cXoff);
        } else
-               dbg("%s - INBOUND XON/XOFF is disabled", __func__);
+               dev_dbg(dev, "%s - INBOUND XON/XOFF is disabled\n", __func__);
  
        /* if we are implementing OUTBOUND XON/XOFF */
        if (I_IXON(tty)) {
                config->wFlags |= UMP_MASK_UART_FLAGS_OUT_X;
-               dbg("%s - OUTBOUND XON/XOFF is enabled, XON = %2x, XOFF = %2x",
-                    __func__, config->cXon, config->cXoff);
+               dev_dbg(dev, "%s - OUTBOUND XON/XOFF is enabled, XON = %2x, XOFF = %2x\n",
+                       __func__, config->cXon, config->cXoff);
        } else
-               dbg("%s - OUTBOUND XON/XOFF is disabled", __func__);
+               dev_dbg(dev, "%s - OUTBOUND XON/XOFF is disabled\n", __func__);
  
 -      tty->termios->c_cflag &= ~CMSPAR;
 +      tty->termios.c_cflag &= ~CMSPAR;
  
        /* Round the baud rate */
        baud = tty_get_baud_rate(tty);
  
        /* FIXME: Recompute actual baud from divisor here */
  
-       dbg("%s - baud rate = %d, wBaudRate = %d", __func__, baud,
-                                                       config->wBaudRate);
+       dev_dbg(dev, "%s - baud rate = %d, wBaudRate = %d\n", __func__, baud, config->wBaudRate);
  
-       dbg("wBaudRate:   %d", (int)(461550L / config->wBaudRate));
-       dbg("wFlags:    0x%x", config->wFlags);
-       dbg("bDataBits:   %d", config->bDataBits);
-       dbg("bParity:     %d", config->bParity);
-       dbg("bStopBits:   %d", config->bStopBits);
-       dbg("cXon:        %d", config->cXon);
-       dbg("cXoff:       %d", config->cXoff);
-       dbg("bUartMode:   %d", config->bUartMode);
+       dev_dbg(dev, "wBaudRate:   %d\n", (int)(461550L / config->wBaudRate));
+       dev_dbg(dev, "wFlags:    0x%x\n", config->wFlags);
+       dev_dbg(dev, "bDataBits:   %d\n", config->bDataBits);
+       dev_dbg(dev, "bParity:     %d\n", config->bParity);
+       dev_dbg(dev, "bStopBits:   %d\n", config->bStopBits);
+       dev_dbg(dev, "cXon:        %d\n", config->cXon);
+       dev_dbg(dev, "cXoff:       %d\n", config->cXoff);
+       dev_dbg(dev, "bUartMode:   %d\n", config->bUartMode);
  
        /* move the word values into big endian mode */
        cpu_to_be16s(&config->wFlags);
                                (__u8)(UMPM_UART1_PORT + port_number),
                                0, (__u8 *)config, sizeof(*config));
        if (status)
-               dbg("%s - error %d when trying to write config to device",
-                    __func__, status);
+               dev_dbg(dev, "%s - error %d when trying to write config to device\n",
+                       __func__, status);
        kfree(config);
  }
  
@@@ -2408,13 -2352,13 +2352,13 @@@ static void edge_set_termios(struct tty
        struct edgeport_port *edge_port = usb_get_serial_port_data(port);
        unsigned int cflag;
  
 -      cflag = tty->termios->c_cflag;
 +      cflag = tty->termios.c_cflag;
  
-       dbg("%s - clfag %08x iflag %08x", __func__,
-           tty->termios.c_cflag, tty->termios.c_iflag);
-       dbg("%s - old clfag %08x old iflag %08x", __func__,
-           old_termios->c_cflag, old_termios->c_iflag);
-       dbg("%s - port %d", __func__, port->number);
+       dev_dbg(&port->dev, "%s - clfag %08x iflag %08x\n", __func__,
 -              tty->termios->c_cflag, tty->termios->c_iflag);
++              tty->termios.c_cflag, tty->termios.c_iflag);
+       dev_dbg(&port->dev, "%s - old clfag %08x old iflag %08x\n", __func__,
+               old_termios->c_cflag, old_termios->c_iflag);
+       dev_dbg(&port->dev, "%s - port %d\n", __func__, port->number);
  
        if (edge_port == NULL)
                return;
@@@ -2430,8 -2374,6 +2374,6 @@@ static int edge_tiocmset(struct tty_str
        unsigned int mcr;
        unsigned long flags;
  
-       dbg("%s - port %d", __func__, port->number);
        spin_lock_irqsave(&edge_port->ep_lock, flags);
        mcr = edge_port->shadow_mcr;
        if (set & TIOCM_RTS)
@@@ -2464,8 -2406,6 +2406,6 @@@ static int edge_tiocmget(struct tty_str
        unsigned int mcr;
        unsigned long flags;
  
-       dbg("%s - port %d", __func__, port->number);
        spin_lock_irqsave(&edge_port->ep_lock, flags);
  
        msr = edge_port->shadow_msr;
                  | ((msr & EDGEPORT_MSR_DSR)   ? TIOCM_DSR: 0);  /* 0x100 */
  
  
-       dbg("%s -- %x", __func__, result);
+       dev_dbg(&port->dev, "%s -- %x\n", __func__, result);
        spin_unlock_irqrestore(&edge_port->ep_lock, flags);
  
        return result;
@@@ -2538,15 -2478,15 +2478,15 @@@ static int edge_ioctl(struct tty_struc
        struct async_icount cnow;
        struct async_icount cprev;
  
-       dbg("%s - port %d, cmd = 0x%x", __func__, port->number, cmd);
+       dev_dbg(&port->dev, "%s - port %d, cmd = 0x%x\n", __func__, port->number, cmd);
  
        switch (cmd) {
        case TIOCGSERIAL:
-               dbg("%s - (%d) TIOCGSERIAL", __func__, port->number);
+               dev_dbg(&port->dev, "%s - TIOCGSERIAL\n", __func__);
                return get_serial_info(edge_port,
                                (struct serial_struct __user *) arg);
        case TIOCMIWAIT:
-               dbg("%s - (%d) TIOCMIWAIT", __func__, port->number);
+               dev_dbg(&port->dev, "%s - TIOCMIWAIT\n", __func__);
                cprev = edge_port->icount;
                while (1) {
                        interruptible_sleep_on(&edge_port->delta_msr_wait);
@@@ -2578,8 -2518,6 +2518,6 @@@ static void edge_break(struct tty_struc
        int status;
        int bv = 0;     /* Off */
  
-       dbg("%s - state = %d", __func__, break_state);
        /* chase the port close */
        chase_port(edge_port, 0, 0);
  
                bv = 1; /* On */
        status = ti_do_config(edge_port, UMPC_SET_CLR_BREAK, bv);
        if (status)
-               dbg("%s - error %d sending break set/clear command.",
-                    __func__, status);
+               dev_dbg(&port->dev, "%s - error %d sending break set/clear command.\n",
+                       __func__, status);
  }
  
  static int edge_startup(struct usb_serial *serial)
@@@ -2655,7 -2593,6 +2593,6 @@@ cleanup
  
  static void edge_disconnect(struct usb_serial *serial)
  {
-       dbg("%s", __func__);
  }
  
  static void edge_release(struct usb_serial *serial)
        int i;
        struct edgeport_port *edge_port;
  
-       dbg("%s", __func__);
        for (i = 0; i < serial->num_ports; ++i) {
                edge_port = usb_get_serial_port_data(serial->port[i]);
                kfifo_free(&edge_port->write_fifo);
@@@ -2692,7 -2627,7 +2627,7 @@@ static ssize_t store_uart_mode(struct d
        struct edgeport_port *edge_port = usb_get_serial_port_data(port);
        unsigned int v = simple_strtoul(valbuf, NULL, 0);
  
-       dbg("%s: setting uart_mode = %d", __func__, v);
+       dev_dbg(dev, "%s: setting uart_mode = %d\n", __func__, v);
  
        if (v < 256)
                edge_port->bUartMode = v;
@@@ -2789,9 -2724,6 +2724,6 @@@ MODULE_DESCRIPTION(DRIVER_DESC)
  MODULE_LICENSE("GPL");
  MODULE_FIRMWARE("edgeport/down3.bin");
  
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug enabled or not");
  module_param(closing_wait, int, S_IRUGO | S_IWUSR);
  MODULE_PARM_DESC(closing_wait, "Maximum wait for data to drain, in .01 secs");
  
  #include <linux/usb/serial.h>
  #include <linux/usb/irda.h>
  
- /*
-  * Version Information
-  */
- #define DRIVER_VERSION "v0.5"
  #define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>, Johan Hovold <jhovold@gmail.com>"
  #define DRIVER_DESC "USB IR Dongle driver"
  
- static bool debug;
  /* if overridden by the user, then use their value for the size of the read and
   * write urbs */
  static int buffer_size;
@@@ -381,7 -375,7 +375,7 @@@ static void ir_set_termios(struct tty_s
                ir_xbof = ir_xbof_change(xbof) ;
  
        /* Only speed changes are supported */
 -      tty_termios_copy_hw(tty->termios, old_termios);
 +      tty_termios_copy_hw(&tty->termios, old_termios);
        tty_encode_baud_rate(tty, baud, baud);
  
        /*
@@@ -430,18 -424,12 +424,12 @@@ err_buf
  
  static int __init ir_init(void)
  {
-       int retval;
        if (buffer_size) {
                ir_device.bulk_in_size = buffer_size;
                ir_device.bulk_out_size = buffer_size;
        }
  
-       retval = usb_serial_register_drivers(serial_drivers, KBUILD_MODNAME, ir_id_table);
-       if (retval == 0)
-               printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
-                              DRIVER_DESC "\n");
-       return retval;
+       return usb_serial_register_drivers(serial_drivers, KBUILD_MODNAME, ir_id_table);
  }
  
  static void __exit ir_exit(void)
@@@ -457,8 -445,6 +445,6 @@@ MODULE_AUTHOR(DRIVER_AUTHOR)
  MODULE_DESCRIPTION(DRIVER_DESC);
  MODULE_LICENSE("GPL");
  
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug enabled or not");
  module_param(xbof, int, 0);
  MODULE_PARM_DESC(xbof, "Force specific number of XBOFs");
  module_param(buffer_size, int, 0);
  #include "iuu_phoenix.h"
  #include <linux/random.h>
  
- #ifdef CONFIG_USB_SERIAL_DEBUG
- static bool debug = 1;
- #else
- static bool debug;
- #endif
  /*
   * Version Information
   */
@@@ -72,7 -65,6 +65,6 @@@ struct iuu_private 
        u8 *writebuf;           /* buffer for writing to device */
        int writelen;           /* num of byte to write to device */
        u8 *buf;                /* used for initialize speed */
-       u8 *dbgbuf;             /* debug buffer */
        u8 len;
        int vcc;                /* vcc (either 3 or 5 V) */
        u32 baud;
  static void iuu_free_buf(struct iuu_private *priv)
  {
        kfree(priv->buf);
-       kfree(priv->dbgbuf);
        kfree(priv->writebuf);
  }
  
- static int iuu_alloc_buf(struct iuu_private *priv)
+ static int iuu_alloc_buf(struct usb_serial *serial, struct iuu_private *priv)
  {
        priv->buf = kzalloc(256, GFP_KERNEL);
-       priv->dbgbuf = kzalloc(256, GFP_KERNEL);
        priv->writebuf = kzalloc(256, GFP_KERNEL);
-       if (!priv->buf || !priv->dbgbuf || !priv->writebuf) {
+       if (!priv->buf || !priv->writebuf) {
                iuu_free_buf(priv);
-               dbg("%s problem allocation buffer", __func__);
+               dev_dbg(&serial->dev->dev, "%s problem allocation buffer\n", __func__);
                return -ENOMEM;
        }
-       dbg("%s - Privates buffers allocation success", __func__);
+       dev_dbg(&serial->dev->dev, "%s - Privates buffers allocation success\n", __func__);
        return 0;
  }
  
  static int iuu_startup(struct usb_serial *serial)
  {
        struct iuu_private *priv;
        priv = kzalloc(sizeof(struct iuu_private), GFP_KERNEL);
-       dbg("%s- priv allocation success", __func__);
+       dev_dbg(&serial->dev->dev, "%s- priv allocation success\n", __func__);
        if (!priv)
                return -ENOMEM;
-       if (iuu_alloc_buf(priv)) {
+       if (iuu_alloc_buf(serial, priv)) {
                kfree(priv);
                return -ENOMEM;
        }
@@@ -130,13 -121,13 +121,13 @@@ static void iuu_release(struct usb_seri
  
        if (priv) {
                iuu_free_buf(priv);
-               dbg("%s - I will free all", __func__);
+               dev_dbg(&port->dev, "%s - I will free all\n", __func__);
                usb_set_serial_port_data(port, NULL);
  
-               dbg("%s - priv is not anymore in port structure", __func__);
+               dev_dbg(&port->dev, "%s - priv is not anymore in port structure\n", __func__);
                kfree(priv);
  
-               dbg("%s priv is now kfree", __func__);
+               dev_dbg(&port->dev, "%s priv is now kfree\n", __func__);
        }
  }
  
@@@ -148,13 -139,13 +139,13 @@@ static int iuu_tiocmset(struct tty_stru
        unsigned long flags;
  
        /* FIXME: locking on tiomstatus */
-       dbg("%s (%d) msg : SET = 0x%04x, CLEAR = 0x%04x ", __func__,
-           port->number, set, clear);
+       dev_dbg(&port->dev, "%s msg : SET = 0x%04x, CLEAR = 0x%04x\n",
+               __func__, set, clear);
  
        spin_lock_irqsave(&priv->lock, flags);
  
        if ((set & TIOCM_RTS) && !(priv->tiostatus == TIOCM_RTS)) {
-               dbg("%s TIOCMSET RESET called !!!", __func__);
+               dev_dbg(&port->dev, "%s TIOCMSET RESET called !!!\n", __func__);
                priv->reset = 1;
        }
        if (set & TIOCM_RTS)
@@@ -190,7 -181,7 +181,7 @@@ static void iuu_rxcmd(struct urb *urb
        int status = urb->status;
  
        if (status) {
-               dbg("%s - status = %d", __func__, status);
+               dev_dbg(&port->dev, "%s - status = %d\n", __func__, status);
                /* error stop all */
                return;
        }
@@@ -244,13 -235,13 +235,13 @@@ static void iuu_update_status_callback(
        int status = urb->status;
  
        if (status) {
-               dbg("%s - status = %d", __func__, status);
+               dev_dbg(&port->dev, "%s - status = %d\n", __func__, status);
                /* error stop all */
                return;
        }
  
        st = urb->transfer_buffer;
-       dbg("%s - enter", __func__);
+       dev_dbg(&port->dev, "%s - enter\n", __func__);
        if (urb->actual_length == 1) {
                switch (st[0]) {
                case 0x1:
@@@ -272,7 -263,7 +263,7 @@@ static void iuu_status_callback(struct 
        int result;
        int status = urb->status;
  
-       dbg("%s - status = %d", __func__, status);
+       dev_dbg(&port->dev, "%s - status = %d\n", __func__, status);
        usb_fill_bulk_urb(port->read_urb, port->serial->dev,
                          usb_rcvbulkpipe(port->serial->dev,
                                          port->bulk_in_endpointAddress),
@@@ -311,9 -302,9 +302,9 @@@ static int bulk_immediate(struct usb_se
                         count, &actual, HZ * 1);
  
        if (status != IUU_OPERATION_OK)
-               dbg("%s - error = %2x", __func__, status);
+               dev_dbg(&port->dev, "%s - error = %2x\n", __func__, status);
        else
-               dbg("%s - write OK !", __func__);
+               dev_dbg(&port->dev, "%s - write OK !\n", __func__);
        return status;
  }
  
@@@ -331,9 -322,9 +322,9 @@@ static int read_immediate(struct usb_se
                         count, &actual, HZ * 1);
  
        if (status != IUU_OPERATION_OK)
-               dbg("%s - error = %2x", __func__, status);
+               dev_dbg(&port->dev, "%s - error = %2x\n", __func__, status);
        else
-               dbg("%s - read OK !", __func__);
+               dev_dbg(&port->dev, "%s - read OK !\n", __func__);
        return status;
  }
  
@@@ -357,9 -348,9 +348,9 @@@ static int iuu_led(struct usb_serial_po
        status = bulk_immediate(port, buf, 8);
        kfree(buf);
        if (status != IUU_OPERATION_OK)
-               dbg("%s - led error status = %2x", __func__, status);
+               dev_dbg(&port->dev, "%s - led error status = %2x\n", __func__, status);
        else
-               dbg("%s - led OK !", __func__);
+               dev_dbg(&port->dev, "%s - led OK !\n", __func__);
        return IUU_OPERATION_OK;
  }
  
@@@ -445,7 -436,7 +436,7 @@@ static int iuu_clk(struct usb_serial_po
  
                status = bulk_immediate(port, (u8 *) priv->buf, Count);
                if (status != 0) {
-                       dbg("%s - write error ", __func__);
+                       dev_dbg(&port->dev, "%s - write error\n", __func__);
                        return status;
                }
        } else if (frq == 3579000) {
  
        status = bulk_immediate(port, (u8 *) priv->buf, Count);
        if (status != IUU_OPERATION_OK)
-               dbg("%s - write error ", __func__);
+               dev_dbg(&port->dev, "%s - write error\n", __func__);
        return status;
  }
  
  static int iuu_uart_flush(struct usb_serial_port *port)
  {
+       struct device *dev = &port->dev;
        int i;
        int status;
        u8 rxcmd = IUU_UART_RX;
        for (i = 0; i < 2; i++) {
                status = bulk_immediate(port, &rxcmd, 1);
                if (status != IUU_OPERATION_OK) {
-                       dbg("%s - uart_flush_write error", __func__);
+                       dev_dbg(dev, "%s - uart_flush_write error\n", __func__);
                        return status;
                }
  
                status = read_immediate(port, &priv->len, 1);
                if (status != IUU_OPERATION_OK) {
-                       dbg("%s - uart_flush_read error", __func__);
+                       dev_dbg(dev, "%s - uart_flush_read error\n", __func__);
                        return status;
                }
  
                if (priv->len > 0) {
-                       dbg("%s - uart_flush datalen is : %i ", __func__,
-                           priv->len);
+                       dev_dbg(dev, "%s - uart_flush datalen is : %i\n", __func__, priv->len);
                        status = read_immediate(port, priv->buf, priv->len);
                        if (status != IUU_OPERATION_OK) {
-                               dbg("%s - uart_flush_read error", __func__);
+                               dev_dbg(dev, "%s - uart_flush_read error\n", __func__);
                                return status;
                        }
                }
        }
-       dbg("%s - uart_flush_read OK!", __func__);
+       dev_dbg(dev, "%s - uart_flush_read OK!\n", __func__);
        iuu_led(port, 0, 0xF000, 0, 0xFF);
        return status;
  }
@@@ -610,10 -601,10 +601,10 @@@ static void read_buf_callback(struct ur
                return;
        }
  
-       dbg("%s - %i chars to write", __func__, urb->actual_length);
+       dev_dbg(&port->dev, "%s - %i chars to write\n", __func__, urb->actual_length);
        tty = tty_port_tty_get(&port->port);
        if (data == NULL)
-               dbg("%s - data is NULL !!!", __func__);
+               dev_dbg(&port->dev, "%s - data is NULL !!!\n", __func__);
        if (tty && urb->actual_length && data) {
                tty_insert_flip_string(tty, data, urb->actual_length);
                tty_flip_buffer_push(tty);
@@@ -627,7 -618,6 +618,6 @@@ static int iuu_bulk_write(struct usb_se
        struct iuu_private *priv = usb_get_serial_port_data(port);
        unsigned long flags;
        int result;
-       int i;
        int buf_len;
        char *buf_ptr = port->write_urb->transfer_buffer;
  
        buf_len = priv->writelen;
        priv->writelen = 0;
        spin_unlock_irqrestore(&priv->lock, flags);
-       if (debug == 1) {
-               for (i = 0; i < buf_len; i++)
-                       sprintf(priv->dbgbuf + i*2 ,
-                               "%02X", priv->writebuf[i]);
-               priv->dbgbuf[buf_len+i*2] = 0;
-               dbg("%s - writing %i chars : %s", __func__,
-                   buf_len, priv->dbgbuf);
-       }
+       dev_dbg(&port->dev, "%s - writing %i chars : %*ph\n", __func__,
+               buf_len, buf_len, buf_ptr);
        usb_fill_bulk_urb(port->write_urb, port->serial->dev,
                          usb_sndbulkpipe(port->serial->dev,
                                          port->bulk_out_endpointAddress),
@@@ -683,18 -667,18 +667,18 @@@ static void iuu_uart_read_callback(stru
        priv->poll++;
  
        if (status) {
-               dbg("%s - status = %d", __func__, status);
+               dev_dbg(&port->dev, "%s - status = %d\n", __func__, status);
                /* error stop all */
                return;
        }
        if (data == NULL)
-               dbg("%s - data is NULL !!!", __func__);
+               dev_dbg(&port->dev, "%s - data is NULL !!!\n", __func__);
  
        if (urb->actual_length == 1  && data != NULL)
                len = (int) data[0];
  
        if (urb->actual_length > 1) {
-               dbg("%s - urb->actual_length = %i", __func__,
+               dev_dbg(&port->dev, "%s - urb->actual_length = %i\n", __func__,
                    urb->actual_length);
                error = 1;
                return;
        /* if len > 0 call readbuf */
  
        if (len > 0 && error == 0) {
-               dbg("%s - call read buf - len to read is %i ",
+               dev_dbg(&port->dev, "%s - call read buf - len to read is %i\n",
                        __func__, len);
                status = iuu_read_buf(port, len);
                return;
        }
        spin_unlock_irqrestore(&priv->lock, flags);
        /* if nothing to write call again rxcmd */
-       dbg("%s - rxcmd recall", __func__);
+       dev_dbg(&port->dev, "%s - rxcmd recall\n", __func__);
        iuu_led_activity_off(urb);
  }
  
@@@ -769,7 -753,7 +753,7 @@@ static void read_rxcmd_callback(struct 
                          port->read_urb->transfer_buffer, 256,
                          iuu_uart_read_callback, port);
        result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
-       dbg("%s - submit result = %d", __func__, result);
+       dev_dbg(&port->dev, "%s - submit result = %d\n", __func__, result);
  }
  
  static int iuu_uart_on(struct usb_serial_port *port)
  
        status = bulk_immediate(port, buf, 4);
        if (status != IUU_OPERATION_OK) {
-               dbg("%s - uart_on error", __func__);
+               dev_dbg(&port->dev, "%s - uart_on error\n", __func__);
                goto uart_enable_failed;
        }
        /*  iuu_reset() the card after iuu_uart_on() */
        status = iuu_uart_flush(port);
        if (status != IUU_OPERATION_OK)
-               dbg("%s - uart_flush error", __func__);
+               dev_dbg(&port->dev, "%s - uart_flush error\n", __func__);
  uart_enable_failed:
        kfree(buf);
        return status;
@@@ -813,7 -797,7 +797,7 @@@ static int iuu_uart_off(struct usb_seri
  
        status = bulk_immediate(port, buf, 1);
        if (status != IUU_OPERATION_OK)
-               dbg("%s - uart_off error", __func__);
+               dev_dbg(&port->dev, "%s - uart_off error\n", __func__);
  
        kfree(buf);
        return status;
@@@ -830,7 -814,7 +814,7 @@@ static int iuu_uart_baud(struct usb_ser
        u8 T1reload = 0;
        unsigned int T1FrekvensHZ = 0;
  
-       dbg("%s - enter baud_base=%d", __func__, baud_base);
+       dev_dbg(&port->dev, "%s - enter baud_base=%d\n", __func__, baud_base);
        dataout = kmalloc(sizeof(u8) * 5, GFP_KERNEL);
  
        if (!dataout)
  
        status = bulk_immediate(port, dataout, DataCount);
        if (status != IUU_OPERATION_OK)
-               dbg("%s - uart_off error", __func__);
+               dev_dbg(&port->dev, "%s - uart_off error\n", __func__);
        kfree(dataout);
        return status;
  }
@@@ -921,7 -905,7 +905,7 @@@ static void iuu_set_termios(struct tty_
  {
        const u32 supported_mask = CMSPAR|PARENB|PARODD;
        struct iuu_private *priv = usb_get_serial_port_data(port);
 -      unsigned int cflag = tty->termios->c_cflag;
 +      unsigned int cflag = tty->termios.c_cflag;
        int status;
        u32 actual;
        u32 parity;
        u32 newval = cflag & supported_mask;
  
        /* Just use the ospeed. ispeed should be the same. */
 -      baud = tty->termios->c_ospeed;
 +      baud = tty->termios.c_ospeed;
  
-       dbg("%s - enter c_ospeed or baud=%d", __func__, baud);
+       dev_dbg(&port->dev, "%s - enter c_ospeed or baud=%d\n", __func__, baud);
  
        /* compute the parity parameter */
        parity = 0;
         * settings back over and then adjust them
         */
        if (old_termios)
 -              tty_termios_copy_hw(tty->termios, old_termios);
 +              tty_termios_copy_hw(&tty->termios, old_termios);
        if (status != 0)        /* Set failed - return old bits */
                return;
        /* Re-encode speed, parity and csize */
        tty_encode_baud_rate(tty, baud, baud);
 -      tty->termios->c_cflag &= ~(supported_mask|CSIZE);
 -      tty->termios->c_cflag |= newval | csize;
 +      tty->termios.c_cflag &= ~(supported_mask|CSIZE);
 +      tty->termios.c_cflag |= newval | csize;
  }
  
  static void iuu_close(struct usb_serial_port *port)
        if (serial->dev) {
                /* free writebuf */
                /* shutdown our urbs */
-               dbg("%s - shutting down urbs", __func__);
+               dev_dbg(&port->dev, "%s - shutting down urbs\n", __func__);
                usb_kill_urb(port->write_urb);
                usb_kill_urb(port->read_urb);
                usb_kill_urb(port->interrupt_in_urb);
  
  static void iuu_init_termios(struct tty_struct *tty)
  {
 -      *(tty->termios) = tty_std_termios;
 -      tty->termios->c_cflag = CLOCAL | CREAD | CS8 | B9600
 +      tty->termios = tty_std_termios;
 +      tty->termios.c_cflag = CLOCAL | CREAD | CS8 | B9600
                                | TIOCM_CTS | CSTOPB | PARENB;
 -      tty->termios->c_ispeed = 9600;
 -      tty->termios->c_ospeed = 9600;
 -      tty->termios->c_lflag = 0;
 -      tty->termios->c_oflag = 0;
 -      tty->termios->c_iflag = 0;
 +      tty->termios.c_ispeed = 9600;
 +      tty->termios.c_ospeed = 9600;
 +      tty->termios.c_lflag = 0;
 +      tty->termios.c_oflag = 0;
 +      tty->termios.c_iflag = 0;
  }
  
  static int iuu_open(struct tty_struct *tty, struct usb_serial_port *port)
  {
        struct usb_serial *serial = port->serial;
+       struct device *dev = &port->dev;
        u8 *buf;
        int result;
        int baud;
        u32 actual;
        struct iuu_private *priv = usb_get_serial_port_data(port);
  
 -      baud = tty->termios->c_ospeed;
 -      tty->termios->c_ispeed = baud;
 +      baud = tty->termios.c_ospeed;
 +      tty->termios.c_ispeed = baud;
        /* Re-encode speed */
        tty_encode_baud_rate(tty, baud, baud);
  
-       dbg("%s -  port %d, baud %d", __func__, port->number, baud);
+       dev_dbg(dev, "%s - baud %d\n", __func__, baud);
        usb_clear_halt(serial->dev, port->write_urb->pipe);
        usb_clear_halt(serial->dev, port->read_urb->pipe);
  
        result = usb_control_msg(port->serial->dev,     \
                                usb_rcvctrlpipe(port->serial->dev, 0),  \
                                b, a, c, d, buf, 1, 1000); \
-       dbg("0x%x:0x%x:0x%x:0x%x  %d - %x", a, b, c, d, result, \
+       dev_dbg(dev, "0x%x:0x%x:0x%x:0x%x  %d - %x\n", a, b, c, d, result, \
                                buf[0]); } while (0);
  
  #define SOUP(a, b, c, d)  do { \
        result = usb_control_msg(port->serial->dev,     \
                                usb_sndctrlpipe(port->serial->dev, 0),  \
                                b, a, c, d, NULL, 0, 1000); \
-       dbg("0x%x:0x%x:0x%x:0x%x  %d", a, b, c, d, result); } while (0)
+       dev_dbg(dev, "0x%x:0x%x:0x%x:0x%x  %d\n", a, b, c, d, result); } while (0)
  
        /*  This is not UART related but IUU USB driver related or something */
        /*  like that. Basically no IUU will accept any commands from the USB */
  
        iuu_uart_flush(port);
  
-       dbg("%s - initialization done", __func__);
+       dev_dbg(dev, "%s - initialization done\n", __func__);
  
        memset(port->write_urb->transfer_buffer, IUU_UART_RX, 1);
        usb_fill_bulk_urb(port->write_urb, port->serial->dev,
                          read_rxcmd_callback, port);
        result = usb_submit_urb(port->write_urb, GFP_KERNEL);
        if (result) {
-               dev_err(&port->dev, "%s - failed submitting read urb,"
-                       " error %d\n", __func__, result);
+               dev_err(dev, "%s - failed submitting read urb, error %d\n", __func__, result);
                iuu_close(port);
        } else {
-               dbg("%s - rxcmd OK", __func__);
+               dev_dbg(dev, "%s - rxcmd OK\n", __func__);
        }
  
        return result;
@@@ -1159,9 -1143,9 +1143,9 @@@ static int iuu_vcc_set(struct usb_seria
        kfree(buf);
  
        if (status != IUU_OPERATION_OK)
-               dbg("%s - vcc error status = %2x", __func__, status);
+               dev_dbg(&port->dev, "%s - vcc error status = %2x\n", __func__, status);
        else
-               dbg("%s - vcc OK !", __func__);
+               dev_dbg(&port->dev, "%s - vcc OK !\n", __func__);
  
        return status;
  }
@@@ -1192,7 -1176,7 +1176,7 @@@ static ssize_t store_vcc_mode(struct de
                goto fail_store_vcc_mode;
        }
  
-       dbg("%s: setting vcc_mode = %ld", __func__, v);
+       dev_dbg(dev, "%s: setting vcc_mode = %ld", __func__, v);
  
        if ((v != 3) && (v != 5)) {
                dev_err(dev, "%s - vcc_mode %ld is invalid\n", __func__, v);
@@@ -1257,8 -1241,6 +1241,6 @@@ MODULE_DESCRIPTION(DRIVER_DESC)
  MODULE_LICENSE("GPL");
  
  MODULE_VERSION(DRIVER_VERSION);
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug enabled or not");
  
  module_param(xmas, bool, S_IRUGO | S_IWUSR);
  MODULE_PARM_DESC(xmas, "Xmas colors enabled or not");
  #include <linux/tty_flip.h>
  #include <linux/module.h>
  #include <linux/spinlock.h>
- #include <linux/firmware.h>
- #include <linux/ihex.h>
  #include <linux/uaccess.h>
  #include <linux/usb.h>
  #include <linux/usb/serial.h>
+ #include <linux/usb/ezusb.h>
  #include "keyspan.h"
  
- static bool debug;
  /*
   * Version Information
   */
@@@ -158,14 -155,14 +155,14 @@@ static void keyspan_set_termios(struct 
  
        p_priv = usb_get_serial_port_data(port);
        d_details = p_priv->device_details;
 -      cflag = tty->termios->c_cflag;
 +      cflag = tty->termios.c_cflag;
        device_port = port->number - port->serial->minor;
  
        /* Baud rate calculation takes baud rate as an integer
           so other rates can be generated if desired. */
        baud_rate = tty_get_baud_rate(tty);
        /* If no match or invalid, don't change */
-       if (d_details->calculate_baud_rate(baud_rate, d_details->baudclk,
+       if (d_details->calculate_baud_rate(port, baud_rate, d_details->baudclk,
                                NULL, NULL, NULL, device_port) == KEYSPAN_BAUD_RATE_OK) {
                /* FIXME - more to do here to ensure rate changes cleanly */
                /* FIXME - calcuate exact rate from divisor ? */
        p_priv->flow_control = (cflag & CRTSCTS) ? flow_cts : flow_none;
  
        /* Mark/Space not supported */
 -      tty->termios->c_cflag &= ~CMSPAR;
 +      tty->termios.c_cflag &= ~CMSPAR;
  
        keyspan_send_setup(port, 0);
  }
@@@ -241,8 -238,8 +238,8 @@@ static int keyspan_write(struct tty_str
                dataOffset = 1;
        }
  
-       dbg("%s - for port %d (%d chars), flip=%d",
-           __func__, port->number, count, p_priv->out_flip);
+       dev_dbg(&port->dev, "%s - for port %d (%d chars), flip=%d\n",
+               __func__, port->number, count, p_priv->out_flip);
  
        for (left = count; left > 0; left -= todo) {
                todo = left;
                this_urb = p_priv->out_urbs[flip];
                if (this_urb == NULL) {
                        /* no bulk out, so return 0 bytes written */
-                       dbg("%s - no output urb :(", __func__);
+                       dev_dbg(&port->dev, "%s - no output urb :(\n", __func__);
                        return count;
                }
  
-               dbg("%s - endpoint %d flip %d",
+               dev_dbg(&port->dev, "%s - endpoint %d flip %d\n",
                        __func__, usb_pipeendpoint(this_urb->pipe), flip);
  
                if (this_urb->status == -EINPROGRESS) {
  
                err = usb_submit_urb(this_urb, GFP_ATOMIC);
                if (err != 0)
-                       dbg("usb_submit_urb(write bulk) failed (%d)", err);
+                       dev_dbg(&port->dev, "usb_submit_urb(write bulk) failed (%d)\n", err);
                p_priv->tx_start_time[flip] = jiffies;
  
                /* Flip for next time if usa26 or usa28 interface
@@@ -305,8 -302,8 +302,8 @@@ static void        usa26_indat_callback(struc
        endpoint = usb_pipeendpoint(urb->pipe);
  
        if (status) {
-               dbg("%s - nonzero status: %x on endpoint %d.",
-                   __func__, status, endpoint);
+               dev_dbg(&urb->dev->dev,"%s - nonzero status: %x on endpoint %d.\n",
+                       __func__, status, endpoint);
                return;
        }
  
                                tty_insert_flip_char(tty, data[i], err);
                } else {
                        /* some bytes had errors, every byte has status */
-                       dbg("%s - RX error!!!!", __func__);
+                       dev_dbg(&port->dev, "%s - RX error!!!!\n", __func__);
                        for (i = 0; i + 1 < urb->actual_length; i += 2) {
                                int stat = data[i], flag = 0;
                                if (stat & RXERROR_OVERRUN)
        /* Resubmit urb so we continue receiving */
        err = usb_submit_urb(urb, GFP_ATOMIC);
        if (err != 0)
-               dbg("%s - resubmit read urb failed. (%d)", __func__, err);
+               dev_dbg(&port->dev, "%s - resubmit read urb failed. (%d)\n", __func__, err);
  }
  
  /* Outdat handling is common for all devices */
@@@ -356,7 -353,7 +353,7 @@@ static void        usa2x_outdat_callback(struc
  
        port =  urb->context;
        p_priv = usb_get_serial_port_data(port);
-       dbg("%s - urb %d", __func__, urb == p_priv->out_urbs[1]);
+       dev_dbg(&port->dev, "%s - urb %d\n", __func__, urb == p_priv->out_urbs[1]);
  
        usb_serial_port_softint(port);
  }
@@@ -374,7 -371,7 +371,7 @@@ static void        usa26_outcont_callback(stru
        p_priv = usb_get_serial_port_data(port);
  
        if (p_priv->resend_cont) {
-               dbg("%s - sending setup", __func__);
+               dev_dbg(&port->dev, "%s - sending setup\n", __func__);
                keyspan_usa26_send_setup(port->serial, port,
                                                p_priv->resend_cont - 1);
        }
@@@ -394,20 -391,22 +391,22 @@@ static void     usa26_instat_callback(struc
        serial =  urb->context;
  
        if (status) {
-               dbg("%s - nonzero status: %x", __func__, status);
+               dev_dbg(&urb->dev->dev, "%s - nonzero status: %x\n", __func__, status);
                return;
        }
        if (urb->actual_length != 9) {
-               dbg("%s - %d byte report??", __func__, urb->actual_length);
+               dev_dbg(&urb->dev->dev, "%s - %d byte report??\n", __func__, urb->actual_length);
                goto exit;
        }
  
        msg = (struct keyspan_usa26_portStatusMessage *)data;
  
  #if 0
-       dbg("%s - port status: port %d cts %d dcd %d dsr %d ri %d toff %d txoff %d rxen %d cr %d",
-           __func__, msg->port, msg->hskia_cts, msg->gpia_dcd, msg->dsr, msg->ri, msg->_txOff,
-           msg->_txXoff, msg->rxEnabled, msg->controlResponse);
+       dev_dbg(&urb->dev->dev,
+               "%s - port status: port %d cts %d dcd %d dsr %d ri %d toff %d txoff %d rxen %d cr %d",
+               __func__, msg->port, msg->hskia_cts, msg->gpia_dcd, msg->dsr,
+               msg->ri, msg->_txOff, msg->_txXoff, msg->rxEnabled,
+               msg->controlResponse);
  #endif
  
        /* Now do something useful with the data */
  
        /* Check port number from message and retrieve private data */
        if (msg->port >= serial->num_ports) {
-               dbg("%s - Unexpected port number %d", __func__, msg->port);
+               dev_dbg(&urb->dev->dev, "%s - Unexpected port number %d\n", __func__, msg->port);
                goto exit;
        }
        port = serial->port[msg->port];
        /* Resubmit urb so we continue receiving */
        err = usb_submit_urb(urb, GFP_ATOMIC);
        if (err != 0)
-               dbg("%s - resubmit read urb failed. (%d)", __func__, err);
+               dev_dbg(&port->dev, "%s - resubmit read urb failed. (%d)\n", __func__, err);
  exit: ;
  }
  
@@@ -465,8 -464,8 +464,8 @@@ static void usa28_indat_callback(struc
  
        do {
                if (status) {
-                       dbg("%s - nonzero status: %x on endpoint %d.",
-                           __func__, status, usb_pipeendpoint(urb->pipe));
+                       dev_dbg(&urb->dev->dev, "%s - nonzero status: %x on endpoint %d.\n",
+                               __func__, status, usb_pipeendpoint(urb->pipe));
                        return;
                }
  
                /* Resubmit urb so we continue receiving */
                err = usb_submit_urb(urb, GFP_ATOMIC);
                if (err != 0)
-                       dbg("%s - resubmit read urb failed. (%d)",
+                       dev_dbg(&port->dev, "%s - resubmit read urb failed. (%d)\n",
                                                        __func__, err);
                p_priv->in_flip ^= 1;
  
@@@ -505,7 -504,7 +504,7 @@@ static void        usa28_outcont_callback(stru
        p_priv = usb_get_serial_port_data(port);
  
        if (p_priv->resend_cont) {
-               dbg("%s - sending setup", __func__);
+               dev_dbg(&port->dev, "%s - sending setup\n", __func__);
                keyspan_usa28_send_setup(port->serial, port,
                                                p_priv->resend_cont - 1);
        }
@@@ -526,25 -525,28 +525,28 @@@ static void     usa28_instat_callback(struc
        serial =  urb->context;
  
        if (status) {
-               dbg("%s - nonzero status: %x", __func__, status);
+               dev_dbg(&urb->dev->dev, "%s - nonzero status: %x\n", __func__, status);
                return;
        }
  
        if (urb->actual_length != sizeof(struct keyspan_usa28_portStatusMessage)) {
-               dbg("%s - bad length %d", __func__, urb->actual_length);
+               dev_dbg(&urb->dev->dev, "%s - bad length %d\n", __func__, urb->actual_length);
                goto exit;
        }
  
-       /*dbg("%s %x %x %x %x %x %x %x %x %x %x %x %x", __func__
-           data[0], data[1], data[2], data[3], data[4], data[5],
-           data[6], data[7], data[8], data[9], data[10], data[11]);*/
+       /*
+       dev_dbg(&urb->dev->dev,
+               "%s %x %x %x %x %x %x %x %x %x %x %x %x", __func__,
+               data[0], data[1], data[2], data[3], data[4], data[5],
+               data[6], data[7], data[8], data[9], data[10], data[11]);
+       */
  
        /* Now do something useful with the data */
        msg = (struct keyspan_usa28_portStatusMessage *)data;
  
        /* Check port number from message and retrieve private data */
        if (msg->port >= serial->num_ports) {
-               dbg("%s - Unexpected port number %d", __func__, msg->port);
+               dev_dbg(&urb->dev->dev, "%s - Unexpected port number %d\n", __func__, msg->port);
                goto exit;
        }
        port = serial->port[msg->port];
                /* Resubmit urb so we continue receiving */
        err = usb_submit_urb(urb, GFP_ATOMIC);
        if (err != 0)
-               dbg("%s - resubmit read urb failed. (%d)", __func__, err);
+               dev_dbg(&port->dev, "%s - resubmit read urb failed. (%d)\n", __func__, err);
  exit: ;
  }
  
@@@ -589,7 -591,7 +591,7 @@@ static void        usa49_glocont_callback(stru
                p_priv = usb_get_serial_port_data(port);
  
                if (p_priv->resend_cont) {
-                       dbg("%s - sending setup", __func__);
+                       dev_dbg(&port->dev, "%s - sending setup\n", __func__);
                        keyspan_usa49_send_setup(serial, port,
                                                p_priv->resend_cont - 1);
                        break;
@@@ -613,27 -615,29 +615,29 @@@ static void     usa49_instat_callback(struc
        serial =  urb->context;
  
        if (status) {
-               dbg("%s - nonzero status: %x", __func__, status);
+               dev_dbg(&urb->dev->dev, "%s - nonzero status: %x\n", __func__, status);
                return;
        }
  
        if (urb->actual_length !=
                        sizeof(struct keyspan_usa49_portStatusMessage)) {
-               dbg("%s - bad length %d", __func__, urb->actual_length);
+               dev_dbg(&urb->dev->dev, "%s - bad length %d\n", __func__, urb->actual_length);
                goto exit;
        }
  
-       /*dbg(" %x %x %x %x %x %x %x %x %x %x %x", __func__,
-           data[0], data[1], data[2], data[3], data[4], data[5],
-           data[6], data[7], data[8], data[9], data[10]);*/
+       /*
+       dev_dbg(&urb->dev->dev, "%s: %x %x %x %x %x %x %x %x %x %x %x",
+               __func__, data[0], data[1], data[2], data[3], data[4],
+               data[5], data[6], data[7], data[8], data[9], data[10]);
+       */
  
        /* Now do something useful with the data */
        msg = (struct keyspan_usa49_portStatusMessage *)data;
  
        /* Check port number from message and retrieve private data */
        if (msg->portNumber >= serial->num_ports) {
-               dbg("%s - Unexpected port number %d",
-                                       __func__, msg->portNumber);
+               dev_dbg(&urb->dev->dev, "%s - Unexpected port number %d\n",
+                       __func__, msg->portNumber);
                goto exit;
        }
        port = serial->port[msg->portNumber];
        /* Resubmit urb so we continue receiving */
        err = usb_submit_urb(urb, GFP_ATOMIC);
        if (err != 0)
-               dbg("%s - resubmit read urb failed. (%d)", __func__, err);
+               dev_dbg(&port->dev, "%s - resubmit read urb failed. (%d)\n", __func__, err);
  exit: ;
  }
  
@@@ -676,8 -680,8 +680,8 @@@ static void        usa49_indat_callback(struc
        endpoint = usb_pipeendpoint(urb->pipe);
  
        if (status) {
-               dbg("%s - nonzero status: %x on endpoint %d.", __func__,
-                   status, endpoint);
+               dev_dbg(&urb->dev->dev, "%s - nonzero status: %x on endpoint %d.\n",
+                       __func__, status, endpoint);
                return;
        }
  
        /* Resubmit urb so we continue receiving */
        err = usb_submit_urb(urb, GFP_ATOMIC);
        if (err != 0)
-               dbg("%s - resubmit read urb failed. (%d)", __func__, err);
+               dev_dbg(&port->dev, "%s - resubmit read urb failed. (%d)\n", __func__, err);
  }
  
  static void usa49wg_indat_callback(struct urb *urb)
        serial = urb->context;
  
        if (status) {
-               dbg("%s - nonzero status: %x", __func__, status);
+               dev_dbg(&urb->dev->dev, "%s - nonzero status: %x\n", __func__, status);
                return;
        }
  
  
                        /* Check port number from message*/
                        if (data[i] >= serial->num_ports) {
-                               dbg("%s - Unexpected port number %d",
+                               dev_dbg(&urb->dev->dev, "%s - Unexpected port number %d\n",
                                        __func__, data[i]);
                                return;
                        }
        /* Resubmit urb so we continue receiving */
        err = usb_submit_urb(urb, GFP_ATOMIC);
        if (err != 0)
-               dbg("%s - resubmit read urb failed. (%d)", __func__, err);
+               dev_dbg(&urb->dev->dev, "%s - resubmit read urb failed. (%d)\n", __func__, err);
  }
  
  /* not used, usa-49 doesn't have per-port control endpoints */
@@@ -799,7 -803,7 +803,7 @@@ static void usa90_indat_callback(struc
        endpoint = usb_pipeendpoint(urb->pipe);
  
        if (status) {
-               dbg("%s - nonzero status: %x on endpoint %d.",
+               dev_dbg(&urb->dev->dev, "%s - nonzero status: %x on endpoint %d.\n",
                    __func__, status, endpoint);
                return;
        }
                                                                        err);
                        }  else {
                        /* some bytes had errors, every byte has status */
-                               dbg("%s - RX error!!!!", __func__);
+                               dev_dbg(&port->dev, "%s - RX error!!!!\n", __func__);
                                for (i = 0; i + 1 < urb->actual_length; i += 2) {
                                        int stat = data[i], flag = 0;
                                        if (stat & RXERROR_OVERRUN)
        /* Resubmit urb so we continue receiving */
        err = usb_submit_urb(urb, GFP_ATOMIC);
        if (err != 0)
-               dbg("%s - resubmit read urb failed. (%d)", __func__, err);
+               dev_dbg(&port->dev, "%s - resubmit read urb failed. (%d)\n", __func__, err);
  }
  
  
@@@ -868,11 -872,11 +872,11 @@@ static void     usa90_instat_callback(struc
        serial =  urb->context;
  
        if (status) {
-               dbg("%s - nonzero status: %x", __func__, status);
+               dev_dbg(&urb->dev->dev, "%s - nonzero status: %x\n", __func__, status);
                return;
        }
        if (urb->actual_length < 14) {
-               dbg("%s - %d byte report??", __func__, urb->actual_length);
+               dev_dbg(&urb->dev->dev, "%s - %d byte report??\n", __func__, urb->actual_length);
                goto exit;
        }
  
        /* Resubmit urb so we continue receiving */
        err = usb_submit_urb(urb, GFP_ATOMIC);
        if (err != 0)
-               dbg("%s - resubmit read urb failed. (%d)", __func__, err);
+               dev_dbg(&port->dev, "%s - resubmit read urb failed. (%d)\n", __func__, err);
  exit:
        ;
  }
@@@ -914,7 -918,7 +918,7 @@@ static void        usa90_outcont_callback(stru
        p_priv = usb_get_serial_port_data(port);
  
        if (p_priv->resend_cont) {
-               dbg("%s - sending setup", __func__);
+               dev_dbg(&urb->dev->dev, "%s - sending setup\n", __func__);
                keyspan_usa90_send_setup(port->serial, port,
                                                p_priv->resend_cont - 1);
        }
@@@ -935,13 -939,13 +939,13 @@@ static void     usa67_instat_callback(struc
        serial = urb->context;
  
        if (status) {
-               dbg("%s - nonzero status: %x", __func__, status);
+               dev_dbg(&urb->dev->dev, "%s - nonzero status: %x\n", __func__, status);
                return;
        }
  
        if (urb->actual_length !=
                        sizeof(struct keyspan_usa67_portStatusMessage)) {
-               dbg("%s - bad length %d", __func__, urb->actual_length);
+               dev_dbg(&urb->dev->dev, "%s - bad length %d\n", __func__, urb->actual_length);
                return;
        }
  
  
        /* Check port number from message and retrieve private data */
        if (msg->port >= serial->num_ports) {
-               dbg("%s - Unexpected port number %d", __func__, msg->port);
+               dev_dbg(&urb->dev->dev, "%s - Unexpected port number %d\n", __func__, msg->port);
                return;
        }
  
        /* Resubmit urb so we continue receiving */
        err = usb_submit_urb(urb, GFP_ATOMIC);
        if (err != 0)
-               dbg("%s - resubmit read urb failed. (%d)", __func__, err);
+               dev_dbg(&port->dev, "%s - resubmit read urb failed. (%d)\n", __func__, err);
  }
  
  static void usa67_glocont_callback(struct urb *urb)
                p_priv = usb_get_serial_port_data(port);
  
                if (p_priv->resend_cont) {
-                       dbg("%s - sending setup", __func__);
+                       dev_dbg(&port->dev, "%s - sending setup\n", __func__);
                        keyspan_usa67_send_setup(serial, port,
                                                p_priv->resend_cont - 1);
                        break;
@@@ -1068,8 -1072,7 +1072,7 @@@ static int keyspan_open(struct tty_stru
                usb_clear_halt(urb->dev, urb->pipe);
                err = usb_submit_urb(urb, GFP_KERNEL);
                if (err != 0)
-                       dbg("%s - submit urb %d failed (%d)",
-                                                       __func__, i, err);
+                       dev_dbg(&port->dev, "%s - submit urb %d failed (%d)\n", __func__, i, err);
        }
  
        /* Reset low level data toggle on out endpoints */
  
        device_port = port->number - port->serial->minor;
        if (tty) {
 -              cflag = tty->termios->c_cflag;
 +              cflag = tty->termios.c_cflag;
                /* Baud rate calculation takes baud rate as an integer
                   so other rates can be generated if desired. */
                baud_rate = tty_get_baud_rate(tty);
                /* If no match or invalid, leave as default */
                if (baud_rate >= 0
-                   && d_details->calculate_baud_rate(baud_rate, d_details->baudclk,
+                   && d_details->calculate_baud_rate(port, baud_rate, d_details->baudclk,
                                        NULL, NULL, NULL, device_port) == KEYSPAN_BAUD_RATE_OK) {
                        p_priv->baud = baud_rate;
                }
@@@ -1142,7 -1145,7 +1145,7 @@@ static void keyspan_close(struct usb_se
        }
  
        /*while (p_priv->outcont_urb->status == -EINPROGRESS) {
-               dbg("%s - urb in progress", __func__);
+               dev_dbg(&port->dev, "%s - urb in progress\n", __func__);
        }*/
  
        p_priv->out_flip = 0;
  /* download the firmware to a pre-renumeration device */
  static int keyspan_fake_startup(struct usb_serial *serial)
  {
-       int                             response;
-       const struct ihex_binrec        *record;
-       char                            *fw_name;
-       const struct firmware           *fw;
+       char    *fw_name;
  
-       dbg("Keyspan startup version %04x product %04x",
-           le16_to_cpu(serial->dev->descriptor.bcdDevice),
-           le16_to_cpu(serial->dev->descriptor.idProduct));
+       dev_dbg(&serial->dev->dev, "Keyspan startup version %04x product %04x\n",
+               le16_to_cpu(serial->dev->descriptor.bcdDevice),
+               le16_to_cpu(serial->dev->descriptor.idProduct));
  
        if ((le16_to_cpu(serial->dev->descriptor.bcdDevice) & 0x8000)
                                                                != 0x8000) {
-               dbg("Firmware already loaded.  Quitting.");
+               dev_dbg(&serial->dev->dev, "Firmware already loaded.  Quitting.\n");
                return 1;
        }
  
                return 1;
        }
  
-       if (request_ihex_firmware(&fw, fw_name, &serial->dev->dev)) {
-               dev_err(&serial->dev->dev, "Required keyspan firmware image (%s) unavailable.\n", fw_name);
-               return 1;
-       }
-       dbg("Uploading Keyspan %s firmware.", fw_name);
+       dev_dbg(&serial->dev->dev, "Uploading Keyspan %s firmware.\n", fw_name);
  
-               /* download the firmware image */
-       response = ezusb_set_reset(serial, 1);
-       record = (const struct ihex_binrec *)fw->data;
-       while (record) {
-               response = ezusb_writememory(serial, be32_to_cpu(record->addr),
-                                            (unsigned char *)record->data,
-                                            be16_to_cpu(record->len), 0xa0);
-               if (response < 0) {
-                       dev_err(&serial->dev->dev, "ezusb_writememory failed for Keyspan firmware (%d %04X %p %d)\n",
-                               response, be32_to_cpu(record->addr),
-                               record->data, be16_to_cpu(record->len));
-                       break;
-               }
-               record = ihex_next_binrec(record);
+       if (ezusb_fx1_ihex_firmware_download(serial->dev, fw_name) < 0) {
+               dev_err(&serial->dev->dev, "failed to load firmware \"%s\"\n",
+                       fw_name);
+               return -ENOENT;
        }
-       release_firmware(fw);
-               /* bring device out of reset. Renumeration will occur in a
-                  moment and the new device will bind to the real driver */
-       response = ezusb_set_reset(serial, 0);
+       /* after downloading firmware Renumeration will occur in a
+         moment and the new device will bind to the real driver */
  
        /* we don't want this device to have a driver assigned to it. */
        return 1;
@@@ -1296,10 -1278,10 +1278,10 @@@ static struct urb *keyspan_setup_urb(st
        if (endpoint == -1)
                return NULL;            /* endpoint not needed */
  
-       dbg("%s - alloc for endpoint %d.", __func__, endpoint);
+       dev_dbg(&serial->interface->dev, "%s - alloc for endpoint %d.\n", __func__, endpoint);
        urb = usb_alloc_urb(0, GFP_KERNEL);             /* No ISO */
        if (urb == NULL) {
-               dbg("%s - alloc for endpoint %d failed.", __func__, endpoint);
+               dev_dbg(&serial->interface->dev, "%s - alloc for endpoint %d failed.\n", __func__, endpoint);
                return NULL;
        }
  
                return NULL;
        }
  
-       dbg("%s - using urb %p for %s endpoint %x",
+       dev_dbg(&serial->interface->dev, "%s - using urb %p for %s endpoint %x\n",
            __func__, urb, ep_type_name, endpoint);
        return urb;
  }
@@@ -1464,14 -1446,15 +1446,15 @@@ static void keyspan_setup_urbs(struct u
  }
  
  /* usa19 function doesn't require prescaler */
- static int keyspan_usa19_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi,
+ static int keyspan_usa19_calc_baud(struct usb_serial_port *port,
+                                  u32 baud_rate, u32 baudclk, u8 *rate_hi,
                                   u8 *rate_low, u8 *prescaler, int portnum)
  {
        u32     b16,    /* baud rate times 16 (actual rate used internally) */
                div,    /* divisor */
                cnt;    /* inverse of divisor (programmed into 8051) */
  
-       dbg("%s - %d.", __func__, baud_rate);
+       dev_dbg(&port->dev, "%s - %d.\n", __func__, baud_rate);
  
        /* prevent divide by zero...  */
        b16 = baud_rate * 16L;
        if (rate_hi)
                *rate_hi = (u8) ((cnt >> 8) & 0xff);
        if (rate_low && rate_hi)
-               dbg("%s - %d %02x %02x.",
+               dev_dbg(&port->dev, "%s - %d %02x %02x.\n",
                                __func__, baud_rate, *rate_hi, *rate_low);
        return KEYSPAN_BAUD_RATE_OK;
  }
  
  /* usa19hs function doesn't require prescaler */
- static int keyspan_usa19hs_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi,
-                                  u8 *rate_low, u8 *prescaler, int portnum)
+ static int keyspan_usa19hs_calc_baud(struct usb_serial_port *port,
+                                    u32 baud_rate, u32 baudclk, u8 *rate_hi,
+                                    u8 *rate_low, u8 *prescaler, int portnum)
  {
        u32     b16,    /* baud rate times 16 (actual rate used internally) */
                        div;    /* divisor */
  
-       dbg("%s - %d.", __func__, baud_rate);
+       dev_dbg(&port->dev, "%s - %d.\n", __func__, baud_rate);
  
        /* prevent divide by zero...  */
        b16 = baud_rate * 16L;
                *rate_hi = (u8) ((div >> 8) & 0xff);
  
        if (rate_low && rate_hi)
-               dbg("%s - %d %02x %02x.",
+               dev_dbg(&port->dev, "%s - %d %02x %02x.\n",
                        __func__, baud_rate, *rate_hi, *rate_low);
  
        return KEYSPAN_BAUD_RATE_OK;
  }
  
- static int keyspan_usa19w_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi,
+ static int keyspan_usa19w_calc_baud(struct usb_serial_port *port,
+                                   u32 baud_rate, u32 baudclk, u8 *rate_hi,
                                    u8 *rate_low, u8 *prescaler, int portnum)
  {
        u32     b16,    /* baud rate times 16 (actual rate used internally) */
        u8      best_prescaler;
        int     i;
  
-       dbg("%s - %d.", __func__, baud_rate);
+       dev_dbg(&port->dev, "%s - %d.\n", __func__, baud_rate);
  
        /* prevent divide by zero */
        b16 = baud_rate * 16L;
                *rate_hi = (u8) ((div >> 8) & 0xff);
        if (prescaler) {
                *prescaler = best_prescaler;
-               /*  dbg("%s - %d %d", __func__, *prescaler, div); */
+               /*  dev_dbg(&port->dev, "%s - %d %d\n", __func__, *prescaler, div); */
        }
        return KEYSPAN_BAUD_RATE_OK;
  }
  
        /* USA-28 supports different maximum baud rates on each port */
- static int keyspan_usa28_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi,
-                                   u8 *rate_low, u8 *prescaler, int portnum)
+ static int keyspan_usa28_calc_baud(struct usb_serial_port *port,
+                                  u32 baud_rate, u32 baudclk, u8 *rate_hi,
+                                  u8 *rate_low, u8 *prescaler, int portnum)
  {
        u32     b16,    /* baud rate times 16 (actual rate used internally) */
                div,    /* divisor */
                cnt;    /* inverse of divisor (programmed into 8051) */
  
-       dbg("%s - %d.", __func__, baud_rate);
+       dev_dbg(&port->dev, "%s - %d.\n", __func__, baud_rate);
  
                /* prevent divide by zero */
        b16 = baud_rate * 16L;
                *rate_low = (u8) (cnt & 0xff);
        if (rate_hi)
                *rate_hi = (u8) ((cnt >> 8) & 0xff);
-       dbg("%s - %d OK.", __func__, baud_rate);
+       dev_dbg(&port->dev, "%s - %d OK.\n", __func__, baud_rate);
        return KEYSPAN_BAUD_RATE_OK;
  }
  
@@@ -1658,7 -1644,7 +1644,7 @@@ static int keyspan_usa26_send_setup(str
        struct urb                              *this_urb;
        int                                     device_port, err;
  
-       dbg("%s reset=%d", __func__, reset_port);
+       dev_dbg(&port->dev, "%s reset=%d\n", __func__, reset_port);
  
        s_priv = usb_get_serial_data(serial);
        p_priv = usb_get_serial_port_data(port);
        outcont_urb = d_details->outcont_endpoints[port->number];
        this_urb = p_priv->outcont_urb;
  
-       dbg("%s - endpoint %d", __func__, usb_pipeendpoint(this_urb->pipe));
+       dev_dbg(&port->dev, "%s - endpoint %d\n", __func__, usb_pipeendpoint(this_urb->pipe));
  
                /* Make sure we have an urb then send the message */
        if (this_urb == NULL) {
-               dbg("%s - oops no urb.", __func__);
+               dev_dbg(&port->dev, "%s - oops no urb.\n", __func__);
                return -1;
        }
  
        if ((reset_port + 1) > p_priv->resend_cont)
                p_priv->resend_cont = reset_port + 1;
        if (this_urb->status == -EINPROGRESS) {
-               /*  dbg("%s - already writing", __func__); */
+               /*  dev_dbg(&port->dev, "%s - already writing\n", __func__); */
                mdelay(5);
                return -1;
        }
        if (p_priv->old_baud != p_priv->baud) {
                p_priv->old_baud = p_priv->baud;
                msg.setClocking = 0xff;
-               if (d_details->calculate_baud_rate
-                   (p_priv->baud, d_details->baudclk, &msg.baudHi,
-                    &msg.baudLo, &msg.prescaler, device_port) == KEYSPAN_INVALID_BAUD_RATE) {
-                       dbg("%s - Invalid baud rate %d requested, using 9600.",
-                                               __func__, p_priv->baud);
+               if (d_details->calculate_baud_rate(port, p_priv->baud, d_details->baudclk,
+                                                  &msg.baudHi, &msg.baudLo, &msg.prescaler,
+                                                  device_port) == KEYSPAN_INVALID_BAUD_RATE) {
+                       dev_dbg(&port->dev, "%s - Invalid baud rate %d requested, using 9600.\n",
+                               __func__, p_priv->baud);
                        msg.baudLo = 0;
                        msg.baudHi = 125;       /* Values for 9600 baud */
                        msg.prescaler = 10;
  
        err = usb_submit_urb(this_urb, GFP_ATOMIC);
        if (err != 0)
-               dbg("%s - usb_submit_urb(setup) failed (%d)", __func__, err);
+               dev_dbg(&port->dev, "%s - usb_submit_urb(setup) failed (%d)\n", __func__, err);
  #if 0
        else {
-               dbg("%s - usb_submit_urb(%d) OK %d bytes (end %d)", __func__
-                   outcont_urb, this_urb->transfer_buffer_length,
-                   usb_pipeendpoint(this_urb->pipe));
+               dev_dbg(&port->dev, "%s - usb_submit_urb(%d) OK %d bytes (end %d)\n", __func__
+                       outcont_urb, this_urb->transfer_buffer_length,
+                       usb_pipeendpoint(this_urb->pipe));
        }
  #endif
  
@@@ -1821,7 -1807,7 +1807,7 @@@ static int keyspan_usa28_send_setup(str
        /* only do something if we have a bulk out endpoint */
        this_urb = p_priv->outcont_urb;
        if (this_urb == NULL) {
-               dbg("%s - oops no urb.", __func__);
+               dev_dbg(&port->dev, "%s - oops no urb.\n", __func__);
                return -1;
        }
  
        if ((reset_port + 1) > p_priv->resend_cont)
                p_priv->resend_cont = reset_port + 1;
        if (this_urb->status == -EINPROGRESS) {
-               dbg("%s already writing", __func__);
+               dev_dbg(&port->dev, "%s already writing\n", __func__);
                mdelay(5);
                return -1;
        }
        memset(&msg, 0, sizeof(struct keyspan_usa28_portControlMessage));
  
        msg.setBaudRate = 1;
-       if (d_details->calculate_baud_rate(p_priv->baud, d_details->baudclk,
-               &msg.baudHi, &msg.baudLo, NULL, device_port) == KEYSPAN_INVALID_BAUD_RATE) {
-               dbg("%s - Invalid baud rate requested %d.",
+       if (d_details->calculate_baud_rate(port, p_priv->baud, d_details->baudclk,
+                                          &msg.baudHi, &msg.baudLo, NULL,
+                                          device_port) == KEYSPAN_INVALID_BAUD_RATE) {
+               dev_dbg(&port->dev, "%s - Invalid baud rate requested %d.\n",
                                                __func__, p_priv->baud);
                msg.baudLo = 0xff;
                msg.baudHi = 0xb2;      /* Values for 9600 baud */
  
        err = usb_submit_urb(this_urb, GFP_ATOMIC);
        if (err != 0)
-               dbg("%s - usb_submit_urb(setup) failed", __func__);
+               dev_dbg(&port->dev, "%s - usb_submit_urb(setup) failed\n", __func__);
  #if 0
        else {
-               dbg("%s - usb_submit_urb(setup) OK %d bytes", __func__,
+               dev_dbg(&port->dev, "%s - usb_submit_urb(setup) OK %d bytes\n", __func__,
                    this_urb->transfer_buffer_length);
        }
  #endif
@@@ -1949,13 -1936,13 +1936,13 @@@ static int keyspan_usa49_send_setup(str
  
        /* Make sure we have an urb then send the message */
        if (this_urb == NULL) {
-               dbg("%s - oops no urb for port %d.", __func__, port->number);
+               dev_dbg(&port->dev, "%s - oops no urb for port %d.\n", __func__, port->number);
                return -1;
        }
  
-       dbg("%s - endpoint %d port %d (%d)",
-                       __func__, usb_pipeendpoint(this_urb->pipe),
-                       port->number, device_port);
+       dev_dbg(&port->dev, "%s - endpoint %d port %d (%d)\n",
+               __func__, usb_pipeendpoint(this_urb->pipe),
+               port->number, device_port);
  
        /* Save reset port val for resend.
           Don't overwrite resend for open/close condition. */
                p_priv->resend_cont = reset_port + 1;
  
        if (this_urb->status == -EINPROGRESS) {
-               /*  dbg("%s - already writing", __func__); */
+               /*  dev_dbg(&port->dev, "%s - already writing\n", __func__); */
                mdelay(5);
                return -1;
        }
        if (p_priv->old_baud != p_priv->baud) {
                p_priv->old_baud = p_priv->baud;
                msg.setClocking = 0xff;
-               if (d_details->calculate_baud_rate
-                   (p_priv->baud, d_details->baudclk, &msg.baudHi,
-                    &msg.baudLo, &msg.prescaler, device_port) == KEYSPAN_INVALID_BAUD_RATE) {
-                       dbg("%s - Invalid baud rate %d requested, using 9600.",
-                                               __func__, p_priv->baud);
+               if (d_details->calculate_baud_rate(port, p_priv->baud, d_details->baudclk,
+                                                  &msg.baudHi, &msg.baudLo, &msg.prescaler,
+                                                  device_port) == KEYSPAN_INVALID_BAUD_RATE) {
+                       dev_dbg(&port->dev, "%s - Invalid baud rate %d requested, using 9600.\n",
+                               __func__, p_priv->baud);
                        msg.baudLo = 0;
                        msg.baudHi = 125;       /* Values for 9600 baud */
                        msg.prescaler = 10;
        }
        err = usb_submit_urb(this_urb, GFP_ATOMIC);
        if (err != 0)
-               dbg("%s - usb_submit_urb(setup) failed (%d)", __func__, err);
+               dev_dbg(&port->dev, "%s - usb_submit_urb(setup) failed (%d)\n", __func__, err);
  #if 0
        else {
-               dbg("%s - usb_submit_urb(%d) OK %d bytes (end %d)", __func__,
-                          outcont_urb, this_urb->transfer_buffer_length,
-                          usb_pipeendpoint(this_urb->pipe));
+               dev_dbg(&port->dev, "%s - usb_submit_urb(%d) OK %d bytes (end %d)\n", __func__,
+                       outcont_urb, this_urb->transfer_buffer_length,
+                       usb_pipeendpoint(this_urb->pipe));
        }
  #endif
  
@@@ -2131,7 -2118,7 +2118,7 @@@ static int keyspan_usa90_send_setup(str
        /* only do something if we have a bulk out endpoint */
        this_urb = p_priv->outcont_urb;
        if (this_urb == NULL) {
-               dbg("%s - oops no urb.", __func__);
+               dev_dbg(&port->dev, "%s - oops no urb.\n", __func__);
                return -1;
        }
  
        if ((reset_port + 1) > p_priv->resend_cont)
                p_priv->resend_cont = reset_port + 1;
        if (this_urb->status == -EINPROGRESS) {
-               dbg("%s already writing", __func__);
+               dev_dbg(&port->dev, "%s already writing\n", __func__);
                mdelay(5);
                return -1;
        }
        if (p_priv->old_baud != p_priv->baud) {
                p_priv->old_baud = p_priv->baud;
                msg.setClocking = 0x01;
-               if (d_details->calculate_baud_rate
-                   (p_priv->baud, d_details->baudclk, &msg.baudHi,
-                    &msg.baudLo, &prescaler, 0) == KEYSPAN_INVALID_BAUD_RATE) {
-                       dbg("%s - Invalid baud rate %d requested, using 9600.",
-                                               __func__, p_priv->baud);
+               if (d_details->calculate_baud_rate(port, p_priv->baud, d_details->baudclk,
+                                                  &msg.baudHi, &msg.baudLo, &prescaler, 0) == KEYSPAN_INVALID_BAUD_RATE) {
+                       dev_dbg(&port->dev, "%s - Invalid baud rate %d requested, using 9600.\n",
+                               __func__, p_priv->baud);
                        p_priv->baud = 9600;
-                       d_details->calculate_baud_rate(p_priv->baud, d_details->baudclk,
+                       d_details->calculate_baud_rate(port, p_priv->baud, d_details->baudclk,
                                &msg.baudHi, &msg.baudLo, &prescaler, 0);
                }
                msg.setRxMode = 1;
  
        err = usb_submit_urb(this_urb, GFP_ATOMIC);
        if (err != 0)
-               dbg("%s - usb_submit_urb(setup) failed (%d)", __func__, err);
+               dev_dbg(&port->dev, "%s - usb_submit_urb(setup) failed (%d)\n", __func__, err);
        return 0;
  }
  
@@@ -2265,7 -2251,7 +2251,7 @@@ static int keyspan_usa67_send_setup(str
  
        /* Make sure we have an urb then send the message */
        if (this_urb == NULL) {
-               dbg("%s - oops no urb for port %d.", __func__,
+               dev_dbg(&port->dev, "%s - oops no urb for port %d.\n", __func__,
                        port->number);
                return -1;
        }
        if ((reset_port + 1) > p_priv->resend_cont)
                p_priv->resend_cont = reset_port + 1;
        if (this_urb->status == -EINPROGRESS) {
-               /*  dbg("%s - already writing", __func__); */
+               /*  dev_dbg(&port->dev, "%s - already writing\n", __func__); */
                mdelay(5);
                return -1;
        }
        if (p_priv->old_baud != p_priv->baud) {
                p_priv->old_baud = p_priv->baud;
                msg.setClocking = 0xff;
-               if (d_details->calculate_baud_rate
-                   (p_priv->baud, d_details->baudclk, &msg.baudHi,
-                    &msg.baudLo, &msg.prescaler, device_port) == KEYSPAN_INVALID_BAUD_RATE) {
-                       dbg("%s - Invalid baud rate %d requested, using 9600.",
-                                               __func__, p_priv->baud);
+               if (d_details->calculate_baud_rate(port, p_priv->baud, d_details->baudclk,
+                                                  &msg.baudHi, &msg.baudLo, &msg.prescaler,
+                                                  device_port) == KEYSPAN_INVALID_BAUD_RATE) {
+                       dev_dbg(&port->dev, "%s - Invalid baud rate %d requested, using 9600.\n",
+                               __func__, p_priv->baud);
                        msg.baudLo = 0;
                        msg.baudHi = 125;       /* Values for 9600 baud */
                        msg.prescaler = 10;
  
        err = usb_submit_urb(this_urb, GFP_ATOMIC);
        if (err != 0)
-               dbg("%s - usb_submit_urb(setup) failed (%d)", __func__,
-                               err);
+               dev_dbg(&port->dev, "%s - usb_submit_urb(setup) failed (%d)\n", __func__, err);
        return 0;
  }
  
@@@ -2440,8 -2425,7 +2425,7 @@@ static int keyspan_startup(struct usb_s
        /* Setup private data for serial driver */
        s_priv = kzalloc(sizeof(struct keyspan_serial_private), GFP_KERNEL);
        if (!s_priv) {
-               dbg("%s - kmalloc for keyspan_serial_private failed.",
-                                                               __func__);
+               dev_dbg(&serial->dev->dev, "%s - kmalloc for keyspan_serial_private failed.\n", __func__);
                return -ENOMEM;
        }
  
                p_priv = kzalloc(sizeof(struct keyspan_port_private),
                                                                GFP_KERNEL);
                if (!p_priv) {
-                       dbg("%s - kmalloc for keyspan_port_private (%d) failed!.", __func__, i);
+                       dev_dbg(&port->dev, "%s - kmalloc for keyspan_port_private (%d) failed!.\n", __func__, i);
                        return 1;
                }
                p_priv->device_details = d_details;
        if (s_priv->instat_urb != NULL) {
                err = usb_submit_urb(s_priv->instat_urb, GFP_KERNEL);
                if (err != 0)
-                       dbg("%s - submit instat urb failed %d", __func__,
-                               err);
+                       dev_dbg(&serial->dev->dev, "%s - submit instat urb failed %d\n", __func__, err);
        }
        if (s_priv->indat_urb != NULL) {
                err = usb_submit_urb(s_priv->indat_urb, GFP_KERNEL);
                if (err != 0)
-                       dbg("%s - submit indat urb failed %d", __func__,
-                               err);
+                       dev_dbg(&serial->dev->dev, "%s - submit indat urb failed %d\n", __func__, err);
        }
  
        return 0;
@@@ -2527,10 -2509,8 +2509,8 @@@ static void keyspan_release(struct usb_
  
        s_priv = usb_get_serial_data(serial);
  
-       /*  dbg("Freeing serial->private."); */
        kfree(s_priv);
  
-       /*  dbg("Freeing port->private."); */
        /* Now free per port private data */
        for (i = 0; i < serial->num_ports; i++) {
                port = serial->port[i];
@@@ -2554,7 -2534,3 +2534,3 @@@ MODULE_FIRMWARE("keyspan/usa18x.fw")
  MODULE_FIRMWARE("keyspan/usa19w.fw");
  MODULE_FIRMWARE("keyspan/usa49w.fw");
  MODULE_FIRMWARE("keyspan/usa49wlc.fw");
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug enabled or not");
  #include <linux/module.h>
  #include <linux/spinlock.h>
  #include <linux/workqueue.h>
- #include <linux/firmware.h>
- #include <linux/ihex.h>
  #include <linux/uaccess.h>
  #include <linux/usb.h>
  #include <linux/usb/serial.h>
- static bool debug;
+ #include <linux/usb/ezusb.h>
  
  /* make a simple define to handle if we are compiling keyspan_pda or xircom support */
  #if defined(CONFIG_USB_SERIAL_KEYSPAN_PDA) || defined(CONFIG_USB_SERIAL_KEYSPAN_PDA_MODULE)
@@@ -137,8 -134,8 +134,8 @@@ static void keyspan_pda_request_unthrot
                                 0,
                                 2000);
        if (result < 0)
-               dbg("%s - error %d from usb_control_msg",
-                   __func__, result);
+               dev_dbg(&serial->dev->dev, "%s - error %d from usb_control_msg\n",
+                       __func__, result);
  }
  
  
@@@ -160,12 -157,10 +157,10 @@@ static void keyspan_pda_rx_interrupt(st
        case -ENOENT:
        case -ESHUTDOWN:
                /* this urb is terminated, clean up */
-               dbg("%s - urb shutting down with status: %d",
-                   __func__, status);
+               dev_dbg(&urb->dev->dev, "%s - urb shutting down with status: %d\n", __func__, status);
                return;
        default:
-               dbg("%s - nonzero urb status received: %d",
-                   __func__, status);
+               dev_dbg(&urb->dev->dev, "%s - nonzero urb status received: %d\n", __func__, status);
                goto exit;
        }
  
                break;
        case 1:
                /* status interrupt */
-               dbg(" rx int, d1=%d, d2=%d", data[1], data[2]);
+               dev_dbg(&port->dev, "rx int, d1=%d, d2=%d\n", data[1], data[2]);
                switch (data[1]) {
                case 1: /* modemline change */
                        break;
@@@ -229,7 -224,7 +224,7 @@@ static void keyspan_pda_rx_unthrottle(s
        /* just restart the receive interrupt URB */
  
        if (usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL))
-               dbg(" usb_submit_urb(read urb) failed");
+               dev_dbg(&port->dev, "usb_submit_urb(read urb) failed\n");
  }
  
  
@@@ -308,8 -303,8 +303,8 @@@ static void keyspan_pda_break_ctl(struc
                        USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT,
                        value, 0, NULL, 0, 2000);
        if (result < 0)
-               dbg("%s - error %d from usb_control_msg",
-                   __func__, result);
+               dev_dbg(&port->dev, "%s - error %d from usb_control_msg\n",
+                       __func__, result);
        /* there is something funky about this.. the TCSBRK that 'cu' performs
           ought to translate into a break_ctl(-1),break_ctl(0) pair HZ/4
           seconds apart, but it feels like the break sent isn't as long as it
@@@ -338,7 -333,7 +333,7 @@@ static void keyspan_pda_set_termios(str
           7[EOMS]1: 10 bit, b0/b7 is parity
           7[EOMS]2: 11 bit, b0/b7 is parity, extra bit always (mark?)
  
 -         HW flow control is dictated by the tty->termios->c_cflags & CRTSCTS
 +         HW flow control is dictated by the tty->termios.c_cflags & CRTSCTS
           bit.
  
           For now, just do baud. */
        speed = keyspan_pda_setbaud(serial, speed);
  
        if (speed == 0) {
-               dbg("can't handle requested baud rate");
+               dev_dbg(&port->dev, "can't handle requested baud rate\n");
                /* It hasn't changed so.. */
                speed = tty_termios_baud_rate(old_termios);
        }
        /* Only speed can change so copy the old h/w parameters
           then encode the new speed */
 -      tty_termios_copy_hw(tty->termios, old_termios);
 +      tty_termios_copy_hw(&tty->termios, old_termios);
        tty_encode_baud_rate(tty, speed, speed);
  }
  
@@@ -459,7 -454,7 +454,7 @@@ static int keyspan_pda_write(struct tty
           Block if we can't write anything at all, otherwise write as much as
           we can. */
        if (count == 0) {
-               dbg(" write request of 0 bytes");
+               dev_dbg(&port->dev, "write request of 0 bytes\n");
                return 0;
        }
  
                                     1,
                                     2000);
                if (rc > 0) {
-                       dbg(" roomquery says %d", *room);
+                       dev_dbg(&port->dev, "roomquery says %d\n", *room);
                        priv->tx_room = *room;
                }
                kfree(room);
                if (rc < 0) {
-                       dbg(" roomquery failed");
+                       dev_dbg(&port->dev, "roomquery failed\n");
                        goto exit;
                }
                if (rc == 0) {
-                       dbg(" roomquery returned 0 bytes");
+                       dev_dbg(&port->dev, "roomquery returned 0 bytes\n");
                        rc = -EIO; /* device didn't return any data */
                        goto exit;
                }
  
                rc = usb_submit_urb(port->write_urb, GFP_ATOMIC);
                if (rc) {
-                       dbg(" usb_submit_urb(write bulk) failed");
+                       dev_dbg(&port->dev, "usb_submit_urb(write bulk) failed\n");
                        goto exit;
                }
        } else {
@@@ -639,11 -634,11 +634,11 @@@ static int keyspan_pda_open(struct tty_
                             1,
                             2000);
        if (rc < 0) {
-               dbg("%s - roomquery failed", __func__);
+               dev_dbg(&port->dev, "%s - roomquery failed\n", __func__);
                goto error;
        }
        if (rc == 0) {
-               dbg("%s - roomquery returned 0 bytes", __func__);
+               dev_dbg(&port->dev, "%s - roomquery returned 0 bytes\n", __func__);
                rc = -EIO;
                goto error;
        }
        /*Start reading from the device*/
        rc = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
        if (rc) {
-               dbg("%s - usb_submit_urb(read int) failed", __func__);
+               dev_dbg(&port->dev, "%s - usb_submit_urb(read int) failed\n", __func__);
                goto error;
        }
  error:
@@@ -678,11 -673,9 +673,9 @@@ static int keyspan_pda_fake_startup(str
  {
        int response;
        const char *fw_name;
-       const struct ihex_binrec *record;
-       const struct firmware *fw;
  
        /* download the firmware here ... */
-       response = ezusb_set_reset(serial, 1);
+       response = ezusb_fx1_set_reset(serial->dev, 1);
  
        if (0) { ; }
  #ifdef KEYSPAN
                        __func__);
                return -ENODEV;
        }
-       if (request_ihex_firmware(&fw, fw_name, &serial->dev->dev)) {
+       if (ezusb_fx1_ihex_firmware_download(serial->dev, fw_name) < 0) {
                dev_err(&serial->dev->dev, "failed to load firmware \"%s\"\n",
                        fw_name);
                return -ENOENT;
        }
-       record = (const struct ihex_binrec *)fw->data;
-       while (record) {
-               response = ezusb_writememory(serial, be32_to_cpu(record->addr),
-                                            (unsigned char *)record->data,
-                                            be16_to_cpu(record->len), 0xa0);
-               if (response < 0) {
-                       dev_err(&serial->dev->dev, "ezusb_writememory failed "
-                               "for Keyspan PDA firmware (%d %04X %p %d)\n",
-                               response, be32_to_cpu(record->addr),
-                               record->data, be16_to_cpu(record->len));
-                       break;
-               }
-               record = ihex_next_binrec(record);
-       }
-       release_firmware(fw);
-       /* bring device out of reset. Renumeration will occur in a moment
-          and the new device will bind to the real driver */
-       response = ezusb_set_reset(serial, 0);
+       /* after downloading firmware Renumeration will occur in a
+         moment and the new device will bind to the real driver */
  
        /* we want this device to fail to have a driver assigned to it. */
        return 1;
@@@ -828,6 -806,3 +806,3 @@@ module_usb_serial_driver(serial_drivers
  MODULE_AUTHOR(DRIVER_AUTHOR);
  MODULE_DESCRIPTION(DRIVER_DESC);
  MODULE_LICENSE("GPL");
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug enabled or not");
@@@ -49,8 -49,6 +49,6 @@@
  #include <linux/usb/serial.h>
  #include "kl5kusb105.h"
  
- static bool debug;
  /*
   * Version Information
   */
@@@ -239,7 -237,9 +237,9 @@@ static int klsi_105_startup(struct usb_
                priv = kmalloc(sizeof(struct klsi_105_private),
                                                   GFP_KERNEL);
                if (!priv) {
-                       dbg("%skmalloc for klsi_105_private failed.", __func__);
+                       dev_dbg(&serial->interface->dev,
+                               "%s - kmalloc for klsi_105_private failed.\n",
+                               __func__);
                        i--;
                        goto err_cleanup;
                }
@@@ -311,12 -311,12 +311,12 @@@ static int  klsi_105_open(struct tty_st
  
        /* set up termios structure */
        spin_lock_irqsave(&priv->lock, flags);
 -      priv->termios.c_iflag = tty->termios->c_iflag;
 -      priv->termios.c_oflag = tty->termios->c_oflag;
 -      priv->termios.c_cflag = tty->termios->c_cflag;
 -      priv->termios.c_lflag = tty->termios->c_lflag;
 +      priv->termios.c_iflag = tty->termios.c_iflag;
 +      priv->termios.c_oflag = tty->termios.c_oflag;
 +      priv->termios.c_cflag = tty->termios.c_cflag;
 +      priv->termios.c_lflag = tty->termios.c_lflag;
        for (i = 0; i < NCCS; i++)
 -              priv->termios.c_cc[i] = tty->termios->c_cc[i];
 +              priv->termios.c_cc[i] = tty->termios.c_cc[i];
        priv->cfg.pktlen   = cfg->pktlen;
        priv->cfg.baudrate = cfg->baudrate;
        priv->cfg.databits = cfg->databits;
                dev_err(&port->dev, "Enabling read failed (error = %d)\n", rc);
                retval = rc;
        } else
-               dbg("%s - enabled reading", __func__);
+               dev_dbg(&port->dev, "%s - enabled reading\n", __func__);
  
        rc = klsi_105_get_line_state(port, &line_state);
        if (rc >= 0) {
                spin_lock_irqsave(&priv->lock, flags);
                priv->line_state = line_state;
                spin_unlock_irqrestore(&priv->lock, flags);
-               dbg("%s - read line state 0x%lx", __func__, line_state);
+               dev_dbg(&port->dev, "%s - read line state 0x%lx\n", __func__, line_state);
                retval = 0;
        } else
                retval = rc;
@@@ -421,7 -421,7 +421,7 @@@ static void klsi_105_process_read_urb(s
                return;
  
        if (urb->actual_length <= KLSI_HDR_LEN) {
-               dbg("%s - malformed packet", __func__);
+               dev_dbg(&port->dev, "%s - malformed packet\n", __func__);
                return;
        }
  
  
        len = get_unaligned_le16(data);
        if (len > urb->actual_length - KLSI_HDR_LEN) {
-               dbg("%s - packet length mismatch", __func__);
+               dev_dbg(&port->dev, "%s - packet length mismatch\n", __func__);
                len = urb->actual_length - KLSI_HDR_LEN;
        }
  
@@@ -445,9 -445,10 +445,10 @@@ static void klsi_105_set_termios(struc
                                 struct ktermios *old_termios)
  {
        struct klsi_105_private *priv = usb_get_serial_port_data(port);
 -      unsigned int iflag = tty->termios->c_iflag;
+       struct device *dev = &port->dev;
 +      unsigned int iflag = tty->termios.c_iflag;
        unsigned int old_iflag = old_termios->c_iflag;
 -      unsigned int cflag = tty->termios->c_cflag;
 +      unsigned int cflag = tty->termios.c_cflag;
        unsigned int old_cflag = old_termios->c_cflag;
        struct klsi_105_port_settings *cfg;
        unsigned long flags;
  
        cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
        if (!cfg) {
-               dev_err(&port->dev, "%s - out of memory for config buffer.\n",
-                               __func__);
+               dev_err(dev, "%s - out of memory for config buffer.\n", __func__);
                return;
        }
  
        if ((cflag & CBAUD) != (old_cflag & CBAUD)) {
                /* reassert DTR and (maybe) RTS on transition from B0 */
                if ((old_cflag & CBAUD) == B0) {
-                       dbg("%s: baud was B0", __func__);
+                       dev_dbg(dev, "%s: baud was B0\n", __func__);
  #if 0
                        priv->control_state |= TIOCM_DTR;
                        /* don't set RTS if using hardware flow control */
                priv->cfg.baudrate = kl5kusb105a_sio_b115200;
                break;
        default:
-               dbg("KLSI USB->Serial converter:"
-                   " unsupported baudrate request, using default of 9600");
-                       priv->cfg.baudrate = kl5kusb105a_sio_b9600;
+               dev_dbg(dev, "KLSI USB->Serial converter: unsupported baudrate request, using default of 9600");
+               priv->cfg.baudrate = kl5kusb105a_sio_b9600;
                baud = 9600;
                break;
        }
        if ((cflag & CBAUD) == B0) {
-               dbg("%s: baud is B0", __func__);
+               dev_dbg(dev, "%s: baud is B0\n", __func__);
                /* Drop RTS and DTR */
                /* maybe this should be simulated by sending read
                 * disable and read enable messages?
                /* set the number of data bits */
                switch (cflag & CSIZE) {
                case CS5:
-                       dbg("%s - 5 bits/byte not supported", __func__);
+                       dev_dbg(dev, "%s - 5 bits/byte not supported\n", __func__);
                        spin_unlock_irqrestore(&priv->lock, flags);
                        goto err;
                case CS6:
-                       dbg("%s - 6 bits/byte not supported", __func__);
+                       dev_dbg(dev, "%s - 6 bits/byte not supported\n", __func__);
                        spin_unlock_irqrestore(&priv->lock, flags);
                        goto err;
                case CS7:
                        priv->cfg.databits = kl5kusb105a_dtb_8;
                        break;
                default:
-                       dev_err(&port->dev,
-                               "CSIZE was not CS5-CS8, using default of 8\n");
+                       dev_err(dev, "CSIZE was not CS5-CS8, using default of 8\n");
                        priv->cfg.databits = kl5kusb105a_dtb_8;
                        break;
                }
        if ((cflag & (PARENB|PARODD)) != (old_cflag & (PARENB|PARODD))
            || (cflag & CSTOPB) != (old_cflag & CSTOPB)) {
                /* Not currently supported */
 -              tty->termios->c_cflag &= ~(PARENB|PARODD|CSTOPB);
 +              tty->termios.c_cflag &= ~(PARENB|PARODD|CSTOPB);
  #if 0
                priv->last_lcr = 0;
  
            || (iflag & IXON) != (old_iflag & IXON)
            ||  (cflag & CRTSCTS) != (old_cflag & CRTSCTS)) {
                /* Not currently supported */
 -              tty->termios->c_cflag &= ~CRTSCTS;
 +              tty->termios.c_cflag &= ~CRTSCTS;
                /* Drop DTR/RTS if no flow control otherwise assert */
  #if 0
                if ((iflag & IXOFF) || (iflag & IXON) || (cflag & CRTSCTS))
@@@ -616,7 -614,7 +614,7 @@@ static void mct_u232_break_ctl(struct t
                                (struct mct_u232_private *)port->private;
        unsigned char lcr = priv->last_lcr;
  
-       dbg("%sstate=%d", __func__, break_state);
+       dev_dbg(&port->dev, "%s - state=%d\n", __func__, break_state);
  
        /* LOCKING */
        if (break_state)
@@@ -645,7 -643,7 +643,7 @@@ static int klsi_105_tiocmget(struct tty
        spin_lock_irqsave(&priv->lock, flags);
        priv->line_state = line_state;
        spin_unlock_irqrestore(&priv->lock, flags);
-       dbg("%s - read line state 0x%lx", __func__, line_state);
+       dev_dbg(&port->dev, "%s - read line state 0x%lx\n", __func__, line_state);
        return (int)line_state;
  }
  
@@@ -681,6 -679,3 +679,3 @@@ module_usb_serial_driver(serial_drivers
  MODULE_AUTHOR(DRIVER_AUTHOR);
  MODULE_DESCRIPTION(DRIVER_DESC);
  MODULE_LICENSE("GPL");
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "enable extensive debugging messages");
@@@ -38,8 -38,6 +38,6 @@@
  #include <linux/ioctl.h>
  #include "kobil_sct.h"
  
- static bool debug;
  /* Version Information */
  #define DRIVER_VERSION "21/05/2004"
  #define DRIVER_AUTHOR "KOBIL Systems GmbH - http://www.kobil.com"
@@@ -139,17 -137,16 +137,16 @@@ static int kobil_startup(struct usb_ser
  
        switch (priv->device_type) {
        case KOBIL_ADAPTER_B_PRODUCT_ID:
-               printk(KERN_DEBUG "KOBIL B1 PRO / KAAN PRO detected\n");
+               dev_dbg(&serial->dev->dev, "KOBIL B1 PRO / KAAN PRO detected\n");
                break;
        case KOBIL_ADAPTER_K_PRODUCT_ID:
-               printk(KERN_DEBUG
-                 "KOBIL KAAN Standard Plus / SecOVID Reader Plus detected\n");
+               dev_dbg(&serial->dev->dev, "KOBIL KAAN Standard Plus / SecOVID Reader Plus detected\n");
                break;
        case KOBIL_USBTWIN_PRODUCT_ID:
-               printk(KERN_DEBUG "KOBIL USBTWIN detected\n");
+               dev_dbg(&serial->dev->dev, "KOBIL USBTWIN detected\n");
                break;
        case KOBIL_KAAN_SIM_PRODUCT_ID:
-               printk(KERN_DEBUG "KOBIL KAAN SIM detected\n");
+               dev_dbg(&serial->dev->dev, "KOBIL KAAN SIM detected\n");
                break;
        }
        usb_set_serial_port_data(serial->port[0], priv);
        for (i = 0; i < altsetting->desc.bNumEndpoints; i++) {
                endpoint = &altsetting->endpoint[i];
                if (usb_endpoint_is_int_out(&endpoint->desc)) {
-                       dbg("%s Found interrupt out endpoint. Address: %d",
+                       dev_dbg(&serial->dev->dev,
+                               "%s Found interrupt out endpoint. Address: %d\n",
                                __func__, endpoint->desc.bEndpointAddress);
                        priv->write_int_endpoint_address =
                                endpoint->desc.bEndpointAddress;
                }
                if (usb_endpoint_is_int_in(&endpoint->desc)) {
-                       dbg("%s Found interrupt in  endpoint. Address: %d",
+                       dev_dbg(&serial->dev->dev,
+                               "%s Found interrupt in  endpoint. Address: %d\n",
                                __func__, endpoint->desc.bEndpointAddress);
                        priv->read_int_endpoint_address =
                                endpoint->desc.bEndpointAddress;
@@@ -191,15 -190,16 +190,16 @@@ static void kobil_release(struct usb_se
  static void kobil_init_termios(struct tty_struct *tty)
  {
        /* Default to echo off and other sane device settings */
 -      tty->termios->c_lflag = 0;
 -      tty->termios->c_lflag &= ~(ISIG | ICANON | ECHO | IEXTEN | XCASE);
 -      tty->termios->c_iflag = IGNBRK | IGNPAR | IXOFF;
 +      tty->termios.c_lflag = 0;
 +      tty->termios.c_iflag &= ~(ISIG | ICANON | ECHO | IEXTEN | XCASE);
 +      tty->termios.c_iflag |= IGNBRK | IGNPAR | IXOFF;
        /* do NOT translate CR to CR-NL (0x0A -> 0x0A 0x0D) */
 -      tty->termios->c_oflag &= ~ONLCR;
 +      tty->termios.c_oflag &= ~ONLCR;
  }
  
  static int kobil_open(struct tty_struct *tty, struct usb_serial_port *port)
  {
+       struct device *dev = &port->dev;
        int result = 0;
        struct kobil_private *priv;
        unsigned char *transfer_buffer;
  
        /* allocate write_urb */
        if (!port->write_urb) {
-               dbg("%s - port %d  Allocating port->write_urb",
-                                               __func__, port->number);
+               dev_dbg(dev, "%s - Allocating port->write_urb\n", __func__);
                port->write_urb = usb_alloc_urb(0, GFP_KERNEL);
                if (!port->write_urb) {
-                       dbg("%s - port %d usb_alloc_urb failed",
-                                               __func__, port->number);
+                       dev_dbg(dev, "%s - usb_alloc_urb failed\n", __func__);
                        kfree(transfer_buffer);
                        return -ENOMEM;
                }
                          transfer_buffer_length,
                          KOBIL_TIMEOUT
        );
-       dbg("%s - port %d Send get_HW_version URB returns: %i",
-               __func__, port->number, result);
-       dbg("Harware version: %i.%i.%i",
-               transfer_buffer[0], transfer_buffer[1], transfer_buffer[2]);
+       dev_dbg(dev, "%s - Send get_HW_version URB returns: %i\n", __func__, result);
+       dev_dbg(dev, "Harware version: %i.%i.%i\n", transfer_buffer[0],
+               transfer_buffer[1], transfer_buffer[2]);
  
        /* get firmware version */
        result = usb_control_msg(port->serial->dev,
                          transfer_buffer_length,
                          KOBIL_TIMEOUT
        );
-       dbg("%s - port %d Send get_FW_version URB returns: %i",
-                                       __func__, port->number, result);
-       dbg("Firmware version: %i.%i.%i",
-               transfer_buffer[0], transfer_buffer[1], transfer_buffer[2]);
+       dev_dbg(dev, "%s - Send get_FW_version URB returns: %i\n", __func__, result);
+       dev_dbg(dev, "Firmware version: %i.%i.%i\n", transfer_buffer[0],
+               transfer_buffer[1], transfer_buffer[2]);
  
        if (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID ||
                        priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID) {
                          0,
                          KOBIL_TIMEOUT
                );
-               dbg("%s - port %d Send set_baudrate URB returns: %i",
-                                       __func__, port->number, result);
+               dev_dbg(dev, "%s - Send set_baudrate URB returns: %i\n", __func__, result);
  
                /* reset all queues */
                result = usb_control_msg(port->serial->dev,
                          0,
                          KOBIL_TIMEOUT
                );
-               dbg("%s - port %d Send reset_all_queues URB returns: %i",
-                                       __func__, port->number, result);
+               dev_dbg(dev, "%s - Send reset_all_queues URB returns: %i\n", __func__, result);
        }
        if (priv->device_type == KOBIL_USBTWIN_PRODUCT_ID ||
            priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID ||
            priv->device_type == KOBIL_KAAN_SIM_PRODUCT_ID) {
                /* start reading (Adapter B 'cause PNP string) */
                result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);
-               dbg("%s - port %d Send read URB returns: %i",
-                                       __func__, port->number, result);
+               dev_dbg(dev, "%s - Send read URB returns: %i\n", __func__, result);
        }
  
        kfree(transfer_buffer);
@@@ -333,11 -326,9 +326,9 @@@ static void kobil_read_int_callback(str
        struct tty_struct *tty;
        unsigned char *data = urb->transfer_buffer;
        int status = urb->status;
- /*    char *dbg_data; */
  
        if (status) {
-               dbg("%s - port %d Read int status not zero: %d",
-                   __func__, port->number, status);
+               dev_dbg(&port->dev, "%s - Read int status not zero: %d\n", __func__, status);
                return;
        }
  
  
                /* BEGIN DEBUG */
                /*
+                 char *dbg_data;
                  dbg_data = kzalloc((3 *  purb->actual_length + 10)
                                                * sizeof(char), GFP_KERNEL);
                  if (! dbg_data) {
                  for (i = 0; i < purb->actual_length; i++) {
                          sprintf(dbg_data +3*i, "%02X ", data[i]);
                  }
-                 dbg(" <-- %s", dbg_data);
+                 dev_dbg(&port->dev, " <-- %s\n", dbg_data);
                  kfree(dbg_data);
                */
                /* END DEBUG */
        tty_kref_put(tty);
  
        result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);
-       dbg("%s - port %d Send read URB returns: %i",
-                       __func__, port->number, result);
+       dev_dbg(&port->dev, "%s - Send read URB returns: %i\n", __func__, result);
  }
  
  
@@@ -384,22 -376,20 +376,20 @@@ static int kobil_write(struct tty_struc
        struct kobil_private *priv;
  
        if (count == 0) {
-               dbg("%s - port %d write request of 0 bytes",
-                                               __func__, port->number);
+               dev_dbg(&port->dev, "%s - write request of 0 bytes\n", __func__);
                return 0;
        }
  
        priv = usb_get_serial_port_data(port);
  
        if (count > (KOBIL_BUF_LENGTH - priv->filled)) {
-               dbg("%s - port %d Error: write request bigger than buffer size", __func__, port->number);
+               dev_dbg(&port->dev, "%s - Error: write request bigger than buffer size\n", __func__);
                return -ENOMEM;
        }
  
        /* Copy data to buffer */
        memcpy(priv->buf + priv->filled, buf, count);
-       usb_serial_debug_data(debug, &port->dev, __func__, count,
-                                               priv->buf + priv->filled);
+       usb_serial_debug_data(&port->dev, __func__, count, priv->buf + priv->filled);
        priv->filled = priv->filled + count;
  
        /* only send complete block. TWIN, KAAN SIM and adapter K
  
                        priv->cur_pos = priv->cur_pos + length;
                        result = usb_submit_urb(port->write_urb, GFP_NOIO);
-                       dbg("%s - port %d Send write URB returns: %i",
-                                       __func__, port->number, result);
+                       dev_dbg(&port->dev, "%s - Send write URB returns: %i\n", __func__, result);
                        todo = priv->filled - priv->cur_pos;
  
                        if (todo > 0)
                        priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID) {
                        result = usb_submit_urb(port->interrupt_in_urb,
                                                                GFP_NOIO);
-                       dbg("%s - port %d Send read URB returns: %i",
-                                       __func__, port->number, result);
+                       dev_dbg(&port->dev, "%s - Send read URB returns: %i\n", __func__, result);
                }
        }
        return count;
@@@ -493,8 -481,8 +481,8 @@@ static int kobil_tiocmget(struct tty_st
                          transfer_buffer_length,
                          KOBIL_TIMEOUT);
  
-       dbg("%s - port %d Send get_status_line_state URB returns: %i. Statusline: %02x",
-           __func__, port->number, result, transfer_buffer[0]);
+       dev_dbg(&port->dev, "%s - Send get_status_line_state URB returns: %i. Statusline: %02x\n",
+               __func__, result, transfer_buffer[0]);
  
        result = 0;
        if ((transfer_buffer[0] & SUSBCR_GSL_DSR) != 0)
@@@ -507,6 -495,7 +495,7 @@@ static int kobil_tiocmset(struct tty_st
                           unsigned int set, unsigned int clear)
  {
        struct usb_serial_port *port = tty->driver_data;
+       struct device *dev = &port->dev;
        struct kobil_private *priv;
        int result;
        int dtr = 0;
  
        if (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID) {
                if (dtr != 0)
-                       dbg("%s - port %d Setting DTR",
-                                               __func__, port->number);
+                       dev_dbg(dev, "%s - Setting DTR\n", __func__);
                else
-                       dbg("%s - port %d Clearing DTR",
-                                               __func__, port->number);
+                       dev_dbg(dev, "%s - Clearing DTR\n", __func__);
                result = usb_control_msg(port->serial->dev,
                          usb_rcvctrlpipe(port->serial->dev, 0),
                          SUSBCRequest_SetStatusLinesOrQueues,
                          KOBIL_TIMEOUT);
        } else {
                if (rts != 0)
-                       dbg("%s - port %d Setting RTS",
-                                               __func__, port->number);
+                       dev_dbg(dev, "%s - Setting RTS\n", __func__);
                else
-                       dbg("%s - port %d Clearing RTS",
-                                               __func__, port->number);
+                       dev_dbg(dev, "%s - Clearing RTS\n", __func__);
                result = usb_control_msg(port->serial->dev,
                        usb_rcvctrlpipe(port->serial->dev, 0),
                        SUSBCRequest_SetStatusLinesOrQueues,
                        0,
                        KOBIL_TIMEOUT);
        }
-       dbg("%s - port %d Send set_status_line URB returns: %i",
-                                       __func__, port->number, result);
+       dev_dbg(dev, "%s - Send set_status_line URB returns: %i\n", __func__, result);
        kfree(transfer_buffer);
        return (result < 0) ? result : 0;
  }
@@@ -581,14 -565,14 +565,14 @@@ static void kobil_set_termios(struct tt
        struct kobil_private *priv;
        int result;
        unsigned short urb_val = 0;
 -      int c_cflag = tty->termios->c_cflag;
 +      int c_cflag = tty->termios.c_cflag;
        speed_t speed;
  
        priv = usb_get_serial_port_data(port);
        if (priv->device_type == KOBIL_USBTWIN_PRODUCT_ID ||
                        priv->device_type == KOBIL_KAAN_SIM_PRODUCT_ID) {
                /* This device doesn't support ioctl calls */
 -              *tty->termios = *old;
 +              tty_termios_copy_hw(&tty->termios, old);
                return;
        }
  
                        urb_val |= SUSBCR_SPASB_EvenParity;
        } else
                urb_val |= SUSBCR_SPASB_NoParity;
 -      tty->termios->c_cflag &= ~CMSPAR;
 +      tty->termios.c_cflag &= ~CMSPAR;
        tty_encode_baud_rate(tty, speed, speed);
  
        result = usb_control_msg(port->serial->dev,
@@@ -658,7 -642,8 +642,8 @@@ static int kobil_ioctl(struct tty_struc
                          KOBIL_TIMEOUT
                        );
  
-               dbg("%s - port %d Send reset_all_queues (FLUSH) URB returns: %i", __func__, port->number, result);
+               dev_dbg(&port->dev,
+                       "%s - Send reset_all_queues (FLUSH) URB returns: %i", __func__, result);
                kfree(transfer_buffer);
                return (result < 0) ? -EIO: 0;
        default:
@@@ -671,6 -656,3 +656,3 @@@ module_usb_serial_driver(serial_drivers
  MODULE_AUTHOR(DRIVER_AUTHOR);
  MODULE_DESCRIPTION(DRIVER_DESC);
  MODULE_LICENSE("GPL");
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug enabled or not");
@@@ -45,8 -45,6 +45,6 @@@
  #define DRIVER_AUTHOR "Wolfgang Grandegger <wolfgang@ces.ch>"
  #define DRIVER_DESC "Magic Control Technology USB-RS232 converter driver"
  
- static bool debug;
  /*
   * Function prototypes
   */
@@@ -214,7 -212,7 +212,7 @@@ static int mct_u232_set_baud_rate(struc
                        value, rc);
        else
                tty_encode_baud_rate(tty, speed, speed);
-       dbg("set_baud_rate: value: 0x%x, divisor: 0x%x", value, divisor);
+       dev_dbg(&port->dev, "set_baud_rate: value: 0x%x, divisor: 0x%x\n", value, divisor);
  
        /* Mimic the MCT-supplied Windows driver (version 1.21P.0104), which
           always sends two extra USB 'device request' messages after the
        if (port && C_CRTSCTS(tty))
           cts_enable_byte = 1;
  
-       dbg("set_baud_rate: send second control message, data = %02X",
-                                                       cts_enable_byte);
+       dev_dbg(&port->dev, "set_baud_rate: send second control message, data = %02X\n",
+               cts_enable_byte);
        buf[0] = cts_enable_byte;
        rc = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
                        MCT_U232_SET_CTS_REQUEST,
        return rc;
  } /* mct_u232_set_baud_rate */
  
- static int mct_u232_set_line_ctrl(struct usb_serial *serial, unsigned char lcr)
+ static int mct_u232_set_line_ctrl(struct usb_serial_port *port,
+                                 unsigned char lcr)
  {
        int rc;
        unsigned char *buf;
                return -ENOMEM;
  
        buf[0] = lcr;
-       rc = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
+       rc = usb_control_msg(port->serial->dev, usb_sndctrlpipe(port->serial->dev, 0),
                        MCT_U232_SET_LINE_CTRL_REQUEST,
                        MCT_U232_SET_REQUEST_TYPE,
                        0, 0, buf, MCT_U232_SET_LINE_CTRL_SIZE,
                        WDR_TIMEOUT);
        if (rc < 0)
-               dev_err(&serial->dev->dev,
-                       "Set LINE CTRL 0x%x failed (error = %d)\n", lcr, rc);
-       dbg("set_line_ctrl: 0x%x", lcr);
+               dev_err(&port->dev, "Set LINE CTRL 0x%x failed (error = %d)\n", lcr, rc);
+       dev_dbg(&port->dev, "set_line_ctrl: 0x%x\n", lcr);
        kfree(buf);
        return rc;
  } /* mct_u232_set_line_ctrl */
  
- static int mct_u232_set_modem_ctrl(struct usb_serial *serial,
+ static int mct_u232_set_modem_ctrl(struct usb_serial_port *port,
                                   unsigned int control_state)
  {
        int rc;
                mcr |= MCT_U232_MCR_RTS;
  
        buf[0] = mcr;
-       rc = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
+       rc = usb_control_msg(port->serial->dev, usb_sndctrlpipe(port->serial->dev, 0),
                        MCT_U232_SET_MODEM_CTRL_REQUEST,
                        MCT_U232_SET_REQUEST_TYPE,
                        0, 0, buf, MCT_U232_SET_MODEM_CTRL_SIZE,
                        WDR_TIMEOUT);
        kfree(buf);
  
-       dbg("set_modem_ctrl: state=0x%x ==> mcr=0x%x", control_state, mcr);
+       dev_dbg(&port->dev, "set_modem_ctrl: state=0x%x ==> mcr=0x%x\n", control_state, mcr);
  
        if (rc < 0) {
-               dev_err(&serial->dev->dev,
-                       "Set MODEM CTRL 0x%x failed (error = %d)\n", mcr, rc);
+               dev_err(&port->dev, "Set MODEM CTRL 0x%x failed (error = %d)\n", mcr, rc);
                return rc;
        }
        return 0;
  } /* mct_u232_set_modem_ctrl */
  
- static int mct_u232_get_modem_stat(struct usb_serial *serial,
-                                               unsigned char *msr)
+ static int mct_u232_get_modem_stat(struct usb_serial_port *port,
+                                  unsigned char *msr)
  {
        int rc;
        unsigned char *buf;
                *msr = 0;
                return -ENOMEM;
        }
-       rc = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
+       rc = usb_control_msg(port->serial->dev, usb_rcvctrlpipe(port->serial->dev, 0),
                        MCT_U232_GET_MODEM_STAT_REQUEST,
                        MCT_U232_GET_REQUEST_TYPE,
                        0, 0, buf, MCT_U232_GET_MODEM_STAT_SIZE,
                        WDR_TIMEOUT);
        if (rc < 0) {
-               dev_err(&serial->dev->dev,
-                       "Get MODEM STATus failed (error = %d)\n", rc);
+               dev_err(&port->dev, "Get MODEM STATus failed (error = %d)\n", rc);
                *msr = 0;
        } else {
                *msr = buf[0];
        }
-       dbg("get_modem_stat: 0x%x", *msr);
+       dev_dbg(&port->dev, "get_modem_stat: 0x%x\n", *msr);
        kfree(buf);
        return rc;
  } /* mct_u232_get_modem_stat */
@@@ -363,8 -359,8 +359,8 @@@ static void mct_u232_msr_to_icount(stru
                icount->dcd++;
  } /* mct_u232_msr_to_icount */
  
- static void mct_u232_msr_to_state(unsigned int *control_state,
-                                               unsigned char msr)
+ static void mct_u232_msr_to_state(struct usb_serial_port *port,
+                                 unsigned int *control_state, unsigned char msr)
  {
        /* Translate Control Line states */
        if (msr & MCT_U232_MSR_DSR)
                *control_state |=  TIOCM_CD;
        else
                *control_state &= ~TIOCM_CD;
-       dbg("msr_to_state: msr=0x%x ==> state=0x%x", msr, *control_state);
+       dev_dbg(&port->dev, "msr_to_state: msr=0x%x ==> state=0x%x\n", msr, *control_state);
  } /* mct_u232_msr_to_state */
  
  /*
@@@ -454,7 -450,7 +450,7 @@@ static int  mct_u232_open(struct tty_st
         * either.
         */
        spin_lock_irqsave(&priv->lock, flags);
 -      if (tty && (tty->termios->c_cflag & CBAUD))
 +      if (tty && (tty->termios.c_cflag & CBAUD))
                priv->control_state = TIOCM_DTR | TIOCM_RTS;
        else
                priv->control_state = 0;
        control_state = priv->control_state;
        last_lcr = priv->last_lcr;
        spin_unlock_irqrestore(&priv->lock, flags);
-       mct_u232_set_modem_ctrl(serial, control_state);
-       mct_u232_set_line_ctrl(serial, last_lcr);
+       mct_u232_set_modem_ctrl(port, control_state);
+       mct_u232_set_line_ctrl(port, last_lcr);
  
        /* Read modem status and update control state */
-       mct_u232_get_modem_stat(serial, &last_msr);
+       mct_u232_get_modem_stat(port, &last_msr);
        spin_lock_irqsave(&priv->lock, flags);
        priv->last_msr = last_msr;
-       mct_u232_msr_to_state(&priv->control_state, priv->last_msr);
+       mct_u232_msr_to_state(port, &priv->control_state, priv->last_msr);
        spin_unlock_irqrestore(&priv->lock, flags);
  
        retval = usb_submit_urb(port->read_urb, GFP_KERNEL);
@@@ -512,7 -508,7 +508,7 @@@ static void mct_u232_dtr_rts(struct usb
                        priv->control_state &= ~(TIOCM_DTR | TIOCM_RTS);
                control_state = priv->control_state;
                spin_unlock_irq(&priv->lock);
-               mct_u232_set_modem_ctrl(port->serial, control_state);
+               mct_u232_set_modem_ctrl(port, control_state);
        }
        mutex_unlock(&port->serial->disc_mutex);
  }
@@@ -532,7 -528,6 +528,6 @@@ static void mct_u232_read_int_callback(
  {
        struct usb_serial_port *port = urb->context;
        struct mct_u232_private *priv = usb_get_serial_port_data(port);
-       struct usb_serial *serial = port->serial;
        struct tty_struct *tty;
        unsigned char *data = urb->transfer_buffer;
        int retval;
        case -ENOENT:
        case -ESHUTDOWN:
                /* this urb is terminated, clean up */
-               dbg("%s - urb shutting down with status: %d",
-                   __func__, status);
+               dev_dbg(&port->dev, "%s - urb shutting down with status: %d\n",
+                       __func__, status);
                return;
        default:
-               dbg("%s - nonzero urb status received: %d",
-                   __func__, status);
+               dev_dbg(&port->dev, "%s - nonzero urb status received: %d\n",
+                       __func__, status);
                goto exit;
        }
  
-       if (!serial) {
-               dbg("%s - bad serial pointer, exiting", __func__);
-               return;
-       }
-       usb_serial_debug_data(debug, &port->dev, __func__,
-                                       urb->actual_length, data);
+       usb_serial_debug_data(&port->dev, __func__, urb->actual_length, data);
  
        /*
         * Work-a-round: handle the 'usual' bulk-in pipe here
        priv->last_msr = data[MCT_U232_MSR_INDEX];
  
        /* Record Control Line states */
-       mct_u232_msr_to_state(&priv->control_state, priv->last_msr);
+       mct_u232_msr_to_state(port, &priv->control_state, priv->last_msr);
  
        mct_u232_msr_to_icount(&priv->icount, priv->last_msr);
  
@@@ -634,7 -623,7 +623,7 @@@ static void mct_u232_set_termios(struc
  {
        struct usb_serial *serial = port->serial;
        struct mct_u232_private *priv = usb_get_serial_port_data(port);
 -      struct ktermios *termios = tty->termios;
 +      struct ktermios *termios = &tty->termios;
        unsigned int cflag = termios->c_cflag;
        unsigned int old_cflag = old_termios->c_cflag;
        unsigned long flags;
  
        /* reassert DTR and RTS on transition from B0 */
        if ((old_cflag & CBAUD) == B0) {
-               dbg("%s: baud was B0", __func__);
+               dev_dbg(&port->dev, "%s: baud was B0\n", __func__);
                control_state |= TIOCM_DTR | TIOCM_RTS;
-               mct_u232_set_modem_ctrl(serial, control_state);
+               mct_u232_set_modem_ctrl(port, control_state);
        }
  
        mct_u232_set_baud_rate(tty, serial, port, tty_get_baud_rate(tty));
  
        if ((cflag & CBAUD) == B0) {
-               dbg("%s: baud is B0", __func__);
+               dev_dbg(&port->dev, "%s: baud is B0\n", __func__);
                /* Drop RTS and DTR */
                control_state &= ~(TIOCM_DTR | TIOCM_RTS);
-               mct_u232_set_modem_ctrl(serial, control_state);
+               mct_u232_set_modem_ctrl(port, control_state);
        }
  
        /*
        last_lcr |= (cflag & CSTOPB) ?
                MCT_U232_STOP_BITS_2 : MCT_U232_STOP_BITS_1;
  
-       mct_u232_set_line_ctrl(serial, last_lcr);
+       mct_u232_set_line_ctrl(port, last_lcr);
  
        /* save off the modified port settings */
        spin_lock_irqsave(&priv->lock, flags);
  static void mct_u232_break_ctl(struct tty_struct *tty, int break_state)
  {
        struct usb_serial_port *port = tty->driver_data;
-       struct usb_serial *serial = port->serial;
        struct mct_u232_private *priv = usb_get_serial_port_data(port);
        unsigned char lcr;
        unsigned long flags;
                lcr |= MCT_U232_SET_BREAK;
        spin_unlock_irqrestore(&priv->lock, flags);
  
-       mct_u232_set_line_ctrl(serial, lcr);
+       mct_u232_set_line_ctrl(port, lcr);
  } /* mct_u232_break_ctl */
  
  
@@@ -750,7 -738,6 +738,6 @@@ static int mct_u232_tiocmset(struct tty
                              unsigned int set, unsigned int clear)
  {
        struct usb_serial_port *port = tty->driver_data;
-       struct usb_serial *serial = port->serial;
        struct mct_u232_private *priv = usb_get_serial_port_data(port);
        unsigned int control_state;
        unsigned long flags;
  
        priv->control_state = control_state;
        spin_unlock_irqrestore(&priv->lock, flags);
-       return mct_u232_set_modem_ctrl(serial, control_state);
+       return mct_u232_set_modem_ctrl(port, control_state);
  }
  
  static void mct_u232_throttle(struct tty_struct *tty)
                priv->control_state &= ~TIOCM_RTS;
                control_state = priv->control_state;
                spin_unlock_irq(&priv->lock);
-               (void) mct_u232_set_modem_ctrl(port->serial, control_state);
+               mct_u232_set_modem_ctrl(port, control_state);
        } else {
                spin_unlock_irq(&priv->lock);
        }
@@@ -802,7 -789,7 +789,7 @@@ static void mct_u232_unthrottle(struct 
                priv->control_state |= TIOCM_RTS;
                control_state = priv->control_state;
                spin_unlock_irq(&priv->lock);
-               (void) mct_u232_set_modem_ctrl(port->serial, control_state);
+               mct_u232_set_modem_ctrl(port, control_state);
        } else {
                spin_unlock_irq(&priv->lock);
        }
@@@ -817,13 -804,13 +804,13 @@@ static int  mct_u232_ioctl(struct tty_s
        struct async_icount cnow, cprev;
        unsigned long flags;
  
-       dbg("%s - port %d, cmd = 0x%x", __func__, port->number, cmd);
+       dev_dbg(&port->dev, "%s - cmd = 0x%x\n", __func__, cmd);
  
        switch (cmd) {
  
        case TIOCMIWAIT:
  
-               dbg("%s (%d) TIOCMIWAIT", __func__,  port->number);
+               dev_dbg(&port->dev, "%s TIOCMIWAIT", __func__);
  
                spin_lock_irqsave(&mct_u232_port->lock, flags);
                cprev = mct_u232_port->icount;
@@@ -879,8 -866,8 +866,8 @@@ static int  mct_u232_get_icount(struct 
  
        spin_unlock_irqrestore(&mct_u232_port->lock, flags);
  
-       dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d",
-               __func__,  port->number, icount->rx, icount->tx);
+       dev_dbg(&port->dev, "%s TIOCGICOUNT RX=%d, TX=%d\n",
+               __func__,  icount->rx, icount->tx);
        return 0;
  }
  
@@@ -889,6 -876,3 +876,3 @@@ module_usb_serial_driver(serial_drivers
  MODULE_AUTHOR(DRIVER_AUTHOR);
  MODULE_DESCRIPTION(DRIVER_DESC);
  MODULE_LICENSE("GPL");
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug enabled or not");
@@@ -52,9 -52,6 +52,6 @@@ static struct usb_device_id id_table[] 
  };
  MODULE_DEVICE_TABLE(usb, id_table);
  
- /* Input parameter constants. */
- static bool debug;
  /* UNI-Directional mode commands for device configure */
  #define UNI_CMD_OPEN  0x80
  #define UNI_CMD_CLOSE 0xFF
@@@ -130,6 -127,12 +127,6 @@@ static void metrousb_read_int_callback(
  
        /* Set the data read from the usb port into the serial port buffer. */
        tty = tty_port_tty_get(&port->port);
 -      if (!tty) {
 -              dev_err(&port->dev, "%s - bad tty pointer - exiting\n",
 -                      __func__);
 -              return;
 -      }
 -
        if (tty && urb->actual_length) {
                /* Loop through the data copying each byte to the tty layer. */
                tty_insert_flip_string(tty, data, urb->actual_length);
@@@ -436,7 -439,3 +433,3 @@@ MODULE_LICENSE("GPL")
  MODULE_AUTHOR("Philip Nicastro");
  MODULE_AUTHOR("Aleksey Babahin <tamerlan311@gmail.com>");
  MODULE_DESCRIPTION(DRIVER_DESC);
- /* Module input parameters */
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Print debug info (bool 1=on, 0=off)");
@@@ -71,8 -71,6 +71,6 @@@ struct moschip_port 
        struct urb              *write_urb_pool[NUM_URBS];
  };
  
- static bool debug;
  static struct usb_serial_driver moschip7720_2port_driver;
  
  #define USB_VENDOR_ID_MOSCHIP         0x9710
@@@ -281,16 -279,19 +279,19 @@@ static void send_deferred_urbs(unsigne
        int ret_val;
        unsigned long flags;
        struct mos7715_parport *mos_parport = (void *)_mos_parport;
-       struct urbtracker *urbtrack;
+       struct urbtracker *urbtrack, *tmp;
        struct list_head *cursor, *next;
+       struct device *dev;
  
        /* if release function ran, game over */
        if (unlikely(mos_parport->serial == NULL))
                return;
  
+       dev = &mos_parport->serial->dev->dev;
        /* try again to get the mutex */
        if (!mutex_trylock(&mos_parport->serial->disc_mutex)) {
-               dbg("%s: rescheduling tasklet", __func__);
+               dev_dbg(dev, "%s: rescheduling tasklet\n", __func__);
                tasklet_schedule(&mos_parport->urb_tasklet);
                return;
        }
        if (list_empty(&mos_parport->deferred_urbs)) {
                spin_unlock_irqrestore(&mos_parport->listlock, flags);
                mutex_unlock(&mos_parport->serial->disc_mutex);
-               dbg("%s: deferred_urbs list empty", __func__);
+               dev_dbg(dev, "%s: deferred_urbs list empty\n", __func__);
                return;
        }
  
        /* move contents of deferred_urbs list to active_urbs list and submit */
        list_for_each_safe(cursor, next, &mos_parport->deferred_urbs)
                list_move_tail(cursor, &mos_parport->active_urbs);
-       list_for_each_entry(urbtrack, &mos_parport->active_urbs,
+       list_for_each_entry_safe(urbtrack, tmp, &mos_parport->active_urbs,
                            urblist_entry) {
                ret_val = usb_submit_urb(urbtrack->urb, GFP_ATOMIC);
-               dbg("%s: urb submitted", __func__);
+               dev_dbg(dev, "%s: urb submitted\n", __func__);
                if (ret_val) {
-                       dev_err(&mos_parport->serial->dev->dev,
-                               "usb_submit_urb() failed: %d", ret_val);
+                       dev_err(dev, "usb_submit_urb() failed: %d\n", ret_val);
                        list_del(&urbtrack->urblist_entry);
                        kref_put(&urbtrack->ref_count, destroy_urbtracker);
                }
@@@ -334,7 -334,7 +334,7 @@@ static void async_complete(struct urb *
        int status = urb->status;
  
        if (unlikely(status))
-               dbg("%s - nonzero urb status received: %d", __func__, status);
+               dev_dbg(&urb->dev->dev, "%s - nonzero urb status received: %d\n", __func__, status);
  
        /* remove the urbtracker from the active_urbs list */
        spin_lock(&urbtrack->mos_parport->listlock);
@@@ -389,7 -389,7 +389,7 @@@ static int write_parport_reg_nonblock(s
                              &mos_parport->deferred_urbs);
                spin_unlock_irqrestore(&mos_parport->listlock, flags);
                tasklet_schedule(&mos_parport->urb_tasklet);
-               dbg("tasklet scheduled");
+               dev_dbg(&usbdev->dev, "tasklet scheduled");
                return 0;
        }
  
@@@ -690,7 -690,7 +690,7 @@@ static int mos7715_parport_init(struct 
        /* allocate and initialize parallel port control struct */
        mos_parport = kzalloc(sizeof(struct mos7715_parport), GFP_KERNEL);
        if (mos_parport == NULL) {
-               dbg("mos7715_parport_init: kzalloc failed");
+               dev_dbg(&serial->dev->dev, "%s: kzalloc failed\n", __func__);
                return -ENOMEM;
        }
        mos_parport->msg_pending = false;
@@@ -743,6 -743,7 +743,7 @@@ static void mos7720_interrupt_callback(
        int result;
        int length;
        int status = urb->status;
+       struct device *dev = &urb->dev->dev;
        __u8 *data;
        __u8 sp1;
        __u8 sp2;
        case -ENOENT:
        case -ESHUTDOWN:
                /* this urb is terminated, clean up */
-               dbg("%s - urb shutting down with status: %d", __func__,
-                   status);
+               dev_dbg(dev, "%s - urb shutting down with status: %d\n", __func__, status);
                return;
        default:
-               dbg("%s - nonzero urb status received: %d", __func__,
-                   status);
+               dev_dbg(dev, "%s - nonzero urb status received: %d\n", __func__, status);
                goto exit;
        }
  
         *      oneukum 2007-03-14 */
  
        if (unlikely(length != 4)) {
-               dbg("Wrong data !!!");
+               dev_dbg(dev, "Wrong data !!!\n");
                return;
        }
  
  
        if ((sp1 | sp2) & 0x01) {
                /* No Interrupt Pending in both the ports */
-               dbg("No Interrupt !!!");
+               dev_dbg(dev, "No Interrupt !!!\n");
        } else {
                switch (sp1 & 0x0f) {
                case SERIAL_IIR_RLS:
-                       dbg("Serial Port 1: Receiver status error or address "
-                           "bit detected in 9-bit mode\n");
+                       dev_dbg(dev, "Serial Port 1: Receiver status error or address bit detected in 9-bit mode\n");
                        break;
                case SERIAL_IIR_CTI:
-                       dbg("Serial Port 1: Receiver time out");
+                       dev_dbg(dev, "Serial Port 1: Receiver time out\n");
                        break;
                case SERIAL_IIR_MS:
-                       /* dbg("Serial Port 1: Modem status change"); */
+                       /* dev_dbg(dev, "Serial Port 1: Modem status change\n"); */
                        break;
                }
  
                switch (sp2 & 0x0f) {
                case SERIAL_IIR_RLS:
-                       dbg("Serial Port 2: Receiver status error or address "
-                           "bit detected in 9-bit mode");
+                       dev_dbg(dev, "Serial Port 2: Receiver status error or address bit detected in 9-bit mode\n");
                        break;
                case SERIAL_IIR_CTI:
-                       dbg("Serial Port 2: Receiver time out");
+                       dev_dbg(dev, "Serial Port 2: Receiver time out\n");
                        break;
                case SERIAL_IIR_MS:
-                       /* dbg("Serial Port 2: Modem status change"); */
+                       /* dev_dbg(dev, "Serial Port 2: Modem status change\n"); */
                        break;
                }
        }
  exit:
        result = usb_submit_urb(urb, GFP_ATOMIC);
        if (result)
-               dev_err(&urb->dev->dev,
-                       "%s - Error %d submitting control urb\n",
-                       __func__, result);
+               dev_err(dev, "%s - Error %d submitting control urb\n", __func__, result);
  }
  
  /*
@@@ -833,6 -828,7 +828,7 @@@ static void mos7715_interrupt_callback(
        int result;
        int length;
        int status = urb->status;
+       struct device *dev = &urb->dev->dev;
        __u8 *data;
        __u8 iir;
  
        case -ESHUTDOWN:
        case -ENODEV:
                /* this urb is terminated, clean up */
-               dbg("%s - urb shutting down with status: %d", __func__,
-                   status);
+               dev_dbg(dev, "%s - urb shutting down with status: %d\n", __func__, status);
                return;
        default:
-               dbg("%s - nonzero urb status received: %d", __func__,
-                   status);
+               dev_dbg(dev, "%s - nonzero urb status received: %d\n", __func__, status);
                goto exit;
        }
  
         * Byte 4: FIFO status for both */
  
        if (unlikely(length != 4)) {
-               dbg("Wrong data !!!");
+               dev_dbg(dev, "Wrong data !!!\n");
                return;
        }
  
        if (!(iir & 0x01)) {    /* serial port interrupt pending */
                switch (iir & 0x0f) {
                case SERIAL_IIR_RLS:
-                       dbg("Serial Port: Receiver status error or address "
-                           "bit detected in 9-bit mode\n");
+                       dev_dbg(dev, "Serial Port: Receiver status error or address bit detected in 9-bit mode\n\n");
                        break;
                case SERIAL_IIR_CTI:
-                       dbg("Serial Port: Receiver time out");
+                       dev_dbg(dev, "Serial Port: Receiver time out\n");
                        break;
                case SERIAL_IIR_MS:
-                       /* dbg("Serial Port: Modem status change"); */
+                       /* dev_dbg(dev, "Serial Port: Modem status change\n"); */
                        break;
                }
        }
  exit:
        result = usb_submit_urb(urb, GFP_ATOMIC);
        if (result)
-               dev_err(&urb->dev->dev,
-                       "%s - Error %d submitting control urb\n",
-                       __func__, result);
+               dev_err(dev, "%s - Error %d submitting control urb\n", __func__, result);
  }
  
  /*
@@@ -916,13 -907,13 +907,13 @@@ static void mos7720_bulk_in_callback(st
        int status = urb->status;
  
        if (status) {
-               dbg("nonzero read bulk status received: %d", status);
+               dev_dbg(&urb->dev->dev, "nonzero read bulk status received: %d\n", status);
                return;
        }
  
        port = urb->context;
  
-       dbg("Entering...%s", __func__);
+       dev_dbg(&port->dev, "Entering...%s\n", __func__);
  
        data = urb->transfer_buffer;
  
        if (port->read_urb->status != -EINPROGRESS) {
                retval = usb_submit_urb(port->read_urb, GFP_ATOMIC);
                if (retval)
-                       dbg("usb_submit_urb(read bulk) failed, retval = %d",
-                           retval);
+                       dev_dbg(&port->dev, "usb_submit_urb(read bulk) failed, retval = %d\n", retval);
        }
  }
  
@@@ -953,13 -943,13 +943,13 @@@ static void mos7720_bulk_out_data_callb
        int status = urb->status;
  
        if (status) {
-               dbg("nonzero write bulk status received:%d", status);
+               dev_dbg(&urb->dev->dev, "nonzero write bulk status received:%d\n", status);
                return;
        }
  
        mos7720_port = urb->context;
        if (!mos7720_port) {
-               dbg("NULL mos7720_port pointer");
+               dev_dbg(&urb->dev->dev, "NULL mos7720_port pointer\n");
                return ;
        }
  
@@@ -1061,9 -1051,7 +1051,7 @@@ static int mos7720_open(struct tty_stru
        port_number = port->number - port->serial->minor;
        read_mos_reg(serial, port_number, LSR, &data);
  
-       dbg("SS::%p LSR:%x", mos7720_port, data);
-       dbg("Check:Sending Command ..........");
+       dev_dbg(&port->dev, "SS::%p LSR:%x\n", mos7720_port, data);
  
        write_mos_reg(serial, dummy, SP1_REG, 0x02);
        write_mos_reg(serial, dummy, SP2_REG, 0x02);
@@@ -1122,20 -1110,16 +1110,16 @@@ static int mos7720_chars_in_buffer(stru
        int chars = 0;
        struct moschip_port *mos7720_port;
  
-       dbg("%s:entering ...........", __func__);
        mos7720_port = usb_get_serial_port_data(port);
-       if (mos7720_port == NULL) {
-               dbg("%s:leaving ...........", __func__);
+       if (mos7720_port == NULL)
                return 0;
-       }
  
        for (i = 0; i < NUM_URBS; ++i) {
                if (mos7720_port->write_urb_pool[i] &&
                    mos7720_port->write_urb_pool[i]->status == -EINPROGRESS)
                        chars += URB_TRANSFER_BUFFER_SIZE;
        }
-       dbg("%s - returns %d", __func__, chars);
+       dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars);
        return chars;
  }
  
@@@ -1145,8 -1129,6 +1129,6 @@@ static void mos7720_close(struct usb_se
        struct moschip_port *mos7720_port;
        int j;
  
-       dbg("mos7720_close:entering...");
        serial = port->serial;
  
        mos7720_port = usb_get_serial_port_data(port);
  
        /* While closing port, shutdown all bulk read, write  *
         * and interrupt read if they exists, otherwise nop   */
-       dbg("Shutdown bulk write");
        usb_kill_urb(port->write_urb);
-       dbg("Shutdown bulk read");
        usb_kill_urb(port->read_urb);
  
        mutex_lock(&serial->disc_mutex);
        }
        mutex_unlock(&serial->disc_mutex);
        mos7720_port->open = 0;
-       dbg("Leaving %s", __func__);
  }
  
  static void mos7720_break(struct tty_struct *tty, int break_state)
        struct usb_serial *serial;
        struct moschip_port *mos7720_port;
  
-       dbg("Entering %s", __func__);
        serial = port->serial;
  
        mos7720_port = usb_get_serial_port_data(port);
@@@ -1225,13 -1201,9 +1201,9 @@@ static int mos7720_write_room(struct tt
        int room = 0;
        int i;
  
-       dbg("%s:entering ...........", __func__);
        mos7720_port = usb_get_serial_port_data(port);
-       if (mos7720_port == NULL) {
-               dbg("%s:leaving ...........", __func__);
+       if (mos7720_port == NULL)
                return -ENODEV;
-       }
  
        /* FIXME: Locking */
        for (i = 0; i < NUM_URBS; ++i) {
                        room += URB_TRANSFER_BUFFER_SIZE;
        }
  
-       dbg("%s - returns %d", __func__, room);
+       dev_dbg(&port->dev, "%s - returns %d\n", __func__, room);
        return room;
  }
  
@@@ -1257,15 -1229,11 +1229,11 @@@ static int mos7720_write(struct tty_str
        struct urb    *urb;
        const unsigned char *current_position = data;
  
-       dbg("%s:entering ...........", __func__);
        serial = port->serial;
  
        mos7720_port = usb_get_serial_port_data(port);
-       if (mos7720_port == NULL) {
-               dbg("mos7720_port is NULL");
+       if (mos7720_port == NULL)
                return -ENODEV;
-       }
  
        /* try to find a free urb in the list */
        urb = NULL;
                if (mos7720_port->write_urb_pool[i] &&
                    mos7720_port->write_urb_pool[i]->status != -EINPROGRESS) {
                        urb = mos7720_port->write_urb_pool[i];
-                       dbg("URB:%d", i);
+                       dev_dbg(&port->dev, "URB:%d\n", i);
                        break;
                }
        }
  
        if (urb == NULL) {
-               dbg("%s - no more free urbs", __func__);
+               dev_dbg(&port->dev, "%s - no more free urbs\n", __func__);
                goto exit;
        }
  
        transfer_size = min(count, URB_TRANSFER_BUFFER_SIZE);
  
        memcpy(urb->transfer_buffer, current_position, transfer_size);
-       usb_serial_debug_data(debug, &port->dev, __func__, transfer_size,
+       usb_serial_debug_data(&port->dev, __func__, transfer_size,
                              urb->transfer_buffer);
  
        /* fill urb with data and submit  */
@@@ -1326,20 -1294,16 +1294,16 @@@ static void mos7720_throttle(struct tty
        struct moschip_port *mos7720_port;
        int status;
  
-       dbg("%s- port %d", __func__, port->number);
        mos7720_port = usb_get_serial_port_data(port);
  
        if (mos7720_port == NULL)
                return;
  
        if (!mos7720_port->open) {
-               dbg("port not opened");
+               dev_dbg(&port->dev, "%s - port not opened\n", __func__);
                return;
        }
  
-       dbg("%s: Entering ..........", __func__);
        /* if we are implementing XON/XOFF, send the stop character */
        if (I_IXOFF(tty)) {
                unsigned char stop_char = STOP_CHAR(tty);
        }
  
        /* if we are implementing RTS/CTS, toggle that line */
 -      if (tty->termios->c_cflag & CRTSCTS) {
 +      if (tty->termios.c_cflag & CRTSCTS) {
                mos7720_port->shadowMCR &= ~UART_MCR_RTS;
                write_mos_reg(port->serial, port->number - port->serial->minor,
                              MCR, mos7720_port->shadowMCR);
@@@ -1368,12 -1332,10 +1332,10 @@@ static void mos7720_unthrottle(struct t
                return;
  
        if (!mos7720_port->open) {
-               dbg("%s - port not opened", __func__);
+               dev_dbg(&port->dev, "%s - port not opened\n", __func__);
                return;
        }
  
-       dbg("%s: Entering ..........", __func__);
        /* if we are implementing XON/XOFF, send the start character */
        if (I_IXOFF(tty)) {
                unsigned char start_char = START_CHAR(tty);
        }
  
        /* if we are implementing RTS/CTS, toggle that line */
 -      if (tty->termios->c_cflag & CRTSCTS) {
 +      if (tty->termios.c_cflag & CRTSCTS) {
                mos7720_port->shadowMCR |= UART_MCR_RTS;
                write_mos_reg(port->serial, port->number - port->serial->minor,
                              MCR, mos7720_port->shadowMCR);
@@@ -1409,7 -1371,7 +1371,7 @@@ static int set_higher_rates(struct mosc
         /***********************************************
         *      Init Sequence for higher rates
         ***********************************************/
-       dbg("Sending Setting Commands ..........");
+       dev_dbg(&port->dev, "Sending Setting Commands ..........\n");
        port_number = port->number - port->serial->minor;
  
        write_mos_reg(serial, port_number, IER, 0x00);
@@@ -1478,7 -1440,7 +1440,7 @@@ static struct divisor_table_entry divis
   *    this function calculates the proper baud rate divisor for the specified
   *    baud rate.
   *****************************************************************************/
- static int calc_baud_rate_divisor(int baudrate, int *divisor)
+ static int calc_baud_rate_divisor(struct usb_serial_port *port, int baudrate, int *divisor)
  {
        int i;
        __u16 custom;
        __u16 round;
  
  
-       dbg("%s - %d", __func__, baudrate);
+       dev_dbg(&port->dev, "%s - %d\n", __func__, baudrate);
  
        for (i = 0; i < ARRAY_SIZE(divisor_table); i++) {
                if (divisor_table[i].baudrate == baudrate) {
                        custom++;
                *divisor = custom;
  
-               dbg("Baud %d = %d", baudrate, custom);
+               dev_dbg(&port->dev, "Baud %d = %d\n", baudrate, custom);
                return 0;
        }
  
-       dbg("Baud calculation Failed...");
+       dev_dbg(&port->dev, "Baud calculation Failed...\n");
        return -EINVAL;
  }
  
@@@ -1536,13 -1498,11 +1498,11 @@@ static int send_cmd_write_baud_rate(str
        port = mos7720_port->port;
        serial = port->serial;
  
-       dbg("%s: Entering ..........", __func__);
        number = port->number - port->serial->minor;
-       dbg("%s - port = %d, baud = %d", __func__, port->number, baudrate);
+       dev_dbg(&port->dev, "%s - baud = %d\n", __func__, baudrate);
  
        /* Calculate the Divisor */
-       status = calc_baud_rate_divisor(baudrate, &divisor);
+       status = calc_baud_rate_divisor(port, baudrate, &divisor);
        if (status) {
                dev_err(&port->dev, "%s - bad baud rate\n", __func__);
                return status;
@@@ -1591,21 -1551,17 +1551,17 @@@ static void change_port_settings(struc
        serial = port->serial;
        port_number = port->number - port->serial->minor;
  
-       dbg("%s - port %d", __func__, port->number);
        if (!mos7720_port->open) {
-               dbg("%s - port not opened", __func__);
+               dev_dbg(&port->dev, "%s - port not opened\n", __func__);
                return;
        }
  
-       dbg("%s: Entering ..........", __func__);
        lData = UART_LCR_WLEN8;
        lStop = 0x00;   /* 1 stop bit */
        lParity = 0x00; /* No parity */
  
 -      cflag = tty->termios->c_cflag;
 -      iflag = tty->termios->c_iflag;
 +      cflag = tty->termios.c_cflag;
 +      iflag = tty->termios.c_iflag;
  
        /* Change the number of bits */
        switch (cflag & CSIZE) {
        if (cflag & PARENB) {
                if (cflag & PARODD) {
                        lParity = UART_LCR_PARITY;
-                       dbg("%s - parity = odd", __func__);
+                       dev_dbg(&port->dev, "%s - parity = odd\n", __func__);
                } else {
                        lParity = (UART_LCR_EPAR | UART_LCR_PARITY);
-                       dbg("%s - parity = even", __func__);
+                       dev_dbg(&port->dev, "%s - parity = even\n", __func__);
                }
  
        } else {
-               dbg("%s - parity = none", __func__);
+               dev_dbg(&port->dev, "%s - parity = none\n", __func__);
        }
  
        if (cflag & CMSPAR)
        /* Change the Stop bit */
        if (cflag & CSTOPB) {
                lStop = UART_LCR_STOP;
-               dbg("%s - stop bits = 2", __func__);
+               dev_dbg(&port->dev, "%s - stop bits = 2\n", __func__);
        } else {
                lStop = 0x00;
-               dbg("%s - stop bits = 1", __func__);
+               dev_dbg(&port->dev, "%s - stop bits = 1\n", __func__);
        }
  
  #define LCR_BITS_MASK         0x03    /* Mask for bits/char field */
        baud = tty_get_baud_rate(tty);
        if (!baud) {
                /* pick a default, any default... */
-               dbg("Picked default baud...");
+               dev_dbg(&port->dev, "Picked default baud...\n");
                baud = 9600;
        }
  
                return;
        }
  
-       dbg("%s - baud rate = %d", __func__, baud);
+       dev_dbg(&port->dev, "%s - baud rate = %d\n", __func__, baud);
        status = send_cmd_write_baud_rate(mos7720_port, baud);
        /* FIXME: needs to write actual resulting baud back not just
           blindly do so */
        if (port->read_urb->status != -EINPROGRESS) {
                status = usb_submit_urb(port->read_urb, GFP_ATOMIC);
                if (status)
-                       dbg("usb_submit_urb(read bulk) failed, status = %d",
-                           status);
+                       dev_dbg(&port->dev, "usb_submit_urb(read bulk) failed, status = %d\n", status);
        }
  }
  
@@@ -1747,23 -1702,19 +1702,19 @@@ static void mos7720_set_termios(struct 
                return;
  
        if (!mos7720_port->open) {
-               dbg("%s - port not opened", __func__);
+               dev_dbg(&port->dev, "%s - port not opened\n", __func__);
                return;
        }
  
-       dbg("%s\n", "setting termios - ASPIRE");
+       dev_dbg(&port->dev, "setting termios - ASPIRE\n");
  
 -      cflag = tty->termios->c_cflag;
 +      cflag = tty->termios.c_cflag;
  
-       dbg("%s - cflag %08x iflag %08x", __func__,
-           tty->termios.c_cflag,
-           RELEVANT_IFLAG(tty->termios.c_iflag));
+       dev_dbg(&port->dev, "%s - cflag %08x iflag %08x\n", __func__,
 -              tty->termios->c_cflag, RELEVANT_IFLAG(tty->termios->c_iflag));
++              tty->termios.c_cflag, RELEVANT_IFLAG(tty->termios.c_iflag));
  
-       dbg("%s - old cflag %08x old iflag %08x", __func__,
-           old_termios->c_cflag,
-           RELEVANT_IFLAG(old_termios->c_iflag));
-       dbg("%s - port %d", __func__, port->number);
+       dev_dbg(&port->dev, "%s - old cflag %08x old iflag %08x\n", __func__,
+               old_termios->c_cflag, RELEVANT_IFLAG(old_termios->c_iflag));
  
        /* change the port settings to the new ones specified */
        change_port_settings(tty, mos7720_port, old_termios);
        if (port->read_urb->status != -EINPROGRESS) {
                status = usb_submit_urb(port->read_urb, GFP_ATOMIC);
                if (status)
-                       dbg("usb_submit_urb(read bulk) failed, status = %d",
-                           status);
+                       dev_dbg(&port->dev, "usb_submit_urb(read bulk) failed, status = %d\n", status);
        }
  }
  
@@@ -1800,7 -1750,7 +1750,7 @@@ static int get_lsr_info(struct tty_stru
                read_mos_reg(port->serial, port_number, LSR, &data);
                if ((data & (UART_LSR_TEMT | UART_LSR_THRE))
                                        == (UART_LSR_TEMT | UART_LSR_THRE)) {
-                       dbg("%s -- Empty", __func__);
+                       dev_dbg(&port->dev, "%s -- Empty\n", __func__);
                        result = TIOCSER_TEMT;
                }
        }
@@@ -1817,8 -1767,6 +1767,6 @@@ static int mos7720_tiocmget(struct tty_
        unsigned int mcr ;
        unsigned int msr ;
  
-       dbg("%s - port %d", __func__, port->number);
        mcr = mos7720_port->shadowMCR;
        msr = mos7720_port->shadowMSR;
  
          | ((msr & UART_MSR_RI)    ? TIOCM_RI :  0)   /* 0x080 */
          | ((msr & UART_MSR_DSR)   ? TIOCM_DSR : 0);  /* 0x100 */
  
-       dbg("%s -- %x", __func__, result);
        return result;
  }
  
@@@ -1840,8 -1786,6 +1786,6 @@@ static int mos7720_tiocmset(struct tty_
        struct usb_serial_port *port = tty->driver_data;
        struct moschip_port *mos7720_port = usb_get_serial_port_data(port);
        unsigned int mcr ;
-       dbg("%s - port %d", __func__, port->number);
-       dbg("he was at tiocmset");
  
        mcr = mos7720_port->shadowMCR;
  
@@@ -1888,8 -1832,8 +1832,8 @@@ static int mos7720_get_icount(struct tt
        icount->brk = cnow.brk;
        icount->buf_overrun = cnow.buf_overrun;
  
-       dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __func__,
-               port->number, icount->rx, icount->tx);
+       dev_dbg(&port->dev, "%s TIOCGICOUNT RX=%d, TX=%d\n", __func__,
+               icount->rx, icount->tx);
        return 0;
  }
  
@@@ -1975,29 -1919,28 +1919,28 @@@ static int mos7720_ioctl(struct tty_str
        if (mos7720_port == NULL)
                return -ENODEV;
  
-       dbg("%s - port %d, cmd = 0x%x", __func__, port->number, cmd);
+       dev_dbg(&port->dev, "%s - cmd = 0x%x", __func__, cmd);
  
        switch (cmd) {
        case TIOCSERGETLSR:
-               dbg("%s (%d) TIOCSERGETLSR", __func__,  port->number);
+               dev_dbg(&port->dev, "%s TIOCSERGETLSR\n", __func__);
                return get_lsr_info(tty, mos7720_port,
                                        (unsigned int __user *)arg);
  
        /* FIXME: These should be using the mode methods */
        case TIOCMBIS:
        case TIOCMBIC:
-               dbg("%s (%d) TIOCMSET/TIOCMBIC/TIOCMSET",
-                                       __func__, port->number);
+               dev_dbg(&port->dev, "%s TIOCMSET/TIOCMBIC/TIOCMSET\n", __func__);
                return set_modem_info(mos7720_port, cmd,
                                      (unsigned int __user *)arg);
  
        case TIOCGSERIAL:
-               dbg("%s (%d) TIOCGSERIAL", __func__,  port->number);
+               dev_dbg(&port->dev, "%s TIOCGSERIAL\n", __func__);
                return get_serial_info(mos7720_port,
                                       (struct serial_struct __user *)arg);
  
        case TIOCMIWAIT:
-               dbg("%s (%d) TIOCMIWAIT", __func__,  port->number);
+               dev_dbg(&port->dev, "%s TIOCMIWAIT\n", __func__);
                cprev = mos7720_port->icount;
                while (1) {
                        if (signal_pending(current))
@@@ -2030,13 -1973,6 +1973,6 @@@ static int mos7720_startup(struct usb_s
        u16 product;
        int ret_val;
  
-       dbg("%s: Entering ..........", __func__);
-       if (!serial) {
-               dbg("Invalid Handler");
-               return -ENODEV;
-       }
        product = le16_to_cpu(serial->dev->descriptor.idProduct);
        dev = serial->dev;
  
                mos7720_port->port = serial->port[i];
                usb_set_serial_port_data(serial->port[i], mos7720_port);
  
-               dbg("port number is %d", serial->port[i]->number);
-               dbg("serial number is %d", serial->minor);
+               dev_dbg(&dev->dev, "port number is %d\n", serial->port[i]->number);
+               dev_dbg(&dev->dev, "serial number is %d\n", serial->minor);
        }
  
  
  #endif
        /* LSR For Port 1 */
        read_mos_reg(serial, 0, LSR, &data);
-       dbg("LSR:%x", data);
+       dev_dbg(&dev->dev, "LSR:%x\n", data);
  
        return 0;
  }
@@@ -2195,6 -2131,3 +2131,3 @@@ module_usb_serial_driver(serial_drivers
  MODULE_AUTHOR(DRIVER_AUTHOR);
  MODULE_DESCRIPTION(DRIVER_DESC);
  MODULE_LICENSE("GPL");
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug enabled or not");
@@@ -252,8 -252,6 +252,6 @@@ struct moschip_port 
        struct timer_list led_timer2;   /* Timer for LED off */
  };
  
- static bool debug;
  /*
   * mos7840_set_reg_sync
   *    To set the Control register by calling usb_fill_control_urb function
@@@ -265,7 -263,7 +263,7 @@@ static int mos7840_set_reg_sync(struct 
  {
        struct usb_device *dev = port->serial->dev;
        val = val & 0x00ff;
-       dbg("mos7840_set_reg_sync offset is %x, value %x", reg, val);
+       dev_dbg(&port->dev, "mos7840_set_reg_sync offset is %x, value %x\n", reg, val);
  
        return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), MCS_WRREQ,
                               MCS_WR_RTYPE, val, reg, NULL, 0,
@@@ -293,7 -291,7 +291,7 @@@ static int mos7840_get_reg_sync(struct 
                              MCS_RD_RTYPE, 0, reg, buf, VENDOR_READ_LENGTH,
                              MOS_WDR_TIMEOUT);
        *val = buf[0];
-       dbg("mos7840_get_reg_sync offset is %x, return val %x", reg, *val);
+       dev_dbg(&port->dev, "%s offset is %x, return val %x\n", __func__, reg, *val);
  
        kfree(buf);
        return ret;
@@@ -316,21 -314,16 +314,16 @@@ static int mos7840_set_uart_reg(struct 
        if (port->serial->num_ports == 4) {
                val |= (((__u16) port->number -
                                (__u16) (port->serial->minor)) + 1) << 8;
-               dbg("mos7840_set_uart_reg application number is %x", val);
        } else {
                if (((__u16) port->number - (__u16) (port->serial->minor)) == 0) {
                        val |= (((__u16) port->number -
                              (__u16) (port->serial->minor)) + 1) << 8;
-                       dbg("mos7840_set_uart_reg application number is %x",
-                           val);
                } else {
-                       val |=
-                           (((__u16) port->number -
+                       val |= (((__u16) port->number -
                              (__u16) (port->serial->minor)) + 2) << 8;
-                       dbg("mos7840_set_uart_reg application number is %x",
-                           val);
                }
        }
+       dev_dbg(&port->dev, "%s application number is %x\n", __func__, val);
        return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), MCS_WRREQ,
                               MCS_WR_RTYPE, val, reg, NULL, 0,
                               MOS_WDR_TIMEOUT);
@@@ -354,27 -347,21 +347,21 @@@ static int mos7840_get_uart_reg(struct 
        if (!buf)
                return -ENOMEM;
  
-       /* dbg("application number is %4x",
-           (((__u16)port->number - (__u16)(port->serial->minor))+1)<<8); */
        /* Wval  is same as application number */
        if (port->serial->num_ports == 4) {
                Wval =
                    (((__u16) port->number - (__u16) (port->serial->minor)) +
                     1) << 8;
-               dbg("mos7840_get_uart_reg application number is %x", Wval);
        } else {
                if (((__u16) port->number - (__u16) (port->serial->minor)) == 0) {
                        Wval = (((__u16) port->number -
                              (__u16) (port->serial->minor)) + 1) << 8;
-                       dbg("mos7840_get_uart_reg application number is %x",
-                           Wval);
                } else {
                        Wval = (((__u16) port->number -
                              (__u16) (port->serial->minor)) + 2) << 8;
-                       dbg("mos7840_get_uart_reg application number is %x",
-                           Wval);
                }
        }
+       dev_dbg(&port->dev, "%s application number is %x\n", __func__, Wval);
        ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), MCS_RDREQ,
                              MCS_RD_RTYPE, Wval, reg, buf, VENDOR_READ_LENGTH,
                              MOS_WDR_TIMEOUT);
        return ret;
  }
  
- static void mos7840_dump_serial_port(struct moschip_port *mos7840_port)
+ static void mos7840_dump_serial_port(struct usb_serial_port *port,
+                                    struct moschip_port *mos7840_port)
  {
  
-       dbg("***************************************");
-       dbg("SpRegOffset is %2x", mos7840_port->SpRegOffset);
-       dbg("ControlRegOffset is %2x", mos7840_port->ControlRegOffset);
-       dbg("DCRRegOffset is %2x", mos7840_port->DcrRegOffset);
-       dbg("***************************************");
+       dev_dbg(&port->dev, "SpRegOffset is %2x\n", mos7840_port->SpRegOffset);
+       dev_dbg(&port->dev, "ControlRegOffset is %2x\n", mos7840_port->ControlRegOffset);
+       dev_dbg(&port->dev, "DCRRegOffset is %2x\n", mos7840_port->DcrRegOffset);
  
  }
  
@@@ -450,8 -436,6 +436,6 @@@ static void mos7840_handle_new_lsr(stru
  {
        struct async_icount *icount;
  
-       dbg("%s - %02x", __func__, new_lsr);
        if (new_lsr & SERIAL_LSR_BI) {
                /*
                 * Parity and Framing errors only count if they
@@@ -492,6 -476,7 +476,7 @@@ static void mos7840_control_callback(st
  {
        unsigned char *data;
        struct moschip_port *mos7840_port;
+       struct device *dev = &urb->dev->dev;
        __u8 regval = 0x0;
        int result = 0;
        int status = urb->status;
        case -ENOENT:
        case -ESHUTDOWN:
                /* this urb is terminated, clean up */
-               dbg("%s - urb shutting down with status: %d", __func__,
-                   status);
+               dev_dbg(dev, "%s - urb shutting down with status: %d\n", __func__, status);
                return;
        default:
-               dbg("%s - nonzero urb status received: %d", __func__,
-                   status);
+               dev_dbg(dev, "%s - nonzero urb status received: %d\n", __func__, status);
                goto exit;
        }
  
-       dbg("%s urb buffer size is %d", __func__, urb->actual_length);
-       dbg("%s mos7840_port->MsrLsr is %d port %d", __func__,
-           mos7840_port->MsrLsr, mos7840_port->port_num);
+       dev_dbg(dev, "%s urb buffer size is %d\n", __func__, urb->actual_length);
+       dev_dbg(dev, "%s mos7840_port->MsrLsr is %d port %d\n", __func__,
+               mos7840_port->MsrLsr, mos7840_port->port_num);
        data = urb->transfer_buffer;
        regval = (__u8) data[0];
-       dbg("%s data is %x", __func__, regval);
+       dev_dbg(dev, "%s data is %x\n", __func__, regval);
        if (mos7840_port->MsrLsr == 0)
                mos7840_handle_new_msr(mos7840_port, regval);
        else if (mos7840_port->MsrLsr == 1)
@@@ -532,8 -515,7 +515,7 @@@ exit
                result = usb_submit_urb(mos7840_port->int_urb, GFP_ATOMIC);
        spin_unlock(&mos7840_port->pool_lock);
        if (result) {
-               dev_err(&urb->dev->dev,
-                       "%s - Error %d submitting interrupt urb\n",
+               dev_err(dev, "%s - Error %d submitting interrupt urb\n",
                        __func__, result);
        }
  }
@@@ -570,12 -552,12 +552,12 @@@ static void mos7840_set_led_callback(st
        case -ENOENT:
        case -ESHUTDOWN:
                /* This urb is terminated, clean up */
-               dbg("%s - urb shutting down with status: %d", __func__,
-                       urb->status);
+               dev_dbg(&urb->dev->dev, "%s - urb shutting down with status: %d",
+                       __func__, urb->status);
                break;
        default:
-               dbg("%s - nonzero urb status received: %d", __func__,
-                       urb->status);
+               dev_dbg(&urb->dev->dev, "%s - nonzero urb status received: %d",
+                       __func__, urb->status);
        }
  }
  
@@@ -650,12 -632,12 +632,12 @@@ static void mos7840_interrupt_callback(
        case -ENOENT:
        case -ESHUTDOWN:
                /* this urb is terminated, clean up */
-               dbg("%s - urb shutting down with status: %d", __func__,
-                   status);
+               dev_dbg(&urb->dev->dev, "%s - urb shutting down with status: %d\n",
+                       __func__, status);
                return;
        default:
-               dbg("%s - nonzero urb status received: %d", __func__,
-                   status);
+               dev_dbg(&urb->dev->dev, "%s - nonzero urb status received: %d\n",
+                       __func__, status);
                goto exit;
        }
  
         * Byte 5 FIFO status for both */
  
        if (length && length > 5) {
-               dbg("%s", "Wrong data !!!");
+               dev_dbg(&urb->dev->dev, "%s", "Wrong data !!!\n");
                return;
        }
  
                      (__u16) (serial->minor)) + 1) << 8;
                if (mos7840_port->open) {
                        if (sp[i] & 0x01) {
-                               dbg("SP%d No Interrupt !!!", i);
+                               dev_dbg(&urb->dev->dev, "SP%d No Interrupt !!!\n", i);
                        } else {
                                switch (sp[i] & 0x0f) {
                                case SERIAL_IIR_RLS:
-                                       dbg("Serial Port %d: Receiver status error or ", i);
-                                       dbg("address bit detected in 9-bit mode");
+                                       dev_dbg(&urb->dev->dev, "Serial Port %d: Receiver status error or \n", i);
+                                       dev_dbg(&urb->dev->dev, "address bit detected in 9-bit mode\n");
                                        mos7840_port->MsrLsr = 1;
                                        wreg = LINE_STATUS_REGISTER;
                                        break;
                                case SERIAL_IIR_MS:
-                                       dbg("Serial Port %d: Modem status change", i);
+                                       dev_dbg(&urb->dev->dev, "Serial Port %d: Modem status change\n", i);
                                        mos7840_port->MsrLsr = 0;
                                        wreg = MODEM_STATUS_REGISTER;
                                        break;
@@@ -731,11 -713,11 +713,11 @@@ static int mos7840_port_paranoia_check(
                                       const char *function)
  {
        if (!port) {
-               dbg("%s - port == NULL", function);
+               pr_debug("%s - port == NULL\n", function);
                return -1;
        }
        if (!port->serial) {
-               dbg("%s - port->serial == NULL", function);
+               pr_debug("%s - port->serial == NULL\n", function);
                return -1;
        }
  
@@@ -747,11 -729,11 +729,11 @@@ static int mos7840_serial_paranoia_chec
                                         const char *function)
  {
        if (!serial) {
-               dbg("%s - serial == NULL", function);
+               pr_debug("%s - serial == NULL\n", function);
                return -1;
        }
        if (!serial->type) {
-               dbg("%s - serial->type == NULL!", function);
+               pr_debug("%s - serial->type == NULL!\n", function);
                return -1;
        }
  
@@@ -790,49 -772,44 +772,44 @@@ static void mos7840_bulk_in_callback(st
        int status = urb->status;
  
        mos7840_port = urb->context;
-       if (!mos7840_port) {
-               dbg("%s", "NULL mos7840_port pointer");
+       if (!mos7840_port)
                return;
-       }
  
        if (status) {
-               dbg("nonzero read bulk status received: %d", status);
+               dev_dbg(&urb->dev->dev, "nonzero read bulk status received: %d\n", status);
                mos7840_port->read_urb_busy = false;
                return;
        }
  
-       port = (struct usb_serial_port *)mos7840_port->port;
+       port = mos7840_port->port;
        if (mos7840_port_paranoia_check(port, __func__)) {
-               dbg("%s", "Port Paranoia failed");
                mos7840_port->read_urb_busy = false;
                return;
        }
  
        serial = mos7840_get_usb_serial(port, __func__);
        if (!serial) {
-               dbg("%s", "Bad serial pointer");
                mos7840_port->read_urb_busy = false;
                return;
        }
  
        data = urb->transfer_buffer;
+       usb_serial_debug_data(&port->dev, __func__, urb->actual_length, data);
  
        if (urb->actual_length) {
                tty = tty_port_tty_get(&mos7840_port->port->port);
                if (tty) {
                        tty_insert_flip_string(tty, data, urb->actual_length);
-                       dbg(" %s ", data);
                        tty_flip_buffer_push(tty);
                        tty_kref_put(tty);
                }
                mos7840_port->icount.rx += urb->actual_length;
                smp_wmb();
-               dbg("mos7840_port->icount.rx is %d:",
-                   mos7840_port->icount.rx);
+               dev_dbg(&port->dev, "mos7840_port->icount.rx is %d:\n", mos7840_port->icount.rx);
        }
  
        if (!mos7840_port->read_urb) {
-               dbg("%s", "URB KILLED !!!");
+               dev_dbg(&port->dev, "%s", "URB KILLED !!!\n");
                mos7840_port->read_urb_busy = false;
                return;
        }
        retval = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC);
  
        if (retval) {
-               dbg("usb_submit_urb(read bulk) failed, retval = %d", retval);
+               dev_dbg(&port->dev, "usb_submit_urb(read bulk) failed, retval = %d\n", retval);
                mos7840_port->read_urb_busy = false;
        }
  }
  static void mos7840_bulk_out_data_callback(struct urb *urb)
  {
        struct moschip_port *mos7840_port;
+       struct usb_serial_port *port;
        struct tty_struct *tty;
        int status = urb->status;
        int i;
  
        mos7840_port = urb->context;
+       port = mos7840_port->port;
        spin_lock(&mos7840_port->pool_lock);
        for (i = 0; i < NUM_URBS; i++) {
                if (urb == mos7840_port->write_urb_pool[i]) {
        spin_unlock(&mos7840_port->pool_lock);
  
        if (status) {
-               dbg("nonzero write bulk status received:%d", status);
+               dev_dbg(&port->dev, "nonzero write bulk status received:%d\n", status);
                return;
        }
  
-       if (mos7840_port_paranoia_check(mos7840_port->port, __func__)) {
-               dbg("%s", "Port Paranoia failed");
+       if (mos7840_port_paranoia_check(port, __func__))
                return;
-       }
  
-       tty = tty_port_tty_get(&mos7840_port->port->port);
+       tty = tty_port_tty_get(&port->port);
        if (tty && mos7840_port->open)
                tty_wakeup(tty);
        tty_kref_put(tty);
@@@ -929,17 -906,13 +906,13 @@@ static int mos7840_open(struct tty_stru
        struct moschip_port *mos7840_port;
        struct moschip_port *port0;
  
-       if (mos7840_port_paranoia_check(port, __func__)) {
-               dbg("%s", "Port Paranoia failed");
+       if (mos7840_port_paranoia_check(port, __func__))
                return -ENODEV;
-       }
  
        serial = port->serial;
  
-       if (mos7840_serial_paranoia_check(serial, __func__)) {
-               dbg("%s", "Serial Paranoia failed");
+       if (mos7840_serial_paranoia_check(serial, __func__))
                return -ENODEV;
-       }
  
        mos7840_port = mos7840_get_port_private(port);
        port0 = mos7840_get_port_private(serial->port[0]);
        Data = 0x0;
        status = mos7840_get_reg_sync(port, mos7840_port->SpRegOffset, &Data);
        if (status < 0) {
-               dbg("Reading Spreg failed");
+               dev_dbg(&port->dev, "Reading Spreg failed\n");
                return -1;
        }
        Data |= 0x80;
        status = mos7840_set_reg_sync(port, mos7840_port->SpRegOffset, Data);
        if (status < 0) {
-               dbg("writing Spreg failed");
+               dev_dbg(&port->dev, "writing Spreg failed\n");
                return -1;
        }
  
        Data &= ~0x80;
        status = mos7840_set_reg_sync(port, mos7840_port->SpRegOffset, Data);
        if (status < 0) {
-               dbg("writing Spreg failed");
+               dev_dbg(&port->dev, "writing Spreg failed\n");
                return -1;
        }
        /* End of block to be checked */
        status = mos7840_get_reg_sync(port, mos7840_port->ControlRegOffset,
                                                                        &Data);
        if (status < 0) {
-               dbg("Reading Controlreg failed");
+               dev_dbg(&port->dev, "Reading Controlreg failed\n");
                return -1;
        }
        Data |= 0x08;           /* Driver done bit */
        status = mos7840_set_reg_sync(port,
                                mos7840_port->ControlRegOffset, Data);
        if (status < 0) {
-               dbg("writing Controlreg failed");
+               dev_dbg(&port->dev, "writing Controlreg failed\n");
                return -1;
        }
        /* do register settings here */
        Data = 0x00;
        status = mos7840_set_uart_reg(port, INTERRUPT_ENABLE_REGISTER, Data);
        if (status < 0) {
-               dbg("disabling interrupts failed");
+               dev_dbg(&port->dev, "disabling interrupts failed\n");
                return -1;
        }
        /* Set FIFO_CONTROL_REGISTER to the default value */
        Data = 0x00;
        status = mos7840_set_uart_reg(port, FIFO_CONTROL_REGISTER, Data);
        if (status < 0) {
-               dbg("Writing FIFO_CONTROL_REGISTER  failed");
+               dev_dbg(&port->dev, "Writing FIFO_CONTROL_REGISTER  failed\n");
                return -1;
        }
  
        Data = 0xcf;
        status = mos7840_set_uart_reg(port, FIFO_CONTROL_REGISTER, Data);
        if (status < 0) {
-               dbg("Writing FIFO_CONTROL_REGISTER  failed");
+               dev_dbg(&port->dev, "Writing FIFO_CONTROL_REGISTER  failed\n");
                return -1;
        }
  
         * (can't set it up in mos7840_startup as the  *
         * structures were not set up at that time.)   */
  
-       dbg("port number is %d", port->number);
-       dbg("serial number is %d", port->serial->minor);
-       dbg("Bulkin endpoint is %d", port->bulk_in_endpointAddress);
-       dbg("BulkOut endpoint is %d", port->bulk_out_endpointAddress);
-       dbg("Interrupt endpoint is %d", port->interrupt_in_endpointAddress);
-       dbg("port's number in the device is %d", mos7840_port->port_num);
+       dev_dbg(&port->dev, "port number is %d\n", port->number);
+       dev_dbg(&port->dev, "serial number is %d\n", port->serial->minor);
+       dev_dbg(&port->dev, "Bulkin endpoint is %d\n", port->bulk_in_endpointAddress);
+       dev_dbg(&port->dev, "BulkOut endpoint is %d\n", port->bulk_out_endpointAddress);
+       dev_dbg(&port->dev, "Interrupt endpoint is %d\n", port->interrupt_in_endpointAddress);
+       dev_dbg(&port->dev, "port's number in the device is %d\n", mos7840_port->port_num);
        mos7840_port->read_urb = port->read_urb;
  
        /* set up our bulk in urb */
                        mos7840_bulk_in_callback, mos7840_port);
        }
  
-       dbg("mos7840_open: bulkin endpoint is %d",
-           port->bulk_in_endpointAddress);
+       dev_dbg(&port->dev, "%s: bulkin endpoint is %d\n", __func__, port->bulk_in_endpointAddress);
        mos7840_port->read_urb_busy = true;
        response = usb_submit_urb(mos7840_port->read_urb, GFP_KERNEL);
        if (response) {
        mos7840_port->icount.tx = 0;
        mos7840_port->icount.rx = 0;
  
-       dbg("usb_serial serial:%p       mos7840_port:%p\n      usb_serial_port port:%p",
-                               serial, mos7840_port, port);
        return 0;
  }
  
@@@ -1221,10 -1190,8 +1190,8 @@@ static int mos7840_chars_in_buffer(stru
        unsigned long flags;
        struct moschip_port *mos7840_port;
  
-       if (mos7840_port_paranoia_check(port, __func__)) {
-               dbg("%s", "Invalid port");
+       if (mos7840_port_paranoia_check(port, __func__))
                return 0;
-       }
  
        mos7840_port = mos7840_get_port_private(port);
        if (mos7840_port == NULL)
                }
        }
        spin_unlock_irqrestore(&mos7840_port->pool_lock, flags);
-       dbg("%s - returns %d", __func__, chars);
+       dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars);
        return chars;
  
  }
@@@ -1256,16 -1223,12 +1223,12 @@@ static void mos7840_close(struct usb_se
        int j;
        __u16 Data;
  
-       if (mos7840_port_paranoia_check(port, __func__)) {
-               dbg("%s", "Port Paranoia failed");
+       if (mos7840_port_paranoia_check(port, __func__))
                return;
-       }
  
        serial = mos7840_get_usb_serial(port, __func__);
-       if (!serial) {
-               dbg("%s", "Serial Paranoia failed");
+       if (!serial)
                return;
-       }
  
        mos7840_port = mos7840_get_port_private(port);
        port0 = mos7840_get_port_private(serial->port[0]);
         * and interrupt read if they exists                  */
        if (serial->dev) {
                if (mos7840_port->write_urb) {
-                       dbg("%s", "Shutdown bulk write");
+                       dev_dbg(&port->dev, "%s", "Shutdown bulk write\n");
                        usb_kill_urb(mos7840_port->write_urb);
                }
                if (mos7840_port->read_urb) {
-                       dbg("%s", "Shutdown bulk read");
+                       dev_dbg(&port->dev, "%s", "Shutdown bulk read\n");
                        usb_kill_urb(mos7840_port->read_urb);
                        mos7840_port->read_urb_busy = false;
                }
                if ((&mos7840_port->control_urb)) {
-                       dbg("%s", "Shutdown control read");
+                       dev_dbg(&port->dev, "%s", "Shutdown control read\n");
                        /*/      usb_kill_urb (mos7840_port->control_urb); */
                }
        }
  /*      if(mos7840_port->ctrl_buf != NULL) */
  /*              kfree(mos7840_port->ctrl_buf); */
        port0->open_ports--;
-       dbg("mos7840_num_open_ports in close%d:in port%d",
-           port0->open_ports, port->number);
+       dev_dbg(&port->dev, "%s in close%d:in port%d\n", __func__, port0->open_ports, port->number);
        if (port0->open_ports == 0) {
                if (serial->port[0]->interrupt_in_urb) {
-                       dbg("%s", "Shutdown interrupt_in_urb");
+                       dev_dbg(&port->dev, "Shutdown interrupt_in_urb\n");
                        usb_kill_urb(serial->port[0]->interrupt_in_urb);
                }
        }
@@@ -1363,7 -1325,7 +1325,7 @@@ static void mos7840_block_until_chase_r
                /* No activity.. count down section */
                wait--;
                if (wait == 0) {
-                       dbg("%s - TIMEOUT", __func__);
+                       dev_dbg(&mos7840_port->port->dev, "%s - TIMEOUT\n", __func__);
                        return;
                } else {
                        /* Reset timeout value back to seconds */
@@@ -1384,16 -1346,12 +1346,12 @@@ static void mos7840_break(struct tty_st
        struct usb_serial *serial;
        struct moschip_port *mos7840_port;
  
-       if (mos7840_port_paranoia_check(port, __func__)) {
-               dbg("%s", "Port Paranoia failed");
+       if (mos7840_port_paranoia_check(port, __func__))
                return;
-       }
  
        serial = mos7840_get_usb_serial(port, __func__);
-       if (!serial) {
-               dbg("%s", "Serial Paranoia failed");
+       if (!serial)
                return;
-       }
  
        mos7840_port = mos7840_get_port_private(port);
  
  
        /* FIXME: no locking on shadowLCR anywhere in driver */
        mos7840_port->shadowLCR = data;
-       dbg("mcs7840_break mos7840_port->shadowLCR is %x",
-           mos7840_port->shadowLCR);
+       dev_dbg(&port->dev, "%s mos7840_port->shadowLCR is %x\n", __func__, mos7840_port->shadowLCR);
        mos7840_set_uart_reg(port, LINE_CONTROL_REGISTER,
                             mos7840_port->shadowLCR);
  }
@@@ -1433,17 -1390,12 +1390,12 @@@ static int mos7840_write_room(struct tt
        unsigned long flags;
        struct moschip_port *mos7840_port;
  
-       if (mos7840_port_paranoia_check(port, __func__)) {
-               dbg("%s", "Invalid port");
-               dbg("%s", " mos7840_write_room:leaving ...........");
+       if (mos7840_port_paranoia_check(port, __func__))
                return -1;
-       }
  
        mos7840_port = mos7840_get_port_private(port);
-       if (mos7840_port == NULL) {
-               dbg("%s", "mos7840_break:leaving ...........");
+       if (mos7840_port == NULL)
                return -1;
-       }
  
        spin_lock_irqsave(&mos7840_port->pool_lock, flags);
        for (i = 0; i < NUM_URBS; ++i) {
        spin_unlock_irqrestore(&mos7840_port->pool_lock, flags);
  
        room = (room == 0) ? 0 : room - URB_TRANSFER_BUFFER_SIZE + 1;
-       dbg("%s - returns %d", __func__, room);
+       dev_dbg(&mos7840_port->port->dev, "%s - returns %d\n", __func__, room);
        return room;
  
  }
@@@ -1486,9 -1438,8 +1438,8 @@@ static int mos7840_write(struct tty_str
        Data = 0x00;
        status = mos7840_get_uart_reg(port, LINE_CONTROL_REGISTER, &Data);
        mos7840_port->shadowLCR = Data;
-       dbg("mos7840_write: LINE_CONTROL_REGISTER is %x", Data);
-       dbg("mos7840_write: mos7840_port->shadowLCR is %x",
-           mos7840_port->shadowLCR);
+       dev_dbg(&port->dev, "%s: LINE_CONTROL_REGISTER is %x\n", __func__, Data);
+       dev_dbg(&port->dev, "%s: mos7840_port->shadowLCR is %x\n", __func__, mos7840_port->shadowLCR);
  
        /* Data = 0x03; */
        /* status = mos7840_set_uart_reg(port,LINE_CONTROL_REGISTER,Data); */
        /* status = mos7840_set_uart_reg(port,DIVISOR_LATCH_LSB,Data); */
        Data = 0x00;
        status = mos7840_get_uart_reg(port, DIVISOR_LATCH_LSB, &Data);
-       dbg("mos7840_write:DLL value is %x", Data);
+       dev_dbg(&port->dev, "%s: DLL value is %x\n", __func__, Data);
  
        Data = 0x0;
        status = mos7840_get_uart_reg(port, DIVISOR_LATCH_MSB, &Data);
-       dbg("mos7840_write:DLM value is %x", Data);
+       dev_dbg(&port->dev, "%s: DLM value is %x\n", __func__, Data);
  
        Data = Data & ~SERIAL_LCR_DLAB;
-       dbg("mos7840_write: mos7840_port->shadowLCR is %x",
-           mos7840_port->shadowLCR);
+       dev_dbg(&port->dev, "%s: mos7840_port->shadowLCR is %x\n", __func__, mos7840_port->shadowLCR);
        status = mos7840_set_uart_reg(port, LINE_CONTROL_REGISTER, Data);
  #endif
  
-       if (mos7840_port_paranoia_check(port, __func__)) {
-               dbg("%s", "Port Paranoia failed");
+       if (mos7840_port_paranoia_check(port, __func__))
                return -1;
-       }
  
        serial = port->serial;
-       if (mos7840_serial_paranoia_check(serial, __func__)) {
-               dbg("%s", "Serial Paranoia failed");
+       if (mos7840_serial_paranoia_check(serial, __func__))
                return -1;
-       }
  
        mos7840_port = mos7840_get_port_private(port);
-       if (mos7840_port == NULL) {
-               dbg("%s", "mos7840_port is NULL");
+       if (mos7840_port == NULL)
                return -1;
-       }
  
        /* try to find a free urb in the list */
        urb = NULL;
                if (!mos7840_port->busy[i]) {
                        mos7840_port->busy[i] = 1;
                        urb = mos7840_port->write_urb_pool[i];
-                       dbg("URB:%d", i);
+                       dev_dbg(&port->dev, "URB:%d\n", i);
                        break;
                }
        }
        spin_unlock_irqrestore(&mos7840_port->pool_lock, flags);
  
        if (urb == NULL) {
-               dbg("%s - no more free urbs", __func__);
+               dev_dbg(&port->dev, "%s - no more free urbs\n", __func__);
                goto exit;
        }
  
        }
  
        data1 = urb->transfer_buffer;
-       dbg("bulkout endpoint is %d", port->bulk_out_endpointAddress);
+       dev_dbg(&port->dev, "bulkout endpoint is %d\n", port->bulk_out_endpointAddress);
  
        /* Turn on LED */
        if (mos7840_port->has_led && !mos7840_port->led_flag) {
        bytes_sent = transfer_size;
        mos7840_port->icount.tx += transfer_size;
        smp_wmb();
-       dbg("mos7840_port->icount.tx is %d:", mos7840_port->icount.tx);
+       dev_dbg(&port->dev, "mos7840_port->icount.tx is %d:\n", mos7840_port->icount.tx);
  exit:
        return bytes_sent;
  
@@@ -1626,12 -1570,8 +1570,8 @@@ static void mos7840_throttle(struct tty
        struct moschip_port *mos7840_port;
        int status;
  
-       if (mos7840_port_paranoia_check(port, __func__)) {
-               dbg("%s", "Invalid port");
+       if (mos7840_port_paranoia_check(port, __func__))
                return;
-       }
-       dbg("- port %d", port->number);
  
        mos7840_port = mos7840_get_port_private(port);
  
                return;
  
        if (!mos7840_port->open) {
-               dbg("%s", "port not opened");
+               dev_dbg(&port->dev, "%s", "port not opened\n");
                return;
        }
  
                        return;
        }
        /* if we are implementing RTS/CTS, toggle that line */
 -      if (tty->termios->c_cflag & CRTSCTS) {
 +      if (tty->termios.c_cflag & CRTSCTS) {
                mos7840_port->shadowMCR &= ~MCR_RTS;
                status = mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER,
                                         mos7840_port->shadowMCR);
@@@ -1672,16 -1612,14 +1612,14 @@@ static void mos7840_unthrottle(struct t
        int status;
        struct moschip_port *mos7840_port = mos7840_get_port_private(port);
  
-       if (mos7840_port_paranoia_check(port, __func__)) {
-               dbg("%s", "Invalid port");
+       if (mos7840_port_paranoia_check(port, __func__))
                return;
-       }
  
        if (mos7840_port == NULL)
                return;
  
        if (!mos7840_port->open) {
-               dbg("%s - port not opened", __func__);
+               dev_dbg(&port->dev, "%s - port not opened\n", __func__);
                return;
        }
  
        }
  
        /* if we are implementing RTS/CTS, toggle that line */
 -      if (tty->termios->c_cflag & CRTSCTS) {
 +      if (tty->termios.c_cflag & CRTSCTS) {
                mos7840_port->shadowMCR |= MCR_RTS;
                status = mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER,
                                         mos7840_port->shadowMCR);
@@@ -1726,7 -1664,7 +1664,7 @@@ static int mos7840_tiocmget(struct tty_
            | ((msr & MOS7840_MSR_RI) ? TIOCM_RI : 0)
            | ((msr & MOS7840_MSR_DSR) ? TIOCM_DSR : 0);
  
-       dbg("%s - 0x%04X", __func__, result);
+       dev_dbg(&port->dev, "%s - 0x%04X\n", __func__, result);
  
        return result;
  }
@@@ -1764,7 -1702,7 +1702,7 @@@ static int mos7840_tiocmset(struct tty_
  
        status = mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER, mcr);
        if (status < 0) {
-               dbg("setting MODEM_CONTROL_REGISTER Failed");
+               dev_dbg(&port->dev, "setting MODEM_CONTROL_REGISTER Failed\n");
                return status;
        }
  
   *    this function calculates the proper baud rate divisor for the specified
   *    baud rate.
   *****************************************************************************/
- static int mos7840_calc_baud_rate_divisor(int baudRate, int *divisor,
+ static int mos7840_calc_baud_rate_divisor(struct usb_serial_port *port,
+                                         int baudRate, int *divisor,
                                          __u16 *clk_sel_val)
  {
-       dbg("%s - %d", __func__, baudRate);
+       dev_dbg(&port->dev, "%s - %d\n", __func__, baudRate);
  
        if (baudRate <= 115200) {
                *divisor = 115200 / baudRate;
                        custom++;
                *divisor = custom;
  
-               dbg(" Baud %d = %d", baudrate, custom);
+               dev_dbg(&port->dev, " Baud %d = %d\n", baudrate, custom);
                return 0;
        }
  
-       dbg("%s", " Baud calculation Failed...");
+       dev_dbg(&port->dev, "%s", " Baud calculation Failed...\n");
        return -1;
  #endif
  }
@@@ -1860,21 -1799,17 +1799,17 @@@ static int mos7840_send_cmd_write_baud_
        if (mos7840_port == NULL)
                return -1;
  
-       port = (struct usb_serial_port *)mos7840_port->port;
-       if (mos7840_port_paranoia_check(port, __func__)) {
-               dbg("%s", "Invalid port");
+       port = mos7840_port->port;
+       if (mos7840_port_paranoia_check(port, __func__))
                return -1;
-       }
  
-       if (mos7840_serial_paranoia_check(port->serial, __func__)) {
-               dbg("%s", "Invalid Serial");
+       if (mos7840_serial_paranoia_check(port->serial, __func__))
                return -1;
-       }
  
        number = mos7840_port->port->number - mos7840_port->port->serial->minor;
  
-       dbg("%s - port = %d, baud = %d", __func__,
-           mos7840_port->port->number, baudRate);
+       dev_dbg(&port->dev, "%s - port = %d, baud = %d\n", __func__,
+               mos7840_port->port->number, baudRate);
        /* reset clk_uart_sel in spregOffset */
        if (baudRate > 115200) {
  #ifdef HW_flow_control
                status = mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER,
                                                                        Data);
                if (status < 0) {
-                       dbg("Writing spreg failed in set_serial_baud");
+                       dev_dbg(&port->dev, "Writing spreg failed in set_serial_baud\n");
                        return -1;
                }
  #endif
                status = mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER,
                                                                        Data);
                if (status < 0) {
-                       dbg("Writing spreg failed in set_serial_baud");
+                       dev_dbg(&port->dev, "Writing spreg failed in set_serial_baud\n");
                        return -1;
                }
  #endif
        if (1) {                /* baudRate <= 115200) */
                clk_sel_val = 0x0;
                Data = 0x0;
-               status = mos7840_calc_baud_rate_divisor(baudRate, &divisor,
+               status = mos7840_calc_baud_rate_divisor(port, baudRate, &divisor,
                                                   &clk_sel_val);
                status = mos7840_get_reg_sync(port, mos7840_port->SpRegOffset,
                                                                 &Data);
                if (status < 0) {
-                       dbg("reading spreg failed in set_serial_baud");
+                       dev_dbg(&port->dev, "reading spreg failed in set_serial_baud\n");
                        return -1;
                }
                Data = (Data & 0x8f) | clk_sel_val;
                status = mos7840_set_reg_sync(port, mos7840_port->SpRegOffset,
                                                                Data);
                if (status < 0) {
-                       dbg("Writing spreg failed in set_serial_baud");
+                       dev_dbg(&port->dev, "Writing spreg failed in set_serial_baud\n");
                        return -1;
                }
                /* Calculate the Divisor */
  
                /* Write the divisor */
                Data = (unsigned char)(divisor & 0xff);
-               dbg("set_serial_baud Value to write DLL is %x", Data);
+               dev_dbg(&port->dev, "set_serial_baud Value to write DLL is %x\n", Data);
                mos7840_set_uart_reg(port, DIVISOR_LATCH_LSB, Data);
  
                Data = (unsigned char)((divisor & 0xff00) >> 8);
-               dbg("set_serial_baud Value to write DLM is %x", Data);
+               dev_dbg(&port->dev, "set_serial_baud Value to write DLM is %x\n", Data);
                mos7840_set_uart_reg(port, DIVISOR_LATCH_MSB, Data);
  
                /* Disable access to divisor latch */
@@@ -1975,24 -1910,18 +1910,18 @@@ static void mos7840_change_port_setting
        if (mos7840_port == NULL)
                return;
  
-       port = (struct usb_serial_port *)mos7840_port->port;
+       port = mos7840_port->port;
  
-       if (mos7840_port_paranoia_check(port, __func__)) {
-               dbg("%s", "Invalid port");
+       if (mos7840_port_paranoia_check(port, __func__))
                return;
-       }
  
-       if (mos7840_serial_paranoia_check(port->serial, __func__)) {
-               dbg("%s", "Invalid Serial");
+       if (mos7840_serial_paranoia_check(port->serial, __func__))
                return;
-       }
  
        serial = port->serial;
  
-       dbg("%s - port %d", __func__, mos7840_port->port->number);
        if (!mos7840_port->open) {
-               dbg("%s - port not opened", __func__);
+               dev_dbg(&port->dev, "%s - port not opened\n", __func__);
                return;
        }
  
        lStop = LCR_STOP_1;
        lParity = LCR_PAR_NONE;
  
 -      cflag = tty->termios->c_cflag;
 -      iflag = tty->termios->c_iflag;
 +      cflag = tty->termios.c_cflag;
 +      iflag = tty->termios.c_iflag;
  
        /* Change the number of bits */
        if (cflag & CSIZE) {
        if (cflag & PARENB) {
                if (cflag & PARODD) {
                        lParity = LCR_PAR_ODD;
-                       dbg("%s - parity = odd", __func__);
+                       dev_dbg(&port->dev, "%s - parity = odd\n", __func__);
                } else {
                        lParity = LCR_PAR_EVEN;
-                       dbg("%s - parity = even", __func__);
+                       dev_dbg(&port->dev, "%s - parity = even\n", __func__);
                }
  
        } else {
-               dbg("%s - parity = none", __func__);
+               dev_dbg(&port->dev, "%s - parity = none\n", __func__);
        }
  
        if (cflag & CMSPAR)
        /* Change the Stop bit */
        if (cflag & CSTOPB) {
                lStop = LCR_STOP_2;
-               dbg("%s - stop bits = 2", __func__);
+               dev_dbg(&port->dev, "%s - stop bits = 2\n", __func__);
        } else {
                lStop = LCR_STOP_1;
-               dbg("%s - stop bits = 1", __func__);
+               dev_dbg(&port->dev, "%s - stop bits = 1\n", __func__);
        }
  
        /* Update the LCR with the correct value */
            ~(LCR_BITS_MASK | LCR_STOP_MASK | LCR_PAR_MASK);
        mos7840_port->shadowLCR |= (lData | lParity | lStop);
  
-       dbg("mos7840_change_port_settings mos7840_port->shadowLCR is %x",
-           mos7840_port->shadowLCR);
+       dev_dbg(&port->dev, "%s - mos7840_port->shadowLCR is %x\n", __func__,
+               mos7840_port->shadowLCR);
        /* Disable Interrupts */
        Data = 0x00;
        mos7840_set_uart_reg(port, INTERRUPT_ENABLE_REGISTER, Data);
  
        if (!baud) {
                /* pick a default, any default... */
-               dbg("%s", "Picked default baud...");
+               dev_dbg(&port->dev, "%s", "Picked default baud...\n");
                baud = 9600;
        }
  
-       dbg("%s - baud rate = %d", __func__, baud);
+       dev_dbg(&port->dev, "%s - baud rate = %d\n", __func__, baud);
        status = mos7840_send_cmd_write_baud_rate(mos7840_port, baud);
  
        /* Enable Interrupts */
                mos7840_port->read_urb_busy = true;
                status = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC);
                if (status) {
-                       dbg("usb_submit_urb(read bulk) failed, status = %d",
+                       dev_dbg(&port->dev, "usb_submit_urb(read bulk) failed, status = %d\n",
                            status);
                        mos7840_port->read_urb_busy = false;
                }
        }
        wake_up(&mos7840_port->delta_msr_wait);
        mos7840_port->delta_msr_cond = 1;
-       dbg("mos7840_change_port_settings mos7840_port->shadowLCR is End %x",
-           mos7840_port->shadowLCR);
+       dev_dbg(&port->dev, "%s - mos7840_port->shadowLCR is End %x\n", __func__,
+               mos7840_port->shadowLCR);
  }
  
  /*****************************************************************************
@@@ -2137,17 -2066,13 +2066,13 @@@ static void mos7840_set_termios(struct 
        struct usb_serial *serial;
        struct moschip_port *mos7840_port;
  
-       if (mos7840_port_paranoia_check(port, __func__)) {
-               dbg("%s", "Invalid port");
+       if (mos7840_port_paranoia_check(port, __func__))
                return;
-       }
  
        serial = port->serial;
  
-       if (mos7840_serial_paranoia_check(serial, __func__)) {
-               dbg("%s", "Invalid Serial");
+       if (mos7840_serial_paranoia_check(serial, __func__))
                return;
-       }
  
        mos7840_port = mos7840_get_port_private(port);
  
                return;
  
        if (!mos7840_port->open) {
-               dbg("%s - port not opened", __func__);
+               dev_dbg(&port->dev, "%s - port not opened\n", __func__);
                return;
        }
  
-       dbg("%s", "setting termios - ");
+       dev_dbg(&port->dev, "%s", "setting termios - \n");
  
 -      cflag = tty->termios->c_cflag;
 +      cflag = tty->termios.c_cflag;
  
-       dbg("%s - clfag %08x iflag %08x", __func__,
-           tty->termios.c_cflag, RELEVANT_IFLAG(tty->termios.c_iflag));
-       dbg("%s - old clfag %08x old iflag %08x", __func__,
-           old_termios->c_cflag, RELEVANT_IFLAG(old_termios->c_iflag));
-       dbg("%s - port %d", __func__, port->number);
+       dev_dbg(&port->dev, "%s - clfag %08x iflag %08x\n", __func__,
 -              tty->termios->c_cflag, RELEVANT_IFLAG(tty->termios->c_iflag));
++              tty->termios.c_cflag, RELEVANT_IFLAG(tty->termios.c_iflag));
+       dev_dbg(&port->dev, "%s - old clfag %08x old iflag %08x\n", __func__,
+               old_termios->c_cflag, RELEVANT_IFLAG(old_termios->c_iflag));
+       dev_dbg(&port->dev, "%s - port %d\n", __func__, port->number);
  
        /* change the port settings to the new ones specified */
  
        mos7840_change_port_settings(tty, mos7840_port, old_termios);
  
        if (!mos7840_port->read_urb) {
-               dbg("%s", "URB KILLED !!!!!");
+               dev_dbg(&port->dev, "%s", "URB KILLED !!!!!\n");
                return;
        }
  
                mos7840_port->read_urb_busy = true;
                status = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC);
                if (status) {
-                       dbg("usb_submit_urb(read bulk) failed, status = %d",
+                       dev_dbg(&port->dev, "usb_submit_urb(read bulk) failed, status = %d\n",
                            status);
                        mos7840_port->read_urb_busy = false;
                }
@@@ -2207,10 -2132,8 +2132,8 @@@ static int mos7840_get_lsr_info(struct 
        unsigned int result = 0;
  
        count = mos7840_chars_in_buffer(tty);
-       if (count == 0) {
-               dbg("%s -- Empty", __func__);
+       if (count == 0)
                result = TIOCSER_TEMT;
-       }
  
        if (copy_to_user(value, &result, sizeof(int)))
                return -EFAULT;
@@@ -2273,8 -2196,8 +2196,8 @@@ static int mos7840_get_icount(struct tt
        icount->brk = cnow.brk;
        icount->buf_overrun = cnow.buf_overrun;
  
-       dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __func__,
-               port->number, icount->rx, icount->tx);
+       dev_dbg(&port->dev, "%s TIOCGICOUNT RX=%d, TX=%d\n", __func__,
+               icount->rx, icount->tx);
        return 0;
  }
  
@@@ -2293,35 -2216,33 +2216,33 @@@ static int mos7840_ioctl(struct tty_str
        struct async_icount cnow;
        struct async_icount cprev;
  
-       if (mos7840_port_paranoia_check(port, __func__)) {
-               dbg("%s", "Invalid port");
+       if (mos7840_port_paranoia_check(port, __func__))
                return -1;
-       }
  
        mos7840_port = mos7840_get_port_private(port);
  
        if (mos7840_port == NULL)
                return -1;
  
-       dbg("%s - port %d, cmd = 0x%x", __func__, port->number, cmd);
+       dev_dbg(&port->dev, "%s - cmd = 0x%x\n", __func__, cmd);
  
        switch (cmd) {
                /* return number of bytes available */
  
        case TIOCSERGETLSR:
-               dbg("%s (%d) TIOCSERGETLSR", __func__, port->number);
+               dev_dbg(&port->dev, "%s TIOCSERGETLSR\n", __func__);
                return mos7840_get_lsr_info(tty, argp);
  
        case TIOCGSERIAL:
-               dbg("%s (%d) TIOCGSERIAL", __func__, port->number);
+               dev_dbg(&port->dev, "%s TIOCGSERIAL\n", __func__);
                return mos7840_get_serial_info(mos7840_port, argp);
  
        case TIOCSSERIAL:
-               dbg("%s (%d) TIOCSSERIAL", __func__, port->number);
+               dev_dbg(&port->dev, "%s TIOCSSERIAL\n", __func__);
                break;
  
        case TIOCMIWAIT:
-               dbg("%s (%d) TIOCMIWAIT", __func__, port->number);
+               dev_dbg(&port->dev, "%s  TIOCMIWAIT\n", __func__);
                cprev = mos7840_port->icount;
                while (1) {
                        /* interruptible_sleep_on(&mos7840_port->delta_msr_wait); */
@@@ -2437,11 -2358,6 +2358,6 @@@ static int mos7840_startup(struct usb_s
        int i, status;
        __u16 Data;
  
-       if (!serial) {
-               dbg("%s", "Invalid Handler");
-               return -1;
-       }
        dev = serial->dev;
  
        /* we set up the pointers to the endpoints in the mos7840_open *
  
        /* set up port private structures */
        for (i = 0; i < serial->num_ports; ++i) {
-               dbg ("mos7840_startup: configuring port %d............", i);
+               dev_dbg(&dev->dev, "mos7840_startup: configuring port %d............\n", i);
                mos7840_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL);
                if (mos7840_port == NULL) {
                        dev_err(&dev->dev, "%s - Out of memory\n", __func__);
                 * usb-serial.c:get_free_serial() and cannot therefore be used
                 * to index device instances */
                mos7840_port->port_num = i + 1;
-               dbg ("serial->port[i]->number = %d", serial->port[i]->number);
-               dbg ("serial->port[i]->serial->minor = %d", serial->port[i]->serial->minor);
-               dbg ("mos7840_port->port_num = %d", mos7840_port->port_num);
-               dbg ("serial->minor = %d", serial->minor);
+               dev_dbg(&dev->dev, "serial->port[i]->number = %d\n", serial->port[i]->number);
+               dev_dbg(&dev->dev, "serial->port[i]->serial->minor = %d\n", serial->port[i]->serial->minor);
+               dev_dbg(&dev->dev, "mos7840_port->port_num = %d\n", mos7840_port->port_num);
+               dev_dbg(&dev->dev, "serial->minor = %d\n", serial->minor);
  
                if (mos7840_port->port_num == 1) {
                        mos7840_port->SpRegOffset = 0x0;
                        mos7840_port->ControlRegOffset = 0xd;
                        mos7840_port->DcrRegOffset = 0x1c;
                }
-               mos7840_dump_serial_port(mos7840_port);
+               mos7840_dump_serial_port(serial->port[i], mos7840_port);
                mos7840_set_port_private(serial->port[i], mos7840_port);
  
                /* enable rx_disable bit in control register */
                status = mos7840_get_reg_sync(serial->port[i],
                                 mos7840_port->ControlRegOffset, &Data);
                if (status < 0) {
-                       dbg("Reading ControlReg failed status-0x%x", status);
+                       dev_dbg(&dev->dev, "Reading ControlReg failed status-0x%x\n", status);
                        break;
                } else
-                       dbg("ControlReg Reading success val is %x, status%d",
-                           Data, status);
+                       dev_dbg(&dev->dev, "ControlReg Reading success val is %x, status%d\n", Data, status);
                Data |= 0x08;   /* setting driver done bit */
                Data |= 0x04;   /* sp1_bit to have cts change reflect in
                                   modem status reg */
                status = mos7840_set_reg_sync(serial->port[i],
                                         mos7840_port->ControlRegOffset, Data);
                if (status < 0) {
-                       dbg("Writing ControlReg failed(rx_disable) status-0x%x", status);
+                       dev_dbg(&dev->dev, "Writing ControlReg failed(rx_disable) status-0x%x\n", status);
                        break;
                } else
-                       dbg("ControlReg Writing success(rx_disable) status%d",
-                           status);
+                       dev_dbg(&dev->dev, "ControlReg Writing success(rx_disable) status%d\n", status);
  
                /* Write default values in DCR (i.e 0x01 in DCR0, 0x05 in DCR2
                   and 0x24 in DCR3 */
                status = mos7840_set_reg_sync(serial->port[i],
                         (__u16) (mos7840_port->DcrRegOffset + 0), Data);
                if (status < 0) {
-                       dbg("Writing DCR0 failed status-0x%x", status);
+                       dev_dbg(&dev->dev, "Writing DCR0 failed status-0x%x\n", status);
                        break;
                } else
-                       dbg("DCR0 Writing success status%d", status);
+                       dev_dbg(&dev->dev, "DCR0 Writing success status%d\n", status);
  
                Data = 0x05;
                status = mos7840_set_reg_sync(serial->port[i],
                         (__u16) (mos7840_port->DcrRegOffset + 1), Data);
                if (status < 0) {
-                       dbg("Writing DCR1 failed status-0x%x", status);
+                       dev_dbg(&dev->dev, "Writing DCR1 failed status-0x%x\n", status);
                        break;
                } else
-                       dbg("DCR1 Writing success status%d", status);
+                       dev_dbg(&dev->dev, "DCR1 Writing success status%d\n", status);
  
                Data = 0x24;
                status = mos7840_set_reg_sync(serial->port[i],
                         (__u16) (mos7840_port->DcrRegOffset + 2), Data);
                if (status < 0) {
-                       dbg("Writing DCR2 failed status-0x%x", status);
+                       dev_dbg(&dev->dev, "Writing DCR2 failed status-0x%x\n", status);
                        break;
                } else
-                       dbg("DCR2 Writing success status%d", status);
+                       dev_dbg(&dev->dev, "DCR2 Writing success status%d\n", status);
  
                /* write values in clkstart0x0 and clkmulti 0x20 */
                Data = 0x0;
                status = mos7840_set_reg_sync(serial->port[i],
                                         CLK_START_VALUE_REGISTER, Data);
                if (status < 0) {
-                       dbg("Writing CLK_START_VALUE_REGISTER failed status-0x%x", status);
+                       dev_dbg(&dev->dev, "Writing CLK_START_VALUE_REGISTER failed status-0x%x\n", status);
                        break;
                } else
-                       dbg("CLK_START_VALUE_REGISTER Writing success status%d", status);
+                       dev_dbg(&dev->dev, "CLK_START_VALUE_REGISTER Writing success status%d\n", status);
  
                Data = 0x20;
                status = mos7840_set_reg_sync(serial->port[i],
                                        CLK_MULTI_REGISTER, Data);
                if (status < 0) {
-                       dbg("Writing CLK_MULTI_REGISTER failed status-0x%x",
-                           status);
+                       dev_dbg(&dev->dev, "Writing CLK_MULTI_REGISTER failed status-0x%x\n", status);
                        goto error;
                } else
-                       dbg("CLK_MULTI_REGISTER Writing success status%d",
-                           status);
+                       dev_dbg(&dev->dev, "CLK_MULTI_REGISTER Writing success status%d\n", status);
  
                /* write value 0x0 to scratchpad register */
                Data = 0x00;
                status = mos7840_set_uart_reg(serial->port[i],
                                                SCRATCH_PAD_REGISTER, Data);
                if (status < 0) {
-                       dbg("Writing SCRATCH_PAD_REGISTER failed status-0x%x",
-                           status);
+                       dev_dbg(&dev->dev, "Writing SCRATCH_PAD_REGISTER failed status-0x%x\n", status);
                        break;
                } else
-                       dbg("SCRATCH_PAD_REGISTER Writing success status%d",
-                           status);
+                       dev_dbg(&dev->dev, "SCRATCH_PAD_REGISTER Writing success status%d\n", status);
  
                /* Zero Length flag register */
                if ((mos7840_port->port_num != 1)
                        status = mos7840_set_reg_sync(serial->port[i],
                                      (__u16) (ZLP_REG1 +
                                      ((__u16)mos7840_port->port_num)), Data);
-                       dbg("ZLIP offset %x",
-                           (__u16) (ZLP_REG1 +
-                                       ((__u16) mos7840_port->port_num)));
+                       dev_dbg(&dev->dev, "ZLIP offset %x\n",
+                               (__u16)(ZLP_REG1 + ((__u16) mos7840_port->port_num)));
                        if (status < 0) {
-                               dbg("Writing ZLP_REG%d failed status-0x%x",
-                                   i + 2, status);
+                               dev_dbg(&dev->dev, "Writing ZLP_REG%d failed status-0x%x\n", i + 2, status);
                                break;
                        } else
-                               dbg("ZLP_REG%d Writing success status%d",
-                                   i + 2, status);
+                               dev_dbg(&dev->dev, "ZLP_REG%d Writing success status%d\n", i + 2, status);
                } else {
                        Data = 0xff;
                        status = mos7840_set_reg_sync(serial->port[i],
                              (__u16) (ZLP_REG1 +
                              ((__u16)mos7840_port->port_num) - 0x1), Data);
-                       dbg("ZLIP offset %x",
-                           (__u16) (ZLP_REG1 +
-                                    ((__u16) mos7840_port->port_num) - 0x1));
+                       dev_dbg(&dev->dev, "ZLIP offset %x\n",
+                               (__u16)(ZLP_REG1 + ((__u16) mos7840_port->port_num) - 0x1));
                        if (status < 0) {
-                               dbg("Writing ZLP_REG%d failed status-0x%x",
-                                   i + 1, status);
+                               dev_dbg(&dev->dev, "Writing ZLP_REG%d failed status-0x%x\n", i + 1, status);
                                break;
                        } else
-                               dbg("ZLP_REG%d Writing success status%d",
-                                   i + 1, status);
+                               dev_dbg(&dev->dev, "ZLP_REG%d Writing success status%d\n", i + 1, status);
  
                }
                mos7840_port->control_urb = usb_alloc_urb(0, GFP_KERNEL);
                                                MODEM_CONTROL_REGISTER, 0x0300);
                }
        }
-       dbg ("mos7840_startup: all ports configured...........");
  
        /* Zero Length flag enable */
        Data = 0x0f;
        status = mos7840_set_reg_sync(serial->port[0], ZLP_REG5, Data);
        if (status < 0) {
-               dbg("Writing ZLP_REG5 failed status-0x%x", status);
+               dev_dbg(&dev->dev, "Writing ZLP_REG5 failed status-0x%x\n", status);
                goto error;
        } else
-               dbg("ZLP_REG5 Writing success status%d", status);
+               dev_dbg(&dev->dev, "ZLP_REG5 Writing success status%d\n", status);
  
        /* setting configuration feature to one */
        usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
@@@ -2700,11 -2603,6 +2603,6 @@@ static void mos7840_disconnect(struct u
        unsigned long flags;
        struct moschip_port *mos7840_port;
  
-       if (!serial) {
-               dbg("%s", "Invalid Handler");
-               return;
-       }
        /* check for the ports to be closed,close the ports and disconnect */
  
        /* free private structure allocated for serial port  *
  
        for (i = 0; i < serial->num_ports; ++i) {
                mos7840_port = mos7840_get_port_private(serial->port[i]);
-               dbg ("mos7840_port %d = %p", i, mos7840_port);
                if (mos7840_port) {
                        spin_lock_irqsave(&mos7840_port->pool_lock, flags);
                        mos7840_port->zombie = 1;
@@@ -2732,11 -2629,6 +2629,6 @@@ static void mos7840_release(struct usb_
        int i;
        struct moschip_port *mos7840_port;
  
-       if (!serial) {
-               dbg("%s", "Invalid Handler");
-               return;
-       }
        /* check for the ports to be closed,close the ports and disconnect */
  
        /* free private structure allocated for serial port  *
  
        for (i = 0; i < serial->num_ports; ++i) {
                mos7840_port = mos7840_get_port_private(serial->port[i]);
-               dbg("mos7840_port %d = %p", i, mos7840_port);
                if (mos7840_port) {
                        if (mos7840_port->has_led) {
                                /* Turn off LED */
@@@ -2801,6 -2692,3 +2692,3 @@@ module_usb_serial_driver(serial_drivers
  
  MODULE_DESCRIPTION(DRIVER_DESC);
  MODULE_LICENSE("GPL");
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug enabled or not");
@@@ -66,8 -66,6 +66,6 @@@ static const struct usb_device_id id_ta
  
  MODULE_DEVICE_TABLE(usb, id_table);
  
- static bool debug;
  /* requests */
  #define       OTI6858_REQ_GET_STATUS          (USB_DIR_IN | USB_TYPE_VENDOR | 0x00)
  #define       OTI6858_REQ_T_GET_STATUS        0x01
@@@ -256,11 -254,11 +254,11 @@@ static void setup_line(struct work_stru
        priv->setup_done = 1;
        spin_unlock_irqrestore(&priv->lock, flags);
  
-       dbg("%s(): submitting interrupt urb", __func__);
+       dev_dbg(&port->dev, "%s(): submitting interrupt urb\n", __func__);
        result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
        if (result != 0) {
-               dev_err(&port->dev, "%s(): usb_submit_urb() failed"
-                               " with error %d\n", __func__, result);
+               dev_err(&port->dev, "%s(): usb_submit_urb() failed with error %d\n",
+                       __func__, result);
        }
  }
  
@@@ -310,11 -308,11 +308,11 @@@ static void send_data(struct work_struc
        if (count == 0) {
                priv->flags.write_urb_in_use = 0;
  
-               dbg("%s(): submitting interrupt urb", __func__);
+               dev_dbg(&port->dev, "%s(): submitting interrupt urb\n", __func__);
                result = usb_submit_urb(port->interrupt_in_urb, GFP_NOIO);
                if (result != 0) {
-                       dev_err(&port->dev, "%s(): usb_submit_urb() failed"
-                               " with error %d\n", __func__, result);
+                       dev_err(&port->dev, "%s(): usb_submit_urb() failed with error %d\n",
+                               __func__, result);
                }
                return;
        }
        port->write_urb->transfer_buffer_length = count;
        result = usb_submit_urb(port->write_urb, GFP_NOIO);
        if (result != 0) {
-               dev_err_console(port, "%s(): usb_submit_urb() failed"
-                              " with error %d\n", __func__, result);
+               dev_err_console(port, "%s(): usb_submit_urb() failed with error %d\n",
+                               __func__, result);
                priv->flags.write_urb_in_use = 0;
        }
  
@@@ -404,10 -402,10 +402,10 @@@ static int oti6858_chars_in_buffer(stru
  
  static void oti6858_init_termios(struct tty_struct *tty)
  {
 -      *(tty->termios) = tty_std_termios;
 -      tty->termios->c_cflag = B38400 | CS8 | CREAD | HUPCL | CLOCAL;
 -      tty->termios->c_ispeed = 38400;
 -      tty->termios->c_ospeed = 38400;
 +      tty->termios = tty_std_termios;
 +      tty->termios.c_cflag = B38400 | CS8 | CREAD | HUPCL | CLOCAL;
 +      tty->termios.c_ispeed = 38400;
 +      tty->termios.c_ospeed = 38400;
  }
  
  static void oti6858_set_termios(struct tty_struct *tty,
        __le16 divisor;
        int br;
  
-       if (!tty) {
-               dbg("%s(): no tty structures", __func__);
+       if (!tty)
                return;
-       }
  
 -      cflag = tty->termios->c_cflag;
 +      cflag = tty->termios.c_cflag;
  
        spin_lock_irqsave(&priv->lock, flags);
        divisor = priv->pending_setup.divisor;
@@@ -560,11 -556,11 +556,11 @@@ static int oti6858_open(struct tty_stru
        spin_unlock_irqrestore(&priv->lock, flags);
        kfree(buf);
  
-       dbg("%s(): submitting interrupt urb", __func__);
+       dev_dbg(&port->dev, "%s(): submitting interrupt urb\n", __func__);
        result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
        if (result != 0) {
-               dev_err(&port->dev, "%s(): usb_submit_urb() failed"
-                              " with error %d\n", __func__, result);
+               dev_err(&port->dev, "%s(): usb_submit_urb() failed with error %d\n",
+                       __func__, result);
                oti6858_close(port);
                return result;
        }
@@@ -586,14 -582,14 +582,14 @@@ static void oti6858_close(struct usb_se
        kfifo_reset_out(&port->write_fifo);
        spin_unlock_irqrestore(&port->lock, flags);
  
-       dbg("%s(): after buf_clear()", __func__);
+       dev_dbg(&port->dev, "%s(): after buf_clear()\n", __func__);
  
        /* cancel scheduled setup */
        cancel_delayed_work_sync(&priv->delayed_setup_work);
        cancel_delayed_work_sync(&priv->delayed_write_work);
  
        /* shutdown our urbs */
-       dbg("%s(): shutting down urbs", __func__);
+       dev_dbg(&port->dev, "%s(): shutting down urbs\n", __func__);
        usb_kill_urb(port->write_urb);
        usb_kill_urb(port->read_urb);
        usb_kill_urb(port->interrupt_in_urb);
@@@ -607,8 -603,8 +603,8 @@@ static int oti6858_tiocmset(struct tty_
        unsigned long flags;
        u8 control;
  
-       dbg("%s(port = %d, set = 0x%08x, clear = 0x%08x)",
-                               __func__, port->number, set, clear);
+       dev_dbg(&port->dev, "%s(set = 0x%08x, clear = 0x%08x)\n",
+               __func__, set, clear);
  
        /* FIXME: check if this is correct (active high/low) */
        spin_lock_irqsave(&priv->lock, flags);
@@@ -655,7 -651,7 +651,7 @@@ static int oti6858_tiocmget(struct tty_
        if ((pin_state & PIN_DCD) != 0)
                result |= TIOCM_CD;
  
-       dbg("%s() = 0x%08x", __func__, result);
+       dev_dbg(&port->dev, "%s() = 0x%08x\n", __func__, result);
  
        return result;
  }
@@@ -700,15 -696,14 +696,14 @@@ static int oti6858_ioctl(struct tty_str
  {
        struct usb_serial_port *port = tty->driver_data;
  
-       dbg("%s(port = %d, cmd = 0x%04x, arg = 0x%08lx)",
-                               __func__, port->number, cmd, arg);
+       dev_dbg(&port->dev, "%s(cmd = 0x%04x, arg = 0x%08lx)\n", __func__, cmd, arg);
  
        switch (cmd) {
        case TIOCMIWAIT:
-               dbg("%s(): TIOCMIWAIT", __func__);
+               dev_dbg(&port->dev, "%s(): TIOCMIWAIT\n", __func__);
                return wait_modem_info(port, arg);
        default:
-               dbg("%s(): 0x%04x not supported", __func__, cmd);
+               dev_dbg(&port->dev, "%s(): 0x%04x not supported\n", __func__, cmd);
                break;
        }
        return -ENOIOCTLCMD;
@@@ -738,12 -733,12 +733,12 @@@ static void oti6858_read_int_callback(s
        case -ENOENT:
        case -ESHUTDOWN:
                /* this urb is terminated, clean up */
-               dbg("%s(): urb shutting down with status: %d",
-                                       __func__, status);
+               dev_dbg(&urb->dev->dev, "%s(): urb shutting down with status: %d\n",
+                       __func__, status);
                return;
        default:
-               dbg("%s(): nonzero urb status received: %d",
-                                       __func__, status);
+               dev_dbg(&urb->dev->dev, "%s(): nonzero urb status received: %d\n",
+                       __func__, status);
                break;
        }
  
                                        priv->transient = 4;
                                        priv->setup_done = 0;
                                        resubmit = 0;
-                                       dbg("%s(): scheduling setup_line()",
-                                           __func__);
+                                       dev_dbg(&port->dev, "%s(): scheduling setup_line()\n", __func__);
                                        schedule_delayed_work(&priv->delayed_setup_work, 0);
                                }
                        }
                                        priv->transient = 4;
                                        priv->setup_done = 0;
                                        resubmit = 0;
-                                       dbg("%s(): scheduling setup_line()",
-                                           __func__);
+                                       dev_dbg(&port->dev, "%s(): scheduling setup_line()\n", __func__);
                                        schedule_delayed_work(&priv->delayed_setup_work, 0);
                                }
                        }
        if (resubmit) {
                int result;
  
- /*            dbg("%s(): submitting interrupt urb", __func__); */
+ /*            dev_dbg(&urb->dev->dev, "%s(): submitting interrupt urb\n", __func__); */
                result = usb_submit_urb(urb, GFP_ATOMIC);
                if (result != 0) {
                        dev_err(&urb->dev->dev,
@@@ -851,7 -844,7 +844,7 @@@ static void oti6858_read_bulk_callback(
        spin_unlock_irqrestore(&priv->lock, flags);
  
        if (status != 0) {
-               dbg("%s(): unable to handle the error, exiting", __func__);
+               dev_dbg(&urb->dev->dev, "%s(): unable to handle the error, exiting\n", __func__);
                return;
        }
  
@@@ -885,15 -878,13 +878,13 @@@ static void oti6858_write_bulk_callback
        case -ENOENT:
        case -ESHUTDOWN:
                /* this urb is terminated, clean up */
-               dbg("%s(): urb shutting down with status: %d",
-                                       __func__, status);
+               dev_dbg(&urb->dev->dev, "%s(): urb shutting down with status: %d\n", __func__, status);
                priv->flags.write_urb_in_use = 0;
                return;
        default:
                /* error in the urb, so we have to resubmit it */
-               dbg("%s(): nonzero write bulk status received: %d",
-                                       __func__, status);
-               dbg("%s(): overflow in write", __func__);
+               dev_dbg(&urb->dev->dev, "%s(): nonzero write bulk status received: %d\n", __func__, status);
+               dev_dbg(&urb->dev->dev, "%s(): overflow in write\n", __func__);
  
                port->write_urb->transfer_buffer_length = 1;
                result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
        priv->flags.write_urb_in_use = 0;
  
        /* schedule the interrupt urb if we are still open */
-       dbg("%s(): submitting interrupt urb", __func__);
+       dev_dbg(&port->dev, "%s(): submitting interrupt urb\n", __func__);
        result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);
        if (result != 0) {
                dev_err(&port->dev, "%s(): failed submitting int urb,"
@@@ -922,7 -913,3 +913,3 @@@ MODULE_DESCRIPTION(OTI6858_DESCRIPTION)
  MODULE_AUTHOR(OTI6858_AUTHOR);
  MODULE_VERSION(OTI6858_VERSION);
  MODULE_LICENSE("GPL");
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "enable debug output");
@@@ -36,8 -36,6 +36,6 @@@
   */
  #define DRIVER_DESC "Prolific PL2303 USB to serial adaptor driver"
  
- static bool debug;
  static const struct usb_device_id id_table[] = {
        { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID) },
        { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ2) },
@@@ -260,16 -258,16 +258,16 @@@ static void pl2303_set_termios(struct t
           serial settings even to the same values as before. Thus
           we actually need to filter in this specific case */
  
 -      if (!tty_termios_hw_change(tty->termios, old_termios))
 +      if (!tty_termios_hw_change(&tty->termios, old_termios))
                return;
  
 -      cflag = tty->termios->c_cflag;
 +      cflag = tty->termios.c_cflag;
  
        buf = kzalloc(7, GFP_KERNEL);
        if (!buf) {
                dev_err(&port->dev, "%s - out of memory.\n", __func__);
                /* Report back no change occurred */
 -              *tty->termios = *old_termios;
 +              tty->termios = *old_termios;
                return;
        }
  
@@@ -741,7 -739,7 +739,7 @@@ static void pl2303_read_int_callback(st
                goto exit;
        }
  
-       usb_serial_debug_data(debug, &port->dev, __func__,
+       usb_serial_debug_data(&port->dev, __func__,
                              urb->actual_length, urb->transfer_buffer);
  
        pl2303_update_line_status(port, data, actual_length);
@@@ -839,7 -837,3 +837,3 @@@ module_usb_serial_driver(serial_drivers
  
  MODULE_DESCRIPTION(DRIVER_DESC);
  MODULE_LICENSE("GPL");
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug enabled or not");
@@@ -27,8 -27,6 +27,6 @@@
  #include <linux/serial_reg.h>
  #include <linux/uaccess.h>
  
- static bool debug;
  /* default urb timeout for usb operations */
  #define QT2_USB_TIMEOUT USB_CTRL_SET_TIMEOUT
  
@@@ -275,7 -273,7 +273,7 @@@ static void qt2_set_termios(struct tty_
  {
        struct usb_device *dev = port->serial->dev;
        struct qt2_port_private *port_priv;
 -      struct ktermios *termios = tty->termios;
 +      struct ktermios *termios = &tty->termios;
        u16 baud;
        unsigned int cflag = termios->c_cflag;
        u16 new_lcr = 0;
@@@ -406,7 -404,7 +404,7 @@@ static int qt2_open(struct tty_struct *
        port_priv->device_port = (u8) device_port;
  
        if (tty)
 -              qt2_set_termios(tty, port, tty->termios);
 +              qt2_set_termios(tty, port, &tty->termios);
  
        return 0;
  
@@@ -1089,7 -1087,7 +1087,7 @@@ static int qt2_write(struct tty_struct 
        data = write_urb->transfer_buffer;
        spin_lock_irqsave(&port_priv->urb_lock, flags);
        if (port_priv->urb_in_use == true) {
-               printk(KERN_INFO "qt2_write - urb is in use\n");
+               dev_err(&port->dev, "qt2_write - urb is in use\n");
                goto write_out;
        }
  
@@@ -1146,6 -1144,3 +1144,3 @@@ module_usb_serial_driver(serial_drivers
  
  MODULE_DESCRIPTION(DRIVER_DESC);
  MODULE_LICENSE("GPL");
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug enabled or not");
@@@ -46,7 -46,6 +46,6 @@@
     allocations > PAGE_SIZE and the number of packets in a page
     is an integer 512 is the largest possible packet on EHCI */
  
- static bool debug;
  static bool nmea;
  
  /* Used in interface blacklisting */
@@@ -382,7 -381,7 +381,7 @@@ static int sierra_send_setup(struct usb
  static void sierra_set_termios(struct tty_struct *tty,
                struct usb_serial_port *port, struct ktermios *old_termios)
  {
 -      tty_termios_copy_hw(tty->termios, old_termios);
 +      tty_termios_copy_hw(&tty->termios, old_termios);
        sierra_send_setup(port);
  }
  
@@@ -518,7 -517,7 +517,7 @@@ static int sierra_write(struct tty_stru
  
        memcpy(buffer, buf, writesize);
  
-       usb_serial_debug_data(debug, &port->dev, __func__, writesize, buffer);
+       usb_serial_debug_data(&port->dev, __func__, writesize, buffer);
  
        usb_fill_bulk_urb(urb, serial->dev,
                          usb_sndbulkpipe(serial->dev,
@@@ -595,8 -594,8 +594,8 @@@ static void sierra_indat_callback(struc
                                tty_flip_buffer_push(tty);
  
                                tty_kref_put(tty);
-                               usb_serial_debug_data(debug, &port->dev,
-                                       __func__, urb->actual_length, data);
+                               usb_serial_debug_data(&port->dev, __func__,
+                                                     urb->actual_length, data);
                        }
                } else {
                        dev_dbg(&port->dev, "%s: empty read urb"
@@@ -765,7 -764,6 +764,6 @@@ static struct urb *sierra_setup_urb(str
                        usb_sndbulkpipe(serial->dev, endpoint) | dir,
                        buf, len, callback, ctx);
  
-               /* debug */
                dev_dbg(&serial->dev->dev, "%s %c u : %p d:%p\n", __func__,
                                dir == USB_DIR_IN ? 'i' : 'o', urb, buf);
        } else {
@@@ -1082,6 -1080,3 +1080,3 @@@ MODULE_LICENSE("GPL")
  
  module_param(nmea, bool, S_IRUGO | S_IWUSR);
  MODULE_PARM_DESC(nmea, "NMEA streaming");
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug messages");
@@@ -33,8 -33,6 +33,6 @@@
  #define DRIVER_VERSION        "v0.10"
  #define DRIVER_DESC   "SPCP8x5 USB to serial adaptor driver"
  
- static bool debug;
  #define SPCP8x5_007_VID               0x04FC
  #define SPCP8x5_007_PID               0x0201
  #define SPCP8x5_008_VID               0x04fc
@@@ -316,10 -314,10 +314,10 @@@ static void spcp8x5_dtr_rts(struct usb_
  static void spcp8x5_init_termios(struct tty_struct *tty)
  {
        /* for the 1st time call this function */
 -      *(tty->termios) = tty_std_termios;
 -      tty->termios->c_cflag = B115200 | CS8 | CREAD | HUPCL | CLOCAL;
 -      tty->termios->c_ispeed = 115200;
 -      tty->termios->c_ospeed = 115200;
 +      tty->termios = tty_std_termios;
 +      tty->termios.c_cflag = B115200 | CS8 | CREAD | HUPCL | CLOCAL;
 +      tty->termios.c_ispeed = 115200;
 +      tty->termios.c_ospeed = 115200;
  }
  
  /* set the serial param for transfer. we should check if we really need to
@@@ -330,7 -328,7 +328,7 @@@ static void spcp8x5_set_termios(struct 
        struct usb_serial *serial = port->serial;
        struct spcp8x5_private *priv = usb_get_serial_port_data(port);
        unsigned long flags;
 -      unsigned int cflag = tty->termios->c_cflag;
 +      unsigned int cflag = tty->termios.c_cflag;
        unsigned int old_cflag = old_termios->c_cflag;
        unsigned short uartdata;
        unsigned char buf[2] = {0, 0};
  
  
        /* check that they really want us to change something */
 -      if (!tty_termios_hw_change(tty->termios, old_termios))
 +      if (!tty_termios_hw_change(&tty->termios, old_termios))
                return;
  
        /* set DTR/RTS active */
@@@ -665,6 -663,3 +663,3 @@@ module_usb_serial_driver(serial_drivers
  MODULE_DESCRIPTION(DRIVER_DESC);
  MODULE_VERSION(DRIVER_VERSION);
  MODULE_LICENSE("GPL");
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug enabled or not");
@@@ -46,8 -46,6 +46,6 @@@
  #define FULLPWRBIT          0x00000080
  #define NEXT_BOARD_POWER_BIT        0x00000004
  
- static bool debug;
  /* Version Information */
  #define DRIVER_VERSION "v0.1"
  #define DRIVER_DESC "Quatech SSU-100 USB to Serial Driver"
@@@ -135,7 -133,7 +133,7 @@@ static inline int update_mctrl(struct u
        int result;
  
        if (((set | clear) & (TIOCM_DTR | TIOCM_RTS)) == 0) {
-               dbg("%s - DTR|RTS not being set|cleared", __func__);
+               dev_dbg(&dev->dev, "%s - DTR|RTS not being set|cleared\n", __func__);
                return 0;       /* no change */
        }
  
  
        result = ssu100_setregister(dev, 0, UART_MCR, urb_value);
        if (result < 0)
-               dbg("%s Error from MODEM_CTRL urb", __func__);
+               dev_dbg(&dev->dev, "%s Error from MODEM_CTRL urb\n", __func__);
  
        return result;
  }
@@@ -164,7 -162,7 +162,7 @@@ static int ssu100_initdevice(struct usb
  
        result = ssu100_getdevice(dev, data);
        if (result < 0) {
-               dbg("%s - get_device failed %i", __func__, result);
+               dev_dbg(&dev->dev, "%s - get_device failed %i\n", __func__, result);
                goto out;
        }
  
  
        result = ssu100_setdevice(dev, data);
        if (result < 0) {
-               dbg("%s - setdevice failed %i", __func__, result);
+               dev_dbg(&dev->dev, "%s - setdevice failed %i\n", __func__, result);
                goto out;
        }
  
        result = ssu100_control_msg(dev, QT_GET_SET_PREBUF_TRIG_LVL, 128, 0);
        if (result < 0) {
-               dbg("%s - set prebuffer level failed %i", __func__, result);
+               dev_dbg(&dev->dev, "%s - set prebuffer level failed %i\n", __func__, result);
                goto out;
        }
  
        result = ssu100_control_msg(dev, QT_SET_ATF, ATC_DISABLED, 0);
        if (result < 0) {
-               dbg("%s - set ATFprebuffer level failed %i", __func__, result);
+               dev_dbg(&dev->dev, "%s - set ATFprebuffer level failed %i\n", __func__, result);
                goto out;
        }
  
        result = ssu100_getdevice(dev, data);
        if (result < 0) {
-               dbg("%s - get_device failed %i", __func__, result);
+               dev_dbg(&dev->dev, "%s - get_device failed %i\n", __func__, result);
                goto out;
        }
  
  
        result = ssu100_setdevice(dev, data);
        if (result < 0) {
-               dbg("%s - setdevice failed %i", __func__, result);
+               dev_dbg(&dev->dev, "%s - setdevice failed %i\n", __func__, result);
                goto out;
        }
  
@@@ -216,7 -214,7 +214,7 @@@ static void ssu100_set_termios(struct t
                               struct ktermios *old_termios)
  {
        struct usb_device *dev = port->serial->dev;
 -      struct ktermios *termios = tty->termios;
 +      struct ktermios *termios = &tty->termios;
        u16 baud, divisor, remainder;
        unsigned int cflag = termios->c_cflag;
        u16 urb_value = 0; /* will hold the new flags */
        if (!baud)
                baud = 9600;
  
-       dbg("%s - got baud = %d\n", __func__, baud);
+       dev_dbg(&port->dev, "%s - got baud = %d\n", __func__, baud);
  
  
        divisor = MAX_BAUD_RATE / baud;
  
        result = ssu100_control_msg(dev, QT_GET_SET_UART, divisor, urb_value);
        if (result < 0)
-               dbg("%s - set uart failed", __func__);
+               dev_dbg(&port->dev, "%s - set uart failed\n", __func__);
  
        if (cflag & CRTSCTS)
                result = ssu100_control_msg(dev, QT_HW_FLOW_CONTROL_MASK,
                result = ssu100_control_msg(dev, QT_HW_FLOW_CONTROL_MASK,
                                            0, 0);
        if (result < 0)
-               dbg("%s - set HW flow control failed", __func__);
+               dev_dbg(&port->dev, "%s - set HW flow control failed\n", __func__);
  
        if (I_IXOFF(tty) || I_IXON(tty)) {
                u16 x = ((u16)(START_CHAR(tty) << 8) | (u16)(STOP_CHAR(tty)));
                                            0, 0);
  
        if (result < 0)
-               dbg("%s - set SW flow control failed", __func__);
+               dev_dbg(&port->dev, "%s - set SW flow control failed\n", __func__);
  
  }
  
@@@ -304,7 -302,7 +302,7 @@@ static int ssu100_open(struct tty_struc
                                 QT_TRANSFER_IN, 0x01,
                                 0, data, 2, 300);
        if (result < 0) {
-               dbg("%s - open failed %i", __func__, result);
+               dev_dbg(&port->dev, "%s - open failed %i\n", __func__, result);
                kfree(data);
                return result;
        }
  /* set to 9600 */
        result = ssu100_control_msg(dev, QT_GET_SET_UART, 0x30, 0x0300);
        if (result < 0)
-               dbg("%s - set uart failed", __func__);
+               dev_dbg(&port->dev, "%s - set uart failed\n", __func__);
  
        if (tty)
 -              ssu100_set_termios(tty, port, tty->termios);
 +              ssu100_set_termios(tty, port, &tty->termios);
  
        return usb_serial_generic_open(tty, port);
  }
@@@ -423,7 -421,7 +421,7 @@@ static int ssu100_ioctl(struct tty_stru
  {
        struct usb_serial_port *port = tty->driver_data;
  
-       dbg("%s cmd 0x%04x", __func__, cmd);
+       dev_dbg(&port->dev, "%s cmd 0x%04x\n", __func__, cmd);
  
        switch (cmd) {
        case TIOCGSERIAL:
                break;
        }
  
-       dbg("%s arg not supported", __func__);
+       dev_dbg(&port->dev, "%s arg not supported\n", __func__);
  
        return -ENOIOCTLCMD;
  }
@@@ -668,6 -666,3 +666,3 @@@ module_usb_serial_driver(serial_drivers
  
  MODULE_DESCRIPTION(DRIVER_DESC);
  MODULE_LICENSE("GPL");
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug enabled or not");
@@@ -40,7 -40,6 +40,6 @@@
  
  /* Defines */
  
- #define TI_DRIVER_VERSION     "v0.10"
  #define TI_DRIVER_AUTHOR      "Al Borchers <alborchers@steinerpoint.com>"
  #define TI_DRIVER_DESC                "TI USB 3410/5052 Serial Driver"
  
@@@ -141,8 -140,8 +140,8 @@@ static int ti_command_out_sync(struct t
  static int ti_command_in_sync(struct ti_device *tdev, __u8 command,
        __u16 moduleid, __u16 value, __u8 *data, int size);
  
- static int ti_write_byte(struct ti_device *tdev, unsigned long addr,
-       __u8 mask, __u8 byte);
+ static int ti_write_byte(struct usb_serial_port *port, struct ti_device *tdev,
+                        unsigned long addr, __u8 mask, __u8 byte);
  
  static int ti_download_firmware(struct ti_device *tdev);
  
  /* Data */
  
  /* module parameters */
- static bool debug;
  static int closing_wait = TI_DEFAULT_CLOSING_WAIT;
  static ushort vendor_3410[TI_EXTRA_VID_PID_COUNT];
  static unsigned int vendor_3410_count;
@@@ -277,7 -275,6 +275,6 @@@ static struct usb_serial_driver * cons
  
  MODULE_AUTHOR(TI_DRIVER_AUTHOR);
  MODULE_DESCRIPTION(TI_DRIVER_DESC);
- MODULE_VERSION(TI_DRIVER_VERSION);
  MODULE_LICENSE("GPL");
  
  MODULE_FIRMWARE("ti_3410.fw");
@@@ -288,9 -285,6 +285,6 @@@ MODULE_FIRMWARE("mts_edge.fw")
  MODULE_FIRMWARE("mts_mt9234mu.fw");
  MODULE_FIRMWARE("mts_mt9234zba.fw");
  
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Enable debugging, 0=no, 1=yes");
  module_param(closing_wait, int, S_IRUGO | S_IWUSR);
  MODULE_PARM_DESC(closing_wait,
      "Maximum wait for data to drain in close, in .01 secs, default is 4000");
@@@ -316,7 -310,6 +310,6 @@@ MODULE_DEVICE_TABLE(usb, ti_id_table_co
  static int __init ti_init(void)
  {
        int i, j, c;
-       int ret;
  
        /* insert extra vendor and product ids */
        c = ARRAY_SIZE(ti_id_table_combined) - 2 * TI_EXTRA_VID_PID_COUNT - 1;
                ti_id_table_combined[c].match_flags = USB_DEVICE_ID_MATCH_DEVICE;
        }
  
-       ret = usb_serial_register_drivers(serial_drivers, KBUILD_MODNAME, ti_id_table_combined);
-       if (ret == 0)
-               printk(KERN_INFO KBUILD_MODNAME ": " TI_DRIVER_VERSION ":"
-                              TI_DRIVER_DESC "\n");
-       return ret;
+       return usb_serial_register_drivers(serial_drivers, KBUILD_MODNAME, ti_id_table_combined);
  }
  
  static void __exit ti_exit(void)
@@@ -364,10 -353,11 +353,11 @@@ static int ti_startup(struct usb_seria
        int i;
  
  
-       dbg("%s - product 0x%4X, num configurations %d, configuration value %d",
-           __func__, le16_to_cpu(dev->descriptor.idProduct),
-           dev->descriptor.bNumConfigurations,
-           dev->actconfig->desc.bConfigurationValue);
+       dev_dbg(&dev->dev,
+               "%s - product 0x%4X, num configurations %d, configuration value %d",
+               __func__, le16_to_cpu(dev->descriptor.idProduct),
+               dev->descriptor.bNumConfigurations,
+               dev->actconfig->desc.bConfigurationValue);
  
        /* create device structure */
        tdev = kzalloc(sizeof(struct ti_device), GFP_KERNEL);
        /* determine device type */
        if (usb_match_id(serial->interface, ti_id_table_3410))
                tdev->td_is_3410 = 1;
-       dbg("%s - device type is %s", __func__,
-                               tdev->td_is_3410 ? "3410" : "5052");
+       dev_dbg(&dev->dev, "%s - device type is %s\n", __func__,
+               tdev->td_is_3410 ? "3410" : "5052");
  
        /* if we have only 1 configuration, download firmware */
        if (dev->descriptor.bNumConfigurations == 1) {
@@@ -501,37 -491,34 +491,34 @@@ static int ti_open(struct tty_struct *t
  
        /* start interrupt urb the first time a port is opened on this device */
        if (tdev->td_open_port_count == 0) {
-               dbg("%s - start interrupt in urb", __func__);
+               dev_dbg(&port->dev, "%s - start interrupt in urb\n", __func__);
                urb = tdev->td_serial->port[0]->interrupt_in_urb;
                if (!urb) {
-                       dev_err(&port->dev, "%s - no interrupt urb\n",
-                                                               __func__);
+                       dev_err(&port->dev, "%s - no interrupt urb\n", __func__);
                        status = -EINVAL;
                        goto release_lock;
                }
                urb->context = tdev;
                status = usb_submit_urb(urb, GFP_KERNEL);
                if (status) {
-                       dev_err(&port->dev,
-                               "%s - submit interrupt urb failed, %d\n",
-                                       __func__, status);
+                       dev_err(&port->dev, "%s - submit interrupt urb failed, %d\n", __func__, status);
                        goto release_lock;
                }
        }
  
        if (tty)
 -              ti_set_termios(tty, port, tty->termios);
 +              ti_set_termios(tty, port, &tty->termios);
  
-       dbg("%s - sending TI_OPEN_PORT", __func__);
+       dev_dbg(&port->dev, "%s - sending TI_OPEN_PORT\n", __func__);
        status = ti_command_out_sync(tdev, TI_OPEN_PORT,
                (__u8)(TI_UART1_PORT + port_number), open_settings, NULL, 0);
        if (status) {
                dev_err(&port->dev, "%s - cannot send open command, %d\n",
-                                                       __func__, status);
+                       __func__, status);
                goto unlink_int_urb;
        }
  
-       dbg("%s - sending TI_START_PORT", __func__);
+       dev_dbg(&port->dev, "%s - sending TI_START_PORT\n", __func__);
        status = ti_command_out_sync(tdev, TI_START_PORT,
                (__u8)(TI_UART1_PORT + port_number), 0, NULL, 0);
        if (status) {
                goto unlink_int_urb;
        }
  
-       dbg("%s - sending TI_PURGE_PORT", __func__);
+       dev_dbg(&port->dev, "%s - sending TI_PURGE_PORT\n", __func__);
        status = ti_command_out_sync(tdev, TI_PURGE_PORT,
                (__u8)(TI_UART1_PORT + port_number), TI_PURGE_INPUT, NULL, 0);
        if (status) {
        usb_clear_halt(dev, port->read_urb->pipe);
  
        if (tty)
 -              ti_set_termios(tty, port, tty->termios);
 +              ti_set_termios(tty, port, &tty->termios);
  
-       dbg("%s - sending TI_OPEN_PORT (2)", __func__);
+       dev_dbg(&port->dev, "%s - sending TI_OPEN_PORT (2)\n", __func__);
        status = ti_command_out_sync(tdev, TI_OPEN_PORT,
                (__u8)(TI_UART1_PORT + port_number), open_settings, NULL, 0);
        if (status) {
                goto unlink_int_urb;
        }
  
-       dbg("%s - sending TI_START_PORT (2)", __func__);
+       dev_dbg(&port->dev, "%s - sending TI_START_PORT (2)\n", __func__);
        status = ti_command_out_sync(tdev, TI_START_PORT,
                (__u8)(TI_UART1_PORT + port_number), 0, NULL, 0);
        if (status) {
        }
  
        /* start read urb */
-       dbg("%s - start read urb", __func__);
+       dev_dbg(&port->dev, "%s - start read urb\n", __func__);
        urb = port->read_urb;
        if (!urb) {
                dev_err(&port->dev, "%s - no read urb\n", __func__);
@@@ -609,7 -596,7 +596,7 @@@ unlink_int_urb
                usb_kill_urb(port->serial->port[0]->interrupt_in_urb);
  release_lock:
        mutex_unlock(&tdev->td_open_close_lock);
-       dbg("%s - exit %d", __func__, status);
+       dev_dbg(&port->dev, "%s - exit %d\n", __func__, status);
        return status;
  }
  
@@@ -637,7 -624,7 +624,7 @@@ static void ti_close(struct usb_serial_
  
        port_number = port->number - port->serial->minor;
  
-       dbg("%s - sending TI_CLOSE_PORT", __func__);
+       dev_dbg(&port->dev, "%s - sending TI_CLOSE_PORT\n", __func__);
        status = ti_command_out_sync(tdev, TI_CLOSE_PORT,
                     (__u8)(TI_UART1_PORT + port_number), 0, NULL, 0);
        if (status)
@@@ -664,7 -651,7 +651,7 @@@ static int ti_write(struct tty_struct *
        struct ti_port *tport = usb_get_serial_port_data(port);
  
        if (count == 0) {
-               dbg("%s - write request of 0 bytes", __func__);
+               dev_dbg(&port->dev, "%s - write request of 0 bytes\n", __func__);
                return 0;
        }
  
@@@ -693,7 -680,7 +680,7 @@@ static int ti_write_room(struct tty_str
        room = kfifo_avail(&tport->write_fifo);
        spin_unlock_irqrestore(&tport->tp_lock, flags);
  
-       dbg("%s - returns %d", __func__, room);
+       dev_dbg(&port->dev, "%s - returns %d\n", __func__, room);
        return room;
  }
  
@@@ -712,7 -699,7 +699,7 @@@ static int ti_chars_in_buffer(struct tt
        chars = kfifo_len(&tport->write_fifo);
        spin_unlock_irqrestore(&tport->tp_lock, flags);
  
-       dbg("%s - returns %d", __func__, chars);
+       dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars);
        return chars;
  }
  
@@@ -755,8 -742,7 +742,7 @@@ static int ti_get_icount(struct tty_str
        struct ti_port *tport = usb_get_serial_port_data(port);
        struct async_icount cnow = tport->tp_icount;
  
-       dbg("%s - (%d) TIOCGICOUNT RX=%d, TX=%d",
-               __func__, port->number,
+       dev_dbg(&port->dev, "%s - TIOCGICOUNT RX=%d, TX=%d\n", __func__,
                cnow.rx, cnow.tx);
  
        icount->cts = cnow.cts;
@@@ -782,22 -768,22 +768,22 @@@ static int ti_ioctl(struct tty_struct *
        struct async_icount cnow;
        struct async_icount cprev;
  
-       dbg("%s - port %d, cmd = 0x%04X", __func__, port->number, cmd);
+       dev_dbg(&port->dev, "%s - cmd = 0x%04X\n", __func__, cmd);
  
        if (tport == NULL)
                return -ENODEV;
  
        switch (cmd) {
        case TIOCGSERIAL:
-               dbg("%s - (%d) TIOCGSERIAL", __func__, port->number);
+               dev_dbg(&port->dev, "%s - TIOCGSERIAL\n", __func__);
                return ti_get_serial_info(tport,
                                (struct serial_struct __user *)arg);
        case TIOCSSERIAL:
-               dbg("%s - (%d) TIOCSSERIAL", __func__, port->number);
+               dev_dbg(&port->dev, "%s - TIOCSSERIAL\n", __func__);
                return ti_set_serial_info(tty, tport,
                                (struct serial_struct __user *)arg);
        case TIOCMIWAIT:
-               dbg("%s - (%d) TIOCMIWAIT", __func__, port->number);
+               dev_dbg(&port->dev, "%s - TIOCMIWAIT\n", __func__);
                cprev = tport->tp_icount;
                while (1) {
                        interruptible_sleep_on(&tport->tp_msr_wait);
@@@ -831,12 -817,12 +817,12 @@@ static void ti_set_termios(struct tty_s
        int port_number = port->number - port->serial->minor;
        unsigned int mcr;
  
 -      cflag = tty->termios->c_cflag;
 -      iflag = tty->termios->c_iflag;
 +      cflag = tty->termios.c_cflag;
 +      iflag = tty->termios.c_iflag;
  
-       dbg("%s - cflag %08x, iflag %08x", __func__, cflag, iflag);
-       dbg("%s - old clfag %08x, old iflag %08x", __func__,
-                               old_termios->c_cflag, old_termios->c_iflag);
+       dev_dbg(&port->dev, "%s - cflag %08x, iflag %08x\n", __func__, cflag, iflag);
+       dev_dbg(&port->dev, "%s - old clfag %08x, old iflag %08x\n", __func__,
+               old_termios->c_cflag, old_termios->c_iflag);
  
        if (tport == NULL)
                return;
        }
  
        /* CMSPAR isn't supported by this driver */
 -      tty->termios->c_cflag &= ~CMSPAR;
 +      tty->termios.c_cflag &= ~CMSPAR;
  
        if (cflag & PARENB) {
                if (cflag & PARODD) {
        if ((cflag & CBAUD) != B0)
                tty_encode_baud_rate(tty, baud, baud);
  
-       dbg("%s - BaudRate=%d, wBaudRate=%d, wFlags=0x%04X, bDataBits=%d, bParity=%d, bStopBits=%d, cXon=%d, cXoff=%d, bUartMode=%d",
-       __func__, baud, config->wBaudRate, config->wFlags, config->bDataBits, config->bParity, config->bStopBits, config->cXon, config->cXoff, config->bUartMode);
+       dev_dbg(&port->dev,
+               "%s - BaudRate=%d, wBaudRate=%d, wFlags=0x%04X, bDataBits=%d, bParity=%d, bStopBits=%d, cXon=%d, cXoff=%d, bUartMode=%d",
+               __func__, baud, config->wBaudRate, config->wFlags,
+               config->bDataBits, config->bParity, config->bStopBits,
+               config->cXon, config->cXoff, config->bUartMode);
  
        cpu_to_be16s(&config->wBaudRate);
        cpu_to_be16s(&config->wFlags);
@@@ -979,7 -968,7 +968,7 @@@ static int ti_tiocmget(struct tty_struc
                | ((msr & TI_MSR_RI) ? TIOCM_RI : 0)
                | ((msr & TI_MSR_DSR) ? TIOCM_DSR : 0);
  
-       dbg("%s - 0x%04X", __func__, result);
+       dev_dbg(&port->dev, "%s - 0x%04X\n", __func__, result);
  
        return result;
  }
@@@ -1024,19 -1013,19 +1013,19 @@@ static void ti_break(struct tty_struct 
        struct ti_port *tport = usb_get_serial_port_data(port);
        int status;
  
-       dbg("%s - state = %d", __func__, break_state);
+       dev_dbg(&port->dev, "%s - state = %d\n", __func__, break_state);
  
        if (tport == NULL)
                return;
  
        ti_drain(tport, (tport->tp_closing_wait*HZ)/100, 0);
  
-       status = ti_write_byte(tport->tp_tdev,
+       status = ti_write_byte(port, tport->tp_tdev,
                tport->tp_uart_base_addr + TI_UART_OFFSET_LCR,
                TI_LCR_BREAK, break_state == -1 ? TI_LCR_BREAK : 0);
  
        if (status)
-               dbg("%s - error setting break, %d", __func__, status);
+               dev_dbg(&port->dev, "%s - error setting break, %d\n", __func__, status);
  }
  
  
@@@ -1061,18 -1050,17 +1050,17 @@@ static void ti_interrupt_callback(struc
        case -ECONNRESET:
        case -ENOENT:
        case -ESHUTDOWN:
-               dbg("%s - urb shutting down, %d", __func__, status);
+               dev_dbg(dev, "%s - urb shutting down, %d\n", __func__, status);
                tdev->td_urb_error = 1;
                return;
        default:
-               dev_err(dev, "%s - nonzero urb status, %d\n",
-                       __func__, status);
+               dev_err(dev, "%s - nonzero urb status, %d\n", __func__, status);
                tdev->td_urb_error = 1;
                goto exit;
        }
  
        if (length != 2) {
-               dbg("%s - bad packet size, %d", __func__, length);
+               dev_dbg(dev, "%s - bad packet size, %d\n", __func__, length);
                goto exit;
        }
  
        port_number = TI_GET_PORT_FROM_CODE(data[0]);
        function = TI_GET_FUNC_FROM_CODE(data[0]);
  
-       dbg("%s - port_number %d, function %d, data 0x%02X",
-                               __func__, port_number, function, data[1]);
+       dev_dbg(dev, "%s - port_number %d, function %d, data 0x%02X\n",
+               __func__, port_number, function, data[1]);
  
        if (port_number >= serial->num_ports) {
                dev_err(dev, "%s - bad port number, %d\n",
        switch (function) {
        case TI_CODE_DATA_ERROR:
                dev_err(dev, "%s - DATA ERROR, port %d, data 0x%02X\n",
-                                       __func__, port_number, data[1]);
+                       __func__, port_number, data[1]);
                break;
  
        case TI_CODE_MODEM_STATUS:
                msr = data[1];
-               dbg("%s - port %d, msr 0x%02X", __func__, port_number, msr);
+               dev_dbg(dev, "%s - port %d, msr 0x%02X\n", __func__, port_number, msr);
                ti_handle_new_msr(tport, msr);
                break;
  
@@@ -1140,7 -1128,7 +1128,7 @@@ static void ti_bulk_in_callback(struct 
        case -ECONNRESET:
        case -ENOENT:
        case -ESHUTDOWN:
-               dbg("%s - urb shutting down, %d", __func__, status);
+               dev_dbg(dev, "%s - urb shutting down, %d\n", __func__, status);
                tport->tp_tdev->td_urb_error = 1;
                wake_up_interruptible(&tport->tp_write_wait);
                return;
        tty = tty_port_tty_get(&port->port);
        if (tty) {
                if (urb->actual_length) {
-                       usb_serial_debug_data(debug, dev, __func__,
-                               urb->actual_length, urb->transfer_buffer);
+                       usb_serial_debug_data(dev, __func__, urb->actual_length,
+                                             urb->transfer_buffer);
  
                        if (!tport->tp_is_open)
-                               dbg("%s - port closed, dropping data",
+                               dev_dbg(dev, "%s - port closed, dropping data\n",
                                        __func__);
                        else
                                ti_recv(&urb->dev->dev, tty,
@@@ -1208,7 -1196,7 +1196,7 @@@ static void ti_bulk_out_callback(struc
        case -ECONNRESET:
        case -ENOENT:
        case -ESHUTDOWN:
-               dbg("%s - urb shutting down, %d", __func__, status);
+               dev_dbg(&port->dev, "%s - urb shutting down, %d\n", __func__, status);
                tport->tp_tdev->td_urb_error = 1;
                wake_up_interruptible(&tport->tp_write_wait);
                return;
@@@ -1268,8 -1256,8 +1256,8 @@@ static void ti_send(struct ti_port *tpo
  
        spin_unlock_irqrestore(&tport->tp_lock, flags);
  
-       usb_serial_debug_data(debug, &port->dev, __func__, count,
-                                       port->write_urb->transfer_buffer);
+       usb_serial_debug_data(&port->dev, __func__, count,
+                             port->write_urb->transfer_buffer);
  
        usb_fill_bulk_urb(port->write_urb, port->serial->dev,
                           usb_sndbulkpipe(port->serial->dev,
@@@ -1307,7 -1295,7 +1295,7 @@@ static int ti_set_mcr(struct ti_port *t
        unsigned long flags;
        int status;
  
-       status = ti_write_byte(tport->tp_tdev,
+       status = ti_write_byte(tport->tp_port, tport->tp_tdev,
                tport->tp_uart_base_addr + TI_UART_OFFSET_MCR,
                TI_MCR_RTS | TI_MCR_DTR | TI_MCR_LOOP, mcr);
  
@@@ -1344,7 -1332,7 +1332,7 @@@ static int ti_get_lsr(struct ti_port *t
                goto free_data;
        }
  
-       dbg("%s - lsr 0x%02X", __func__, data->bLSR);
+       dev_dbg(&port->dev, "%s - lsr 0x%02X\n", __func__, data->bLSR);
  
        tport->tp_lsr = data->bLSR;
  
@@@ -1401,7 -1389,7 +1389,7 @@@ static void ti_handle_new_msr(struct ti
        struct tty_struct *tty;
        unsigned long flags;
  
-       dbg("%s - msr 0x%02X", __func__, msr);
+       dev_dbg(&tport->tp_port->dev, "%s - msr 0x%02X\n", __func__, msr);
  
        if (msr & TI_MSR_DELTA_MASK) {
                spin_lock_irqsave(&tport->tp_lock, flags);
@@@ -1560,21 -1548,21 +1548,21 @@@ static int ti_command_in_sync(struct ti
  }
  
  
- static int ti_write_byte(struct ti_device *tdev, unsigned long addr,
-       __u8 mask, __u8 byte)
+ static int ti_write_byte(struct usb_serial_port *port,
+                       struct ti_device *tdev, unsigned long addr,
+                       __u8 mask, __u8 byte)
  {
        int status;
        unsigned int size;
        struct ti_write_data_bytes *data;
-       struct device *dev = &tdev->td_serial->dev->dev;
  
-       dbg("%s - addr 0x%08lX, mask 0x%02X, byte 0x%02X",
-                                       __func__, addr, mask, byte);
+       dev_dbg(&port->dev, "%s - addr 0x%08lX, mask 0x%02X, byte 0x%02X\n", __func__,
+               addr, mask, byte);
  
        size = sizeof(struct ti_write_data_bytes) + 2;
        data = kmalloc(size, GFP_KERNEL);
        if (!data) {
-               dev_err(dev, "%s - out of memory\n", __func__);
+               dev_err(&port->dev, "%s - out of memory\n", __func__);
                return -ENOMEM;
        }
  
                (__u8 *)data, size);
  
        if (status < 0)
-               dev_err(dev, "%s - failed, %d\n", __func__, status);
+               dev_err(&port->dev, "%s - failed, %d\n", __func__, status);
  
        kfree(data);
  
@@@ -1615,7 -1603,7 +1603,7 @@@ static int ti_do_download(struct usb_de
                                        - sizeof(struct ti_firmware_header)));
        header->bCheckSum = cs;
  
-       dbg("%s - downloading firmware", __func__);
+       dev_dbg(&dev->dev, "%s - downloading firmware\n", __func__);
        for (pos = 0; pos < size; pos += done) {
                len = min(size - pos, TI_DOWNLOAD_MAX_PACKET_SIZE);
                status = usb_bulk_msg(dev, pipe, buffer + pos, len,
@@@ -1691,7 -1679,7 +1679,7 @@@ static int ti_download_firmware(struct 
                status = ti_do_download(dev, pipe, buffer, fw_p->size);
                kfree(buffer);
        } else {
-               dbg("%s ENOMEM\n", __func__);
+               dev_dbg(&dev->dev, "%s ENOMEM\n", __func__);
                status = -ENOMEM;
        }
        release_firmware(fw_p);
                return status;
        }
  
-       dbg("%s - download successful", __func__);
+       dev_dbg(&dev->dev, "%s - download successful\n", __func__);
  
        return 0;
  }
@@@ -17,6 -17,8 +17,8 @@@
   *
   */
  
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  #include <linux/kernel.h>
  #include <linux/errno.h>
  #include <linux/init.h>
  #include <linux/kfifo.h>
  #include "pl2303.h"
  
- /*
-  * Version Information
-  */
- #define DRIVER_AUTHOR "Greg Kroah-Hartman, greg@kroah.com, http://www.kroah.com/linux/"
+ #define DRIVER_AUTHOR "Greg Kroah-Hartman <gregkh@linuxfoundation.org>"
  #define DRIVER_DESC "USB Serial Driver core"
  
  /* There is no MODULE_DEVICE_TABLE for usbserial.c.  Instead
@@@ -50,7 -49,6 +49,6 @@@
     drivers depend on it.
  */
  
- static bool debug;
  /* initially all NULL */
  static struct usb_serial *serial_table[SERIAL_TTY_MINORS];
  static DEFINE_MUTEX(table_lock);
@@@ -87,7 -85,7 +85,7 @@@ static struct usb_serial *get_free_seri
        unsigned int i, j;
        int good_spot;
  
-       dbg("%s %d", __func__, num_ports);
+       dev_dbg(&serial->interface->dev, "%s %d\n", __func__, num_ports);
  
        *minor = 0;
        mutex_lock(&table_lock);
  
                *minor = i;
                j = 0;
-               dbg("%s - minor base = %d", __func__, *minor);
+               dev_dbg(&serial->interface->dev, "%s - minor base = %d\n", __func__, *minor);
                for (i = *minor; (i < (*minor + num_ports)) && (i < SERIAL_TTY_MINORS); ++i) {
                        serial_table[i] = serial;
                        serial->port[j++]->number = i;
@@@ -123,8 -121,6 +121,6 @@@ static void return_serial(struct usb_se
  {
        int i;
  
-       dbg("%s", __func__);
        mutex_lock(&table_lock);
        for (i = 0; i < serial->num_ports; ++i)
                serial_table[serial->minor + i] = NULL;
@@@ -139,8 -135,6 +135,6 @@@ static void destroy_serial(struct kref 
  
        serial = to_usb_serial(kref);
  
-       dbg("%s - %s", __func__, serial->type->description);
        /* return the minor range that this device had */
        if (serial->minor != SERIAL_TTY_NO_MINOR)
                return_serial(serial);
@@@ -191,8 -185,6 +185,6 @@@ static int serial_install(struct tty_dr
        struct usb_serial_port *port;
        int retval = -ENODEV;
  
-       dbg("%s", __func__);
        serial = usb_serial_get_by_index(idx);
        if (!serial)
                return retval;
        if (retval)
                goto error_get_interface;
  
 -      retval = tty_standard_install(driver, tty);
 +      retval = tty_port_install(&port->port, driver, tty);
        if (retval)
                goto error_init_termios;
  
@@@ -256,7 -248,7 +248,7 @@@ static int serial_open(struct tty_struc
  {
        struct usb_serial_port *port = tty->driver_data;
  
-       dbg("%s - port %d", __func__, port->number);
+       dev_dbg(tty->dev, "%s - port %d\n", __func__, port->number);
        return tty_port_open(&port->port, tty, filp);
  }
  
@@@ -287,14 -279,16 +279,16 @@@ static void serial_down(struct tty_por
  static void serial_hangup(struct tty_struct *tty)
  {
        struct usb_serial_port *port = tty->driver_data;
-       dbg("%s - port %d", __func__, port->number);
+       dev_dbg(tty->dev, "%s - port %d\n", __func__, port->number);
        tty_port_hangup(&port->port);
  }
  
  static void serial_close(struct tty_struct *tty, struct file *filp)
  {
        struct usb_serial_port *port = tty->driver_data;
-       dbg("%s - port %d", __func__, port->number);
+       dev_dbg(tty->dev, "%s - port %d\n", __func__, port->number);
        tty_port_close(&port->port, tty, filp);
  }
  
   * Do the resource freeing and refcount dropping for the port.
   * Avoid freeing the console.
   *
 - * Called asynchronously after the last tty kref is dropped,
 - * and the tty layer has already done the tty_shutdown(tty);
 + * Called asynchronously after the last tty kref is dropped.
   */
  static void serial_cleanup(struct tty_struct *tty)
  {
        if (port->port.console)
                return;
  
-       dbg("%s - port %d", __func__, port->number);
+       dev_dbg(tty->dev, "%s - port %d\n", __func__, port->number);
  
        tty->driver_data = NULL;
  
@@@ -344,7 -339,8 +338,8 @@@ static int serial_write(struct tty_stru
        if (port->serial->dev->state == USB_STATE_NOTATTACHED)
                goto exit;
  
-       dbg("%s - port %d, %d byte(s)", __func__, port->number, count);
+       dev_dbg(tty->dev, "%s - port %d, %d byte(s)\n", __func__,
+               port->number, count);
  
        /* pass on to the driver specific version of this function */
        retval = port->serial->type->write(tty, port, buf, count);
@@@ -357,7 -353,8 +352,8 @@@ exit
  static int serial_write_room(struct tty_struct *tty)
  {
        struct usb_serial_port *port = tty->driver_data;
-       dbg("%s - port %d", __func__, port->number);
+       dev_dbg(tty->dev, "%s - port %d\n", __func__, port->number);
        /* pass on to the driver specific version of this function */
        return port->serial->type->write_room(tty);
  }
  static int serial_chars_in_buffer(struct tty_struct *tty)
  {
        struct usb_serial_port *port = tty->driver_data;
-       dbg("%s - port %d", __func__, port->number);
+       dev_dbg(tty->dev, "%s - port %d\n", __func__, port->number);
  
        /* if the device was unplugged then any remaining characters
           fell out of the connector ;) */
  static void serial_throttle(struct tty_struct *tty)
  {
        struct usb_serial_port *port = tty->driver_data;
-       dbg("%s - port %d", __func__, port->number);
+       dev_dbg(tty->dev, "%s - port %d\n", __func__, port->number);
  
        /* pass on to the driver specific version of this function */
        if (port->serial->type->throttle)
  static void serial_unthrottle(struct tty_struct *tty)
  {
        struct usb_serial_port *port = tty->driver_data;
-       dbg("%s - port %d", __func__, port->number);
+       dev_dbg(tty->dev, "%s - port %d\n", __func__, port->number);
  
        /* pass on to the driver specific version of this function */
        if (port->serial->type->unthrottle)
@@@ -401,7 -401,8 +400,8 @@@ static int serial_ioctl(struct tty_stru
        struct usb_serial_port *port = tty->driver_data;
        int retval = -ENODEV;
  
-       dbg("%s - port %d, cmd 0x%.4x", __func__, port->number, cmd);
+       dev_dbg(tty->dev, "%s - port %d, cmd 0x%.4x\n", __func__,
+               port->number, cmd);
  
        /* pass on to the driver specific version of this function
           if it is available */
  static void serial_set_termios(struct tty_struct *tty, struct ktermios *old)
  {
        struct usb_serial_port *port = tty->driver_data;
-       dbg("%s - port %d", __func__, port->number);
+       dev_dbg(tty->dev, "%s - port %d\n", __func__, port->number);
  
        /* pass on to the driver specific version of this function
           if it is available */
        if (port->serial->type->set_termios)
                port->serial->type->set_termios(tty, port, old);
        else
 -              tty_termios_copy_hw(tty->termios, old);
 +              tty_termios_copy_hw(&tty->termios, old);
  }
  
  static int serial_break(struct tty_struct *tty, int break_state)
  {
        struct usb_serial_port *port = tty->driver_data;
  
-       dbg("%s - port %d", __func__, port->number);
+       dev_dbg(tty->dev, "%s - port %d\n", __func__, port->number);
  
        /* pass on to the driver specific version of this function
           if it is available */
@@@ -444,7 -446,6 +445,6 @@@ static int serial_proc_show(struct seq_
        int i;
        char tmp[40];
  
-       dbg("%s", __func__);
        seq_puts(m, "usbserinfo:1.0 driver:2.0\n");
        for (i = 0; i < SERIAL_TTY_MINORS; ++i) {
                serial = usb_serial_get_by_index(i);
@@@ -489,7 -490,7 +489,7 @@@ static int serial_tiocmget(struct tty_s
  {
        struct usb_serial_port *port = tty->driver_data;
  
-       dbg("%s - port %d", __func__, port->number);
+       dev_dbg(tty->dev, "%s - port %d\n", __func__, port->number);
  
        if (port->serial->type->tiocmget)
                return port->serial->type->tiocmget(tty);
@@@ -501,7 -502,7 +501,7 @@@ static int serial_tiocmset(struct tty_s
  {
        struct usb_serial_port *port = tty->driver_data;
  
-       dbg("%s - port %d", __func__, port->number);
+       dev_dbg(tty->dev, "%s - port %d\n", __func__, port->number);
  
        if (port->serial->type->tiocmset)
                return port->serial->type->tiocmset(tty, set, clear);
@@@ -513,7 -514,7 +513,7 @@@ static int serial_get_icount(struct tty
  {
        struct usb_serial_port *port = tty->driver_data;
  
-       dbg("%s - port %d", __func__, port->number);
+       dev_dbg(tty->dev, "%s - port %d\n", __func__, port->number);
  
        if (port->serial->type->get_icount)
                return port->serial->type->get_icount(tty, icount);
@@@ -537,12 -538,12 +537,12 @@@ static void usb_serial_port_work(struc
                container_of(work, struct usb_serial_port, work);
        struct tty_struct *tty;
  
-       dbg("%s - port %d", __func__, port->number);
        tty = tty_port_tty_get(&port->port);
        if (!tty)
                return;
  
+       dev_dbg(tty->dev, "%s - port %d\n", __func__, port->number);
        tty_wakeup(tty);
        tty_kref_put(tty);
  }
@@@ -575,7 -576,7 +575,7 @@@ static void port_release(struct device 
        struct usb_serial_port *port = to_usb_serial_port(dev);
        int i;
  
-       dbg ("%s - %s", __func__, dev_name(dev));
+       dev_dbg(dev, "%s\n", __func__);
  
        /*
         * Stop all the traffic before cancelling the work, so that
@@@ -644,12 -645,12 +644,12 @@@ static const struct usb_device_id *get_
  
        id = usb_match_id(intf, drv->id_table);
        if (id) {
-               dbg("static descriptor matches");
+               dev_dbg(&intf->dev, "static descriptor matches\n");
                goto exit;
        }
        id = match_dynamic_id(intf, drv);
        if (id)
-               dbg("dynamic descriptor matches");
+               dev_dbg(&intf->dev, "dynamic descriptor matches\n");
  exit:
        return id;
  }
@@@ -703,6 -704,7 +703,7 @@@ static const struct tty_port_operation
  static int usb_serial_probe(struct usb_interface *interface,
                               const struct usb_device_id *id)
  {
+       struct device *ddev = &interface->dev;
        struct usb_device *dev = interface_to_usbdev(interface);
        struct usb_serial *serial = NULL;
        struct usb_serial_port *port;
        type = search_serial_device(interface);
        if (!type) {
                mutex_unlock(&table_lock);
-               dbg("none matched");
+               dev_dbg(ddev, "none matched\n");
                return -ENODEV;
        }
  
        if (!try_module_get(type->driver.owner)) {
                mutex_unlock(&table_lock);
-               dev_err(&interface->dev, "module get failed, exiting\n");
+               dev_err(ddev, "module get failed, exiting\n");
                return -EIO;
        }
        mutex_unlock(&table_lock);
        serial = create_serial(dev, interface, type);
        if (!serial) {
                module_put(type->driver.owner);
-               dev_err(&interface->dev, "%s - out of memory\n", __func__);
+               dev_err(ddev, "%s - out of memory\n", __func__);
                return -ENOMEM;
        }
  
                retval = type->probe(serial, id);
  
                if (retval) {
-                       dbg("sub driver rejected device");
+                       dev_dbg(ddev, "sub driver rejected device\n");
                        usb_serial_put(serial);
                        module_put(type->driver.owner);
                        return retval;
  
                if (usb_endpoint_is_bulk_in(endpoint)) {
                        /* we found a bulk in endpoint */
-                       dbg("found bulk in on endpoint %d", i);
+                       dev_dbg(ddev, "found bulk in on endpoint %d\n", i);
                        bulk_in_endpoint[num_bulk_in] = endpoint;
                        ++num_bulk_in;
                }
  
                if (usb_endpoint_is_bulk_out(endpoint)) {
                        /* we found a bulk out endpoint */
-                       dbg("found bulk out on endpoint %d", i);
+                       dev_dbg(ddev, "found bulk out on endpoint %d\n", i);
                        bulk_out_endpoint[num_bulk_out] = endpoint;
                        ++num_bulk_out;
                }
  
                if (usb_endpoint_is_int_in(endpoint)) {
                        /* we found a interrupt in endpoint */
-                       dbg("found interrupt in on endpoint %d", i);
+                       dev_dbg(ddev, "found interrupt in on endpoint %d\n", i);
                        interrupt_in_endpoint[num_interrupt_in] = endpoint;
                        ++num_interrupt_in;
                }
  
                if (usb_endpoint_is_int_out(endpoint)) {
                        /* we found an interrupt out endpoint */
-                       dbg("found interrupt out on endpoint %d", i);
+                       dev_dbg(ddev, "found interrupt out on endpoint %d\n", i);
                        interrupt_out_endpoint[num_interrupt_out] = endpoint;
                        ++num_interrupt_out;
                }
                                endpoint = &iface_desc->endpoint[i].desc;
                                if (usb_endpoint_is_int_in(endpoint)) {
                                        /* we found a interrupt in endpoint */
-                                       dbg("found interrupt in for Prolific device on separate interface");
+                                       dev_dbg(ddev, "found interrupt in for Prolific device on separate interface\n");
                                        interrupt_in_endpoint[num_interrupt_in] = endpoint;
                                        ++num_interrupt_in;
                                }
                 * properly during a later invocation of usb_serial_probe
                 */
                if (num_bulk_in == 0 || num_bulk_out == 0) {
-                       dev_info(&interface->dev, "PL-2303 hack: descriptors matched but endpoints did not\n");
+                       dev_info(ddev, "PL-2303 hack: descriptors matched but endpoints did not\n");
                        usb_serial_put(serial);
                        module_put(type->driver.owner);
                        return -ENODEV;
        if (type == &usb_serial_generic_device) {
                num_ports = num_bulk_out;
                if (num_ports == 0) {
-                       dev_err(&interface->dev,
-                           "Generic device with no bulk out, not allowed.\n");
+                       dev_err(ddev, "Generic device with no bulk out, not allowed.\n");
                        usb_serial_put(serial);
                        module_put(type->driver.owner);
                        return -EIO;
                }
-               dev_info(&interface->dev, "The \"generic\" usb-serial driver is only for testing and one-off prototypes.\n");
-               dev_info(&interface->dev, "Tell linux-usb@vger.kernel.org to add your device to a proper driver.\n");
+               dev_info(ddev, "The \"generic\" usb-serial driver is only for testing and one-off prototypes.\n");
+               dev_info(ddev, "Tell linux-usb@vger.kernel.org to add your device to a proper driver.\n");
        }
  #endif
        if (!num_ports) {
        serial->num_interrupt_out = num_interrupt_out;
  
        /* found all that we need */
-       dev_info(&interface->dev, "%s converter detected\n",
-                       type->description);
+       dev_info(ddev, "%s converter detected\n", type->description);
  
        /* create our ports, we need as many as the max endpoints */
        /* we don't use num_ports here because some devices have more
        max_endpoints = max(max_endpoints, (int)serial->num_ports);
        serial->num_port_pointers = max_endpoints;
  
-       dbg("%s - setting up %d port structures for this device",
-                                               __func__, max_endpoints);
+       dev_dbg(ddev, "setting up %d port structures for this device", max_endpoints);
        for (i = 0; i < max_endpoints; ++i) {
                port = kzalloc(sizeof(struct usb_serial_port), GFP_KERNEL);
                if (!port)
                        set_bit(j, &port->read_urbs_free);
                        port->read_urbs[j] = usb_alloc_urb(0, GFP_KERNEL);
                        if (!port->read_urbs[j]) {
-                               dev_err(&interface->dev,
-                                               "No free urbs available\n");
+                               dev_err(ddev, "No free urbs available\n");
                                goto probe_error;
                        }
                        port->bulk_in_buffers[j] = kmalloc(buffer_size,
                                                                GFP_KERNEL);
                        if (!port->bulk_in_buffers[j]) {
-                               dev_err(&interface->dev,
-                                       "Couldn't allocate bulk_in_buffer\n");
+                               dev_err(ddev, "Couldn't allocate bulk_in_buffer\n");
                                goto probe_error;
                        }
                        usb_fill_bulk_urb(port->read_urbs[j], dev,
                        set_bit(j, &port->write_urbs_free);
                        port->write_urbs[j] = usb_alloc_urb(0, GFP_KERNEL);
                        if (!port->write_urbs[j]) {
-                               dev_err(&interface->dev,
-                                               "No free urbs available\n");
+                               dev_err(ddev, "No free urbs available\n");
                                goto probe_error;
                        }
                        port->bulk_out_buffers[j] = kmalloc(buffer_size,
                                                                GFP_KERNEL);
                        if (!port->bulk_out_buffers[j]) {
-                               dev_err(&interface->dev,
-                                       "Couldn't allocate bulk_out_buffer\n");
+                               dev_err(ddev, "Couldn't allocate bulk_out_buffer\n");
                                goto probe_error;
                        }
                        usb_fill_bulk_urb(port->write_urbs[j], dev,
                        port = serial->port[i];
                        port->interrupt_in_urb = usb_alloc_urb(0, GFP_KERNEL);
                        if (!port->interrupt_in_urb) {
-                               dev_err(&interface->dev,
-                                               "No free urbs available\n");
+                               dev_err(ddev, "No free urbs available\n");
                                goto probe_error;
                        }
                        buffer_size = usb_endpoint_maxp(endpoint);
                        port->interrupt_in_buffer = kmalloc(buffer_size,
                                                                GFP_KERNEL);
                        if (!port->interrupt_in_buffer) {
-                               dev_err(&interface->dev,
-                                   "Couldn't allocate interrupt_in_buffer\n");
+                               dev_err(ddev, "Couldn't allocate interrupt_in_buffer\n");
                                goto probe_error;
                        }
                        usb_fill_int_urb(port->interrupt_in_urb, dev,
                                endpoint->bInterval);
                }
        } else if (num_interrupt_in) {
-               dbg("the device claims to support interrupt in transfers, but read_int_callback is not defined");
+               dev_dbg(ddev, "The device claims to support interrupt in transfers, but read_int_callback is not defined\n");
        }
  
        if (serial->type->write_int_callback) {
                        port = serial->port[i];
                        port->interrupt_out_urb = usb_alloc_urb(0, GFP_KERNEL);
                        if (!port->interrupt_out_urb) {
-                               dev_err(&interface->dev,
-                                               "No free urbs available\n");
+                               dev_err(ddev, "No free urbs available\n");
                                goto probe_error;
                        }
                        buffer_size = usb_endpoint_maxp(endpoint);
                        port->interrupt_out_buffer = kmalloc(buffer_size,
                                                                GFP_KERNEL);
                        if (!port->interrupt_out_buffer) {
-                               dev_err(&interface->dev,
-                                 "Couldn't allocate interrupt_out_buffer\n");
+                               dev_err(ddev, "Couldn't allocate interrupt_out_buffer\n");
                                goto probe_error;
                        }
                        usb_fill_int_urb(port->interrupt_out_urb, dev,
                                endpoint->bInterval);
                }
        } else if (num_interrupt_out) {
-               dbg("the device claims to support interrupt out transfers, but write_int_callback is not defined");
+               dev_dbg(ddev, "The device claims to support interrupt out transfers, but write_int_callback is not defined\n");
        }
  
        usb_set_intfdata(interface, serial);
        serial->disconnected = 1;
  
        if (get_free_serial(serial, num_ports, &minor) == NULL) {
-               dev_err(&interface->dev, "No more free serial devices\n");
+               dev_err(ddev, "No more free serial devices\n");
                goto probe_error;
        }
        serial->minor = minor;
        for (i = 0; i < num_ports; ++i) {
                port = serial->port[i];
                dev_set_name(&port->dev, "ttyUSB%d", port->number);
-               dbg ("%s - registering %s", __func__, dev_name(&port->dev));
+               dev_dbg(ddev, "registering %s", dev_name(&port->dev));
                device_enable_async_suspend(&port->dev);
  
                retval = device_add(&port->dev);
                if (retval)
-                       dev_err(&port->dev, "Error registering port device, "
-                               "continuing\n");
+                       dev_err(ddev, "Error registering port device, continuing\n");
        }
  
        serial->disconnected = 0;
  
-       usb_serial_console_init(debug, minor);
+       usb_serial_console_init(minor);
  exit:
        module_put(type->driver.owner);
        return 0;
@@@ -1099,7 -1089,6 +1088,6 @@@ static void usb_serial_disconnect(struc
        struct usb_serial_port *port;
  
        usb_serial_console_disconnect(serial);
-       dbg("%s", __func__);
  
        mutex_lock(&serial->disc_mutex);
        /* must set a flag, to signal subdrivers */
@@@ -1234,8 -1223,7 +1222,7 @@@ static int __init usb_serial_init(void
  
        result = bus_register(&usb_serial_bus_type);
        if (result) {
-               printk(KERN_ERR "usb-serial: %s - registering bus driver "
-                      "failed\n", __func__);
+               pr_err("%s - registering bus driver failed\n", __func__);
                goto exit_bus;
        }
  
        tty_set_operations(usb_serial_tty_driver, &serial_ops);
        result = tty_register_driver(usb_serial_tty_driver);
        if (result) {
-               printk(KERN_ERR "usb-serial: %s - tty_register_driver failed\n",
-                      __func__);
+               pr_err("%s - tty_register_driver failed\n", __func__);
                goto exit_reg_driver;
        }
  
        /* register the USB driver */
        result = usb_register(&usb_serial_driver);
        if (result < 0) {
-               printk(KERN_ERR "usb-serial: %s - usb_register failed\n",
-                      __func__);
+               pr_err("%s - usb_register failed\n", __func__);
                goto exit_tty;
        }
  
        /* register the generic driver, if we should */
-       result = usb_serial_generic_register(debug);
+       result = usb_serial_generic_register();
        if (result < 0) {
-               printk(KERN_ERR "usb-serial: %s - registering generic "
-                      "driver failed\n", __func__);
+               pr_err("%s - registering generic driver failed\n", __func__);
                goto exit_generic;
        }
  
-       printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "\n");
        return result;
  
  exit_generic:
@@@ -1290,8 -1273,7 +1272,7 @@@ exit_reg_driver
        bus_unregister(&usb_serial_bus_type);
  
  exit_bus:
-       printk(KERN_ERR "usb-serial: %s - returning with error %d\n",
-              __func__, result);
+       pr_err("%s - returning with error %d\n", __func__, result);
        put_tty_driver(usb_serial_tty_driver);
        return result;
  }
@@@ -1317,7 -1299,7 +1298,7 @@@ module_exit(usb_serial_exit)
        do {                                                            \
                if (!type->function) {                                  \
                        type->function = usb_serial_generic_##function; \
-                       dbg("Had to override the " #function            \
+                       pr_debug("Had to override the " #function       \
                                " usb serial operation with the generic one.");\
                        }                                               \
        } while (0)
@@@ -1360,12 -1342,10 +1341,10 @@@ static int usb_serial_register(struct u
  
        retval = usb_serial_bus_register(driver);
        if (retval) {
-               printk(KERN_ERR "usb-serial: problem %d when registering "
-                      "driver %s\n", retval, driver->description);
+               pr_err("problem %d when registering driver %s\n", retval, driver->description);
                list_del(&driver->driver_list);
        } else
-               printk(KERN_INFO "USB Serial support registered for %s\n",
-                                               driver->description);
+               pr_info("USB Serial support registered for %s\n", driver->description);
  
        mutex_unlock(&table_lock);
        return retval;
  
  static void usb_serial_deregister(struct usb_serial_driver *device)
  {
-       printk(KERN_INFO "USB Serial deregistering driver %s\n",
-              device->description);
+       pr_info("USB Serial deregistering driver %s\n", device->description);
        mutex_lock(&table_lock);
        list_del(&device->driver_list);
        usb_serial_bus_deregister(device);
@@@ -1425,9 -1404,10 +1403,10 @@@ int usb_serial_register_drivers(struct 
  
        /* we only set the reset_resume field if the serial_driver has one */
        for (sd = serial_drivers; *sd; ++sd) {
-               if ((*sd)->reset_resume)
+               if ((*sd)->reset_resume) {
                        udriver->reset_resume = usb_serial_reset_resume;
                        break;
+               }
        }
  
        rc = usb_register(udriver);
@@@ -1477,6 -1457,3 +1456,3 @@@ EXPORT_SYMBOL_GPL(usb_serial_deregister
  MODULE_AUTHOR(DRIVER_AUTHOR);
  MODULE_DESCRIPTION(DRIVER_DESC);
  MODULE_LICENSE("GPL");
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug enabled or not");
@@@ -37,8 -37,6 +37,6 @@@
  #include <linux/serial.h>
  #include "usb-wwan.h"
  
- static bool debug;
  void usb_wwan_dtr_rts(struct usb_serial_port *port, int on)
  {
        struct usb_serial *serial = port->serial;
@@@ -67,7 -65,7 +65,7 @@@ void usb_wwan_set_termios(struct tty_st
        struct usb_wwan_intf_private *intfdata = port->serial->private;
  
        /* Doesn't support option setting */
 -      tty_termios_copy_hw(tty->termios, old_termios);
 +      tty_termios_copy_hw(&tty->termios, old_termios);
  
        if (intfdata->send_setup)
                intfdata->send_setup(port);
@@@ -178,7 -176,7 +176,7 @@@ int usb_wwan_ioctl(struct tty_struct *t
  {
        struct usb_serial_port *port = tty->driver_data;
  
-       dbg("%s cmd 0x%04x", __func__, cmd);
+       dev_dbg(&port->dev, "%s cmd 0x%04x\n", __func__, cmd);
  
        switch (cmd) {
        case TIOCGSERIAL:
                break;
        }
  
-       dbg("%s arg not supported", __func__);
+       dev_dbg(&port->dev, "%s arg not supported\n", __func__);
  
        return -ENOIOCTLCMD;
  }
@@@ -212,7 -210,7 +210,7 @@@ int usb_wwan_write(struct tty_struct *t
        portdata = usb_get_serial_port_data(port);
        intfdata = port->serial->private;
  
-       dbg("%s: write (%d chars)", __func__, count);
+       dev_dbg(&port->dev, "%s: write (%d chars)\n", __func__, count);
  
        i = 0;
        left = count;
                        usb_unlink_urb(this_urb);
                        continue;
                }
-               dbg("%s: endpoint %d buf %d", __func__,
-                   usb_pipeendpoint(this_urb->pipe), i);
+               dev_dbg(&port->dev, "%s: endpoint %d buf %d\n", __func__,
+                       usb_pipeendpoint(this_urb->pipe), i);
  
                err = usb_autopm_get_interface_async(port->serial->interface);
                if (err < 0)
                        spin_unlock_irqrestore(&intfdata->susp_lock, flags);
                        err = usb_submit_urb(this_urb, GFP_ATOMIC);
                        if (err) {
-                               dbg("usb_submit_urb %p (write bulk) failed "
-                                   "(%d)", this_urb, err);
+                               dev_dbg(&port->dev,
+                                       "usb_submit_urb %p (write bulk) failed (%d)\n",
+                                       this_urb, err);
                                clear_bit(i, &portdata->out_busy);
                                spin_lock_irqsave(&intfdata->susp_lock, flags);
                                intfdata->in_flight--;
        }
  
        count -= left;
-       dbg("%s: wrote (did %d)", __func__, count);
+       dev_dbg(&port->dev, "%s: wrote (did %d)\n", __func__, count);
        return count;
  }
  EXPORT_SYMBOL(usb_wwan_write);
@@@ -278,15 -277,17 +277,17 @@@ static void usb_wwan_indat_callback(str
        int endpoint;
        struct usb_serial_port *port;
        struct tty_struct *tty;
+       struct device *dev;
        unsigned char *data = urb->transfer_buffer;
        int status = urb->status;
  
        endpoint = usb_pipeendpoint(urb->pipe);
        port = urb->context;
+       dev = &port->dev;
  
        if (status) {
-               dbg("%s: nonzero status: %d on endpoint %02x.",
-                   __func__, status, endpoint);
+               dev_dbg(dev, "%s: nonzero status: %d on endpoint %02x.\n",
+                       __func__, status, endpoint);
        } else {
                tty = tty_port_tty_get(&port->port);
                if (tty) {
                                                urb->actual_length);
                                tty_flip_buffer_push(tty);
                        } else
-                               dbg("%s: empty read urb received", __func__);
+                               dev_dbg(dev, "%s: empty read urb received\n", __func__);
                        tty_kref_put(tty);
                }
  
                err = usb_submit_urb(urb, GFP_ATOMIC);
                if (err) {
                        if (err != -EPERM) {
-                               printk(KERN_ERR "%s: resubmit read urb failed. "
-                                       "(%d)", __func__, err);
+                               dev_err(dev, "%s: resubmit read urb failed. (%d)\n", __func__, err);
                                /* busy also in error unless we are killed */
                                usb_mark_last_busy(port->serial->dev);
                        }
@@@ -356,7 -356,7 +356,7 @@@ int usb_wwan_write_room(struct tty_stru
                        data_len += OUT_BUFLEN;
        }
  
-       dbg("%s: %d", __func__, data_len);
+       dev_dbg(&port->dev, "%s: %d\n", __func__, data_len);
        return data_len;
  }
  EXPORT_SYMBOL(usb_wwan_write_room);
@@@ -378,7 -378,7 +378,7 @@@ int usb_wwan_chars_in_buffer(struct tty
                if (this_urb && test_bit(i, &portdata->out_busy))
                        data_len += this_urb->transfer_buffer_length;
        }
-       dbg("%s: %d", __func__, data_len);
+       dev_dbg(&port->dev, "%s: %d\n", __func__, data_len);
        return data_len;
  }
  EXPORT_SYMBOL(usb_wwan_chars_in_buffer);
@@@ -401,8 -401,8 +401,8 @@@ int usb_wwan_open(struct tty_struct *tt
                        continue;
                err = usb_submit_urb(urb, GFP_KERNEL);
                if (err) {
-                       dbg("%s: submit urb %d failed (%d) %d",
-                           __func__, i, err, urb->transfer_buffer_length);
+                       dev_dbg(&port->dev, "%s: submit urb %d failed (%d) %d\n",
+                               __func__, i, err, urb->transfer_buffer_length);
                }
        }
  
@@@ -458,7 -458,9 +458,9 @@@ static struct urb *usb_wwan_setup_urb(s
  
        urb = usb_alloc_urb(0, GFP_KERNEL);     /* No ISO */
        if (urb == NULL) {
-               dbg("%s: alloc for endpoint %d failed.", __func__, endpoint);
+               dev_dbg(&serial->interface->dev,
+                       "%s: alloc for endpoint %d failed.\n", __func__,
+                       endpoint);
                return NULL;
        }
  
@@@ -522,8 -524,8 +524,8 @@@ int usb_wwan_startup(struct usb_serial 
                port = serial->port[i];
                portdata = kzalloc(sizeof(*portdata), GFP_KERNEL);
                if (!portdata) {
-                       dbg("%s: kmalloc for usb_wwan_port_private (%d) failed!.",
-                           __func__, i);
+                       dev_dbg(&port->dev, "%s: kmalloc for usb_wwan_port_private (%d) failed!.\n",
+                               __func__, i);
                        return 1;
                }
                init_usb_anchor(&portdata->delayed);
                        continue;
                err = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
                if (err)
-                       dbg("%s: submit irq_in urb failed %d", __func__, err);
+                       dev_dbg(&port->dev, "%s: submit irq_in urb failed %d\n",
+                               __func__, err);
        }
        usb_wwan_setup_urbs(serial);
        return 0;
@@@ -683,11 -686,11 +686,11 @@@ int usb_wwan_resume(struct usb_serial *
        for (i = 0; i < serial->num_ports; i++) {
                port = serial->port[i];
                if (!port->interrupt_in_urb) {
-                       dbg("%s: No interrupt URB for port %d", __func__, i);
+                       dev_dbg(&port->dev, "%s: No interrupt URB for port\n", __func__);
                        continue;
                }
                err = usb_submit_urb(port->interrupt_in_urb, GFP_NOIO);
-               dbg("Submitted interrupt URB for port %d (result %d)", i, err);
+               dev_dbg(&port->dev, "Submitted interrupt URB for port (result %d)\n", err);
                if (err < 0) {
                        dev_err(&port->dev, "%s: Error %d for interrupt URB\n",
                                __func__, err);
@@@ -733,6 -736,3 +736,3 @@@ MODULE_AUTHOR(DRIVER_AUTHOR)
  MODULE_DESCRIPTION(DRIVER_DESC);
  MODULE_VERSION(DRIVER_VERSION);
  MODULE_LICENSE("GPL");
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug messages");
  #include <linux/serial_reg.h>
  #include <linux/serial.h>
  #include <linux/usb/serial.h>
- #include <linux/firmware.h>
- #include <linux/ihex.h>
+ #include <linux/usb/ezusb.h>
  #include "whiteheat.h"                        /* WhiteHEAT specific commands */
  
- static bool debug;
  #ifndef CMSPAR
  #define CMSPAR 0
  #endif
@@@ -195,84 -192,15 +192,15 @@@ static int firm_report_tx_done(struct u
  static int whiteheat_firmware_download(struct usb_serial *serial,
                                        const struct usb_device_id *id)
  {
-       int response, ret = -ENOENT;
-       const struct firmware *loader_fw = NULL, *firmware_fw = NULL;
-       const struct ihex_binrec *record;
+       int response;
  
-       if (request_ihex_firmware(&firmware_fw, "whiteheat.fw",
-                                 &serial->dev->dev)) {
-               dev_err(&serial->dev->dev,
-                       "%s - request \"whiteheat.fw\" failed\n", __func__);
-               goto out;
-       }
-       if (request_ihex_firmware(&loader_fw, "whiteheat_loader.fw",
-                            &serial->dev->dev)) {
-               dev_err(&serial->dev->dev,
-                       "%s - request \"whiteheat_loader.fw\" failed\n",
-                       __func__);
-               goto out;
+       response = ezusb_fx1_ihex_firmware_download(serial->dev, "whiteheat_loader.fw");
+       if (response >= 0) {
+               response = ezusb_fx1_ihex_firmware_download(serial->dev, "whiteheat.fw");
+               if (response >= 0)
+                       return 0;
        }
-       ret = 0;
-       response = ezusb_set_reset (serial, 1);
-       record = (const struct ihex_binrec *)loader_fw->data;
-       while (record) {
-               response = ezusb_writememory (serial, be32_to_cpu(record->addr),
-                                             (unsigned char *)record->data,
-                                             be16_to_cpu(record->len), 0xa0);
-               if (response < 0) {
-                       dev_err(&serial->dev->dev, "%s - ezusb_writememory "
-                               "failed for loader (%d %04X %p %d)\n",
-                               __func__, response, be32_to_cpu(record->addr),
-                               record->data, be16_to_cpu(record->len));
-                       break;
-               }
-               record = ihex_next_binrec(record);
-       }
-       response = ezusb_set_reset(serial, 0);
-       record = (const struct ihex_binrec *)firmware_fw->data;
-       while (record && be32_to_cpu(record->addr) < 0x1b40)
-               record = ihex_next_binrec(record);
-       while (record) {
-               response = ezusb_writememory (serial, be32_to_cpu(record->addr),
-                                             (unsigned char *)record->data,
-                                             be16_to_cpu(record->len), 0xa3);
-               if (response < 0) {
-                       dev_err(&serial->dev->dev, "%s - ezusb_writememory "
-                               "failed for first firmware step "
-                               "(%d %04X %p %d)\n", __func__, response,
-                               be32_to_cpu(record->addr), record->data,
-                               be16_to_cpu(record->len));
-                       break;
-               }
-               ++record;
-       }
-       response = ezusb_set_reset(serial, 1);
-       record = (const struct ihex_binrec *)firmware_fw->data;
-       while (record && be32_to_cpu(record->addr) < 0x1b40) {
-               response = ezusb_writememory (serial, be32_to_cpu(record->addr),
-                                             (unsigned char *)record->data,
-                                             be16_to_cpu(record->len), 0xa0);
-               if (response < 0) {
-                       dev_err(&serial->dev->dev, "%s - ezusb_writememory "
-                               "failed for second firmware step "
-                               "(%d %04X %p %d)\n", __func__, response,
-                               be32_to_cpu(record->addr), record->data,
-                               be16_to_cpu(record->len));
-                       break;
-               }
-               ++record;
-       }
-       ret = 0;
-       response = ezusb_set_reset (serial, 0);
-  out:
-       release_firmware(loader_fw);
-       release_firmware(firmware_fw);
-       return ret;
+       return -ENOENT;
  }
  
  
@@@ -533,7 -461,7 +461,7 @@@ static int whiteheat_ioctl(struct tty_s
        struct serial_struct serstruct;
        void __user *user_arg = (void __user *)arg;
  
-       dbg("%s - port %d, cmd 0x%.4x", __func__, port->number, cmd);
+       dev_dbg(&port->dev, "%s - cmd 0x%.4x\n", __func__, cmd);
  
        switch (cmd) {
        case TIOCGSERIAL:
@@@ -580,7 -508,7 +508,7 @@@ static void command_port_write_callback
        int status = urb->status;
  
        if (status) {
-               dbg("nonzero urb status: %d", status);
+               dev_dbg(&urb->dev->dev, "nonzero urb status: %d\n", status);
                return;
        }
  }
@@@ -596,19 -524,18 +524,18 @@@ static void command_port_read_callback(
  
        command_info = usb_get_serial_port_data(command_port);
        if (!command_info) {
-               dbg("%s - command_info is NULL, exiting.", __func__);
+               dev_dbg(&urb->dev->dev, "%s - command_info is NULL, exiting.\n", __func__);
                return;
        }
        if (status) {
-               dbg("%s - nonzero urb status: %d", __func__, status);
+               dev_dbg(&urb->dev->dev, "%s - nonzero urb status: %d\n", __func__, status);
                if (status != -ENOENT)
                        command_info->command_finished = WHITEHEAT_CMD_FAILURE;
                wake_up(&command_info->wait_command);
                return;
        }
  
-       usb_serial_debug_data(debug, &command_port->dev,
-                               __func__, urb->actual_length, data);
+       usb_serial_debug_data(&command_port->dev, __func__, urb->actual_length, data);
  
        if (data[0] == WHITEHEAT_CMD_COMPLETE) {
                command_info->command_finished = WHITEHEAT_CMD_COMPLETE;
        } else if (data[0] == WHITEHEAT_EVENT) {
                /* These are unsolicited reports from the firmware, hence no
                   waiting command to wakeup */
-               dbg("%s - event received", __func__);
+               dev_dbg(&urb->dev->dev, "%s - event received\n", __func__);
        } else if (data[0] == WHITEHEAT_GET_DTR_RTS) {
                memcpy(command_info->result_buffer, &data[1],
                                                urb->actual_length - 1);
                command_info->command_finished = WHITEHEAT_CMD_COMPLETE;
                wake_up(&command_info->wait_command);
        } else
-               dbg("%s - bad reply from firmware", __func__);
+               dev_dbg(&urb->dev->dev, "%s - bad reply from firmware\n", __func__);
  
        /* Continue trying to always read */
        result = usb_submit_urb(command_port->read_urb, GFP_ATOMIC);
        if (result)
-               dbg("%s - failed resubmitting read urb, error %d",
+               dev_dbg(&urb->dev->dev, "%s - failed resubmitting read urb, error %d\n",
                        __func__, result);
  }
  
@@@ -645,11 -572,12 +572,12 @@@ static int firm_send_command(struct usb
        struct usb_serial_port *command_port;
        struct whiteheat_command_private *command_info;
        struct whiteheat_private *info;
+       struct device *dev = &port->dev;
        __u8 *transfer_buffer;
        int retval = 0;
        int t;
  
-       dbg("%s - command %d", __func__, command);
+       dev_dbg(dev, "%s - command %d\n", __func__, command);
  
        command_port = port->serial->port[COMMAND_PORT];
        command_info = usb_get_serial_port_data(command_port);
        command_port->write_urb->transfer_buffer_length = datasize + 1;
        retval = usb_submit_urb(command_port->write_urb, GFP_NOIO);
        if (retval) {
-               dbg("%s - submit urb failed", __func__);
+               dev_dbg(dev, "%s - submit urb failed\n", __func__);
                goto exit;
        }
  
                usb_kill_urb(command_port->write_urb);
  
        if (command_info->command_finished == false) {
-               dbg("%s - command timed out.", __func__);
+               dev_dbg(dev, "%s - command timed out.\n", __func__);
                retval = -ETIMEDOUT;
                goto exit;
        }
  
        if (command_info->command_finished == WHITEHEAT_CMD_FAILURE) {
-               dbg("%s - command failed.", __func__);
+               dev_dbg(dev, "%s - command failed.\n", __func__);
                retval = -EIO;
                goto exit;
        }
  
        if (command_info->command_finished == WHITEHEAT_CMD_COMPLETE) {
-               dbg("%s - command completed.", __func__);
+               dev_dbg(dev, "%s - command completed.\n", __func__);
                switch (command) {
                case WHITEHEAT_GET_DTR_RTS:
                        info = usb_get_serial_port_data(port);
@@@ -723,8 -651,9 +651,9 @@@ static int firm_close(struct usb_serial
  static void firm_setup_port(struct tty_struct *tty)
  {
        struct usb_serial_port *port = tty->driver_data;
+       struct device *dev = &port->dev;
        struct whiteheat_port_settings port_settings;
 -      unsigned int cflag = tty->termios->c_cflag;
 +      unsigned int cflag = tty->termios.c_cflag;
  
        port_settings.port = port->number + 1;
  
        default:
        case CS8:       port_settings.bits = 8;   break;
        }
-       dbg("%s - data bits = %d", __func__, port_settings.bits);
+       dev_dbg(dev, "%s - data bits = %d\n", __func__, port_settings.bits);
  
        /* determine the parity */
        if (cflag & PARENB)
                                port_settings.parity = WHITEHEAT_PAR_EVEN;
        else
                port_settings.parity = WHITEHEAT_PAR_NONE;
-       dbg("%s - parity = %c", __func__, port_settings.parity);
+       dev_dbg(dev, "%s - parity = %c\n", __func__, port_settings.parity);
  
        /* figure out the stop bits requested */
        if (cflag & CSTOPB)
                port_settings.stop = 2;
        else
                port_settings.stop = 1;
-       dbg("%s - stop bits = %d", __func__, port_settings.stop);
+       dev_dbg(dev, "%s - stop bits = %d\n", __func__, port_settings.stop);
  
        /* figure out the flow control settings */
        if (cflag & CRTSCTS)
                                                WHITEHEAT_HFLOW_RTS);
        else
                port_settings.hflow = WHITEHEAT_HFLOW_NONE;
-       dbg("%s - hardware flow control = %s %s %s %s", __func__,
+       dev_dbg(dev, "%s - hardware flow control = %s %s %s %s\n", __func__,
            (port_settings.hflow & WHITEHEAT_HFLOW_CTS) ? "CTS" : "",
            (port_settings.hflow & WHITEHEAT_HFLOW_RTS) ? "RTS" : "",
            (port_settings.hflow & WHITEHEAT_HFLOW_DSR) ? "DSR" : "",
                port_settings.sflow = WHITEHEAT_SFLOW_RXTX;
        else
                port_settings.sflow = WHITEHEAT_SFLOW_NONE;
-       dbg("%s - software flow control = %c", __func__, port_settings.sflow);
+       dev_dbg(dev, "%s - software flow control = %c\n", __func__, port_settings.sflow);
  
        port_settings.xon = START_CHAR(tty);
        port_settings.xoff = STOP_CHAR(tty);
-       dbg("%s - XON = %2x, XOFF = %2x",
-                       __func__, port_settings.xon, port_settings.xoff);
+       dev_dbg(dev, "%s - XON = %2x, XOFF = %2x\n", __func__, port_settings.xon, port_settings.xoff);
  
        /* get the baud rate wanted */
        port_settings.baud = tty_get_baud_rate(tty);
-       dbg("%s - baud rate = %d", __func__, port_settings.baud);
+       dev_dbg(dev, "%s - baud rate = %d\n", __func__, port_settings.baud);
  
        /* fixme: should set validated settings */
        tty_encode_baud_rate(tty, port_settings.baud, port_settings.baud);
@@@ -918,6 -846,3 +846,3 @@@ MODULE_LICENSE("GPL")
  
  MODULE_FIRMWARE("whiteheat.fw");
  MODULE_FIRMWARE("whiteheat_loader.fw");
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug enabled or not");