aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAndrzej Pietrasiewicz <andrzej.p@samsung.com>2013-03-14 11:02:12 -0400
committerFelipe Balbi <balbi@ti.com>2013-04-03 07:43:34 -0400
commit70cc3c024640a3c60e91d04789f9574a371a2db5 (patch)
tree9c436bfa045554a84a41da60f4e518eb44b04640 /drivers
parent60540ea2c51fa4feb475f689adce56297cb52010 (diff)
usb: gadget: serial: convert to new interface of f_serial
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/gadget/Kconfig1
-rw-r--r--drivers/usb/gadget/serial.c25
2 files changed, 8 insertions, 18 deletions
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 8a08efbb11e7..93217fc86c12 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -762,6 +762,7 @@ config USB_G_SERIAL
762 depends on TTY 762 depends on TTY
763 select USB_U_SERIAL 763 select USB_U_SERIAL
764 select USB_F_ACM 764 select USB_F_ACM
765 select USB_F_SERIAL
765 select USB_LIBCOMPOSITE 766 select USB_LIBCOMPOSITE
766 help 767 help
767 The Serial Gadget talks to the Linux-USB generic serial driver. 768 The Serial Gadget talks to the Linux-USB generic serial driver.
diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c
index 07c1e802f917..9d215c4c2275 100644
--- a/drivers/usb/gadget/serial.c
+++ b/drivers/usb/gadget/serial.c
@@ -37,8 +37,6 @@
37 * a "gcc --combine ... part1.c part2.c part3.c ... " build would. 37 * a "gcc --combine ... part1.c part2.c part3.c ... " build would.
38 */ 38 */
39#include "f_obex.c" 39#include "f_obex.c"
40#define USB_FSERIAL_INCLUDED
41#include "f_serial.c"
42 40
43/*-------------------------------------------------------------------------*/ 41/*-------------------------------------------------------------------------*/
44USB_GADGET_COMPOSITE_OPTIONS(); 42USB_GADGET_COMPOSITE_OPTIONS();
@@ -139,16 +137,6 @@ static int __init serial_bind_obex_config(struct usb_configuration *c)
139 return status; 137 return status;
140} 138}
141 139
142static int __init serial_bind_gser_config(struct usb_configuration *c)
143{
144 unsigned i;
145 int status = 0;
146
147 for (i = 0; i < n_ports && status == 0; i++)
148 status = gser_bind_config(c, tty_lines[i]);
149 return status;
150}
151
152static struct usb_configuration serial_config_driver = { 140static struct usb_configuration serial_config_driver = {
153 /* .label = f(use_acm) */ 141 /* .label = f(use_acm) */
154 /* .bConfigurationValue = f(use_acm) */ 142 /* .bConfigurationValue = f(use_acm) */
@@ -212,7 +200,7 @@ static int __init gs_bind(struct usb_composite_dev *cdev)
212 int status; 200 int status;
213 int cur_line = 0; 201 int cur_line = 0;
214 202
215 if (!use_acm) { 203 if (use_obex) {
216 for (cur_line = 0; cur_line < n_ports; cur_line++) { 204 for (cur_line = 0; cur_line < n_ports; cur_line++) {
217 status = gserial_alloc_line(&tty_lines[cur_line]); 205 status = gserial_alloc_line(&tty_lines[cur_line]);
218 if (status) 206 if (status)
@@ -245,9 +233,10 @@ static int __init gs_bind(struct usb_composite_dev *cdev)
245 } else if (use_obex) 233 } else if (use_obex)
246 status = usb_add_config(cdev, &serial_config_driver, 234 status = usb_add_config(cdev, &serial_config_driver,
247 serial_bind_obex_config); 235 serial_bind_obex_config);
248 else 236 else {
249 status = usb_add_config(cdev, &serial_config_driver, 237 status = serial_register_ports(cdev, &serial_config_driver,
250 serial_bind_gser_config); 238 "gser");
239 }
251 if (status < 0) 240 if (status < 0)
252 goto fail; 241 goto fail;
253 242
@@ -258,7 +247,7 @@ static int __init gs_bind(struct usb_composite_dev *cdev)
258 247
259fail: 248fail:
260 cur_line--; 249 cur_line--;
261 while (cur_line >= 0 && !use_acm) 250 while (cur_line >= 0 && use_obex)
262 gserial_free_line(tty_lines[cur_line--]); 251 gserial_free_line(tty_lines[cur_line--]);
263 return status; 252 return status;
264} 253}
@@ -270,7 +259,7 @@ static int gs_unbind(struct usb_composite_dev *cdev)
270 for (i = 0; i < n_ports; i++) { 259 for (i = 0; i < n_ports; i++) {
271 usb_put_function(f_serial[i]); 260 usb_put_function(f_serial[i]);
272 usb_put_function_instance(fi_serial[i]); 261 usb_put_function_instance(fi_serial[i]);
273 if (!use_acm) 262 if (use_obex)
274 gserial_free_line(tty_lines[i]); 263 gserial_free_line(tty_lines[i]);
275 } 264 }
276 return 0; 265 return 0;