ChangeSet 1.2181.4.91, 2005/03/29 21:41:57-08:00, [EMAIL PROTECTED]
[PATCH] ftdi_sio: add array to map chip type to a string
This patch just adds an array to map the chip type to a string for use
in debug messages for the ftdi_sio driver. I use it in the
get_ftdi_divisor function and another patch.
Signed-off-by: Ian Abbott <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
ftdi_sio.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff -Nru a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
--- a/drivers/usb/serial/ftdi_sio.c 2005-03-30 15:23:39 -08:00
+++ b/drivers/usb/serial/ftdi_sio.c 2005-03-30 15:23:39 -08:00
@@ -626,6 +626,13 @@
.id_table = id_table_combined,
};
+static char *ftdi_chip_name[] = {
+ [SIO] = "SIO", /* the serial part of FT8U100AX */
+ [FT8U232AM] = "FT8U232AM",
+ [FT232BM] = "FT232BM",
+ [FT2232C] = "FT2232C",
+};
+
/* Constants for read urb and write urb */
#define BUFSZ 512
@@ -1004,7 +1011,6 @@
struct ftdi_private *priv = usb_get_serial_port_data(port);
__u32 div_value = 0;
int div_okay = 1;
- char *chip_name = "";
int baud;
/*
@@ -1049,7 +1055,6 @@
if (!baud) baud = 9600;
switch(priv->chip_type) {
case SIO: /* SIO chip */
- chip_name = "SIO";
switch(baud) {
case 300: div_value = ftdi_sio_b300; break;
case 600: div_value = ftdi_sio_b600; break;
@@ -1069,7 +1074,6 @@
}
break;
case FT8U232AM: /* 8U232AM chip */
- chip_name = "FT8U232AM";
if (baud <= 3000000) {
div_value = ftdi_232am_baud_to_divisor(baud);
} else {
@@ -1080,11 +1084,6 @@
break;
case FT232BM: /* FT232BM chip */
case FT2232C: /* FT2232C chip */
- if (priv->chip_type == FT2232C) {
- chip_name = "FT2232C";
- } else {
- chip_name = "FT232BM";
- }
if (baud <= 3000000) {
div_value = ftdi_232bm_baud_to_divisor(baud);
} else {
@@ -1097,7 +1096,8 @@
if (div_okay) {
dbg("%s - Baud rate set to %d (divisor 0x%lX) on chip %s",
- __FUNCTION__, baud, (unsigned long)div_value,
chip_name);
+ __FUNCTION__, baud, (unsigned long)div_value,
+ ftdi_chip_name[priv->chip_type]);
}
return(div_value);
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html