Skip to content

Commit f478f4e

Browse files
seanmsonatique
authored andcommitted
linux: change usbi_handle_disconnect signature to take ctx
Change the signature of private function usbi_handle_disconnect() to take the context as a parameter so that it can eventually use a Clang Thread Safety REQUIRES(ctx->event_lock) decoration. Closes libusb#1696
1 parent 4253625 commit f478f4e

File tree

4 files changed

+4
-5
lines changed

4 files changed

+4
-5
lines changed

libusb/io.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2811,9 +2811,8 @@ void API_EXPORTED libusb_free_pollfds(const struct libusb_pollfd **pollfds)
28112811
* device. This function ensures transfers get cancelled appropriately.
28122812
* Callers of this function must hold the events_lock.
28132813
*/
2814-
void usbi_handle_disconnect(struct libusb_device_handle *dev_handle)
2814+
void usbi_handle_disconnect(struct libusb_context *ctx, struct libusb_device_handle *dev_handle)
28152815
{
2816-
struct libusb_context *ctx = HANDLE_CTX(dev_handle);
28172816
struct usbi_transfer *cur;
28182817
struct usbi_transfer *to_cancel;
28192818

libusb/libusbi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ struct libusb_device *usbi_alloc_device(struct libusb_context *ctx,
816816
struct libusb_device *usbi_get_device_by_session_id(struct libusb_context *ctx,
817817
unsigned long session_id);
818818
int usbi_sanitize_device(struct libusb_device *dev);
819-
void usbi_handle_disconnect(struct libusb_device_handle *dev_handle);
819+
void usbi_handle_disconnect(struct libusb_context *ctx, struct libusb_device_handle *dev_handle);
820820

821821
int usbi_handle_transfer_completion(struct usbi_transfer *itransfer,
822822
enum libusb_transfer_status status);

libusb/os/linux_usbfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2806,7 +2806,7 @@ static int op_handle_events(struct libusb_context *ctx,
28062806
} while (r == 0);
28072807
}
28082808

2809-
usbi_handle_disconnect(handle);
2809+
usbi_handle_disconnect(ctx, handle);
28102810
continue;
28112811
}
28122812

libusb/version_nano.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
#define LIBUSB_NANO 11987
1+
#define LIBUSB_NANO 11988

0 commit comments

Comments
 (0)