diff options
author | Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> | 2011-09-30 07:07:30 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2011-10-13 13:38:38 -0400 |
commit | 12158f4280b4d42ef03b70a47d11b48dd8aad511 (patch) | |
tree | 7a0dc943e44459eba3e517b539d4f991415223f3 /drivers/usb/gadget/r8a66597-udc.c | |
parent | 5c481a639068ac34bd1dcd183f37b7a65d0e3841 (diff) |
usb: gadget: r8a66597-udc: use dev_*() instead of printk()
This patch also fix the balance of braces.
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/r8a66597-udc.c')
-rw-r--r-- | drivers/usb/gadget/r8a66597-udc.c | 99 |
1 files changed, 59 insertions, 40 deletions
diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c index 60c62e418f0e..34abb12a88e8 100644 --- a/drivers/usb/gadget/r8a66597-udc.c +++ b/drivers/usb/gadget/r8a66597-udc.c | |||
@@ -105,13 +105,15 @@ static inline u16 control_reg_get_pid(struct r8a66597 *r8a66597, u16 pipenum) | |||
105 | u16 pid = 0; | 105 | u16 pid = 0; |
106 | unsigned long offset; | 106 | unsigned long offset; |
107 | 107 | ||
108 | if (pipenum == 0) | 108 | if (pipenum == 0) { |
109 | pid = r8a66597_read(r8a66597, DCPCTR) & PID; | 109 | pid = r8a66597_read(r8a66597, DCPCTR) & PID; |
110 | else if (pipenum < R8A66597_MAX_NUM_PIPE) { | 110 | } else if (pipenum < R8A66597_MAX_NUM_PIPE) { |
111 | offset = get_pipectr_addr(pipenum); | 111 | offset = get_pipectr_addr(pipenum); |
112 | pid = r8a66597_read(r8a66597, offset) & PID; | 112 | pid = r8a66597_read(r8a66597, offset) & PID; |
113 | } else | 113 | } else { |
114 | printk(KERN_ERR "unexpect pipe num (%d)\n", pipenum); | 114 | dev_err(r8a66597_to_dev(r8a66597), "unexpect pipe num (%d)\n", |
115 | pipenum); | ||
116 | } | ||
115 | 117 | ||
116 | return pid; | 118 | return pid; |
117 | } | 119 | } |
@@ -121,13 +123,15 @@ static inline void control_reg_set_pid(struct r8a66597 *r8a66597, u16 pipenum, | |||
121 | { | 123 | { |
122 | unsigned long offset; | 124 | unsigned long offset; |
123 | 125 | ||
124 | if (pipenum == 0) | 126 | if (pipenum == 0) { |
125 | r8a66597_mdfy(r8a66597, pid, PID, DCPCTR); | 127 | r8a66597_mdfy(r8a66597, pid, PID, DCPCTR); |
126 | else if (pipenum < R8A66597_MAX_NUM_PIPE) { | 128 | } else if (pipenum < R8A66597_MAX_NUM_PIPE) { |
127 | offset = get_pipectr_addr(pipenum); | 129 | offset = get_pipectr_addr(pipenum); |
128 | r8a66597_mdfy(r8a66597, pid, PID, offset); | 130 | r8a66597_mdfy(r8a66597, pid, PID, offset); |
129 | } else | 131 | } else { |
130 | printk(KERN_ERR "unexpect pipe num (%d)\n", pipenum); | 132 | dev_err(r8a66597_to_dev(r8a66597), "unexpect pipe num (%d)\n", |
133 | pipenum); | ||
134 | } | ||
131 | } | 135 | } |
132 | 136 | ||
133 | static inline void pipe_start(struct r8a66597 *r8a66597, u16 pipenum) | 137 | static inline void pipe_start(struct r8a66597 *r8a66597, u16 pipenum) |
@@ -150,13 +154,15 @@ static inline u16 control_reg_get(struct r8a66597 *r8a66597, u16 pipenum) | |||
150 | u16 ret = 0; | 154 | u16 ret = 0; |
151 | unsigned long offset; | 155 | unsigned long offset; |
152 | 156 | ||
153 | if (pipenum == 0) | 157 | if (pipenum == 0) { |
154 | ret = r8a66597_read(r8a66597, DCPCTR); | 158 | ret = r8a66597_read(r8a66597, DCPCTR); |
155 | else if (pipenum < R8A66597_MAX_NUM_PIPE) { | 159 | } else if (pipenum < R8A66597_MAX_NUM_PIPE) { |
156 | offset = get_pipectr_addr(pipenum); | 160 | offset = get_pipectr_addr(pipenum); |
157 | ret = r8a66597_read(r8a66597, offset); | 161 | ret = r8a66597_read(r8a66597, offset); |
158 | } else | 162 | } else { |
159 | printk(KERN_ERR "unexpect pipe num (%d)\n", pipenum); | 163 | dev_err(r8a66597_to_dev(r8a66597), "unexpect pipe num (%d)\n", |
164 | pipenum); | ||
165 | } | ||
160 | 166 | ||
161 | return ret; | 167 | return ret; |
162 | } | 168 | } |
@@ -167,13 +173,15 @@ static inline void control_reg_sqclr(struct r8a66597 *r8a66597, u16 pipenum) | |||
167 | 173 | ||
168 | pipe_stop(r8a66597, pipenum); | 174 | pipe_stop(r8a66597, pipenum); |
169 | 175 | ||
170 | if (pipenum == 0) | 176 | if (pipenum == 0) { |
171 | r8a66597_bset(r8a66597, SQCLR, DCPCTR); | 177 | r8a66597_bset(r8a66597, SQCLR, DCPCTR); |
172 | else if (pipenum < R8A66597_MAX_NUM_PIPE) { | 178 | } else if (pipenum < R8A66597_MAX_NUM_PIPE) { |
173 | offset = get_pipectr_addr(pipenum); | 179 | offset = get_pipectr_addr(pipenum); |
174 | r8a66597_bset(r8a66597, SQCLR, offset); | 180 | r8a66597_bset(r8a66597, SQCLR, offset); |
175 | } else | 181 | } else { |
176 | printk(KERN_ERR "unexpect pipe num(%d)\n", pipenum); | 182 | dev_err(r8a66597_to_dev(r8a66597), "unexpect pipe num (%d)\n", |
183 | pipenum); | ||
184 | } | ||
177 | } | 185 | } |
178 | 186 | ||
179 | static inline int get_buffer_size(struct r8a66597 *r8a66597, u16 pipenum) | 187 | static inline int get_buffer_size(struct r8a66597 *r8a66597, u16 pipenum) |
@@ -287,17 +295,18 @@ static void pipe_buffer_release(struct r8a66597 *r8a66597, | |||
287 | if (info->pipe == 0) | 295 | if (info->pipe == 0) |
288 | return; | 296 | return; |
289 | 297 | ||
290 | if (is_bulk_pipe(info->pipe)) | 298 | if (is_bulk_pipe(info->pipe)) { |
291 | r8a66597->bulk--; | 299 | r8a66597->bulk--; |
292 | else if (is_interrupt_pipe(info->pipe)) | 300 | } else if (is_interrupt_pipe(info->pipe)) { |
293 | r8a66597->interrupt--; | 301 | r8a66597->interrupt--; |
294 | else if (is_isoc_pipe(info->pipe)) { | 302 | } else if (is_isoc_pipe(info->pipe)) { |
295 | r8a66597->isochronous--; | 303 | r8a66597->isochronous--; |
296 | if (info->type == R8A66597_BULK) | 304 | if (info->type == R8A66597_BULK) |
297 | r8a66597->bulk--; | 305 | r8a66597->bulk--; |
298 | } else | 306 | } else { |
299 | printk(KERN_ERR "ep_release: unexpect pipenum (%d)\n", | 307 | dev_err(r8a66597_to_dev(r8a66597), |
300 | info->pipe); | 308 | "ep_release: unexpect pipenum (%d)\n", info->pipe); |
309 | } | ||
301 | } | 310 | } |
302 | 311 | ||
303 | static void pipe_initialize(struct r8a66597_ep *ep) | 312 | static void pipe_initialize(struct r8a66597_ep *ep) |
@@ -371,7 +380,8 @@ static int alloc_pipe_config(struct r8a66597_ep *ep, | |||
371 | case USB_ENDPOINT_XFER_BULK: | 380 | case USB_ENDPOINT_XFER_BULK: |
372 | if (r8a66597->bulk >= R8A66597_MAX_NUM_BULK) { | 381 | if (r8a66597->bulk >= R8A66597_MAX_NUM_BULK) { |
373 | if (r8a66597->isochronous >= R8A66597_MAX_NUM_ISOC) { | 382 | if (r8a66597->isochronous >= R8A66597_MAX_NUM_ISOC) { |
374 | printk(KERN_ERR "bulk pipe is insufficient\n"); | 383 | dev_err(r8a66597_to_dev(r8a66597), |
384 | "bulk pipe is insufficient\n"); | ||
375 | return -ENODEV; | 385 | return -ENODEV; |
376 | } else { | 386 | } else { |
377 | info.pipe = R8A66597_BASE_PIPENUM_ISOC | 387 | info.pipe = R8A66597_BASE_PIPENUM_ISOC |
@@ -387,7 +397,8 @@ static int alloc_pipe_config(struct r8a66597_ep *ep, | |||
387 | break; | 397 | break; |
388 | case USB_ENDPOINT_XFER_INT: | 398 | case USB_ENDPOINT_XFER_INT: |
389 | if (r8a66597->interrupt >= R8A66597_MAX_NUM_INT) { | 399 | if (r8a66597->interrupt >= R8A66597_MAX_NUM_INT) { |
390 | printk(KERN_ERR "interrupt pipe is insufficient\n"); | 400 | dev_err(r8a66597_to_dev(r8a66597), |
401 | "interrupt pipe is insufficient\n"); | ||
391 | return -ENODEV; | 402 | return -ENODEV; |
392 | } | 403 | } |
393 | info.pipe = R8A66597_BASE_PIPENUM_INT + r8a66597->interrupt; | 404 | info.pipe = R8A66597_BASE_PIPENUM_INT + r8a66597->interrupt; |
@@ -396,7 +407,8 @@ static int alloc_pipe_config(struct r8a66597_ep *ep, | |||
396 | break; | 407 | break; |
397 | case USB_ENDPOINT_XFER_ISOC: | 408 | case USB_ENDPOINT_XFER_ISOC: |
398 | if (r8a66597->isochronous >= R8A66597_MAX_NUM_ISOC) { | 409 | if (r8a66597->isochronous >= R8A66597_MAX_NUM_ISOC) { |
399 | printk(KERN_ERR "isochronous pipe is insufficient\n"); | 410 | dev_err(r8a66597_to_dev(r8a66597), |
411 | "isochronous pipe is insufficient\n"); | ||
400 | return -ENODEV; | 412 | return -ENODEV; |
401 | } | 413 | } |
402 | info.pipe = R8A66597_BASE_PIPENUM_ISOC + r8a66597->isochronous; | 414 | info.pipe = R8A66597_BASE_PIPENUM_ISOC + r8a66597->isochronous; |
@@ -404,7 +416,7 @@ static int alloc_pipe_config(struct r8a66597_ep *ep, | |||
404 | counter = &r8a66597->isochronous; | 416 | counter = &r8a66597->isochronous; |
405 | break; | 417 | break; |
406 | default: | 418 | default: |
407 | printk(KERN_ERR "unexpect xfer type\n"); | 419 | dev_err(r8a66597_to_dev(r8a66597), "unexpect xfer type\n"); |
408 | return -EINVAL; | 420 | return -EINVAL; |
409 | } | 421 | } |
410 | ep->type = info.type; | 422 | ep->type = info.type; |
@@ -419,7 +431,8 @@ static int alloc_pipe_config(struct r8a66597_ep *ep, | |||
419 | 431 | ||
420 | ret = pipe_buffer_setting(r8a66597, &info); | 432 | ret = pipe_buffer_setting(r8a66597, &info); |
421 | if (ret < 0) { | 433 | if (ret < 0) { |
422 | printk(KERN_ERR "pipe_buffer_setting fail\n"); | 434 | dev_err(r8a66597_to_dev(r8a66597), |
435 | "pipe_buffer_setting fail\n"); | ||
423 | return ret; | 436 | return ret; |
424 | } | 437 | } |
425 | 438 | ||
@@ -554,7 +567,8 @@ static void start_ep0(struct r8a66597_ep *ep, struct r8a66597_request *req) | |||
554 | control_end(ep->r8a66597, 0); | 567 | control_end(ep->r8a66597, 0); |
555 | break; | 568 | break; |
556 | default: | 569 | default: |
557 | printk(KERN_ERR "start_ep0: unexpect ctsq(%x)\n", ctsq); | 570 | dev_err(r8a66597_to_dev(ep->r8a66597), |
571 | "start_ep0: unexpect ctsq(%x)\n", ctsq); | ||
558 | break; | 572 | break; |
559 | } | 573 | } |
560 | } | 574 | } |
@@ -708,7 +722,8 @@ static void irq_ep0_write(struct r8a66597_ep *ep, struct r8a66597_request *req) | |||
708 | do { | 722 | do { |
709 | tmp = r8a66597_read(r8a66597, ep->fifoctr); | 723 | tmp = r8a66597_read(r8a66597, ep->fifoctr); |
710 | if (i++ > 100000) { | 724 | if (i++ > 100000) { |
711 | printk(KERN_ERR "pipe0 is busy. maybe cpu i/o bus" | 725 | dev_err(r8a66597_to_dev(r8a66597), |
726 | "pipe0 is busy. maybe cpu i/o bus " | ||
712 | "conflict. please power off this controller."); | 727 | "conflict. please power off this controller."); |
713 | return; | 728 | return; |
714 | } | 729 | } |
@@ -759,7 +774,8 @@ static void irq_packet_write(struct r8a66597_ep *ep, | |||
759 | if (unlikely((tmp & FRDY) == 0)) { | 774 | if (unlikely((tmp & FRDY) == 0)) { |
760 | pipe_stop(r8a66597, pipenum); | 775 | pipe_stop(r8a66597, pipenum); |
761 | pipe_irq_disable(r8a66597, pipenum); | 776 | pipe_irq_disable(r8a66597, pipenum); |
762 | printk(KERN_ERR "write fifo not ready. pipnum=%d\n", pipenum); | 777 | dev_err(r8a66597_to_dev(r8a66597), |
778 | "write fifo not ready. pipnum=%d\n", pipenum); | ||
763 | return; | 779 | return; |
764 | } | 780 | } |
765 | 781 | ||
@@ -809,7 +825,7 @@ static void irq_packet_read(struct r8a66597_ep *ep, | |||
809 | req->req.status = -EPIPE; | 825 | req->req.status = -EPIPE; |
810 | pipe_stop(r8a66597, pipenum); | 826 | pipe_stop(r8a66597, pipenum); |
811 | pipe_irq_disable(r8a66597, pipenum); | 827 | pipe_irq_disable(r8a66597, pipenum); |
812 | printk(KERN_ERR "read fifo not ready"); | 828 | dev_err(r8a66597_to_dev(r8a66597), "read fifo not ready"); |
813 | return; | 829 | return; |
814 | } | 830 | } |
815 | 831 | ||
@@ -1085,7 +1101,7 @@ static void r8a66597_update_usb_speed(struct r8a66597 *r8a66597) | |||
1085 | break; | 1101 | break; |
1086 | default: | 1102 | default: |
1087 | r8a66597->gadget.speed = USB_SPEED_UNKNOWN; | 1103 | r8a66597->gadget.speed = USB_SPEED_UNKNOWN; |
1088 | printk(KERN_ERR "USB speed unknown\n"); | 1104 | dev_err(r8a66597_to_dev(r8a66597), "USB speed unknown\n"); |
1089 | } | 1105 | } |
1090 | } | 1106 | } |
1091 | 1107 | ||
@@ -1148,7 +1164,8 @@ __acquires(r8a66597->lock) | |||
1148 | control_end(r8a66597, 0); | 1164 | control_end(r8a66597, 0); |
1149 | break; | 1165 | break; |
1150 | default: | 1166 | default: |
1151 | printk(KERN_ERR "ctrl_stage: unexpect ctsq(%x)\n", ctsq); | 1167 | dev_err(r8a66597_to_dev(r8a66597), |
1168 | "ctrl_stage: unexpect ctsq(%x)\n", ctsq); | ||
1152 | break; | 1169 | break; |
1153 | } | 1170 | } |
1154 | } | 1171 | } |
@@ -1448,13 +1465,15 @@ static int r8a66597_start(struct usb_gadget_driver *driver, | |||
1448 | 1465 | ||
1449 | retval = device_add(&r8a66597->gadget.dev); | 1466 | retval = device_add(&r8a66597->gadget.dev); |
1450 | if (retval) { | 1467 | if (retval) { |
1451 | printk(KERN_ERR "device_add error (%d)\n", retval); | 1468 | dev_err(r8a66597_to_dev(r8a66597), "device_add error (%d)\n", |
1469 | retval); | ||
1452 | goto error; | 1470 | goto error; |
1453 | } | 1471 | } |
1454 | 1472 | ||
1455 | retval = bind(&r8a66597->gadget); | 1473 | retval = bind(&r8a66597->gadget); |
1456 | if (retval) { | 1474 | if (retval) { |
1457 | printk(KERN_ERR "bind to driver error (%d)\n", retval); | 1475 | dev_err(r8a66597_to_dev(r8a66597), |
1476 | "bind to driver error (%d)\n", retval); | ||
1458 | device_del(&r8a66597->gadget.dev); | 1477 | device_del(&r8a66597->gadget.dev); |
1459 | goto error; | 1478 | goto error; |
1460 | } | 1479 | } |
@@ -1569,7 +1588,7 @@ static int __init r8a66597_probe(struct platform_device *pdev) | |||
1569 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1588 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1570 | if (!res) { | 1589 | if (!res) { |
1571 | ret = -ENODEV; | 1590 | ret = -ENODEV; |
1572 | printk(KERN_ERR "platform_get_resource error.\n"); | 1591 | dev_err(&pdev->dev, "platform_get_resource error.\n"); |
1573 | goto clean_up; | 1592 | goto clean_up; |
1574 | } | 1593 | } |
1575 | 1594 | ||
@@ -1579,14 +1598,14 @@ static int __init r8a66597_probe(struct platform_device *pdev) | |||
1579 | 1598 | ||
1580 | if (irq < 0) { | 1599 | if (irq < 0) { |
1581 | ret = -ENODEV; | 1600 | ret = -ENODEV; |
1582 | printk(KERN_ERR "platform_get_irq error.\n"); | 1601 | dev_err(&pdev->dev, "platform_get_irq error.\n"); |
1583 | goto clean_up; | 1602 | goto clean_up; |
1584 | } | 1603 | } |
1585 | 1604 | ||
1586 | reg = ioremap(res->start, resource_size(res)); | 1605 | reg = ioremap(res->start, resource_size(res)); |
1587 | if (reg == NULL) { | 1606 | if (reg == NULL) { |
1588 | ret = -ENOMEM; | 1607 | ret = -ENOMEM; |
1589 | printk(KERN_ERR "ioremap error.\n"); | 1608 | dev_err(&pdev->dev, "ioremap error.\n"); |
1590 | goto clean_up; | 1609 | goto clean_up; |
1591 | } | 1610 | } |
1592 | 1611 | ||
@@ -1594,7 +1613,7 @@ static int __init r8a66597_probe(struct platform_device *pdev) | |||
1594 | r8a66597 = kzalloc(sizeof(struct r8a66597), GFP_KERNEL); | 1613 | r8a66597 = kzalloc(sizeof(struct r8a66597), GFP_KERNEL); |
1595 | if (r8a66597 == NULL) { | 1614 | if (r8a66597 == NULL) { |
1596 | ret = -ENOMEM; | 1615 | ret = -ENOMEM; |
1597 | printk(KERN_ERR "kzalloc error\n"); | 1616 | dev_err(&pdev->dev, "kzalloc error\n"); |
1598 | goto clean_up; | 1617 | goto clean_up; |
1599 | } | 1618 | } |
1600 | 1619 | ||
@@ -1636,7 +1655,7 @@ static int __init r8a66597_probe(struct platform_device *pdev) | |||
1636 | ret = request_irq(irq, r8a66597_irq, IRQF_SHARED, | 1655 | ret = request_irq(irq, r8a66597_irq, IRQF_SHARED, |
1637 | udc_name, r8a66597); | 1656 | udc_name, r8a66597); |
1638 | if (ret < 0) { | 1657 | if (ret < 0) { |
1639 | printk(KERN_ERR "request_irq error (%d)\n", ret); | 1658 | dev_err(&pdev->dev, "request_irq error (%d)\n", ret); |
1640 | goto clean_up2; | 1659 | goto clean_up2; |
1641 | } | 1660 | } |
1642 | 1661 | ||