Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp589729pxb; Wed, 27 Jan 2021 16:02:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJyOkBv/JsQ9uFxSZIOyGHwkdJT7opPOpfa+6xHBLm4VTDI6DlYFU+wqyXW+x3aWhu0MbAqk X-Received: by 2002:a05:6402:1701:: with SMTP id y1mr11014358edu.251.1611792145572; Wed, 27 Jan 2021 16:02:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611792145; cv=none; d=google.com; s=arc-20160816; b=xWAtQ1FZic106QKaBBXku8AhBUM3HjIaxgsE3Yvysj+PNUpHow5ybsh0KGGvU6Dl+o c63uf8ifwUl92bRfmX2g5jfg54QJhTISeKLZHhjk5vxJ2x9///FzjFIPdzWZVlEO4heL 4BG1y0djZRVz/qZzuOFGS1GYPkbZG2hHdtP4w9z3mydbgEsvgi8lMiQp65NlI7eRKpGJ n7khKaLeJ/Eu/644q35S0LphYEDVB39oAW8UwuotSY2ied7Exk9jYvjUBYecXw9oQH+z Ho9EKevO149vt0RMrd3Zm3eIh3Rlpaf5Xmyx7+0nk1nzWq6IHLngTH+GhnwqzRLoPdnR aIbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=RxI9A4/N8punMQl4KyBBC3vu8x7jM8LEQO9oogyNx3s=; b=Ny5i4tgX2Jvy4EPIVO472h9+NWi25R3fO0yT1lHa5RYg1/X+4/lMDQW0KlV3rzqy21 TZtZr2wn/lFBVppeR85yxEBiOj4fl3pXreeG5xxdhp37l/8pcE+zRzzr5Toc/Nv4edTW 5FPPTq2yuga0yRsp9TOs6+kVVpNI/JY5Xr/Aog8esNfiHMRcDPZJ74MrVO/C0E/C/t5r g0jVgXu/Yo1mpNTmvaCmcQKQqy5J4BUPvEkoU/RIVGb0BRc4a2KHT3b6B8K90kjTTUw0 4L5ueLeV1JBeXrVkQEewhS80v+KKZo0s4SyspkaJWRx1dQb1nNHMfSAapxIDrMGvmUWR LPJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aHXsweOI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g7si1776170edr.423.2021.01.27.16.02.01; Wed, 27 Jan 2021 16:02:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aHXsweOI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234966AbhA0PMe (ORCPT + 99 others); Wed, 27 Jan 2021 10:12:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:57438 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235587AbhA0PH1 (ORCPT ); Wed, 27 Jan 2021 10:07:27 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 57384207E2; Wed, 27 Jan 2021 15:06:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611759991; bh=TWIRJM6gVAm1vQZqku9qg1fMLOchvryOpdAYf8HGPDU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=aHXsweOIcpqgkuspQ3fcjfaTCA0kdWWEAK7WZ3nQZCBqhIXNC5bSXA+Y83TTOkjxv H7enIR2piMgV/sMCuZyCih2ERruJOrH8t24mGD5h29UOaGuyFhPRez+fP60Ot2yS6t j9NHwH2JXoyHvJm4aN5DzivxDDEVf/ZK3R0yIYXp4EA72CMJ3W98vIexPYNXOtMMm5 zEznLnjohJ15VFkq7+7nJ+XaIWA3uN/ZrPcd9fn9mbWsmBX9Syj7942CqVvnHqSl3p rdYZCBKEC5SY+TnXzed9wxR8uwOOMjbtx4XogwATG2MHXkFS5SRWhu2U2PWMh9SFcq qbEtJ5UP4idHQ== Received: from johan by xi.lan with local (Exim 4.93.0.4) (envelope-from ) id 1l4mP5-0001xv-H6; Wed, 27 Jan 2021 16:06:43 +0100 Date: Wed, 27 Jan 2021 16:06:43 +0100 From: Johan Hovold To: Anant Thazhemadam Cc: Greg Kroah-Hartman , Lee Jones , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 08/12] usb: misc: ldusb: update to use usb_control_msg_send() Message-ID: References: <20210126183403.911653-1-anant.thazhemadam@gmail.com> <20210126183403.911653-9-anant.thazhemadam@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210126183403.911653-9-anant.thazhemadam@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 27, 2021 at 12:03:59AM +0530, Anant Thazhemadam wrote: > The newer usb_control_msg_{send|recv}() API are an improvement on the > existing usb_control_msg() as it ensures that a short read/write is treated > as an error, data can be used off the stack, and raw usb pipes need not be > created in the calling functions. > For this reason, the instance of usb_control_msg_send() has been replaced > with usb_control_msg_send() appropriately. > > Signed-off-by: Anant Thazhemadam > --- > drivers/usb/misc/ldusb.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c > index 670e4d91e9ca..259ead4edecb 100644 > --- a/drivers/usb/misc/ldusb.c > +++ b/drivers/usb/misc/ldusb.c > @@ -573,15 +573,13 @@ static ssize_t ld_usb_write(struct file *file, const char __user *buffer, > } > > if (dev->interrupt_out_endpoint == NULL) { > - /* try HID_REQ_SET_REPORT=9 on control_endpoint instead of interrupt_out_endpoint */ > - retval = usb_control_msg(interface_to_usbdev(dev->intf), > - usb_sndctrlpipe(interface_to_usbdev(dev->intf), 0), > - 9, > + retval = usb_control_msg_send(interface_to_usbdev(dev->intf), > + 0, 9, > USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_OUT, > 1 << 8, 0, > dev->interrupt_out_buffer, > bytes_to_write, > - USB_CTRL_SET_TIMEOUT); > + USB_CTRL_SET_TIMEOUT, GFP_KERNEL); > if (retval < 0) > dev_err(&dev->intf->dev, > "Couldn't submit HID_REQ_SET_REPORT %d\n", This would also only introduce a redundant allocation and memcpy() as the buffer is already DMA-able and used for that purpose in other places as well. I suggest dropping this one too. Johan