Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp862214pxf; Wed, 7 Apr 2021 13:33:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAiGFi6H1Of3AV2faeSHqsEB+udQwOU2VmaJoZbdcTNgmSBHfXYfKewTi3bDx+CYKSVD9S X-Received: by 2002:a17:906:a413:: with SMTP id l19mr5975434ejz.421.1617827610157; Wed, 07 Apr 2021 13:33:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617827610; cv=none; d=google.com; s=arc-20160816; b=cXPsfAtsJjPBbzJNvrxkNBz7t3z/zt/D3QcNOqzoCzY53jOiBlz43ChUaOjNNMlAfh ihh/8xGtryMHLIlPpv0qCYyXIRoha971tVogIHxR/RSDNo6RupmVCMxYj4BLRs97NiyU /nJz82wrzqPDwoA1mQ+PtK1wf88E7fRiTohiXbgke7/ckxvXeY2uje5q+fplUI7uv/ld doynn0MN7fL1cMRiWO0+bC/gqGFnEFSy3blex0osVlqTkVdJjSDQiot5oo2Jdt32NIKo scGEb46JQxWE6JeOJ/3OdXZmvgDd0ceOqdfnjCkfIPBXYrD7W2jJziPTRnnd7iVA5HUs aYZQ== 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=/jYC7YnlhhJHVDHPCdvmTaOg33xPjS9m0Ai+MPSpXbI=; b=0XWrjgriH7lVDagkL7FZmUP9KEF2XvGp9XTBgRoSREkt6xhv+q38gTWMc/LMrck1TW WOjQ6O+EyglR0BPZDJcqCv8L/N9K0Deu9Pp97WMw/DO74e/nLg9Xzis9A+GIeXtsQGm/ 5QKBC6JT5mDbZ6GQiohZR4s0OuhWxnmMzsrL9cNFSnaGfTuflaEiDdNBdR0uVExkJXVw 01MVCCRscZt4AnLMpoWoBkolLeN2xa/bz3xEeauRdnFarOOXyP93f86GwqgntvYuxNsn LVqD/D+nok2W8xn4dD2+Mu/ubYxuDO0Zfy9sPEztr9GD2aqn5dhJSsz/jg8dPstsdMZI IAmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TwhcyB0C; 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 y27si4785ejc.615.2021.04.07.13.33.06; Wed, 07 Apr 2021 13:33:30 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TwhcyB0C; 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 S1344910AbhDGIPf (ORCPT + 99 others); Wed, 7 Apr 2021 04:15:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:45020 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239391AbhDGIPc (ORCPT ); Wed, 7 Apr 2021 04:15:32 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5D82D61363; Wed, 7 Apr 2021 08:15:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617783323; bh=spo3XQrXBslXukUO/eKhNGhd8BzmT3xOrjhdgFIQi2M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=TwhcyB0CUooi5wQm/oGRiMjMV54ea8qMkbodoyT/n1HNETiil+sKTEsGhqXQ/DsN4 /NobHk+hk9gwH8VKdaeuHwgya8Pi4G+2wRV3tkHTJIG5yzqQmCasVF/8Itq4JSY2nz s3ultnZ3Ngn0I/52uIW1lHqO5M7u5leHvp6B0+CZaUQ4/INFFYKJGwOt2Cz2SBaPMz TmhTZIWo9XEz6evHCW7l6Fe6ETJz9eFnIaRp7JfPhY6tpJQyspEZp8WAGf++dneOy0 OHiiadV+idYvAL59G90xIOmGTxxXoQBrayJAYNxLiOL9rFVi1JoTlPm3sFFNdhh0zv NZw/HD8gSe2aA== Date: Wed, 7 Apr 2021 11:15:19 +0300 From: Leon Romanovsky To: Dexuan Cui Cc: Andrew Lunn , "davem@davemloft.net" , "kuba@kernel.org" , KY Srinivasan , Haiyang Zhang , Stephen Hemminger , "wei.liu@kernel.org" , Wei Liu , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-hyperv@vger.kernel.org" Subject: Re: [PATCH net-next] net: mana: Add a driver for Microsoft Azure Network Adapter (MANA) Message-ID: References: <20210406232321.12104-1-decui@microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 07, 2021 at 08:02:17AM +0000, Dexuan Cui wrote: > > From: Andrew Lunn > > Sent: Tuesday, April 6, 2021 6:08 PM > > To: Dexuan Cui > > > > > +static int gdma_query_max_resources(struct pci_dev *pdev) > > > +{ > > > + struct gdma_context *gc = pci_get_drvdata(pdev); > > > + struct gdma_general_req req = { 0 }; > > > + struct gdma_query_max_resources_resp resp = { 0 }; > > > + int err; > > > > Network drivers need to use reverse christmas tree. I spotted a number > > of functions getting this wrong. Please review the whole driver. > > Hi Andrew, thanks for the quick comments! > > I think In general the patch follows the reverse christmas tree style. > > For the function you pointed out, I didn't follow the reverse > christmas tree style because I wanted to keep the variable defines > more natural, i.e. first define 'req' and then 'resp'. > > I can swap the 2 lines here, i.e. define 'resp' first, but this looks a little > strange to me, because in some other functions the 'req' should be > defined first, e.g. > > int gdma_test_eq(struct gdma_context *gc, struct gdma_queue *eq) > { > struct gdma_generate_test_event_req req = { 0 }; > struct gdma_general_resp resp = { 0 }; BTW, you don't need to write { 0 }, the {} is enough. Thanks