Re: [PATCH 1/3] usb: gadget: ccid: add support for USB CCID Gadget Device
On Sun, May 27, 2018 at 07:48:47AM +0200, Marcus Folkesson wrote: > On Sat, May 26, 2018 at 10:56:52PM +0200, Greg Kroah-Hartman wrote: > > On Sat, May 26, 2018 at 10:33:59PM +0200, Marcus Folkesson wrote: > > > Signed-off-by: Marcus Folkesson > > > > I can't take patches without any changelog text. And why would you > > submit a patch over 1000 lines without any? > > I'm sorry, obviously not much went well for me yesterday. > The changlelog was "fixup:ed" away and now I noticed that my > patch version history did not follow for v2. > > Is it better to send a v3 with updated version history or wait for more > comments? Nah, that's fine, but I'll let Felipe decide as he is the one that has to review this, not me. thanks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] usb: gadget: ccid: add support for USB CCID Gadget Device
On Sat, May 26, 2018 at 10:56:52PM +0200, Greg Kroah-Hartman wrote: > On Sat, May 26, 2018 at 10:33:59PM +0200, Marcus Folkesson wrote: > > Signed-off-by: Marcus Folkesson > > I can't take patches without any changelog text. And why would you > submit a patch over 1000 lines without any? I'm sorry, obviously not much went well for me yesterday. The changlelog was "fixup:ed" away and now I noticed that my patch version history did not follow for v2. Is it better to send a v3 with updated version history or wait for more comments? I'll start review my patches better before sending them. Thank you for your time and comments. > > Please fix. > > thanks, > > greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 3/3] MAINTAINERS: add USB CCID Gadget Device
Add MAINTAINERS entry for USB CCID Gadget Device Signed-off-by: Marcus Folkesson --- MAINTAINERS | 8 1 file changed, 8 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 078fd80f664f..e77c3d2bec89 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14541,6 +14541,14 @@ L: linux-s...@vger.kernel.org S: Maintained F: drivers/usb/storage/uas.c +USB CCID GADGET +M: Marcus Folkesson +L: linux-usb@vger.kernel.org +S: Maintained +F: drivers/usb/gadget/function/f_ccid.* +F: include/uapi/linux/usb/ccid.h +F: Documentation/usb/gadget_ccid.rst + USB CDC ETHERNET DRIVER M: Oliver Neukum L: linux-usb@vger.kernel.org -- 2.16.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 1/3] usb: gadget: ccid: add support for USB CCID Gadget Device
Chip Card Interface Device (CCID) protocol is a USB protocol that allows a smartcard device to be connected to a computer via a card reader using a standard USB interface, without the need for each manufacturer of smartcards to provide its own reader or protocol. This gadget driver makes Linux show up as a CCID device to the host and let a userspace daemon act as the smartcard. This is useful when the Linux gadget itself should act as a cryptographic device or forward APDUs to an embedded smartcard device. Signed-off-by: Marcus Folkesson --- drivers/usb/gadget/Kconfig | 17 + drivers/usb/gadget/function/Makefile | 1 + drivers/usb/gadget/function/f_ccid.c | 988 +++ drivers/usb/gadget/function/f_ccid.h | 91 include/uapi/linux/usb/ccid.h| 93 5 files changed, 1190 insertions(+) create mode 100644 drivers/usb/gadget/function/f_ccid.c create mode 100644 drivers/usb/gadget/function/f_ccid.h create mode 100644 include/uapi/linux/usb/ccid.h diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 31cce7805eb2..bdebdf1ffa2b 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -149,6 +149,9 @@ config USB_LIBCOMPOSITE config USB_F_ACM tristate +config USB_F_CCID + tristate + config USB_F_SS_LB tristate @@ -248,6 +251,20 @@ config USB_CONFIGFS_ACM ACM serial link. This function can be used to interoperate with MS-Windows hosts or with the Linux-USB "cdc-acm" driver. +config USB_CONFIGFS_CCID + bool "Chip Card Interface Device (CCID)" + depends on USB_CONFIGFS + select USB_F_CCID + help + The CCID function driver provides generic emulation of a + Chip Card Interface Device (CCID). + + You will need a user space server talking to /dev/ccidg*, + since the kernel itself does not implement CCID/TPDU/APDU + protocol. + + For more information, see Documentation/usb/gadget_ccid.rst. + config USB_CONFIGFS_OBEX bool "Object Exchange Model (CDC OBEX)" depends on USB_CONFIGFS diff --git a/drivers/usb/gadget/function/Makefile b/drivers/usb/gadget/function/Makefile index 5d3a6cf02218..629851009e1a 100644 --- a/drivers/usb/gadget/function/Makefile +++ b/drivers/usb/gadget/function/Makefile @@ -9,6 +9,7 @@ ccflags-y += -I$(srctree)/drivers/usb/gadget/udc/ # USB Functions usb_f_acm-y:= f_acm.o obj-$(CONFIG_USB_F_ACM)+= usb_f_acm.o +obj-$(CONFIG_USB_F_CCID) += f_ccid.o usb_f_ss_lb-y := f_loopback.o f_sourcesink.o obj-$(CONFIG_USB_F_SS_LB) += usb_f_ss_lb.o obj-$(CONFIG_USB_U_SERIAL) += u_serial.o diff --git a/drivers/usb/gadget/function/f_ccid.c b/drivers/usb/gadget/function/f_ccid.c new file mode 100644 index ..9ff8615ca303 --- /dev/null +++ b/drivers/usb/gadget/function/f_ccid.c @@ -0,0 +1,988 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * f_ccid.c -- Chip Card Interface Device (CCID) function Driver + * + * Copyright (C) 2018 Marcus Folkesson + * + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "f_ccid.h" +#include "u_f.h" + +/* Number of tx requests to allocate */ +#define N_TX_REQS 4 + +/* Maximum number of devices */ +#define CCID_MINORS 4 + +struct ccidg_bulk_dev { + atomic_t is_open; + atomic_t rx_req_busy; + wait_queue_head_t read_wq; + wait_queue_head_t write_wq; + struct usb_request *rx_req; + atomic_t rx_done; + struct list_head tx_idle; +}; + +struct f_ccidg { + struct usb_function_instancefunc_inst; + struct usb_function function; + spinlock_t lock; + atomic_t online; + + /* Character device */ + struct cdev cdev; + int minor; + + /* Dynamic attributes */ + u32 features; + u32 protocols; + u8 pinsupport; + u8 nslots; + u8 lcdlayout; + + /* Endpoints */ + struct usb_ep *in; + struct usb_ep *out; + struct ccidg_bulk_dev bulk_dev; +}; + +/* Interface Descriptor: */ +static struct usb_interface_descriptor ccid_interface_desc = { + .bLength = USB_DT_INTERFACE_SIZE, + .bDescriptorType = USB_DT_INTERFACE, + .bNumEndpoints =2, + .bInterfaceClass = USB_CLASS_CSCID, + .bInterfaceSubClass = 0, + .bInterfaceProtocol = 0, +}; + +/* CCID Class Descriptor */ +static struct ccid_class_descriptor ccid_class_desc = { + .bLength = sizeof(ccid_class_desc), + .bDescriptorType = CCID_DECRIPTOR_TYPE, + .bcdCCID = CCID1_10, + /* .bMaxSlotIndex = DYNAMIC */ + .bVoltageSupport = CCID_VOLTS_3_0, + /* .dwProtocols = DYNAMIC */ + .dwDefaultClock = 3580, + .dwMaximumClock = 3580, + .bNum
[PATCH v2 2/3] Documentation: usb: add documentation for USB CCID Gadget Device
Add documentation to give a brief description on how to use the CCID Gadget Device. This includes a description for all attributes followed by an example on how to setup the device with ConfigFS. Signed-off-by: Marcus Folkesson --- Documentation/usb/gadget_ccid.rst | 267 ++ 1 file changed, 267 insertions(+) create mode 100644 Documentation/usb/gadget_ccid.rst diff --git a/Documentation/usb/gadget_ccid.rst b/Documentation/usb/gadget_ccid.rst new file mode 100644 index ..5ac806b14604 --- /dev/null +++ b/Documentation/usb/gadget_ccid.rst @@ -0,0 +1,267 @@ +.. SPDX-License-Identifier: GPL-2.0 + + +CCID Gadget + + +:Author: Marcus Folkesson + +Introduction + + +The CCID Gadget will present itself as a CCID device to the host system. +The device supports two endpoints for now; BULK IN and BULK OUT. +These endpoints is exposed to userspace via /dev/ccidg*. + +All CCID commands are sent on the BULK-OUT endpoint. Each command sent to the CCID +has an associated ending response. Some commands can also have intermediate +responses. The response is sent on the BULK-IN endpoint. +See Figure 3-3 in the CCID Specification [1]_ for more details. + +The CCID commands must be handled in userspace since the driver is only working +as a transport layer for the TPDUs. + + +CCID Commands +-- + +All CCID commands begins with a 10 bytes header followed by an optional +data field depending on message type. + +++--+---+--+ +| Offset | Field| Size | Description | +++==+===+==+ +| 0 | bMessageType | 1 | Type of message | +++--+---+--+ +| 1 | dwLength | 4 | Message specific data length | +|| | | | +++--+---+--+ +| 5 | bSlot| 1 | Identifies the slot number | +|| | | for this command | +++--+---+--+ +| 6 | bSeq | 1 | Sequence number for command | +++--+---+--+ +| 7 | ... | 3 | Fields depends on message type | +++--+---+--+ +| 10 | abData | array | Message specific data (OPTIONAL) | +++--+---+--+ + + +Multiple CCID gadgets +-- + +It is possible to create multiple instances of the CCID gadget, however, +a much more flexible way is to create one gadget and set the `nslots` attribute +to the number of desired CCID devices. + +All CCID commands specifies which slot that is the receiver in the `bSlot` field +of the CCID header. + +Usage += + +Access from userspace +-- +All communication is by read(2) and write(2) to the corresponding /dev/ccidg* device. +Only one filedescriptor is allowed to be open to the device at a time. + +The buffer size provided to read(2) **must be at least** 522 (10 bytes header + 512 bytes payload) +bytes as we are working with whole commands. + +The buffer size provided to write(2) **may not exceed** 522 (10 bytes header + 512 bytes payload) +bytes as we are working with whole commands. + + +Configuration with configfs + + +ConfigFS is used to create and configure the CCID gadget. +In order to get a device to work as intended, a few attributes must +be considered. + +The attributes is described below followed by an example. + +features +~ + +The `feature` attribute writes to the dwFeatures field in the class descriptor. +See Table 5.1-1 Smart Card Device Descriptors in the CCID Specification [1]_. + +The value indicates what intelligent features the CCID has. +These values are available to user application as defines in ccid.h [2]_. +The default value is 0x. + +The value is a bitwise OR operation performed on the following values: + ++++ +| Value | Description| ++++ +| 0x | No special characteristics | ++++ +| 0x0002 | Automatic parameter configuration based on ATR data| ++++ +| 0x0004 | Automatic activation of ICC on inserting | +++---
Re: [PATCH 1/3] usb: gadget: ccid: add support for USB CCID Gadget Device
On Sat, May 26, 2018 at 10:33:59PM +0200, Marcus Folkesson wrote: > Signed-off-by: Marcus Folkesson I can't take patches without any changelog text. And why would you submit a patch over 1000 lines without any? Please fix. thanks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/3] usb: gadget: ccid: add support for USB CCID Gadget Device
Signed-off-by: Marcus Folkesson --- drivers/usb/gadget/Kconfig | 17 + drivers/usb/gadget/function/Makefile | 1 + drivers/usb/gadget/function/f_ccid.c | 988 +++ drivers/usb/gadget/function/f_ccid.h | 91 include/uapi/linux/usb/ccid.h| 93 5 files changed, 1190 insertions(+) create mode 100644 drivers/usb/gadget/function/f_ccid.c create mode 100644 drivers/usb/gadget/function/f_ccid.h create mode 100644 include/uapi/linux/usb/ccid.h diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 31cce7805eb2..bdebdf1ffa2b 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -149,6 +149,9 @@ config USB_LIBCOMPOSITE config USB_F_ACM tristate +config USB_F_CCID + tristate + config USB_F_SS_LB tristate @@ -248,6 +251,20 @@ config USB_CONFIGFS_ACM ACM serial link. This function can be used to interoperate with MS-Windows hosts or with the Linux-USB "cdc-acm" driver. +config USB_CONFIGFS_CCID + bool "Chip Card Interface Device (CCID)" + depends on USB_CONFIGFS + select USB_F_CCID + help + The CCID function driver provides generic emulation of a + Chip Card Interface Device (CCID). + + You will need a user space server talking to /dev/ccidg*, + since the kernel itself does not implement CCID/TPDU/APDU + protocol. + + For more information, see Documentation/usb/gadget_ccid.rst. + config USB_CONFIGFS_OBEX bool "Object Exchange Model (CDC OBEX)" depends on USB_CONFIGFS diff --git a/drivers/usb/gadget/function/Makefile b/drivers/usb/gadget/function/Makefile index 5d3a6cf02218..629851009e1a 100644 --- a/drivers/usb/gadget/function/Makefile +++ b/drivers/usb/gadget/function/Makefile @@ -9,6 +9,7 @@ ccflags-y += -I$(srctree)/drivers/usb/gadget/udc/ # USB Functions usb_f_acm-y:= f_acm.o obj-$(CONFIG_USB_F_ACM)+= usb_f_acm.o +obj-$(CONFIG_USB_F_CCID) += f_ccid.o usb_f_ss_lb-y := f_loopback.o f_sourcesink.o obj-$(CONFIG_USB_F_SS_LB) += usb_f_ss_lb.o obj-$(CONFIG_USB_U_SERIAL) += u_serial.o diff --git a/drivers/usb/gadget/function/f_ccid.c b/drivers/usb/gadget/function/f_ccid.c new file mode 100644 index ..9ff8615ca303 --- /dev/null +++ b/drivers/usb/gadget/function/f_ccid.c @@ -0,0 +1,988 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * f_ccid.c -- Chip Card Interface Device (CCID) function Driver + * + * Copyright (C) 2018 Marcus Folkesson + * + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "f_ccid.h" +#include "u_f.h" + +/* Number of tx requests to allocate */ +#define N_TX_REQS 4 + +/* Maximum number of devices */ +#define CCID_MINORS 4 + +struct ccidg_bulk_dev { + atomic_t is_open; + atomic_t rx_req_busy; + wait_queue_head_t read_wq; + wait_queue_head_t write_wq; + struct usb_request *rx_req; + atomic_t rx_done; + struct list_head tx_idle; +}; + +struct f_ccidg { + struct usb_function_instancefunc_inst; + struct usb_function function; + spinlock_t lock; + atomic_t online; + + /* Character device */ + struct cdev cdev; + int minor; + + /* Dynamic attributes */ + u32 features; + u32 protocols; + u8 pinsupport; + u8 nslots; + u8 lcdlayout; + + /* Endpoints */ + struct usb_ep *in; + struct usb_ep *out; + struct ccidg_bulk_dev bulk_dev; +}; + +/* Interface Descriptor: */ +static struct usb_interface_descriptor ccid_interface_desc = { + .bLength = USB_DT_INTERFACE_SIZE, + .bDescriptorType = USB_DT_INTERFACE, + .bNumEndpoints =2, + .bInterfaceClass = USB_CLASS_CSCID, + .bInterfaceSubClass = 0, + .bInterfaceProtocol = 0, +}; + +/* CCID Class Descriptor */ +static struct ccid_class_descriptor ccid_class_desc = { + .bLength = sizeof(ccid_class_desc), + .bDescriptorType = CCID_DECRIPTOR_TYPE, + .bcdCCID = CCID1_10, + /* .bMaxSlotIndex = DYNAMIC */ + .bVoltageSupport = CCID_VOLTS_3_0, + /* .dwProtocols = DYNAMIC */ + .dwDefaultClock = 3580, + .dwMaximumClock = 3580, + .bNumClockSupported = 0, + .dwDataRate = 9600, + .dwMaxDataRate =9600, + .bNumDataRatesSupported = 0, + .dwMaxIFSD =0, + .dwSynchProtocols = 0, + .dwMechanical = 0, + /* .dwFeatures =DYNAMIC */ + + /* extended APDU level Message Length */ + .dwMaxCCIDMessageLength = 0x200, + .bClassGetResponse =0x0, + .bClassEnvelope = 0x0, + /* .wLcdLayout =DYNAMIC */ + /* .bPINSupport
[PATCH 3/3] MAINTAINERS: add USB CCID Gadget Device
Add MAINTAINERS entry for USB CCID Gadget Device Signed-off-by: Marcus Folkesson --- MAINTAINERS | 8 1 file changed, 8 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 078fd80f664f..e77c3d2bec89 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14541,6 +14541,14 @@ L: linux-s...@vger.kernel.org S: Maintained F: drivers/usb/storage/uas.c +USB CCID GADGET +M: Marcus Folkesson +L: linux-usb@vger.kernel.org +S: Maintained +F: drivers/usb/gadget/function/f_ccid.* +F: include/uapi/linux/usb/ccid.h +F: Documentation/usb/gadget_ccid.rst + USB CDC ETHERNET DRIVER M: Oliver Neukum L: linux-usb@vger.kernel.org -- 2.16.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/3] Documentation: usb: add documentation for USB CCID Gadget Device
Signed-off-by: Marcus Folkesson --- Documentation/usb/gadget_ccid.rst | 267 ++ 1 file changed, 267 insertions(+) create mode 100644 Documentation/usb/gadget_ccid.rst diff --git a/Documentation/usb/gadget_ccid.rst b/Documentation/usb/gadget_ccid.rst new file mode 100644 index ..5ac806b14604 --- /dev/null +++ b/Documentation/usb/gadget_ccid.rst @@ -0,0 +1,267 @@ +.. SPDX-License-Identifier: GPL-2.0 + + +CCID Gadget + + +:Author: Marcus Folkesson + +Introduction + + +The CCID Gadget will present itself as a CCID device to the host system. +The device supports two endpoints for now; BULK IN and BULK OUT. +These endpoints is exposed to userspace via /dev/ccidg*. + +All CCID commands are sent on the BULK-OUT endpoint. Each command sent to the CCID +has an associated ending response. Some commands can also have intermediate +responses. The response is sent on the BULK-IN endpoint. +See Figure 3-3 in the CCID Specification [1]_ for more details. + +The CCID commands must be handled in userspace since the driver is only working +as a transport layer for the TPDUs. + + +CCID Commands +-- + +All CCID commands begins with a 10 bytes header followed by an optional +data field depending on message type. + +++--+---+--+ +| Offset | Field| Size | Description | +++==+===+==+ +| 0 | bMessageType | 1 | Type of message | +++--+---+--+ +| 1 | dwLength | 4 | Message specific data length | +|| | | | +++--+---+--+ +| 5 | bSlot| 1 | Identifies the slot number | +|| | | for this command | +++--+---+--+ +| 6 | bSeq | 1 | Sequence number for command | +++--+---+--+ +| 7 | ... | 3 | Fields depends on message type | +++--+---+--+ +| 10 | abData | array | Message specific data (OPTIONAL) | +++--+---+--+ + + +Multiple CCID gadgets +-- + +It is possible to create multiple instances of the CCID gadget, however, +a much more flexible way is to create one gadget and set the `nslots` attribute +to the number of desired CCID devices. + +All CCID commands specifies which slot that is the receiver in the `bSlot` field +of the CCID header. + +Usage += + +Access from userspace +-- +All communication is by read(2) and write(2) to the corresponding /dev/ccidg* device. +Only one filedescriptor is allowed to be open to the device at a time. + +The buffer size provided to read(2) **must be at least** 522 (10 bytes header + 512 bytes payload) +bytes as we are working with whole commands. + +The buffer size provided to write(2) **may not exceed** 522 (10 bytes header + 512 bytes payload) +bytes as we are working with whole commands. + + +Configuration with configfs + + +ConfigFS is used to create and configure the CCID gadget. +In order to get a device to work as intended, a few attributes must +be considered. + +The attributes is described below followed by an example. + +features +~ + +The `feature` attribute writes to the dwFeatures field in the class descriptor. +See Table 5.1-1 Smart Card Device Descriptors in the CCID Specification [1]_. + +The value indicates what intelligent features the CCID has. +These values are available to user application as defines in ccid.h [2]_. +The default value is 0x. + +The value is a bitwise OR operation performed on the following values: + ++++ +| Value | Description| ++++ +| 0x | No special characteristics | ++++ +| 0x0002 | Automatic parameter configuration based on ATR data| ++++ +| 0x0004 | Automatic activation of ICC on inserting | ++++ +| 0x0008 | Automatic ICC voltage selection| ++++ +| 0x0010 | Automati
Re: [PATCH v3 0/3] Revised Renesas uPD72020x workaround for 32bit DMA issue
Hi Marc, On Wed, May 23, 2018 at 06:41:35PM +0100, Marc Zyngier wrote: > Back around the 4.13 timeframe, we tried to address a rather bad issue > with the Renesas uPD72020x USB3 controller family. They have trouble > with the programming of the base addresses which tend to stick on XHCI > reset. This makes transitionning from 64bit to 32bit addresses > completely unsafe. This was observed on a fairly popular arm64 > platform (AMD Opteron 1100, which has all of its memory above 4GB). > > The fix was to perform a PCI reset of the device, but we have had > multiple reports that this generated regressions (the controller not > being usable after the patch was applied). > > This series reverts the problematic patch, and tries to address it in > a more constrained way. If the controller is behind an IOMMU (and only > in that case), we zero its base addresses before reseting it. In the > affected configuration, this has the effect of putting the device in a > state where the XHCI reset will be effective. I tested also this new round on my x86, the regression is gone and my machine boots successfully. As before, I cannot say anything about the original uPD72020x's issue that it was supposed to fix. Tested-by: Domenico Andreoli Regards, Domenico -- 3B10 0CA1 8674 ACBA B4FE FCD2 CE5B CF17 9960 DE13 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 07/12] usb: usbtmc: Add ioctl USBTMC488_IOCTL_WAIT_SRQ
Am Donnerstag, den 24.05.2018, 12:59 + schrieb guido@kiener- muenchen.de: > Zitat von Oliver Neukum : > > > Am Donnerstag, den 17.05.2018, 19:03 +0200 schrieb Guido Kiener: > > > +static int usbtmc488_ioctl_wait_srq(struct usbtmc_file_data *file_data, > > > + unsigned int __user *arg) > > > +{ > > > + struct usbtmc_device_data *data = file_data->data; > > > + struct device *dev = &data->intf->dev; > > > + int rv; > > > + unsigned int timeout; > > > + unsigned long expire; > > > + > > > + if (!data->iin_ep_present) { > > > + dev_dbg(dev, "no interrupt endpoint present\n"); > > > + return -EFAULT; > > > + } > > > + > > > + if (get_user(timeout, arg)) > > > + return -EFAULT; > > > + > > > + expire = msecs_to_jiffies(timeout); > > > + > > > + mutex_unlock(&data->io_mutex); > > > > There is such a thing as threads sharing file descriptors. > > That leads to the question what happens to the mutex if this > > ioctl() is called multiple times. > > > > Regards > > Oliver > > Multiple threads can wait with the same or different file descriptors. > When an SRQ interrupt occurs, all threads and file descriptors are > informed concurrently with wake_up_interruptible_all(&data->waitq); > The "_all" is already fixed in 02/12. No, the problem is that you will underflow io->mutex Regards Oliver -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: dwc3: Remove DEBUG define from Qualcomm DWC3 glue driver
Hi, On 5/26/2018 3:37 AM, Douglas Anderson wrote: > It appears that a "#define DEBUG" was left in on the recent patch > landed for the Qualcomm DWC3 glue driver. Let's remove it. > > Fixes: a4333c3a6ba9 ("usb: dwc3: Add Qualcomm DWC3 glue driver") > Signed-off-by: Douglas Anderson > --- > > drivers/usb/dwc3/dwc3-qcom.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c > index 8abb6f31389d..b0e67ab2f98c 100644 > --- a/drivers/usb/dwc3/dwc3-qcom.c > +++ b/drivers/usb/dwc3/dwc3-qcom.c > @@ -3,7 +3,6 @@ > * > * Inspired by dwc3-of-simple.c > */ > -#define DEBUG :(.. Sorry about that.. Thanks for fixing it. > > #include > #include -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html