Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2572271imu; Mon, 17 Dec 2018 04:25:00 -0800 (PST) X-Google-Smtp-Source: AFSGD/VyEda1aaLvR68qRnDppNEnmnAV4kZPIlfkGdAl/uRVhp+PZdb9u1eSe/XnbPyCaeZFz7q4 X-Received: by 2002:a17:902:4025:: with SMTP id b34mr12651370pld.181.1545049500804; Mon, 17 Dec 2018 04:25:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545049500; cv=none; d=google.com; s=arc-20160816; b=sOKHi0ZQaY0FaIcK9axXcemaA3eIw+uVK+dWZOcv4Eg2TGrYOmYevlR92WoXJhKEQO 63wv5ofd8J4fhu3NR4+vzRZU5Oi39DbvYbqKZ3Vjg6wn6hfXY0soLv7EwqhCyVBOhquV VoyBb4bEmwIQ67TErrd3ipaLQTWssMbkI88Jkb1zc0DnERfKyhcm3sfojCP3JO71bqQY H1oqTBjD/AknLhruS5N03ddyVTauoEZ6ucYIKoNi0tyK2V9z8h7XY7gDT0RzJbF5ermE I1fqpEOwSnKv1Eo1JbS43UJl6XEklq0n4/qcEmz6iHUxN4UPk8Mch94cgmZXYqpQY7Jn UJvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=kVQLD0mOTM56L1adOdfwFJ4a7LrGHRtM5faIcx+gL8U=; b=FIRis/SopD2NacU3omKvzccC8zyXkYRRwsu9f0PsqlbziNDrI4aOUk+lYnbnfEf6VL ed4Hs9r0qs8EFIsusrGmgadfzq3cQ8X5KIWGf803fSoVgQw24tF8hto+bKMpodX8d+hS GXl6e00h+CwlwhsxnH0vxv1nfSFJD5gv7tU2sjWCo8UeCNSY87t99DRDl6Zne5dDvocO N3GRdbPJJHUNmVIGqit90UqHjXO/Q+tvrmj8NenYE/i0e8HxaFI8iG8qwyhL2664CUaa mMBwEraawWcxiYWvJQbOEFfK7N1xHvZ6L9pqWCLOgnXWdDnbY7LouH0l25lcFjXX2as2 tqDw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y1si10333046plt.356.2018.12.17.04.24.45; Mon, 17 Dec 2018 04:25:00 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732229AbeLQLeQ (ORCPT + 99 others); Mon, 17 Dec 2018 06:34:16 -0500 Received: from mga05.intel.com ([192.55.52.43]:35824 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726642AbeLQLeP (ORCPT ); Mon, 17 Dec 2018 06:34:15 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Dec 2018 03:34:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,365,1539673200"; d="asc'?scan'208";a="102123939" Received: from pipin.fi.intel.com (HELO localhost) ([10.237.72.175]) by orsmga008.jf.intel.com with ESMTP; 17 Dec 2018 03:34:11 -0800 From: Felipe Balbi To: Pawel Laszczak , "devicetree\@vger.kernel.org" , Kishon Vijay Abraham I Cc: "gregkh\@linuxfoundation.org" , "linux-usb\@vger.kernel.org" , "rogerq\@ti.com" , "linux-kernel\@vger.kernel.org" , Alan Douglas , "jbergsagel\@ti.com" , "nsekhar\@ti.com" , "nm\@ti.com" , Suresh Punnoose , "peter.chen\@nxp.com" , Pawel Jez , Rahul Kumar Subject: RE: [PATCH v1 2/2] usb:cdns3 Add Cadence USB3 DRD Driver In-Reply-To: References: <1544445555-17325-1-git-send-email-pawell@cadence.com> <1544445555-17325-3-git-send-email-pawell@cadence.com> <87h8fkmfar.fsf@linux.intel.com> <87a7lbme3m.fsf@linux.intel.com> Date: Mon, 17 Dec 2018 13:34:00 +0200 Message-ID: <87sgywgzfb.fsf@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, Pawel Laszczak writes: >>>>> + case USB_REQ_SET_ISOCH_DELAY: >>>>> + sprintf(str, "Set Isochronous Delay Delay: %d ns", wValue); >>>>> + break; >>>>> + default: >>>>> + sprintf(str, >>>>> + "SETUP BRT: %02x BR: %02x V: %04x I: %04x L: %04x\n", >>>>> + bRequestType, bRequest, >>>>> + wValue, wIndex, wLength); >>>>> + } >>>>> + >>>>> + return str; >>>>> +} >>>> >>>>All of these are a flat out copy of dwc3's implementation. It's much, >>>>much better to turn dwc3's implementation into a generic, reusable >>>>library function then spinning your own as a duplicated effort. >>> I agree, >>> It would be nice to have a set of decoding function in some generic li= brary. It could be used >>> also by other drivers. >>> Who should do this ? >> >>since you're the first to reuse it, then it should be you :-) > > So I can prepare debug.h in drivers/usb/gadget directory.=20 no, not there. Host drivers can rely on it too, if they want. Let's have it on drivers/usb/common/debug.c (or some other name) and a header under in= clude/linux/usb/ > Function form drivers/usb/dwc3/debug.h that could be common are:=20 > > static inline void dwc3_decode_get_status(__u8 t, __u16 i, __u16 l, char = *str) > static inline void dwc3_decode_get_set_descriptor(__u8 t, __u8 b, __u16 v, > __u16 i, __u16 l, char *str) > static inline void dwc3_decode_set_clear_feature(__u8 t, __u8 b, __u16 v,= __u16 i, char *str)=09=09=09=09=09=09=09=09=09=09=09=09 > static inline void dwc3_decode_set_address(__u16 v, char *str) > static inline void dwc3_decode_get_set_descriptor(__u8 t, __u8 b, __u16 v= , __u16 i, __u16 l, char *str)=09=09=09=09=09=09=20=20 > static inline void dwc3_decode_get_configuration(__u16 l, char *str) > static inline void dwc3_decode_set_configuration(__u8 v, char *str) > static inline void dwc3_decode_get_intf(__u16 i, __u16 l, char *str) > static inline void dwc3_decode_set_intf(__u8 v, __u16 i, char *str) > static inline void dwc3_decode_synch_frame(__u16 i, __u16 l, char *str) > static inline const char *dwc3_decode_ctrl(char *str, __u8 bRequestType, = __u8 bRequest, __u16 wValue, __u16 wIndex, __u16 wLength) > > After changed it could looks like:=20 > static inline void usb_decode_get_status(__u8 bRequestType, __u16 wIndex,= __u16 wLength, char *str) > static inline void usb _decode_get_set_descriptor(__u8 bRequestType, __u8= bRequest, __u16 wValue, > __u16 wIndex, __u16 wLength, char *str) > static inline void usb_decode_set_clear_feature(__u8 bRequestType, __u8 b= Request, __u16 wValue, __u16 wIndex, char *str)=09=09=09=09=09=09=09=09=09= =09=09=09 > static inline void usb_decode_set_address(__u16 v, char *str) > static inline void usb_decode_get_set_descriptor(__u8 bRequestType, __u8 = bRequest, __u16 wValue, __u16 wIndex, __u16 wLength, char *str)=09=09=09=09= =09=09=20=20 > static inline void usb_decode_get_configuration(__u16 wLength, char *str) > static inline void usb_decode_set_configuration(__u8 wValue, char *str) > static inline void usb_decode_get_intf(__u16 wIndex, __u16 wLength, char = *str) > static inline void usb_decode_set_intf(__u8 wValue, __u16 wIndex, char *s= tr) > static inline void usb_decode_synch_frame(__u16 wIndex, __u16 wLength, ch= ar *str) > static inline const char * usb _decode_ctrl(char *str, __u8 bRequestType,= __u8 bRequest, __u16 wValue, __u16 wIndex, __u16 wLength) > > Sorry but I prefer some more significant names :) meh, no worries > For me functions in drivers/usb/dwc3/debug.h looks ok, but I think that c= ould be better to > add additional usb_decode_test_mode and usb_decode_device_feature and lit= tle simplify usb_decode_get_set_descriptor.=20 sure, just propose patches. Just make sure that your patches do a single thing per patch. Meaning, first you add a patch moving functions to drivers/usb/common and updating dwc3, then you add another to decode test mode (then update dwc3), and another simplifying set_descriptor. > What do you think about this? > > One more question.=20 > Can I add drivers/usb/gadget/debug.h file as part of my set patches, or= this should be done as separate, new patch ?=20 Your first patch moving functions from dwc3 should move them somewhere ;) =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEElLzh7wn96CXwjh2IzL64meEamQYFAlwXiaoACgkQzL64meEa mQb9+BAA0UfEj50YYeKcKFhqmWi16A5m/NFeikwuBKpNfGBhYln18XPA5NuCCX0t j1aXzy2C6K11NDXSyA3XSq6LsVNOQP8Xq2B26fnnUNVuuVCdgynNVSxjuOEmfLD3 9o8GmDQ9qvI6QCsjFAM+nZZzakJ8IGYdq87dKDS30rR2+tyRpznD5jXfPqyLB1uK LtyGcF6z6r851yzJTlEFLtUm4eDJ1pCiRWBJYmqcGPIXXCz1iGTs2Jnmg/fwRoeE 1z6SnQkyoxnKutDTJ7duvY2Y/Oc7H2XwTLtAgEw3jv+AB8UxmlqAF7wxxxK6tXaj KdsTRPwstiTvOv+PUqFyL/bWx3nJi7IzqpdXZ1UEV4XMxN6O4jSDMSOTmIdteqUH lMl9i+odGUq58EzPFiiTccufl4m5/Z8u1SR0df0mplQNlJLpV8vkVMrRakmZVOzk wMUBbx03Pe6JLax1/q6FPFlc2PmtzKiiCUbePQ2J4GAzj7nhSUCtj0OJ4JPTVEw0 umAJ+7F6pIzKpur2RZ4+kETCEjLft/4cyo4yc6jW14hwtXz7FgrAza/0ZtWInhNm ruiF6umHuyJFcZZT60+Sbp/+YX1Q/brgvWoMYEgmO124giOKTC++H1er0URPTXIN 4YyzAJkdKhVfCJFo85aQmXYN/OCbhI2ffvjYLqTJ6Lz9t8DNB3o= =qwLD -----END PGP SIGNATURE----- --=-=-=--