usb: Simplify imports from usb_util

The devices crate imports things from usb_util which is a separate
crate. Importing from a crate normally looks like:

    use name_of_crate::path::to::ThingToImport;

In the case it would be e.g.:

    use usb_util::hotplug::UsbHotplugHandler;

Importing these things through crate::usb::usb_util is unnecessary.

TEST=cargo check

Change-Id: I70554639a71b2423c1e13a30361d5f9d92e9d9a9
Reviewed-on: https://chromium-review.googlesource.com/1565725
Commit-Ready: David Tolnay <dtolnay@chromium.org>
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: David Tolnay <dtolnay@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jingkui Wang <jkwang@google.com>
This commit is contained in:
David Tolnay 2019-04-12 11:42:35 -07:00 committed by chrome-bot
parent a70a2193ad
commit e50ba38a7d
7 changed files with 25 additions and 25 deletions

View file

@ -3,14 +3,14 @@
// found in the LICENSE file.
use super::error::*;
use crate::usb::usb_util::hotplug::UsbHotplugHandler;
use crate::usb::usb_util::libusb_context::{LibUsbContext, LibUsbPollfdChangeHandler};
use crate::usb::usb_util::libusb_device::LibUsbDevice;
use crate::utils::{EventHandler, EventLoop};
use std::os::raw::c_short;
use std::os::unix::io::RawFd;
use std::sync::{Arc, Weak};
use sys_util::WatchingEvents;
use usb_util::hotplug::UsbHotplugHandler;
use usb_util::libusb_context::{LibUsbContext, LibUsbPollfdChangeHandler};
use usb_util::libusb_device::LibUsbDevice;
use vm_control::MaybeOwnedFd;
/// Context wraps libusb context with libusb event handling.

View file

@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use crate::usb::usb_util::error::Error as UsbUtilError;
use crate::usb::xhci::scatter_gather_buffer::Error as BufferError;
use crate::usb::xhci::xhci_transfer::Error as XhciTransferError;
use crate::utils::Error as UtilsError;
use msg_socket::MsgError;
use std::fmt::{self, Display};
use usb_util::error::Error as UsbUtilError;
#[derive(Debug)]
pub enum Error {

View file

@ -9,22 +9,22 @@ use sync::Mutex;
use super::error::*;
use super::usb_endpoint::UsbEndpoint;
use super::utils::{submit_transfer, update_transfer_state};
use crate::usb::usb_util::device_handle::DeviceHandle;
use crate::usb::usb_util::error::Error as LibUsbError;
use crate::usb::usb_util::libusb_device::LibUsbDevice;
use crate::usb::usb_util::types::{
ControlRequestDataPhaseTransferDirection, ControlRequestRecipient, ControlRequestType,
StandardControlRequest, UsbRequestSetup,
};
use crate::usb::usb_util::usb_transfer::{
control_transfer, ControlTransferBuffer, TransferStatus, UsbTransfer,
};
use crate::usb::xhci::scatter_gather_buffer::ScatterGatherBuffer;
use crate::usb::xhci::xhci_backend_device::{BackendType, UsbDeviceAddress, XhciBackendDevice};
use crate::usb::xhci::xhci_transfer::{XhciTransfer, XhciTransferState, XhciTransferType};
use crate::utils::AsyncJobQueue;
use crate::utils::FailHandle;
use std::collections::HashMap;
use usb_util::device_handle::DeviceHandle;
use usb_util::error::Error as LibUsbError;
use usb_util::libusb_device::LibUsbDevice;
use usb_util::types::{
ControlRequestDataPhaseTransferDirection, ControlRequestRecipient, ControlRequestType,
StandardControlRequest, UsbRequestSetup,
};
use usb_util::usb_transfer::{
control_transfer, ControlTransferBuffer, TransferStatus, UsbTransfer,
};
#[derive(PartialEq)]
pub enum ControlEndpointState {

View file

@ -4,9 +4,9 @@
use std::sync::Arc;
use crate::usb::usb_util::hotplug::{HotplugEvent, UsbHotplugHandler};
use crate::usb::usb_util::libusb_device::LibUsbDevice;
use crate::usb::xhci::usb_hub::UsbHub;
use usb_util::hotplug::{HotplugEvent, UsbHotplugHandler};
use usb_util::libusb_device::LibUsbDevice;
pub struct HotplugHandler {
hub: Arc<UsbHub>,

View file

@ -8,17 +8,17 @@ use sync::Mutex;
use super::error::*;
use super::utils::{submit_transfer, update_transfer_state};
use crate::usb::usb_util::device_handle::DeviceHandle;
use crate::usb::usb_util::types::{EndpointDirection, EndpointType, ENDPOINT_DIRECTION_OFFSET};
use crate::usb::usb_util::usb_transfer::{
bulk_transfer, interrupt_transfer, BulkTransferBuffer, TransferStatus, UsbTransfer,
};
use crate::usb::xhci::scatter_gather_buffer::ScatterGatherBuffer;
use crate::usb::xhci::xhci_transfer::{
TransferDirection, XhciTransfer, XhciTransferState, XhciTransferType,
};
use crate::utils::AsyncJobQueue;
use crate::utils::FailHandle;
use usb_util::device_handle::DeviceHandle;
use usb_util::types::{EndpointDirection, EndpointType, ENDPOINT_DIRECTION_OFFSET};
use usb_util::usb_transfer::{
bulk_transfer, interrupt_transfer, BulkTransferBuffer, TransferStatus, UsbTransfer,
};
/// Isochronous, Bulk or Interrupt endpoint.
pub struct UsbEndpoint {

View file

@ -7,11 +7,11 @@ use std::sync::Arc;
use sync::Mutex;
use super::error::*;
use crate::usb::usb_util::device_handle::DeviceHandle;
use crate::usb::usb_util::usb_transfer::{TransferStatus, UsbTransfer, UsbTransferBuffer};
use crate::usb::xhci::xhci_transfer::{XhciTransfer, XhciTransferState};
use crate::utils::AsyncJobQueue;
use crate::utils::FailHandle;
use usb_util::device_handle::DeviceHandle;
use usb_util::usb_transfer::{TransferStatus, UsbTransfer, UsbTransferBuffer};
/// Helper function to update xhci_transfer state.
pub fn update_transfer_state<T: UsbTransferBuffer>(

View file

@ -10,14 +10,14 @@ use super::xhci_abi::{
TrbCompletionCode, TrbType,
};
use super::xhci_regs::MAX_INTERRUPTER;
use crate::usb::usb_util::types::UsbRequestSetup;
use crate::usb::usb_util::usb_transfer::TransferStatus;
use std::cmp::min;
use std::fmt::{self, Display};
use std::mem;
use std::sync::{Arc, Weak};
use sync::Mutex;
use sys_util::{Error as SysError, EventFd, GuestMemory};
use usb_util::types::UsbRequestSetup;
use usb_util::usb_transfer::TransferStatus;
#[derive(Debug)]
pub enum Error {