Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2755226pxv; Sun, 27 Jun 2021 07:51:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwyz92zs+AOBPiqQcJbkhaGZQM6mLq87CsmArINzVLnbqQx2AWhHuRCSgEnEs1ffUFiGgMO X-Received: by 2002:a05:6638:ecf:: with SMTP id q15mr18403211jas.18.1624805480567; Sun, 27 Jun 2021 07:51:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624805480; cv=none; d=google.com; s=arc-20160816; b=N5emQukhc2Yp1tP/0hgU50y6f7vb9p4+VTsW5yHx98wSTinYtj5e2dMzvT2X23iEja UqXyiCded4hj2ci6JsUmbGPolvTrfY20qoNuNHtPZ73US5H+bIYkmfwYh3o5k148tVeY Q1mmHXfxFnJhWLDEdo/ukWYMj+22YA3iPwKZnJmC3LFQmFMbg5vD5/Pp5K0O7T1yAJq+ j7hnjB0MW8Xs2HwcZgfz1lrEgUvQEYdBD5j+tunufYo1ZKU7G+IFx86VDEeUoisYwISM tUmlzUoFQtim/g61t4G8vKQ/5orvRjFVk5oDMaHQuBQKAest4AnPZL87eronyfXmSSfC m09g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=MUAmTSReCsgXgnPbyWMlRfbju40WnRDL9v+QLQYy8tQ=; b=Uz2z1ygwGwwnxy0FIrUI0tpc3YMpq/yC3n+L9kTpmspc2/JrlAS3k2bZfduDyCxpeA spBhN18cIa9QcUh6D9K5yO68eDyxrCO8cyvaHC40poW2FKY8y2OeuOuyOqCX2vcTqzJE 7Eg4puaO9sOzyI0Qxt98zr+0y99CdNCZWdgIIkvY5WDHSXSldUsUxUuT//irqVGaoYa9 /5labLC2qiDPxym/jUImxkaCdG1BuF9HQxaZLnuYcNhhBvxReZLO8JzkM3pImi+siGOp K5Mv0ycRSCqw4GllxrgYPwXQi3GSHckXIGuA1N4mpSoy1l6lMz7QKRrVDj7B6MSpUZbf wU1A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y4si14385423jas.26.2021.06.27.07.51.07; Sun, 27 Jun 2021 07:51:20 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229927AbhF0OVB (ORCPT + 99 others); Sun, 27 Jun 2021 10:21:01 -0400 Received: from netrider.rowland.org ([192.131.102.5]:51627 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S229973AbhF0OVB (ORCPT ); Sun, 27 Jun 2021 10:21:01 -0400 Received: (qmail 625832 invoked by uid 1000); 27 Jun 2021 10:18:36 -0400 Date: Sun, 27 Jun 2021 10:18:36 -0400 From: Alan Stern To: Igor Kononenko Cc: Felipe Balbi , Greg Kroah-Hartman , openbmc@lists.ozlabs.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/6] usb:gadget:mass-storage: Improve the signature of SCSI handler function Message-ID: <20210627141836.GC624763@rowland.harvard.edu> References: <20210626211820.107310-1-i.kononenko@yadro.com> <20210626211820.107310-2-i.kononenko@yadro.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210626211820.107310-2-i.kononenko@yadro.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jun 27, 2021 at 12:18:14AM +0300, Igor Kononenko wrote: > SCSI command handlers currently have an ambiguous return value. This (I dislike very much this way of writing patch descriptions. Unless the reader has already looked at the email subject line and remembers that this patch affects the mass-storage gadget, he will think the sentence above is talking about command handlers in the SCSI core -- a completely different part of the kernel. When writing patch descriptions, please do not assume that the reader already knows what the patch is about.) > return value may indicate the length of the data written to the response > buffer and the command's processing status. Thus, the understanding of > command handling may be implicit. The return value is _not_ ambiguous. If the value is >= 0 then it is a data length, otherwise it is a status. Yes, this is implicit, but it is a very common pattern used throughout the kernel and everyone understands it. > After this patch, the output buffer's size will be set in the > 'data_size_to_handle' field of 'struct fsg_common', and the command > handler's return value indicates only the processing status. What is the reason for making this change? Does it fix any problems or prepare the way for any future patches? It seems like this is completely unnecessary. Alan Stern > Tested: By probing the USBGadget Mass-Storage on the YADRO VEGMAN > BMC(AST2500) sample, each SCSI command was sent through HOST->BMC; the > USBGadget MassStorage debug print showed all sent commands works > properly. > > Signed-off-by: Igor Kononenko