diff options
-rw-r--r-- | drivers/usb/serial/metro-usb.c | 78 |
1 files changed, 44 insertions, 34 deletions
diff --git a/drivers/usb/serial/metro-usb.c b/drivers/usb/serial/metro-usb.c index 6b7d2779148c..6e1622f2a297 100644 --- a/drivers/usb/serial/metro-usb.c +++ b/drivers/usb/serial/metro-usb.c | |||
@@ -66,7 +66,7 @@ static void metrousb_read_int_callback(struct urb *urb) | |||
66 | int result = 0; | 66 | int result = 0; |
67 | unsigned long flags = 0; | 67 | unsigned long flags = 0; |
68 | 68 | ||
69 | dbg("METRO-USB - %s - port number=%d", __FUNCTION__, port->number); | 69 | dev_dbg(&port->dev, "%s\n", __func__); |
70 | 70 | ||
71 | switch (urb->status) { | 71 | switch (urb->status) { |
72 | case 0: | 72 | case 0: |
@@ -76,12 +76,14 @@ static void metrousb_read_int_callback(struct urb *urb) | |||
76 | case -ENOENT: | 76 | case -ENOENT: |
77 | case -ESHUTDOWN: | 77 | case -ESHUTDOWN: |
78 | /* urb has been terminated. */ | 78 | /* urb has been terminated. */ |
79 | dbg("METRO-USB - %s - urb shutting down, port number=%d, error code=%d", | 79 | dev_dbg(&port->dev, |
80 | __FUNCTION__, port->number, result); | 80 | "%s - urb shutting down, error code=%d\n", |
81 | __func__, result); | ||
81 | return; | 82 | return; |
82 | default: | 83 | default: |
83 | dbg("METRO-USB - %s - non-zero urb received, port number=%d, error code=%d", | 84 | dev_dbg(&port->dev, |
84 | __FUNCTION__, port->number, result); | 85 | "%s - non-zero urb received, error code=%d\n", |
86 | __func__, result); | ||
85 | goto exit; | 87 | goto exit; |
86 | } | 88 | } |
87 | 89 | ||
@@ -89,7 +91,8 @@ static void metrousb_read_int_callback(struct urb *urb) | |||
89 | /* Set the data read from the usb port into the serial port buffer. */ | 91 | /* Set the data read from the usb port into the serial port buffer. */ |
90 | tty = tty_port_tty_get(&port->port); | 92 | tty = tty_port_tty_get(&port->port); |
91 | if (!tty) { | 93 | if (!tty) { |
92 | dbg("%s - bad tty pointer - exiting", __func__); | 94 | dev_dbg(&port->dev, "%s - bad tty pointer - exiting\n", |
95 | __func__); | ||
93 | return; | 96 | return; |
94 | } | 97 | } |
95 | 98 | ||
@@ -117,25 +120,25 @@ static void metrousb_read_int_callback(struct urb *urb) | |||
117 | 120 | ||
118 | result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); | 121 | result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); |
119 | 122 | ||
120 | if (result) { | 123 | if (result) |
121 | dbg("METRO-USB - %s - failed submitting interrupt in urb for port number=%d, error code=%d", | 124 | dev_dbg(&port->dev, |
122 | __FUNCTION__, port->number, result); | 125 | "%s - failed submitting interrupt in urb, error code=%d\n", |
123 | } | 126 | __func__, result); |
124 | } | 127 | } |
125 | return; | 128 | return; |
126 | 129 | ||
127 | exit: | 130 | exit: |
128 | /* Try to resubmit the urb. */ | 131 | /* Try to resubmit the urb. */ |
129 | result = usb_submit_urb(urb, GFP_ATOMIC); | 132 | result = usb_submit_urb(urb, GFP_ATOMIC); |
130 | if (result) { | 133 | if (result) |
131 | dbg("METRO-USB - %s - failed submitting interrupt in urb for port number=%d, error code=%d", | 134 | dev_dbg(&port->dev, |
132 | __FUNCTION__, port->number, result); | 135 | "%s - failed submitting interrupt in urb, error code=%d\n", |
133 | } | 136 | __func__, result); |
134 | } | 137 | } |
135 | 138 | ||
136 | static void metrousb_cleanup(struct usb_serial_port *port) | 139 | static void metrousb_cleanup(struct usb_serial_port *port) |
137 | { | 140 | { |
138 | dbg("METRO-USB - %s - port number=%d", __FUNCTION__, port->number); | 141 | dev_dbg(&port->dev, "%s\n", __func__); |
139 | 142 | ||
140 | if (port->serial->dev) { | 143 | if (port->serial->dev) { |
141 | /* Shutdown any interrupt in urbs. */ | 144 | /* Shutdown any interrupt in urbs. */ |
@@ -153,11 +156,12 @@ static int metrousb_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
153 | unsigned long flags = 0; | 156 | unsigned long flags = 0; |
154 | int result = 0; | 157 | int result = 0; |
155 | 158 | ||
156 | dbg("METRO-USB - %s - port number=%d", __FUNCTION__, port->number); | 159 | dev_dbg(&port->dev, "%s\n", __func__); |
157 | 160 | ||
158 | /* Make sure the urb is initialized. */ | 161 | /* Make sure the urb is initialized. */ |
159 | if (!port->interrupt_in_urb) { | 162 | if (!port->interrupt_in_urb) { |
160 | dbg("METRO-USB - %s - interrupt urb not initialized for port number=%d", __FUNCTION__, port->number); | 163 | dev_dbg(&port->dev, "%s - interrupt urb not initialized\n", |
164 | __func__); | ||
161 | return -ENODEV; | 165 | return -ENODEV; |
162 | } | 166 | } |
163 | 167 | ||
@@ -187,12 +191,13 @@ static int metrousb_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
187 | result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); | 191 | result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); |
188 | 192 | ||
189 | if (result) { | 193 | if (result) { |
190 | dbg("METRO-USB - %s - failed submitting interrupt in urb for port number=%d, error code=%d" | 194 | dev_dbg(&port->dev, |
191 | , __FUNCTION__, port->number, result); | 195 | "%s - failed submitting interrupt in urb, error code=%d\n", |
196 | __func__, result); | ||
192 | goto exit; | 197 | goto exit; |
193 | } | 198 | } |
194 | 199 | ||
195 | dbg("METRO-USB - %s - port open for port number=%d", __FUNCTION__, port->number); | 200 | dev_dbg(&port->dev, "%s - port open\n", __func__); |
196 | exit: | 201 | exit: |
197 | return result; | 202 | return result; |
198 | } | 203 | } |
@@ -202,7 +207,8 @@ static int metrousb_set_modem_ctrl(struct usb_serial *serial, unsigned int contr | |||
202 | int retval = 0; | 207 | int retval = 0; |
203 | unsigned char mcr = METROUSB_MCR_NONE; | 208 | unsigned char mcr = METROUSB_MCR_NONE; |
204 | 209 | ||
205 | dbg("METRO-USB - %s - control state=%d", __FUNCTION__, control_state); | 210 | dev_dbg(&serial->dev->dev, "%s - control state = %d\n", |
211 | __func__, control_state); | ||
206 | 212 | ||
207 | /* Set the modem control value. */ | 213 | /* Set the modem control value. */ |
208 | if (control_state & TIOCM_DTR) | 214 | if (control_state & TIOCM_DTR) |
@@ -215,7 +221,9 @@ static int metrousb_set_modem_ctrl(struct usb_serial *serial, unsigned int contr | |||
215 | METROUSB_SET_REQUEST_TYPE, METROUSB_SET_MODEM_CTRL_REQUEST, | 221 | METROUSB_SET_REQUEST_TYPE, METROUSB_SET_MODEM_CTRL_REQUEST, |
216 | control_state, 0, NULL, 0, WDR_TIMEOUT); | 222 | control_state, 0, NULL, 0, WDR_TIMEOUT); |
217 | if (retval < 0) | 223 | if (retval < 0) |
218 | dbg("METRO-USB - %s - set modem ctrl=0x%x failed, error code=%d", __FUNCTION__, mcr, retval); | 224 | dev_dbg(&serial->dev->dev, |
225 | "%s - set modem ctrl=0x%x failed, error code=%d\n", | ||
226 | __func__, mcr, retval); | ||
219 | 227 | ||
220 | return retval; | 228 | return retval; |
221 | } | 229 | } |
@@ -224,7 +232,7 @@ static void metrousb_shutdown(struct usb_serial *serial) | |||
224 | { | 232 | { |
225 | int i = 0; | 233 | int i = 0; |
226 | 234 | ||
227 | dbg("METRO-USB - %s", __FUNCTION__); | 235 | dev_dbg(&serial->dev->dev, "%s\n", __func__); |
228 | 236 | ||
229 | /* Stop reading and writing on all ports. */ | 237 | /* Stop reading and writing on all ports. */ |
230 | for (i = 0; i < serial->num_ports; ++i) { | 238 | for (i = 0; i < serial->num_ports; ++i) { |
@@ -235,7 +243,8 @@ static void metrousb_shutdown(struct usb_serial *serial) | |||
235 | kfree(usb_get_serial_port_data(serial->port[i])); | 243 | kfree(usb_get_serial_port_data(serial->port[i])); |
236 | usb_set_serial_port_data(serial->port[i], NULL); | 244 | usb_set_serial_port_data(serial->port[i], NULL); |
237 | 245 | ||
238 | dbg("METRO-USB - %s - freed port number=%d", __FUNCTION__, serial->port[i]->number); | 246 | dev_dbg(&serial->dev->dev, "%s - freed port number=%d\n", |
247 | __func__, serial->port[i]->number); | ||
239 | } | 248 | } |
240 | } | 249 | } |
241 | 250 | ||
@@ -245,7 +254,7 @@ static int metrousb_startup(struct usb_serial *serial) | |||
245 | struct usb_serial_port *port; | 254 | struct usb_serial_port *port; |
246 | int i = 0; | 255 | int i = 0; |
247 | 256 | ||
248 | dbg("METRO-USB - %s", __FUNCTION__); | 257 | dev_dbg(&serial->dev->dev, "%s\n", __func__); |
249 | 258 | ||
250 | /* Loop through the serial ports setting up the private structures. | 259 | /* Loop through the serial ports setting up the private structures. |
251 | * Currently we only use one port. */ | 260 | * Currently we only use one port. */ |
@@ -261,7 +270,8 @@ static int metrousb_startup(struct usb_serial *serial) | |||
261 | spin_lock_init(&metro_priv->lock); | 270 | spin_lock_init(&metro_priv->lock); |
262 | usb_set_serial_port_data(port, metro_priv); | 271 | usb_set_serial_port_data(port, metro_priv); |
263 | 272 | ||
264 | dbg("METRO-USB - %s - port number=%d.", __FUNCTION__, port->number); | 273 | dev_dbg(&serial->dev->dev, "%s - port number=%d\n ", |
274 | __func__, port->number); | ||
265 | } | 275 | } |
266 | 276 | ||
267 | return 0; | 277 | return 0; |
@@ -273,7 +283,7 @@ static void metrousb_throttle(struct tty_struct *tty) | |||
273 | struct metrousb_private *metro_priv = usb_get_serial_port_data(port); | 283 | struct metrousb_private *metro_priv = usb_get_serial_port_data(port); |
274 | unsigned long flags = 0; | 284 | unsigned long flags = 0; |
275 | 285 | ||
276 | dbg("METRO-USB - %s - port number=%d", __FUNCTION__, port->number); | 286 | dev_dbg(tty->dev, "%s\n", __func__); |
277 | 287 | ||
278 | /* Set the private information for the port to stop reading data. */ | 288 | /* Set the private information for the port to stop reading data. */ |
279 | spin_lock_irqsave(&metro_priv->lock, flags); | 289 | spin_lock_irqsave(&metro_priv->lock, flags); |
@@ -288,7 +298,7 @@ static int metrousb_tiocmget(struct tty_struct *tty) | |||
288 | struct metrousb_private *metro_priv = usb_get_serial_port_data(port); | 298 | struct metrousb_private *metro_priv = usb_get_serial_port_data(port); |
289 | unsigned long flags = 0; | 299 | unsigned long flags = 0; |
290 | 300 | ||
291 | dbg("METRO-USB - %s - port number=%d", __FUNCTION__, port->number); | 301 | dev_dbg(tty->dev, "%s\n", __func__); |
292 | 302 | ||
293 | spin_lock_irqsave(&metro_priv->lock, flags); | 303 | spin_lock_irqsave(&metro_priv->lock, flags); |
294 | control_state = metro_priv->control_state; | 304 | control_state = metro_priv->control_state; |
@@ -306,7 +316,7 @@ static int metrousb_tiocmset(struct tty_struct *tty, | |||
306 | unsigned long flags = 0; | 316 | unsigned long flags = 0; |
307 | unsigned long control_state = 0; | 317 | unsigned long control_state = 0; |
308 | 318 | ||
309 | dbg("METRO-USB - %s - port number=%d, set=%d, clear=%d", __FUNCTION__, port->number, set, clear); | 319 | dev_dbg(tty->dev, "%s - set=%d, clear=%d\n", __func__, set, clear); |
310 | 320 | ||
311 | spin_lock_irqsave(&metro_priv->lock, flags); | 321 | spin_lock_irqsave(&metro_priv->lock, flags); |
312 | control_state = metro_priv->control_state; | 322 | control_state = metro_priv->control_state; |
@@ -333,7 +343,7 @@ static void metrousb_unthrottle(struct tty_struct *tty) | |||
333 | unsigned long flags = 0; | 343 | unsigned long flags = 0; |
334 | int result = 0; | 344 | int result = 0; |
335 | 345 | ||
336 | dbg("METRO-USB - %s - port number=%d", __FUNCTION__, port->number); | 346 | dev_dbg(tty->dev, "%s\n", __func__); |
337 | 347 | ||
338 | /* Set the private information for the port to resume reading data. */ | 348 | /* Set the private information for the port to resume reading data. */ |
339 | spin_lock_irqsave(&metro_priv->lock, flags); | 349 | spin_lock_irqsave(&metro_priv->lock, flags); |
@@ -343,10 +353,10 @@ static void metrousb_unthrottle(struct tty_struct *tty) | |||
343 | /* Submit the urb to read from the port. */ | 353 | /* Submit the urb to read from the port. */ |
344 | port->interrupt_in_urb->dev = port->serial->dev; | 354 | port->interrupt_in_urb->dev = port->serial->dev; |
345 | result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); | 355 | result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); |
346 | if (result) { | 356 | if (result) |
347 | dbg("METRO-USB - %s - failed submitting interrupt in urb for port number=%d, error code=%d", | 357 | dev_dbg(tty->dev, |
348 | __FUNCTION__, port->number, result); | 358 | "failed submitting interrupt in urb error code=%d\n", |
349 | } | 359 | result); |
350 | } | 360 | } |
351 | 361 | ||
352 | static struct usb_driver metrousb_driver = { | 362 | static struct usb_driver metrousb_driver = { |