Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp590122pxb; Wed, 27 Jan 2021 16:03:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJyatTA1kfW6MSrXW58WZUXcSumk2yAcCndkfxMZBXWBcDSKJNdbCnO2hOwfvu2bGuza8BfJ X-Received: by 2002:a17:906:a851:: with SMTP id dx17mr8202760ejb.537.1611792180445; Wed, 27 Jan 2021 16:03:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611792180; cv=none; d=google.com; s=arc-20160816; b=GkV/geSPfC7exZPefAJoljLTaVRCRQWMaGkcl7bZnPpHoQbtv7CSbaNvgmiLW2v5qT bYofLIOt41H1hFqhHw25ZdcePWBXNihBHZFDZs+YHw0+QGhWQUj/ljqLaXMnwABaSzXV LybFFxPm9VoSnh8BUqGf5Z45/OzeFFzPKU2m2el0DUR+4/hRZfS833tvLeL5gEBoUbMK ahk7aQIcPnZeR7LSGN/uCgc41xn6JWYvutEqR97Gky954I1XMakxf/cj61wOdfb6mYrD 0EntzhVsfsOjDHz9g4l8z6mumX1O8yjv3CdODHw2h6ljl0YtGFojQY9k8raxJHQnfTUE ai/A== 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=xPaZJexNZbVRo8dBYBMXyJvqTswtbsVA/+mVVMqJ62A=; b=D0X8bZrg+Za7pklGvJXLCki6y769AEtD+JDbS3lv/N84n3lYxEwt29tKbBswIO9ShG qorhhsYe0dgbX12Np9W14LMpruG0JeG+Gc68Obdy4gqj+eeEVG2WonxyKUFzKePH2r2C R/kQrlwVLekNFPchW0V8WY3xbAZhkyHGuLiR0UqG6qeQq0MapsJ5qXbYyNBrm7U3g1iP vN4ylBsvU/kQJ593MM2H2puuf0cfbZf1n1vTmK39uUxTGBDurqB4ILkMLLYBy9lcVS8s /ucUmRJrA8v1NLYkYwIMG350nDiwhtQnO/vAqa6Bh1oGN3rczPynO/rgnsFaE6BqLv5y gA3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EfVLvV83; 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 op5si1423318ejb.378.2021.01.27.16.02.36; Wed, 27 Jan 2021 16:03:00 -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=EfVLvV83; 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 S235741AbhA0PW2 (ORCPT + 99 others); Wed, 27 Jan 2021 10:22:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:59920 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343777AbhA0PSY (ORCPT ); Wed, 27 Jan 2021 10:18:24 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id EBD4B20771; Wed, 27 Jan 2021 15:17:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611760662; bh=fKQ9phEJBGCKWL5bWxHuJhsxrJRnN4eJ4TrWBGWB0c0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EfVLvV839/tSKovtaxiEQZDLDimk65/gYoA5RM6kHYjo7QDI8owajO8HLL+sSZO2r F5povjE0De1Z99ESUrIiHrFgSBuBXe3IF34QuET2GuVjgj86gZFuhGDFKG7V8L5pJA d+T+BY2laVfQJ0WpHYy9+fwo0cwmF8NSxJHL1L7aoH6T7d8vNbluT//6vqU8NlWBZX ORid54/S2A/K2sDwePkMJRebOO2wBlBeg7Q0F1LgGnAN+VTFADrL9TIWt1GklHm+tX OdI1BK5Jig4m4zsBZsF++FmEULZqt/FRW67bI38PEAoCM/8BwrUtGxGRkrVG0e6+kk vNVXtof7MI1/A== Received: from johan by xi.lan with local (Exim 4.93.0.4) (envelope-from ) id 1l4mZu-00021f-18; Wed, 27 Jan 2021 16:17:54 +0100 Date: Wed, 27 Jan 2021 16:17:54 +0100 From: Johan Hovold To: Anant Thazhemadam Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 10/12] usb: misc: trancevibrator: update to use usb_control_msg_send() Message-ID: References: <20210126183403.911653-1-anant.thazhemadam@gmail.com> <20210126184010.914841-1-anant.thazhemadam@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210126184010.914841-1-anant.thazhemadam@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 27, 2021 at 12:10:10AM +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() has been replaced with > usb_control_msg_send() and the return value checking condition has also > been modified appropriately. > > Signed-off-by: Anant Thazhemadam > --- > drivers/usb/misc/trancevibrator.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/usb/misc/trancevibrator.c b/drivers/usb/misc/trancevibrator.c > index a3dfc77578ea..c50807b4f4ef 100644 > --- a/drivers/usb/misc/trancevibrator.c > +++ b/drivers/usb/misc/trancevibrator.c > @@ -59,11 +59,11 @@ static ssize_t speed_store(struct device *dev, struct device_attribute *attr, > dev_dbg(&tv->udev->dev, "speed = %d\n", tv->speed); > > /* Set speed */ > - retval = usb_control_msg(tv->udev, usb_sndctrlpipe(tv->udev, 0), > + retval = usb_control_msg_send(tv->udev, 0, > 0x01, /* vendor request: set speed */ > USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_OTHER, > tv->speed, /* speed value */ > - 0, NULL, 0, USB_CTRL_GET_TIMEOUT); > + 0, NULL, 0, USB_CTRL_GET_TIMEOUT, GFP_KERNEL); > if (retval) { > tv->speed = old; > dev_dbg(&tv->udev->dev, "retval = %d\n", retval); While this patch looks correct, the new helpers doesn't really buy us anything for (OUT) control transfers without a data stage. Johan