From a9d3ce1e82a263089305b1de38b46d4bf77d4fa5 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Wed, 2 May 2018 13:48:38 +0200 Subject: [PATCH] lib: Rename all instances of "udev" to "usb_dev" Because otherwise it's going to get really confusing when we add udev-based device discovery. https://bugs.freedesktop.org/show_bug.cgi?id=106279 --- libfprint/async.c | 8 ++++---- libfprint/core.c | 20 ++++++++++---------- libfprint/imgdev.c | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/libfprint/async.c b/libfprint/async.c index 2b752ee..1ead745 100644 --- a/libfprint/async.c +++ b/libfprint/async.c @@ -41,7 +41,7 @@ API_EXPORTED int fp_async_dev_open(struct fp_dscv_dev *ddev, fp_dev_open_cb cb, { struct fp_driver *drv = ddev->drv; struct fp_dev *dev; - libusb_device_handle *udevh; + libusb_device_handle *usb_devh; int r; fp_dbg(""); @@ -51,7 +51,7 @@ API_EXPORTED int fp_async_dev_open(struct fp_dscv_dev *ddev, fp_dev_open_cb cb, return -1; } - r = libusb_open(ddev->dev.usb_dev, &udevh); + r = libusb_open(ddev->dev.usb_dev, &usb_devh); if (r < 0) { fp_err("usb_open failed, error %d", r); return r; @@ -60,7 +60,7 @@ API_EXPORTED int fp_async_dev_open(struct fp_dscv_dev *ddev, fp_dev_open_cb cb, dev = g_malloc0(sizeof(*dev)); dev->drv = drv; dev->bus = ddev->bus; - dev->desc.usb_dev = udevh; + dev->desc.usb_dev = usb_devh; dev->__enroll_stage = -1; dev->state = DEV_STATE_INITIALIZING; dev->open_cb = cb; @@ -75,7 +75,7 @@ API_EXPORTED int fp_async_dev_open(struct fp_dscv_dev *ddev, fp_dev_open_cb cb, r = drv->open(dev, ddev->driver_data); if (r) { fp_err("device initialisation failed, driver=%s", drv->name); - libusb_close(udevh); + libusb_close(usb_devh); g_free(dev); } diff --git a/libfprint/core.c b/libfprint/core.c index d5a9572..3164e29 100644 --- a/libfprint/core.c +++ b/libfprint/core.c @@ -442,7 +442,7 @@ API_EXPORTED struct fp_driver **fprint_get_drivers (void) return (struct fp_driver **) g_ptr_array_free (array, FALSE); } -static struct fp_driver *find_supporting_usb_driver(libusb_device *udev, +static struct fp_driver *find_supporting_usb_driver(libusb_device *usb_dev, const struct usb_id **usb_id, uint32_t *devtype) { int ret; @@ -454,7 +454,7 @@ static struct fp_driver *find_supporting_usb_driver(libusb_device *udev, uint32_t best_devtype; int drv_score = 0; - ret = libusb_get_device_descriptor(udev, &dsc); + ret = libusb_get_device_descriptor(usb_dev, &dsc); if (ret < 0) { fp_err("Failed to get device descriptor"); return NULL; @@ -510,14 +510,14 @@ static struct fp_driver *find_supporting_usb_driver(libusb_device *udev, return best_drv; } -static struct fp_dscv_dev *discover_usb_dev(libusb_device *udev) +static struct fp_dscv_dev *discover_usb_dev(libusb_device *usb_dev) { const struct usb_id *usb_id; struct fp_driver *drv; struct fp_dscv_dev *ddev; uint32_t devtype; - drv = find_supporting_usb_driver(udev, &usb_id, &devtype); + drv = find_supporting_usb_driver(usb_dev, &usb_id, &devtype); if (!drv) return NULL; @@ -525,7 +525,7 @@ static struct fp_dscv_dev *discover_usb_dev(libusb_device *udev) ddev = g_malloc0(sizeof(*ddev)); ddev->drv = drv; ddev->bus = drv->bus; - ddev->dev.usb_dev = udev; + ddev->dev.usb_dev = usb_dev; ddev->driver_data = usb_id->driver_data; ddev->devtype = devtype; return ddev; @@ -540,7 +540,7 @@ static struct fp_dscv_dev *discover_usb_dev(libusb_device *udev) API_EXPORTED struct fp_dscv_dev **fp_discover_devs(void) { GPtrArray *tmparray; - libusb_device *udev; + libusb_device *usb_dev; libusb_device **devs; int r; int i = 0; @@ -558,13 +558,13 @@ API_EXPORTED struct fp_dscv_dev **fp_discover_devs(void) /* Check each device against each driver, temporarily storing successfully * discovered devices in a GPtrArray. */ - while ((udev = devs[i++]) != NULL) { - struct fp_dscv_dev *ddev = discover_usb_dev(udev); + while ((usb_dev = devs[i++]) != NULL) { + struct fp_dscv_dev *ddev = discover_usb_dev(usb_dev); if (!ddev) continue; - /* discover_usb_dev() doesn't hold a reference to the udev, + /* discover_usb_dev() doesn't hold a reference to the usb_dev, * so increase the reference for ddev to hold this ref */ - libusb_ref_device(udev); + libusb_ref_device(usb_dev); g_ptr_array_add (tmparray, (gpointer) ddev); } libusb_free_device_list(devs, 1); diff --git a/libfprint/imgdev.c b/libfprint/imgdev.c index b363f2f..61399cc 100644 --- a/libfprint/imgdev.c +++ b/libfprint/imgdev.c @@ -39,7 +39,7 @@ static int img_dev_open(struct fp_dev *dev, unsigned long driver_data) dev->priv = imgdev; dev->nr_enroll_stages = IMG_ENROLL_STAGES; - /* for consistency in driver code, allow udev access through imgdev */ + /* for consistency in driver code, allow usb_dev access through imgdev */ if (imgdev->bus == DRIVER_TYPE_USB) USB_DEV(imgdev) = USB_DEV(dev); -- 2.17.0