Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp3838232ima; Mon, 4 Feb 2019 06:06:28 -0800 (PST) X-Google-Smtp-Source: ALg8bN4mbvXoHPE7s/k3T4E6Jx9xsFz4n3MBBirgxbtE1BeG6upTpwvanngRenrwr7VbLUWAdUGj X-Received: by 2002:a62:b511:: with SMTP id y17mr51721801pfe.199.1549289188439; Mon, 04 Feb 2019 06:06:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549289188; cv=none; d=google.com; s=arc-20160816; b=qP/8G6AXsuP3J9lAbqHLkkO5ZXmW+rLLfUT6olB4xaibG3kjwJBjzR+F2K6U4+zIb3 D6utVxKVWbKOXcxr+hsen4IQ5fwWJjIkoUzOz+O3mVfVBbVcG7dUpFAD7btMQG4Hk01T R8P6N2QBu6eVBzRfH7W+c8DCDyYGqU/mrFh/Tpa5aE2YCVxpJ+pYk1itd5Kzu245zN8p 7fVF2RJErKCE4sEQyErtF+8pSc+cE1XiZVHO1wO2z96TqD2B6JNKi/TX2/b+l2r2S2kN FY6Vf2oFk9l2l1kBsOrp05H/hUgXWSMR2mVSRww/7XUb5YF9vBreUeNzIKHYS2kwqUvS bwXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=BMLm/kSCsv9ZVN0KIHPKBbmRSsLhqqTgXYAbx9n4wuA=; b=mJuubhfoSF0fpj7Z9N81C5Ah9liZOjuPSFEBRz+zat7DgkBYkZrknS+ph41qgR02hT wEj6MZzbTCQuOH3H4/WbGD8kKy5oe4VwuFk0AGMrfjzTaO62fSCs16xrKkKcEWscYf/k EAA4qv8XgVyeYE+6qVYltU0oRajynXhKHbUfh/2nN4jUQL65HBaJ2X1qdDBZ2+mA9+ky HCvdxCmKBPnk6V0G8zM6k+DFUiI+HhPIx6vshBiA5b0Cm2rNPQPi7lV+dxMiqOLGJww4 O8wTaQm0cNaEWBUDMep8h6r1c+2wDBw0K6opezx36SZTSAj/5XqKmdzwRf9ez/4LG9Qp 6TVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=We9gJsvp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p126si94683pgp.529.2019.02.04.06.06.10; Mon, 04 Feb 2019 06:06:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=We9gJsvp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729288AbfBDLpG (ORCPT + 99 others); Mon, 4 Feb 2019 06:45:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:34634 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726603AbfBDLpG (ORCPT ); Mon, 4 Feb 2019 06:45:06 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C326620811; Mon, 4 Feb 2019 11:45:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549280705; bh=bPuflJNOz60O+F3KqUmIB84EZof99yA9gKu3R5BA3zI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=We9gJsvp3ewGnmgl+jbXBgYAka47aGJ62bKaAhnPI4qDTc6gCWTBgCPf3n+LdtT9o Rc//lChcWETjlkWSGv8wnOR+JTLxAVC/lnfiy2IfgeTjQVA5N9MnZSgcPOFh0p/j4R +HUvUliggaYU6A+bxuNrG/pFmsHk/hC3cuFpC77M= Date: Mon, 4 Feb 2019 12:45:02 +0100 From: Greg KH To: Pawel Laszczak Cc: devicetree@vger.kernel.org, mark.rutland@arm.com, linux-usb@vger.kernel.org, hdegoede@redhat.com, heikki.krogerus@linux.intel.com, andy.shevchenko@gmail.com, robh+dt@kernel.org, rogerq@ti.com, linux-kernel@vger.kernel.org, jbergsagel@ti.com, nsekhar@ti.com, nm@ti.com, sureshp@cadence.com, peter.chen@nxp.com, pjez@cadence.com, kurahul@cadence.com Subject: Re: [PATCH v3 2/6] usb:common Separated decoding functions from dwc3 driver. Message-ID: <20190204114502.GA28608@kroah.com> References: <1548935553-452-1-git-send-email-pawell@cadence.com> <1548935553-452-3-git-send-email-pawell@cadence.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1548935553-452-3-git-send-email-pawell@cadence.com> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 31, 2019 at 11:52:29AM +0000, Pawel Laszczak wrote: > Patch moves some decoding functions from driver/usb/dwc3/debug.h driver > to driver/usb/common/debug.c file. These moved functions include: > dwc3_decode_get_status > dwc3_decode_set_clear_feature > dwc3_decode_set_address > dwc3_decode_get_set_descriptor > dwc3_decode_get_configuration > dwc3_decode_set_configuration > dwc3_decode_get_intf > dwc3_decode_set_intf > dwc3_decode_synch_frame > dwc3_decode_set_sel > dwc3_decode_set_isoch_delay > dwc3_decode_ctrl > > These functions are used also in inroduced cdns3 driver. > > All functions prefixes were changed from dwc3 to usb. Ick, why? > Also, function's parameters has been extended according to the name > of fields in standard SETUP packet. > Additionally, patch adds usb_decode_ctrl function to > include/linux/usb/ch9.h file. Why ch9.h? It's not something that is specified in the spec, it's a usb-specific thing :) Also, the api for that function is not ok. If you are going to make this something that the whole kernel can call, you have to fix it up: > +/** > + * usb_decode_ctrl - Returns human readable representation of control request. > + * @str: buffer to return a human-readable representation of control request. > + * This buffer should have about 200 bytes. "about 200 bytes" is not very specific. Pass in the length so we know we don't overflow it. > + * @bRequestType: matches the USB bmRequestType field > + * @bRequest: matches the USB bRequest field > + * @wValue: matches the USB wValue field (CPU byte order) > + * @wIndex: matches the USB wIndex field (CPU byte order) > + * @wLength: matches the USB wLength field (CPU byte order) > + * > + * Function returns decoded, formatted and human-readable description of > + * control request packet. > + * > + * Important: wValue, wIndex, wLength parameters before invoking this function > + * should be processed by le16_to_cpu macro. > + */ > +const char *usb_decode_ctrl(char *str, __u8 bRequestType, __u8 bRequest, > + __u16 wValue, __u16 wIndex, __u16 wLength); Why are you returning a value, isn't the data stored in str? Why not just return an int saying if the call succeeded or not? thanks, greg k-h