Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp390982lqc; Thu, 7 Mar 2024 23:55:28 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWbQj34diCXVx2iToNfRTp+LWtriayY6koZzcRZes/1U0oLn53dQYqrLuCrCB6G5ttKa5SUO1dJk0lCWIUXZO9ODipFqSWLcbbVRPLgnA== X-Google-Smtp-Source: AGHT+IGS04h3GjAoDGGZYkC9kYXvR4RWiugVgGFKhcdF1hZSjZi1Os2LUWBC0Zfe4eNK0GuvGFzg X-Received: by 2002:a05:6808:106:b0:3c2:2f9a:f87b with SMTP id b6-20020a056808010600b003c22f9af87bmr1624535oie.19.1709884528390; Thu, 07 Mar 2024 23:55:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709884528; cv=pass; d=google.com; s=arc-20160816; b=Mzt3PXjlMHmNHq9lDlfojPiYQTKMi/ku34qw9TZxHtTWfOfiYjwpFjNmuVuk3DIUpL qC/tCHimCbTDkDg4DVqzVnIGGPHCn/oI0EXnuvEUW7kiGExzDufgo07nS2/8uMT40LMf L/wsfA8+TGNa6H9an0e+Kdmh/9FaQk3l3vV+j6FHdAo5cAhumgbsyRYnDH/SHjSb8Qwr CmxqJS+VUeXF2WR+LaOJxfVfvNdS09oocoNDfpIqlfrMS3C4ttDnNryMDmOFV73es62R 8zMyNdryBHs6Bo3Pn4NT4zqFM8bksOeh+u76Zegefe4srjRK0wQNuTQQHWFPhGFljdBq S9jw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=mpE/2jSGIqrmXwFzS0mM9cFdG/l5rdqPJ2uli7vIZWc=; fh=oSYg153VkCL7TT8PosKhdNrGWThydDWIaMH2RAkKIfY=; b=D8qIaL97LnaDkRl3ju6l+wCqwUjpzxaq3HX5BUzpjSlOk2gXZOauOLuPjnm3ItWEn4 QSm99uaUBxzi3VBAYa9VsrkcL7ot/aDdLpN7K23AL/RwJOQr58VDVLCFrksu2RyVisf5 zkKLmHs17dSbY1icApjfsDMsFAfP+w/O8rtk7I3E0jfuHBg6BeoU5kDsp2pEK3SiGARY H7pwIRx2GmodbVNyXY8yG5VbQevLulYfk3NbceE6aJGu3VjdS4typa7fOot9EoymfPZx USDZiwdCx8jM9jfYDYDk0xi0Q92Zcijxy7ZKo9n1PtUs62Gvtq/CXUYKDLcLe36vOwQJ rNKg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="yyK/+/8z"; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-96610-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-96610-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id w7-20020a626207000000b006e5ecc091dbsi11097914pfb.362.2024.03.07.23.55.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 23:55:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-96610-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="yyK/+/8z"; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-96610-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-96610-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0E2642844C8 for ; Fri, 8 Mar 2024 07:55:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 423434F8BB; Fri, 8 Mar 2024 07:55:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="yyK/+/8z" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 235F21CD09; Fri, 8 Mar 2024 07:55:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709884519; cv=none; b=eY5I9wLhmFjrCl7J/TP2NZDoM91ta30TabbhuSKvl4C9uO8v7ygZTEKwKNaYfYyAodceBMPRna0ZzOefXCKMC4IkAGgQuewwwhJnm+s3XOvjF2tiFzlH2LC0zG0vE7gVUEv06RpvADGhGso9+A7kXDReBgM2+kkxzM7NV7ZHU/s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709884519; c=relaxed/simple; bh=LdHdlTz00/xGuGZrRMcWu5Guyy6/rT9KdfA6ao/pU6c=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=q1tcFvwf/g6EDYjHY67KZHLjoRYm1owJnRriteNRtP9vCTid58NiaGrDpdwLOPRBvKwPfPea4q9cOLaGMbAbnp5U9b6/16mt41KyGI3g4MjFJc465z6ELMKvovxR13fowR7EiPGSibZ6fcQdF5rBHyzogNDqjHcD0OATt7hEJlI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=yyK/+/8z; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B843C433C7; Fri, 8 Mar 2024 07:55:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1709884518; bh=LdHdlTz00/xGuGZrRMcWu5Guyy6/rT9KdfA6ao/pU6c=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=yyK/+/8zqyTe2hKRyMhT3GgGH/Kh+i/kPwiF1jso98anyRttX/LPN+RmyKZol0Vfi cBZ0vACiHC4yhXYuXLAZvsJ1hwGKwj/IO01FS6I/IrWNiSfNZnrn77XIW9CWZvd7OK SO2rFAyLfhP9yxa+m1lI6wIdTUZ9i4dWFeXFvUSk= Date: Fri, 8 Mar 2024 07:55:16 +0000 From: Greg KH To: Dingyan Li <18500469033@163.com> Cc: stern@rowland.harvard.edu, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] USB: Use EHCI control transfer pid macros instead of constant values. Message-ID: <2024030802-huntsman-undertake-a38a@gregkh> References: <1e7f57d6-a4c1-4a3d-8cff-f966c89a8140@rowland.harvard.edu> <20240308010859.81987-1-18500469033@163.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240308010859.81987-1-18500469033@163.com> On Fri, Mar 08, 2024 at 09:08:59AM +0800, Dingyan Li wrote: > Macros with good names offer better readability. Besides, also move > the definition to ehci.h. > > Signed-off-by: Dingyan Li <18500469033@163.com> > --- > drivers/usb/host/ehci-dbg.c | 10 +++++----- > drivers/usb/host/ehci-q.c | 20 ++++++++------------ > drivers/usb/host/ehci.h | 8 +++++++- > 3 files changed, 20 insertions(+), 18 deletions(-) > > diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c > index c063fb042926..435001128221 100644 > --- a/drivers/usb/host/ehci-dbg.c > +++ b/drivers/usb/host/ehci-dbg.c > @@ -430,13 +430,13 @@ static void qh_lines(struct ehci_hcd *ehci, struct ehci_qh *qh, > mark = '/'; > } > switch ((scratch >> 8) & 0x03) { > - case 0: > + case PID_CODE_OUT: > type = "out"; > break; > - case 1: > + case PID_CODE_IN: > type = "in"; > break; > - case 2: > + case PID_CODE_SETUP: > type = "setup"; > break; > default: > @@ -602,10 +602,10 @@ static unsigned output_buf_tds_dir(char *buf, struct ehci_hcd *ehci, > list_for_each_entry(qtd, &qh->qtd_list, qtd_list) { > temp++; > switch ((hc32_to_cpu(ehci, qtd->hw_token) >> 8) & 0x03) { > - case 0: > + case PID_CODE_OUT: > type = "out"; > continue; > - case 1: > + case PID_CODE_IN: > type = "in"; > continue; > } > diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c > index 666f5c4db25a..ba37a9fcab92 100644 > --- a/drivers/usb/host/ehci-q.c > +++ b/drivers/usb/host/ehci-q.c > @@ -27,10 +27,6 @@ > > /*-------------------------------------------------------------------------*/ > > -/* PID Codes that are used here, from EHCI specification, Table 3-16. */ > -#define PID_CODE_IN 1 > -#define PID_CODE_SETUP 2 > - > /* fill a qtd, returning how much of the buffer we were able to queue up */ > > static unsigned int > @@ -230,7 +226,7 @@ static int qtd_copy_status ( > /* fs/ls interrupt xfer missed the complete-split */ > status = -EPROTO; > } else if (token & QTD_STS_DBE) { > - status = (QTD_PID (token) == 1) /* IN ? */ > + status = (QTD_PID(token) == PID_CODE_IN) /* IN ? */ > ? -ENOSR /* hc couldn't read data */ > : -ECOMM; /* hc couldn't write data */ > } else if (token & QTD_STS_XACT) { > @@ -606,7 +602,7 @@ qh_urb_transaction ( > /* SETUP pid */ > qtd_fill(ehci, qtd, urb->setup_dma, > sizeof (struct usb_ctrlrequest), > - token | (2 /* "setup" */ << 8), 8); > + token | (PID_CODE_SETUP << 8), 8); > > /* ... and always at least one more pid */ > token ^= QTD_TOGGLE; > @@ -620,7 +616,7 @@ qh_urb_transaction ( > > /* for zero length DATA stages, STATUS is always IN */ > if (len == 0) > - token |= (1 /* "in" */ << 8); > + token |= (PID_CODE_IN << 8); > } > > /* > @@ -642,7 +638,7 @@ qh_urb_transaction ( > } > > if (is_input) > - token |= (1 /* "in" */ << 8); > + token |= (PID_CODE_IN << 8); > /* else it's already initted to "out" pid (0 << 8) */ > > maxpacket = usb_endpoint_maxp(&urb->ep->desc); > @@ -709,7 +705,7 @@ qh_urb_transaction ( > > if (usb_pipecontrol (urb->pipe)) { > one_more = 1; > - token ^= 0x0100; /* "in" <--> "out" */ > + token ^= (PID_CODE_IN << 8); /* "in" <--> "out" */ > token |= QTD_TOGGLE; /* force DATA1 */ > } else if (usb_pipeout(urb->pipe) > && (urb->transfer_flags & URB_ZERO_PACKET) > @@ -1203,7 +1199,7 @@ static int ehci_submit_single_step_set_feature( > /* SETUP pid, and interrupt after SETUP completion */ > qtd_fill(ehci, qtd, urb->setup_dma, > sizeof(struct usb_ctrlrequest), > - QTD_IOC | token | (2 /* "setup" */ << 8), 8); > + QTD_IOC | token | (PID_CODE_SETUP << 8), 8); > > submit_async(ehci, urb, &qtd_list, GFP_ATOMIC); > return 0; /*Return now; we shall come back after 15 seconds*/ > @@ -1216,7 +1212,7 @@ static int ehci_submit_single_step_set_feature( > token ^= QTD_TOGGLE; /*We need to start IN with DATA-1 Pid-sequence*/ > buf = urb->transfer_dma; > > - token |= (1 /* "in" */ << 8); /*This is IN stage*/ > + token |= (PID_CODE_IN << 8); /*This is IN stage*/ > > maxpacket = usb_endpoint_maxp(&urb->ep->desc); > > @@ -1229,7 +1225,7 @@ static int ehci_submit_single_step_set_feature( > qtd->hw_alt_next = EHCI_LIST_END(ehci); > > /* STATUS stage for GetDesc control request */ > - token ^= 0x0100; /* "in" <--> "out" */ > + token ^= (PID_CODE_IN << 8); /* "in" <--> "out" */ > token |= QTD_TOGGLE; /* force DATA1 */ > > qtd_prev = qtd; > diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h > index 1441e3400796..d7a3c8d13f6b 100644 > --- a/drivers/usb/host/ehci.h > +++ b/drivers/usb/host/ehci.h > @@ -321,10 +321,16 @@ struct ehci_qtd { > size_t length; /* length of buffer */ > } __aligned(32); > > +/* PID Codes that are used here, from EHCI specification, Table 3-16. */ > +#define PID_CODE_OUT 0 > +#define PID_CODE_IN 1 > +#define PID_CODE_SETUP 2 > + > /* mask NakCnt+T in qh->hw_alt_next */ > #define QTD_MASK(ehci) cpu_to_hc32(ehci, ~0x1f) > > -#define IS_SHORT_READ(token) (QTD_LENGTH(token) != 0 && QTD_PID(token) == 1) > +#define IS_SHORT_READ(token) (QTD_LENGTH(token) != 0 && \ > + QTD_PID(token) == PID_CODE_IN) > > /*-------------------------------------------------------------------------*/ > > -- > 2.25.1 > > Hi, This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree. You are receiving this message because of the following common error(s) as indicated below: - This looks like a new version of a previously submitted patch, but you did not list below the --- line any changes from the previous version. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/process/submitting-patches.rst for what needs to be done here to properly describe this. If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers. thanks, greg k-h's patch email bot