提交 67e6da70 编写于 作者: G Greg Kroah-Hartman

USB: serial: io_ti.c: remove dbg() usage

dbg() was a very old USB-serial-specific macro.
This patch removes it from being used in the
driver and uses dev_dbg() instead.

CC: Johan Hovold <jhovold@gmail.com>
CC: "Eric W. Biederman" <ebiederm@xmission.com>
CC: Rusty Russell <rusty@rustcorp.com.au>
CC: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 7ebcb334
......@@ -233,7 +233,7 @@ static int ti_vread_sync(struct usb_device *dev, __u8 request,
if (status < 0)
return status;
if (status != size) {
dbg("%s - wanted to write %d, but only wrote %d",
dev_dbg(&dev->dev, "%s - wanted to write %d, but only wrote %d\n",
__func__, size, status);
return -ECOMM;
}
......@@ -251,7 +251,7 @@ static int ti_vsend_sync(struct usb_device *dev, __u8 request,
if (status < 0)
return status;
if (status != size) {
dbg("%s - wanted to write %d, but only wrote %d",
dev_dbg(&dev->dev, "%s - wanted to write %d, but only wrote %d\n",
__func__, size, status);
return -ECOMM;
}
......@@ -270,7 +270,7 @@ static int purge_port(struct usb_serial_port *port, __u16 mask)
{
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 +295,7 @@ static int read_download_mem(struct usb_device *dev, int start_address,
__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)
......@@ -307,8 +307,7 @@ static int read_download_mem(struct usb_device *dev, int start_address,
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,
......@@ -317,7 +316,7 @@ static int read_download_mem(struct usb_device *dev, int start_address,
buffer, read_length);
if (status) {
dbg("%s - ERROR %x", __func__, status);
dev_dbg(&dev->dev, "%s - ERROR %x\n", __func__, status);
return status;
}
......@@ -353,12 +352,12 @@ static int read_boot_mem(struct edgeport_serial *serial,
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",
dev_dbg(&serial->serial->dev->dev, "%s - start_address = %x, length = %d\n",
__func__, start_address, length);
usb_serial_debug_data(debug, &serial->serial->dev->dev,
__func__, length, buffer);
......@@ -398,8 +397,7 @@ static int write_boot_mem(struct edgeport_serial *serial,
return status;
}
dbg("%s - start_sddr = %x, length = %d",
__func__, start_address, length);
dev_dbg(&serial->serial->dev->dev, "%s - start_sddr = %x, length = %d\n", __func__, start_address, length);
usb_serial_debug_data(debug, &serial->serial->dev->dev,
__func__, length, buffer);
......@@ -411,6 +409,7 @@ static int write_boot_mem(struct edgeport_serial *serial,
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;
......@@ -424,10 +423,9 @@ static int write_i2c_mem(struct edgeport_serial *serial,
if (write_length > length)
write_length = length;
dbg("%s - BytesInFirstPage Addr = %x, length = %d",
dev_dbg(dev, "%s - BytesInFirstPage Addr = %x, length = %d\n",
__func__, start_address, write_length);
usb_serial_debug_data(debug, &serial->serial->dev->dev,
__func__, write_length, buffer);
usb_serial_debug_data(debug, dev, __func__, write_length, buffer);
/* Write first page */
be_start_address = cpu_to_be16(start_address);
......@@ -436,7 +434,7 @@ static int write_i2c_mem(struct edgeport_serial *serial,
(__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;
}
......@@ -452,10 +450,9 @@ static int write_i2c_mem(struct edgeport_serial *serial,
else
write_length = length;
dbg("%s - Page Write Addr = %x, length = %d",
dev_dbg(dev, "%s - Page Write Addr = %x, length = %d\n",
__func__, start_address, write_length);
usb_serial_debug_data(debug, &serial->serial->dev->dev,
__func__, write_length, buffer);
usb_serial_debug_data(debug, dev, __func__, write_length, buffer);
/* Write next page */
be_start_address = cpu_to_be16(start_address);
......@@ -464,8 +461,7 @@ static int write_i2c_mem(struct edgeport_serial *serial,
(__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 +504,7 @@ static int tx_active(struct edgeport_port *port)
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,
......@@ -516,7 +512,7 @@ static int tx_active(struct edgeport_port *port)
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)
......@@ -527,7 +523,7 @@ static int tx_active(struct edgeport_port *port)
/* 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 +595,13 @@ static int choose_config(struct usb_device *dev)
* configuration # 1, which is Config Descriptor 0.
*/
dbg("%s - Number of Interfaces = %d",
dev_dbg(&dev->dev, "%s - Number of Interfaces = %d\n",
__func__, dev->config->desc.bNumInterfaces);
dbg("%s - MAX Power = %d",
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 +679,7 @@ static int valid_csum(struct ti_i2c_desc *rom_desc, __u8 *buffer)
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 +731,11 @@ static int check_i2c_image(struct edgeport_serial *serial)
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 +774,18 @@ static int get_manuf_info(struct edgeport_serial *serial, __u8 *buffer)
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;
}
......@@ -804,12 +799,12 @@ static int get_manuf_info(struct edgeport_serial *serial, __u8 *buffer)
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);
......@@ -903,13 +898,13 @@ static int build_i2c_fw_hdr(__u8 *header, struct device *dev)
/* 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;
}
......@@ -917,11 +912,11 @@ static int i2c_type_bootmode(struct edgeport_serial *serial)
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;
}
......@@ -930,16 +925,16 @@ static int i2c_type_bootmode(struct edgeport_serial *serial)
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 +1045,11 @@ static int download_fw(struct edgeport_serial *serial)
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;
}
......@@ -1074,7 +1069,7 @@ static int download_fw(struct edgeport_serial *serial)
/* 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;
......@@ -1094,8 +1089,7 @@ static int download_fw(struct edgeport_serial *serial)
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);
......@@ -1127,9 +1121,8 @@ static int download_fw(struct edgeport_serial *serial)
download_new_ver = (OperationalMajorVersion << 8) +
(OperationalMinorVersion);
dbg("%s - >> FW Versions Device %d.%d Driver %d.%d",
__func__,
firmware_version->Ver_Major,
dev_dbg(dev, "%s - >> FW Versions Device %d.%d Driver %d.%d\n",
__func__, firmware_version->Ver_Major,
firmware_version->Ver_Minor,
OperationalMajorVersion,
OperationalMinorVersion);
......@@ -1137,7 +1130,7 @@ static int download_fw(struct edgeport_serial *serial)
/* 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",
dev_dbg(dev, "%s - Update I2C dld from %d.%d to %d.%d\n",
__func__,
firmware_version->Ver_Major,
firmware_version->Ver_Minor,
......@@ -1196,9 +1189,7 @@ static int download_fw(struct edgeport_serial *serial)
}
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);
......@@ -1206,15 +1197,14 @@ static int download_fw(struct edgeport_serial *serial)
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);
......@@ -1249,8 +1239,7 @@ static int download_fw(struct edgeport_serial *serial)
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
......@@ -1292,7 +1281,7 @@ static int download_fw(struct edgeport_serial *serial)
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);
......@@ -1300,8 +1289,7 @@ static int download_fw(struct edgeport_serial *serial)
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);
......@@ -1312,13 +1300,13 @@ static int download_fw(struct edgeport_serial *serial)
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",
......@@ -1338,7 +1326,7 @@ static int download_fw(struct edgeport_serial *serial)
/********************************************************************/
/* 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);
......@@ -1347,7 +1335,7 @@ static int download_fw(struct edgeport_serial *serial)
if (le16_to_cpu(serial->serial->dev->descriptor.idVendor)
!= USB_VENDOR_ID_ION) {
dbg("%s - VID = 0x%x", __func__,
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;
......@@ -1385,7 +1373,7 @@ static int download_fw(struct edgeport_serial *serial)
/* Check for version 2 */
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);
goto stayinbootmode;
......@@ -1442,23 +1430,20 @@ static int download_fw(struct edgeport_serial *serial)
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;
......@@ -1466,7 +1451,7 @@ static int download_fw(struct edgeport_serial *serial)
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 +1472,7 @@ static int restore_mcr(struct edgeport_port *port, __u8 mcr)
{
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 +1509,7 @@ static void handle_new_msr(struct edgeport_port *edge_port, __u8 msr)
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 +1551,7 @@ static void handle_new_lsr(struct edgeport_port *edge_port, int lsr_data,
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 +1589,7 @@ static void edge_interrupt_callback(struct urb *urb)
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;
......@@ -1613,8 +1599,6 @@ static void edge_interrupt_callback(struct urb *urb)
__u8 msr;
int status = urb->status;
dbg("%s", __func__);
switch (status) {
case 0:
/* success */
......@@ -1623,7 +1607,7 @@ static void edge_interrupt_callback(struct urb *urb)
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:
......@@ -1633,27 +1617,26 @@ static void edge_interrupt_callback(struct urb *urb)
}
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(debug, 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) {
......@@ -1662,12 +1645,12 @@ static void edge_interrupt_callback(struct urb *urb)
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",
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 ======",
dev_dbg(dev, "%s - ===== Port %d LSR Status = %02x ======\n",
__func__, port_number, lsr);
handle_new_lsr(edge_port, 0, lsr, 0);
}
......@@ -1676,7 +1659,7 @@ static void edge_interrupt_callback(struct urb *urb)
case TIUMP_INTERRUPT_CODE_MSR: /* MSR */
/* Copy MSR from UMP */
msr = data[1];
dbg("%s - ===== Port %u MSR Status = %02x ======",
dev_dbg(dev, "%s - ===== Port %u MSR Status = %02x ======\n",
__func__, port_number, msr);
handle_new_msr(edge_port, msr);
break;
......@@ -1700,14 +1683,13 @@ static void edge_interrupt_callback(struct urb *urb)
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 */
......@@ -1716,13 +1698,10 @@ static void edge_bulk_in_callback(struct urb *urb)
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)
......@@ -1737,7 +1716,7 @@ static void edge_bulk_in_callback(struct urb *urb)
if (edge_port->lsr_event) {
edge_port->lsr_event = 0;
dbg("%s ===== Port %u LSR Status = %02x, Data = %02x ======",
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 */
......@@ -1747,14 +1726,12 @@ static void edge_bulk_in_callback(struct urb *urb)
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(debug, 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 +1746,7 @@ static void edge_bulk_in_callback(struct urb *urb)
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 +1768,6 @@ static void edge_bulk_out_callback(struct urb *urb)
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) {
......@@ -1805,7 +1778,7 @@ static void edge_bulk_out_callback(struct urb *urb)
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 +1803,6 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port)
u16 open_settings;
u8 transaction_timeout;
dbg("%s - port %d", __func__, port->number);
if (edge_port == NULL)
return -ENODEV;
......@@ -1850,9 +1821,8 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port)
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;
......@@ -1885,7 +1855,7 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *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,
......@@ -1924,11 +1894,11 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *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))
......@@ -1980,8 +1950,6 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port)
++edge_serial->num_ports_open;
dbg("%s - exited", __func__);
goto release_es_lock;
unlink_int_urb:
......@@ -1999,8 +1967,6 @@ static void edge_close(struct usb_serial_port *port)
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)
......@@ -2019,7 +1985,7 @@ static void edge_close(struct usb_serial_port *port)
/* 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);
......@@ -2042,8 +2008,6 @@ static void edge_close(struct usb_serial_port *port)
}
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,
......@@ -2051,10 +2015,8 @@ 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 +2039,6 @@ static void edge_send(struct tty_struct *tty)
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) {
......@@ -2130,8 +2089,6 @@ static int edge_write_room(struct tty_struct *tty)
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)
......@@ -2141,7 +2098,7 @@ static int edge_write_room(struct tty_struct *tty)
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 +2109,6 @@ static int edge_chars_in_buffer(struct tty_struct *tty)
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)
......@@ -2163,7 +2118,7 @@ static int edge_chars_in_buffer(struct tty_struct *tty)
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 +2128,6 @@ static void edge_throttle(struct tty_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;
......@@ -2200,8 +2153,6 @@ static void edge_unthrottle(struct tty_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 +2212,7 @@ static int restart_read(struct edgeport_port *edge_port)
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;
......@@ -2268,13 +2220,12 @@ static void change_port_settings(struct tty_struct *tty,
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;
dev_err(&edge_port->port->dev, "%s - out of memory\n",
__func__);
dev_err(dev, "%s - out of memory\n", __func__);
return;
}
......@@ -2290,20 +2241,20 @@ static void change_port_settings(struct tty_struct *tty,
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;
}
......@@ -2311,32 +2262,32 @@ static void change_port_settings(struct tty_struct *tty,
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);
}
......@@ -2349,18 +2300,18 @@ static void change_port_settings(struct tty_struct *tty,
/* 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",
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",
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;
......@@ -2377,17 +2328,16 @@ static void change_port_settings(struct tty_struct *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);
......@@ -2397,7 +2347,7 @@ static void change_port_settings(struct tty_struct *tty,
(__u8)(UMPM_UART1_PORT + port_number),
0, (__u8 *)config, sizeof(*config));
if (status)
dbg("%s - error %d when trying to write config to device",
dev_dbg(dev, "%s - error %d when trying to write config to device\n",
__func__, status);
kfree(config);
}
......@@ -2410,11 +2360,11 @@ static void edge_set_termios(struct tty_struct *tty,
cflag = tty->termios->c_cflag;
dbg("%s - clfag %08x iflag %08x", __func__,
dev_dbg(&port->dev, "%s - clfag %08x iflag %08x\n", __func__,
tty->termios->c_cflag, tty->termios->c_iflag);
dbg("%s - old clfag %08x old iflag %08x", __func__,
dev_dbg(&port->dev, "%s - old clfag %08x old iflag %08x\n", __func__,
old_termios->c_cflag, old_termios->c_iflag);
dbg("%s - port %d", __func__, port->number);
dev_dbg(&port->dev, "%s - port %d\n", __func__, port->number);
if (edge_port == NULL)
return;
......@@ -2430,8 +2380,6 @@ static int edge_tiocmset(struct tty_struct *tty,
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 +2412,6 @@ static int edge_tiocmget(struct tty_struct *tty)
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;
......@@ -2478,7 +2424,7 @@ static int edge_tiocmget(struct tty_struct *tty)
| ((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 +2484,15 @@ static int edge_ioctl(struct tty_struct *tty,
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 +2524,6 @@ static void edge_break(struct tty_struct *tty, int break_state)
int status;
int bv = 0; /* Off */
dbg("%s - state = %d", __func__, break_state);
/* chase the port close */
chase_port(edge_port, 0, 0);
......@@ -2587,7 +2531,7 @@ static void edge_break(struct tty_struct *tty, int break_state)
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.",
dev_dbg(&port->dev, "%s - error %d sending break set/clear command.\n",
__func__, status);
}
......@@ -2655,7 +2599,6 @@ static int edge_startup(struct usb_serial *serial)
static void edge_disconnect(struct usb_serial *serial)
{
dbg("%s", __func__);
}
static void edge_release(struct usb_serial *serial)
......@@ -2663,8 +2606,6 @@ 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 +2633,7 @@ static ssize_t store_uart_mode(struct device *dev,
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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册