From nobody Fri Dec 17 21:28:59 2021 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3E9D918EFB33; Fri, 17 Dec 2021 21:29:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JG2DD0lKCz3p9m; Fri, 17 Dec 2021 21:29:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D93BD232CA; Fri, 17 Dec 2021 21:28:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1BHLSxXD063084; Fri, 17 Dec 2021 21:28:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BHLSxP5063083; Fri, 17 Dec 2021 21:28:59 GMT (envelope-from git) Date: Fri, 17 Dec 2021 21:28:59 GMT Message-Id: <202112172128.1BHLSxP5063083@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brooks Davis Subject: git: 8010f4ad21b6 - main - libusb: remove use of COMPAT_32BIT List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8010f4ad21b6120e929bda4eed27696e63514677 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639776540; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kSyATib7HxJEP7FWkHPiAaadUpAml3X8/MsJhlTQIZk=; b=pfTV8JW+YGAhsHyxi4ypff0ByMBVR/Q425Ug4rsEYa+Vu2PBkz3waH7inaluSNLfmi+TwX 2co4xSH37/pYrNbtSwACWaKa/NOeYm1hpSnA6H4JmLCcunjbexHPL3xFqmfQ7yqKC3tDAC BgO/f6mS3szclsNbgasrpCsDn/xmDqwmWPb8dXQ1EgFAAQZkWI7DvuPPhFL+PNtTctCOpj 4a7pb/VxxN3OCWFaUU9vDmnlqjtF+arxHgLhvoyvn7snUpXaHO3YuDSCUcxeYl25DFlKZb BUqYQ+nikwp/jJp1VoeNoL+evmkOGXILbh9jeaeR+EHbeidr4GvzcVorzUrzyg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639776540; a=rsa-sha256; cv=none; b=B8ZlcJRuZOLO7hi869Jd15SliHPlnplQQImoLW5c5KS4Tad/E8S8t0KoXLPUQr+pVW7TiB AFatBF0IZ43Mr5eFOeNRhRw3ENUwTNpTszx71htywRcJRAZ6PTSOXHeQxyOdAooDfQAyip q4xVmnlxCxcsCCfZZIRhWgm0/0+gj8dofA4Hyp2lbsgGWsTEZb/qItAc39GLV7rZXFF9c4 iWcCWbnMjvk3he+iNfG43ehmLYDVK25eoOQ8I9QgusGUwevfX66FObx07Q+Lla8WADklcg ur/N+q+ohfWGNHN1XYnwlRWEbZ7lv7NdPIe4xrq90rp6Zruj8lbGNOgnEUTTPQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=8010f4ad21b6120e929bda4eed27696e63514677 commit 8010f4ad21b6120e929bda4eed27696e63514677 Author: Brooks Davis AuthorDate: 2021-12-17 21:28:14 +0000 Commit: Brooks Davis CommitDate: 2021-12-17 21:28:14 +0000 libusb: remove use of COMPAT_32BIT This codepath used uint64_t's in place of pointers in structs and arrays to allow 32-bit code to use 64-bit version of ioctls. Now that we support 32-bit compat natively this is no longer needed. Reviewed by: hselasky, jrtc27 (prior version) --- lib/libusb/Makefile | 8 ++------ lib/libusb/libusb20.c | 12 ++++++------ lib/libusb/libusb20_int.h | 10 ---------- lib/libusb/libusb20_ugen20.c | 16 ++++++++-------- lib/libusbhid/Makefile | 4 ---- lib/libusbhid/data.c | 4 ++-- lib/libusbhid/descr.c | 4 ++-- lib/libusbhid/usbvar.h | 6 ------ 8 files changed, 20 insertions(+), 44 deletions(-) diff --git a/lib/libusb/Makefile b/lib/libusb/Makefile index 83c9f1ade075..3cb2fbd7a462 100644 --- a/lib/libusb/Makefile +++ b/lib/libusb/Makefile @@ -34,10 +34,6 @@ SRCS+= libusb10_desc.c SRCS+= libusb10_hotplug.c SRCS+= libusb10_io.c -.if defined(COMPAT_32BIT) -CFLAGS+= -DCOMPAT_32BIT -.endif - PCFILES= libusb-0.1.pc libusb-1.0.pc libusb-2.0.pc # @@ -45,14 +41,14 @@ PCFILES= libusb-0.1.pc libusb-1.0.pc libusb-2.0.pc # # Examples: # make LIBUSB_GLOBAL_INCLUDE_FILE=libusb_global_linux.h -# make COMPAT_32BIT=YES \ +# make \ # LIBUSB_GLOBAL_INCLUDE_FILE=libusb_global_linux.h \ # DEBUG_FLAGS="-g" # # From Ubuntu 10.04: # freebsd-make LIBUSB_GLOBAL_INCLUDE_FILE=libusb_global_linux.h \ # PTHREAD_LIBS="-lpthread -lrt" -# freebsd-make COMPAT32_BIT=YES \ +# freebsd-make \ # LIBUSB_GLOBAL_INCLUDE_FILE=libusb_global_linux.h \ # PTHREAD_LIBS="-lpthread -lrt" # diff --git a/lib/libusb/libusb20.c b/lib/libusb/libusb20.c index 4323552b83ad..60a5f8448888 100644 --- a/lib/libusb/libusb20.c +++ b/lib/libusb/libusb20.c @@ -352,7 +352,7 @@ libusb20_tr_clear_stall_sync(struct libusb20_transfer *xfer) void libusb20_tr_set_buffer(struct libusb20_transfer *xfer, void *buffer, uint16_t frIndex) { - xfer->ppBuffer[frIndex] = libusb20_pass_ptr(buffer); + xfer->ppBuffer[frIndex] = buffer; return; } @@ -418,7 +418,7 @@ libusb20_tr_set_total_frames(struct libusb20_transfer *xfer, uint32_t nFrames) void libusb20_tr_setup_bulk(struct libusb20_transfer *xfer, void *pBuf, uint32_t length, uint32_t timeout) { - xfer->ppBuffer[0] = libusb20_pass_ptr(pBuf); + xfer->ppBuffer[0] = pBuf; xfer->pLength[0] = length; xfer->timeout = timeout; xfer->nFrames = 1; @@ -430,7 +430,7 @@ libusb20_tr_setup_control(struct libusb20_transfer *xfer, void *psetup, void *pB { uint16_t len; - xfer->ppBuffer[0] = libusb20_pass_ptr(psetup); + xfer->ppBuffer[0] = psetup; xfer->pLength[0] = 8; /* fixed */ xfer->timeout = timeout; @@ -438,7 +438,7 @@ libusb20_tr_setup_control(struct libusb20_transfer *xfer, void *psetup, void *pB if (len != 0) { xfer->nFrames = 2; - xfer->ppBuffer[1] = libusb20_pass_ptr(pBuf); + xfer->ppBuffer[1] = pBuf; xfer->pLength[1] = len; } else { xfer->nFrames = 1; @@ -449,7 +449,7 @@ libusb20_tr_setup_control(struct libusb20_transfer *xfer, void *psetup, void *pB void libusb20_tr_setup_intr(struct libusb20_transfer *xfer, void *pBuf, uint32_t length, uint32_t timeout) { - xfer->ppBuffer[0] = libusb20_pass_ptr(pBuf); + xfer->ppBuffer[0] = pBuf; xfer->pLength[0] = length; xfer->timeout = timeout; xfer->nFrames = 1; @@ -463,7 +463,7 @@ libusb20_tr_setup_isoc(struct libusb20_transfer *xfer, void *pBuf, uint32_t leng /* should not happen */ return; } - xfer->ppBuffer[frIndex] = libusb20_pass_ptr(pBuf); + xfer->ppBuffer[frIndex] = pBuf; xfer->pLength[frIndex] = length; return; } diff --git a/lib/libusb/libusb20_int.h b/lib/libusb/libusb20_int.h index 5f54ee3717fc..16796dc1233d 100644 --- a/lib/libusb/libusb20_int.h +++ b/lib/libusb/libusb20_int.h @@ -33,12 +33,6 @@ #ifndef _LIBUSB20_INT_H_ #define _LIBUSB20_INT_H_ -#ifdef COMPAT_32BIT -#define libusb20_pass_ptr(ptr) ((uint64_t)(uintptr_t)(ptr)) -#else -#define libusb20_pass_ptr(ptr) (ptr) -#endif - struct libusb20_device; struct libusb20_backend; struct libusb20_transfer; @@ -159,11 +153,7 @@ struct libusb20_transfer { /* * Pointer to a list of buffer pointers: */ -#ifdef COMPAT_32BIT - uint64_t *ppBuffer; -#else void **ppBuffer; -#endif /* * Pointer to frame lengths, which are updated to actual length * after the USB transfer completes: diff --git a/lib/libusb/libusb20_ugen20.c b/lib/libusb/libusb20_ugen20.c index 5687caf97e4f..efffff2b5ef0 100644 --- a/lib/libusb/libusb20_ugen20.c +++ b/lib/libusb/libusb20_ugen20.c @@ -251,7 +251,7 @@ ugen20_readdir(struct ugen20_urd_state *st) repeat: if (st->ptr == NULL) { st->urd.urd_startentry += st->nparsed; - st->urd.urd_data = libusb20_pass_ptr(st->buf); + st->urd.urd_data = st->buf; st->urd.urd_maxlen = sizeof(st->buf); st->nparsed = 0; @@ -364,7 +364,7 @@ ugen20_tr_renew(struct libusb20_device *pdev) memset(&fs_init, 0, sizeof(fs_init)); - fs_init.pEndpoints = libusb20_pass_ptr(pdev->privBeData); + fs_init.pEndpoints = pdev->privBeData; fs_init.ep_index_max = nMaxTransfer; if (ioctl(pdev->file, IOUSB(USB_FS_INIT), &fs_init)) { @@ -478,7 +478,7 @@ ugen20_get_config_desc_full(struct libusb20_device *pdev, memset(&cdesc, 0, sizeof(cdesc)); memset(&gen_desc, 0, sizeof(gen_desc)); - gen_desc.ugd_data = libusb20_pass_ptr(&cdesc); + gen_desc.ugd_data = &cdesc; gen_desc.ugd_maxlen = sizeof(cdesc); gen_desc.ugd_config_index = cfg_index; @@ -499,7 +499,7 @@ ugen20_get_config_desc_full(struct libusb20_device *pdev, /* make sure memory is initialised */ memset(ptr, 0, len); - gen_desc.ugd_data = libusb20_pass_ptr(ptr); + gen_desc.ugd_data = ptr; gen_desc.ugd_maxlen = len; error = ioctl(pdev->file_ctrl, IOUSB(USB_GET_FULL_DESC), &gen_desc); @@ -726,7 +726,7 @@ ugen20_do_request_sync(struct libusb20_device *pdev, memset(&req, 0, sizeof(req)); - req.ucr_data = libusb20_pass_ptr(data); + req.ucr_data = data; if (!(flags & LIBUSB20_TRANSFER_SINGLE_SHORT_NOT_OK)) { req.ucr_flags |= USB_SHORT_XFER_OK; } @@ -835,8 +835,8 @@ ugen20_tr_open(struct libusb20_transfer *xfer, uint32_t MaxBufSize, xfer->maxPacketLen = temp.fs_open.max_packet_length; /* setup buffer and length lists using zero copy */ - fsep->ppBuffer = libusb20_pass_ptr(xfer->ppBuffer); - fsep->pLength = libusb20_pass_ptr(xfer->pLength); + fsep->ppBuffer = xfer->ppBuffer; + fsep->pLength = xfer->pLength; return (0); /* success */ } @@ -956,7 +956,7 @@ ugen20_dev_get_iface_desc(struct libusb20_device *pdev, memset(&ugd, 0, sizeof(ugd)); - ugd.ugd_data = libusb20_pass_ptr(buf); + ugd.ugd_data = buf; ugd.ugd_maxlen = len; ugd.ugd_iface_index = iface_index; diff --git a/lib/libusbhid/Makefile b/lib/libusbhid/Makefile index 7dba7ffc9113..2a58a4b1eb48 100644 --- a/lib/libusbhid/Makefile +++ b/lib/libusbhid/Makefile @@ -19,8 +19,4 @@ SRCS= descr.c descr_compat.c parse.c usage.c data.c INCS= usbhid.h -.if defined(COMPAT_32BIT) -CFLAGS+= -DCOMPAT_32BIT -.endif - .include diff --git a/lib/libusbhid/data.c b/lib/libusbhid/data.c index ae81bb321095..cad320562eee 100644 --- a/lib/libusbhid/data.c +++ b/lib/libusbhid/data.c @@ -126,7 +126,7 @@ hid_get_report(int fd, enum hid_kind k, unsigned char *data, unsigned int size) struct usb_gen_descriptor ugd; memset(&ugd, 0, sizeof(ugd)); - ugd.ugd_data = hid_pass_ptr(data); + ugd.ugd_data = data; ugd.ugd_maxlen = size; ugd.ugd_report_type = k + 1; return (ioctl(fd, USB_GET_REPORT, &ugd)); @@ -138,7 +138,7 @@ hid_set_report(int fd, enum hid_kind k, unsigned char *data, unsigned int size) struct usb_gen_descriptor ugd; memset(&ugd, 0, sizeof(ugd)); - ugd.ugd_data = hid_pass_ptr(data); + ugd.ugd_data = data; ugd.ugd_maxlen = size; ugd.ugd_report_type = k + 1; return (ioctl(fd, USB_SET_REPORT, &ugd)); diff --git a/lib/libusbhid/descr.c b/lib/libusbhid/descr.c index 329bbe9261b7..7cd6750ad322 100644 --- a/lib/libusbhid/descr.c +++ b/lib/libusbhid/descr.c @@ -105,7 +105,7 @@ hid_get_report_desc(int fd) memset(&ugd, 0, sizeof(ugd)); /* get actual length first */ - ugd.ugd_data = hid_pass_ptr(NULL); + ugd.ugd_data = NULL; ugd.ugd_maxlen = 65535; if (ioctl(fd, USB_GET_REPORT_DESC, &ugd) < 0) { #ifdef HID_COMPAT7 @@ -126,7 +126,7 @@ hid_get_report_desc(int fd) return (NULL); /* fetch actual descriptor */ - ugd.ugd_data = hid_pass_ptr(data); + ugd.ugd_data = data; ugd.ugd_maxlen = ugd.ugd_actlen; if (ioctl(fd, USB_GET_REPORT_DESC, &ugd) < 0) { /* could not read descriptor */ diff --git a/lib/libusbhid/usbvar.h b/lib/libusbhid/usbvar.h index 5072f4787e42..0dfd596e8bb0 100644 --- a/lib/libusbhid/usbvar.h +++ b/lib/libusbhid/usbvar.h @@ -47,10 +47,4 @@ int hid_get_report_id_compat7(int fd); report_desc_t hid_get_report_desc_compat7(int fd); #endif -#ifdef COMPAT_32BIT -#define hid_pass_ptr(ptr) ((uint64_t)(uintptr_t)(ptr)) -#else -#define hid_pass_ptr(ptr) (ptr) -#endif - #endif /* _USBVAR_H_ */