diff options
author | Treehugger Robot | 2018-05-16 18:25:15 -0500 |
---|---|---|
committer | Gerrit Code Review | 2018-05-16 18:25:15 -0500 |
commit | adf07c54283b1561c14ed908c86a31ce316343e7 (patch) | |
tree | d5142b57bb4056ef7b379f6c8f3938840b68496c | |
parent | e619ebc151b6ffc52d9920488d1da218142b0b62 (diff) | |
parent | d8c1ae910f70124cccd82670d70f27af7a0c6644 (diff) | |
download | platform-system-core-adf07c54283b1561c14ed908c86a31ce316343e7.tar.gz platform-system-core-adf07c54283b1561c14ed908c86a31ce316343e7.tar.xz platform-system-core-adf07c54283b1561c14ed908c86a31ce316343e7.zip |
Merge "adb: Move io_setup to usb_handle init"
-rw-r--r-- | adb/daemon/usb.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/adb/daemon/usb.cpp b/adb/daemon/usb.cpp index ab11bdd1b..fbf7276fe 100644 --- a/adb/daemon/usb.cpp +++ b/adb/daemon/usb.cpp | |||
@@ -234,6 +234,10 @@ static void aio_block_init(aio_block* aiob) { | |||
234 | for (unsigned i = 0; i < USB_FFS_NUM_BUFS; i++) { | 234 | for (unsigned i = 0; i < USB_FFS_NUM_BUFS; i++) { |
235 | aiob->iocbs[i] = &aiob->iocb[i]; | 235 | aiob->iocbs[i] = &aiob->iocb[i]; |
236 | } | 236 | } |
237 | memset(&aiob->ctx, 0, sizeof(aiob->ctx)); | ||
238 | if (io_setup(USB_FFS_NUM_BUFS, &aiob->ctx)) { | ||
239 | D("[ aio: got error on io_setup (%d) ]", errno); | ||
240 | } | ||
237 | } | 241 | } |
238 | 242 | ||
239 | static int getMaxPacketSize(int ffs_fd) { | 243 | static int getMaxPacketSize(int ffs_fd) { |
@@ -312,13 +316,6 @@ bool init_functionfs(struct usb_handle* h) { | |||
312 | goto err; | 316 | goto err; |
313 | } | 317 | } |
314 | 318 | ||
315 | memset(&h->read_aiob.ctx, 0, sizeof(h->read_aiob.ctx)); | ||
316 | memset(&h->write_aiob.ctx, 0, sizeof(h->write_aiob.ctx)); | ||
317 | if (io_setup(USB_FFS_NUM_BUFS, &h->read_aiob.ctx) || | ||
318 | io_setup(USB_FFS_NUM_BUFS, &h->write_aiob.ctx)) { | ||
319 | D("[ aio: got error on io_setup (%d) ]", errno); | ||
320 | } | ||
321 | |||
322 | h->read_aiob.fd = h->bulk_out; | 319 | h->read_aiob.fd = h->bulk_out; |
323 | h->write_aiob.fd = h->bulk_in; | 320 | h->write_aiob.fd = h->bulk_in; |
324 | return true; | 321 | return true; |
@@ -494,8 +491,6 @@ static void usb_ffs_close(usb_handle* h) { | |||
494 | h->kicked = false; | 491 | h->kicked = false; |
495 | adb_close(h->bulk_out); | 492 | adb_close(h->bulk_out); |
496 | adb_close(h->bulk_in); | 493 | adb_close(h->bulk_in); |
497 | io_destroy(h->read_aiob.ctx); | ||
498 | io_destroy(h->write_aiob.ctx); | ||
499 | 494 | ||
500 | // Notify usb_adb_open_thread to open a new connection. | 495 | // Notify usb_adb_open_thread to open a new connection. |
501 | h->lock.lock(); | 496 | h->lock.lock(); |