usb_dev.c (9307d8bdd4de57183bb421d18d34d21febe98656) usb_dev.c (8019e7e723058dda079a32f656fed4bb7554c956)
1/* $FreeBSD$ */
2/*-
3 * Copyright (c) 2006-2008 Hans Petter Selasky. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 168 unchanged lines hidden (view full) ---

177 * This function is used to atomically refer an USB device by its
178 * device location. If this function returns success the USB device
179 * will not dissappear until the USB device is unreferenced.
180 *
181 * Return values:
182 * 0: Success, refcount incremented on the given USB device.
183 * Else: Failure.
184 *------------------------------------------------------------------------*/
1/* $FreeBSD$ */
2/*-
3 * Copyright (c) 2006-2008 Hans Petter Selasky. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 168 unchanged lines hidden (view full) ---

177 * This function is used to atomically refer an USB device by its
178 * device location. If this function returns success the USB device
179 * will not dissappear until the USB device is unreferenced.
180 *
181 * Return values:
182 * 0: Success, refcount incremented on the given USB device.
183 * Else: Failure.
184 *------------------------------------------------------------------------*/
185usb_error_t
185static usb_error_t
186usb_ref_device(struct usb_cdev_privdata *cpd,
187 struct usb_cdev_refdata *crd, int need_uref)
188{
189 struct usb_fifo **ppf;
190 struct usb_fifo *f;
191
192 DPRINTFN(2, "cpd=%p need uref=%d\n", cpd, need_uref);
193

--- 128 unchanged lines hidden (view full) ---

322}
323
324/*------------------------------------------------------------------------*
325 * usb_unref_device
326 *
327 * This function will release the reference count by one unit for the
328 * given USB device.
329 *------------------------------------------------------------------------*/
186usb_ref_device(struct usb_cdev_privdata *cpd,
187 struct usb_cdev_refdata *crd, int need_uref)
188{
189 struct usb_fifo **ppf;
190 struct usb_fifo *f;
191
192 DPRINTFN(2, "cpd=%p need uref=%d\n", cpd, need_uref);
193

--- 128 unchanged lines hidden (view full) ---

322}
323
324/*------------------------------------------------------------------------*
325 * usb_unref_device
326 *
327 * This function will release the reference count by one unit for the
328 * given USB device.
329 *------------------------------------------------------------------------*/
330void
330static void
331usb_unref_device(struct usb_cdev_privdata *cpd,
332 struct usb_cdev_refdata *crd)
333{
334
335 DPRINTFN(2, "cpd=%p is_uref=%d\n", cpd, crd->is_uref);
336
337 if (crd->is_uref)
338 usbd_enum_unlock(cpd->udev);

--- 1940 unchanged lines hidden ---
331usb_unref_device(struct usb_cdev_privdata *cpd,
332 struct usb_cdev_refdata *crd)
333{
334
335 DPRINTFN(2, "cpd=%p is_uref=%d\n", cpd, crd->is_uref);
336
337 if (crd->is_uref)
338 usbd_enum_unlock(cpd->udev);

--- 1940 unchanged lines hidden ---