From patchwork Mon Oct 25 11:51:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 12581577 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3837FC43217 for ; Mon, 25 Oct 2021 11:52:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 22A4C60F46 for ; Mon, 25 Oct 2021 11:52:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231185AbhJYLyt (ORCPT ); Mon, 25 Oct 2021 07:54:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:41508 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229589AbhJYLyr (ORCPT ); Mon, 25 Oct 2021 07:54:47 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DFFC360F22; Mon, 25 Oct 2021 11:52:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635162744; bh=64JTkQdfnCEcyTbOrpuw5TUx7qN2aLjfP/gHT58Jkos=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ps1Uxoqs+29aiUqd263s05TbWkrU8YhrG37j4mqkxiqAkGMltNo+/bBxM+laY4ZeU Cg0S+EF7lnc7svOuOe9ckLlioJ6DE30ojgpTGrpQuBIDWnMwBaUvyBY8R3vdjt9spO kjuaEE4o2gRIs2F/SzPD8XUZAz2F8pb/xfTOD9XwtlxIpFHEiFjrf0NtaFG4aSW3/L kL57GHDq3+qfPqxmHWPRSp9ldL0K9TJnYtSezENQWF0E8UDzvnlvpSSwQXMp1vMVRR IDz32tNp3QHbO3OUK3gNzbxeV01iCgFnT98rBzfiZcAasTy7Nh/akH/JqiVVD/bdbN fNft2uTdBMqbA== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1meyWN-0001Im-Oo; Mon, 25 Oct 2021 13:52:07 +0200 From: Johan Hovold To: Greg Kroah-Hartman Cc: Jonathan Corbet , linux-doc@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 1/2] Documentation: USB: fix example bulk-message timeout Date: Mon, 25 Oct 2021 13:51:58 +0200 Message-Id: <20211025115159.4954-2-johan@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211025115159.4954-1-johan@kernel.org> References: <20211025115159.4954-1-johan@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org USB bulk-message timeouts are specified in milliseconds and should specifically not vary with CONFIG_HZ. Use a fixed five-second timeout in the "Writing USB Device Drivers" example. Signed-off-by: Johan Hovold --- Documentation/driver-api/usb/writing_usb_driver.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/driver-api/usb/writing_usb_driver.rst b/Documentation/driver-api/usb/writing_usb_driver.rst index 2176297e5765..4356f023065b 100644 --- a/Documentation/driver-api/usb/writing_usb_driver.rst +++ b/Documentation/driver-api/usb/writing_usb_driver.rst @@ -231,7 +231,7 @@ error message. This can be shown with the following code:: skel->bulk_in_endpointAddr), skel->bulk_in_buffer, skel->bulk_in_size, - &count, HZ*10); + &count, 5000); /* if the read was successful, copy the data to user space */ if (!retval) { if (copy_to_user (buffer, skel->bulk_in_buffer, count)) From patchwork Mon Oct 25 11:51:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 12581575 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FC77C433FE for ; Mon, 25 Oct 2021 11:52:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 44A3C60F46 for ; Mon, 25 Oct 2021 11:52:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230320AbhJYLys (ORCPT ); Mon, 25 Oct 2021 07:54:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:41512 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229704AbhJYLyr (ORCPT ); Mon, 25 Oct 2021 07:54:47 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E59D660F46; Mon, 25 Oct 2021 11:52:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635162744; bh=erij8O9V4iK0XPCjra19lOi8jI0hAW7huw4GIocOO80=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mmrkYYdbW1Jow2nv08jTazOX7hxL1Q2oXGeKM3c9xoRJTYO9hiiJwb8bUpGhCJwOG GSqKfm7AGpABcRHGuVzYDWopnnyMSBhI3cZSkpK/UT3GiuCOMpIPZdUADXyBaq5yuo GPrgnGa7i8gAYzg57GzB7QRogeaYb1W/FO7xdKy7OTk0m9Tf66VCdZHndreHnz7u9H z8gOSwEqQ3brNmeW23uKEgi2VJmXMkg+yReaPMfX+519eLgVB31Gwok2WexGyvV+AK byayhiqpSO9LtO+SaEkistLM5qtp6Q+EYqh6OZJsW9R0ESsomlkWmOGkCmUzHxCifO NYUylBkfR1lYA== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1meyWN-0001Io-Rh; Mon, 25 Oct 2021 13:52:07 +0200 From: Johan Hovold To: Greg Kroah-Hartman Cc: Jonathan Corbet , linux-doc@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH 2/2] USB: iowarrior: fix control-message timeouts Date: Mon, 25 Oct 2021 13:51:59 +0200 Message-Id: <20211025115159.4954-3-johan@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211025115159.4954-1-johan@kernel.org> References: <20211025115159.4954-1-johan@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org USB control-message timeouts are specified in milliseconds and should specifically not vary with CONFIG_HZ. Use the common control-message timeout define for the five-second timeout and drop the driver-specific one. Fixes: 946b960d13c1 ("USB: add driver for iowarrior devices.") Cc: stable@vger.kernel.org # 2.6.21 Signed-off-by: Johan Hovold --- drivers/usb/misc/iowarrior.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c index efbd317f2f25..988a8c02e7e2 100644 --- a/drivers/usb/misc/iowarrior.c +++ b/drivers/usb/misc/iowarrior.c @@ -99,10 +99,6 @@ struct iowarrior { /* globals */ /*--------------*/ -/* - * USB spec identifies 5 second timeouts. - */ -#define GET_TIMEOUT 5 #define USB_REQ_GET_REPORT 0x01 //#if 0 static int usb_get_report(struct usb_device *dev, @@ -114,7 +110,7 @@ static int usb_get_report(struct usb_device *dev, USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE, (type << 8) + id, inter->desc.bInterfaceNumber, buf, size, - GET_TIMEOUT*HZ); + USB_CTRL_GET_TIMEOUT); } //#endif @@ -129,7 +125,7 @@ static int usb_set_report(struct usb_interface *intf, unsigned char type, USB_TYPE_CLASS | USB_RECIP_INTERFACE, (type << 8) + id, intf->cur_altsetting->desc.bInterfaceNumber, buf, - size, HZ); + size, 1000); } /*---------------------*/