diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2012-12-23 15:10:18 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2013-04-03 07:43:31 -0400 |
commit | c4ed4ac198495895fd1620cba15184c3b2d399dc (patch) | |
tree | 4b6d1601559aed0d29f8348c7460828d1ec27d85 /drivers/usb/gadget/serial.c | |
parent | d6a0143985489e470a118605352f4b18df0ce142 (diff) |
usb: gadget: push tty port allocation from gadget into f_acm
It possible to allocate the tty port number within the "instance"
structure of the function and there is no need to expose this
information within the gadget and therefore it is removed here.
This patch converts only f_acm and all its users. The other gadgets will
follow once the function is converted to the function interface.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/serial.c')
-rw-r--r-- | drivers/usb/gadget/serial.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c index 68d7bb06ebcb..c48ca1eb5442 100644 --- a/drivers/usb/gadget/serial.c +++ b/drivers/usb/gadget/serial.c | |||
@@ -169,15 +169,12 @@ static int serial_register_ports(struct usb_composite_dev *cdev, | |||
169 | goto out; | 169 | goto out; |
170 | 170 | ||
171 | for (i = 0; i < n_ports; i++) { | 171 | for (i = 0; i < n_ports; i++) { |
172 | struct f_serial_opts *opts; | ||
173 | 172 | ||
174 | fi_serial[i] = usb_get_function_instance(f_name); | 173 | fi_serial[i] = usb_get_function_instance(f_name); |
175 | if (IS_ERR(fi_serial[i])) { | 174 | if (IS_ERR(fi_serial[i])) { |
176 | ret = PTR_ERR(fi_serial[i]); | 175 | ret = PTR_ERR(fi_serial[i]); |
177 | goto fail; | 176 | goto fail; |
178 | } | 177 | } |
179 | opts = container_of(fi_serial[i], struct f_serial_opts, func_inst); | ||
180 | opts->port_num = tty_lines[i]; | ||
181 | 178 | ||
182 | f_serial[i] = usb_get_function(fi_serial[i]); | 179 | f_serial[i] = usb_get_function(fi_serial[i]); |
183 | if (IS_ERR(f_serial[i])) { | 180 | if (IS_ERR(f_serial[i])) { |
@@ -212,12 +209,14 @@ out: | |||
212 | static int __init gs_bind(struct usb_composite_dev *cdev) | 209 | static int __init gs_bind(struct usb_composite_dev *cdev) |
213 | { | 210 | { |
214 | int status; | 211 | int status; |
215 | int cur_line; | 212 | int cur_line = 0; |
216 | 213 | ||
217 | for (cur_line = 0; cur_line < n_ports; cur_line++) { | 214 | if (!use_acm) { |
218 | status = gserial_alloc_line(&tty_lines[cur_line]); | 215 | for (cur_line = 0; cur_line < n_ports; cur_line++) { |
219 | if (status) | 216 | status = gserial_alloc_line(&tty_lines[cur_line]); |
220 | goto fail; | 217 | if (status) |
218 | goto fail; | ||
219 | } | ||
221 | } | 220 | } |
222 | 221 | ||
223 | /* Allocate string descriptor numbers ... note that string | 222 | /* Allocate string descriptor numbers ... note that string |
@@ -258,7 +257,7 @@ static int __init gs_bind(struct usb_composite_dev *cdev) | |||
258 | 257 | ||
259 | fail: | 258 | fail: |
260 | cur_line--; | 259 | cur_line--; |
261 | while (cur_line >= 0) | 260 | while (cur_line >= 0 && !use_acm) |
262 | gserial_free_line(tty_lines[cur_line--]); | 261 | gserial_free_line(tty_lines[cur_line--]); |
263 | return status; | 262 | return status; |
264 | } | 263 | } |
@@ -270,7 +269,8 @@ static int gs_unbind(struct usb_composite_dev *cdev) | |||
270 | for (i = 0; i < n_ports; i++) { | 269 | for (i = 0; i < n_ports; i++) { |
271 | usb_put_function(f_serial[i]); | 270 | usb_put_function(f_serial[i]); |
272 | usb_put_function_instance(fi_serial[i]); | 271 | usb_put_function_instance(fi_serial[i]); |
273 | gserial_free_line(tty_lines[i]); | 272 | if (!use_acm) |
273 | gserial_free_line(tty_lines[i]); | ||
274 | } | 274 | } |
275 | return 0; | 275 | return 0; |
276 | } | 276 | } |