diff options
author | Martin Braun <martin.braun@ettus.com> | 2021-09-06 14:20:47 +0200 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2021-09-30 11:29:02 -0700 |
commit | 1beeca2bbafed1681518785530d3dfb9b2c56f42 (patch) | |
tree | fbdf3c2053c7e21a6eb9bcba0bb209efdf81f418 | |
parent | a0d77720dbce873baa5816f15348639ed02ea8ae (diff) | |
download | uhd-1beeca2bbafed1681518785530d3dfb9b2c56f42.tar.gz uhd-1beeca2bbafed1681518785530d3dfb9b2c56f42.tar.bz2 uhd-1beeca2bbafed1681518785530d3dfb9b2c56f42.zip |
libusb: Remove unused context variable
The USB managed buffer implementation created a context every time one
was generated.
The additional load is not very high, because the global session is a
singleton, and simply returns the same context again with only a few
branches. Also, managed buffers persist for the entire session.
However, the context is never used in the managed buffer.
This code is thus confusing for the reader of this code, and we remove
the extraneous, unused context variable.
-rw-r--r-- | host/lib/transport/libusb1_zero_copy.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/host/lib/transport/libusb1_zero_copy.cpp b/host/lib/transport/libusb1_zero_copy.cpp index 8cf76989b..fc36b36b7 100644 --- a/host/lib/transport/libusb1_zero_copy.cpp +++ b/host/lib/transport/libusb1_zero_copy.cpp @@ -108,6 +108,11 @@ static void LIBUSB_CALL libusb_async_cb(libusb_transfer* lut) * Reusable managed buffer: * - Associated with a particular libusb transfer struct. * - Submits the transfer to libusb in the release method. + * + * A note on the USB context: None of the libusb calls made in this class + * require passing in a USB context. The context is implied by virtue of the + * libusb_transfer struct we pass in, which contains a device handle, which + * contains a context. **********************************************************************/ class libusb_zero_copy_mb : public managed_buffer { @@ -120,7 +125,6 @@ public: : _release_cb(release_cb) , _is_recv(is_recv) , _name(name) - , _ctx(libusb::session::get_global_session()->get_context()) , _lut(lut) , _frame_size(frame_size) { /* NOP */ @@ -194,7 +198,6 @@ private: std::function<void(libusb_zero_copy_mb*)> _release_cb; const bool _is_recv; const std::string _name; - libusb_context* _ctx; libusb_transfer* _lut; const size_t _frame_size; }; |