summaryrefslogtreecommitdiff
path: root/drivers/serial/usbtty.c
diff options
context:
space:
mode:
authorAtin Malaviya <atin.malaviya@gmail.com>2009-02-03 15:17:10 -0500
committerRemy Bohmer <linux@bohmer.net>2009-02-15 17:14:38 +0100
commitf3c0de636252f3a18654c8f9c6370a9574a7e755 (patch)
treebf94c4ebd4e000e7f0d6001ac20c73d17caebbb7 /drivers/serial/usbtty.c
parent6b67962fd69ac0bcdf1a982669a029c2f0a7bcc1 (diff)
downloadu-boot-imx-f3c0de636252f3a18654c8f9c6370a9574a7e755.zip
u-boot-imx-f3c0de636252f3a18654c8f9c6370a9574a7e755.tar.gz
u-boot-imx-f3c0de636252f3a18654c8f9c6370a9574a7e755.tar.bz2
Added usbtty_configured() check. Fixed attribute(packed) warnings.
V3: Fixed line-wrap problem due to user error in mail! Added usb_configured() checks in usbtty_puts() and usbtty_putc() to get around a hang when usb is not connected and the user has set up multi-io (setenv stdout serial,usbtty etc). Got rid of redundant __attribute__((packed)) directives that were causing warnings from gcc. Signed-off-by: Atin Malaviya <atin.malaviya@gmail.com> Signed-off-by: Remy Bohmer <linux@bohmer.net>
Diffstat (limited to 'drivers/serial/usbtty.c')
-rw-r--r--drivers/serial/usbtty.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/serial/usbtty.c b/drivers/serial/usbtty.c
index 7eba470..2624e6f 100644
--- a/drivers/serial/usbtty.c
+++ b/drivers/serial/usbtty.c
@@ -150,8 +150,7 @@ struct acm_config_desc {
/* Slave Interface */
struct usb_interface_descriptor data_class_interface;
- struct usb_endpoint_descriptor
- data_endpoints[NUM_ENDPOINTS-1] __attribute__((packed));
+ struct usb_endpoint_descriptor data_endpoints[NUM_ENDPOINTS-1];
} __attribute__((packed));
static struct acm_config_desc acm_configuration_descriptors[NUM_CONFIGS] = {
@@ -280,10 +279,8 @@ static struct rs232_emu rs232_desc={
struct gserial_config_desc {
struct usb_configuration_descriptor configuration_desc;
- struct usb_interface_descriptor
- interface_desc[NUM_GSERIAL_INTERFACES] __attribute__((packed));
- struct usb_endpoint_descriptor
- data_endpoints[NUM_ENDPOINTS] __attribute__((packed));
+ struct usb_interface_descriptor interface_desc[NUM_GSERIAL_INTERFACES];
+ struct usb_endpoint_descriptor data_endpoints[NUM_ENDPOINTS];
} __attribute__((packed));
@@ -433,6 +430,9 @@ int usbtty_getc (void)
*/
void usbtty_putc (const char c)
{
+ if (!usbtty_configured ())
+ return;
+
buf_push (&usbtty_output, &c, 1);
/* If \n, also do \r */
if (c == '\n')
@@ -486,8 +486,12 @@ static void __usbtty_puts (const char *str, int len)
void usbtty_puts (const char *str)
{
int n;
- int len = strlen (str);
+ int len;
+
+ if (!usbtty_configured ())
+ return;
+ len = strlen (str);
/* add '\r' for each '\n' */
while (len > 0) {
n = next_nl_pos (str);