Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp454461lqc; Fri, 8 Mar 2024 02:23:14 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWlsliR/6hSaxaw5JwvNEUBMoOv4EMt9gXZ23ItXukg+2CFVacL/09bgS/bLfXDKGyakKeLQN0uzQ27RC9fKTcuylblN6GeLZktq4jm7Q== X-Google-Smtp-Source: AGHT+IHJFjQDJ4BAdPk/j2ukSRrktDwIjnqMuuvtrkfaY5eaSpp50Qe7n63ZT/gN1uAEjlN9OMUO X-Received: by 2002:a0c:e2d0:0:b0:690:51f7:f621 with SMTP id t16-20020a0ce2d0000000b0069051f7f621mr10419015qvl.47.1709893394161; Fri, 08 Mar 2024 02:23:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709893394; cv=pass; d=google.com; s=arc-20160816; b=JUS/LGyqV1T7FgO+mARU5L5tiTiFl1XqtLHPz9SIiYf0k/kliO+lHM2UzjZ9U6Eyzn x+quziBFq47w4QaSCOVCmb3aE0NPQ3ajaXB3FgENAhuCaZjs/5A7/kREie/FAvU4IXZm xEqdxvX2NQ6ksayEBFIrR4Tmxepij7vueE0Ur0s2y/6LU14KHZ2lwb9dFY/YsKCBGv5M BNE5EXXt5gPMGyLmBkzjPi+bJMXTeOKed00EshT8zGDZ+O7CJoZ858njuu+BAKwtFyxx hNuvip2yl1uYROYYpk3YddM1KWcXasAwIILL+N5hj1zSw9Xo61JR5XnuitAjgq2P4aVx 8zOw== 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=a0XKMCxPK5ARpELL/tL3NEUZHXmwdjNVhu2G5mSQ7Gk=; fh=XkHq6sufsH3TObsvDFtbbMUFfmZcw+V2/ZGOtqSIh/c=; b=UPL/Epv91LN0rQQSq995LV2mpCuWZU+OELciRE2qTyXrsSLcW3Bhcq/nUtTq1UZL/7 4yZtk+mNWUGgRXbA1AHR7e8mQTSQ84Y2VVZUG3NhmMjU3K6X5rFD/NKt5nHuzuCcBOwx M3psUU2fPFdC1vq/pfFpl0admivV9dP4lNKTOIj1eWnlnC4Pa1gpcuDwd2YrRte8Moqc yna9dDN/9m2WWzsTb+6GvBpMyIEb8tPFh14afH38P9xkNl0b6Rfl0y6lGJoglYGS0I4v D3q2iqx5TJXGrveumGsDXQEYoXSrPSFB7GT2HcML3jmW3Qyo5Z/idCT8tBcdrnLZKxgx caQA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eMTB0dxI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-96825-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-96825-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id a8-20020a056214062800b0068fa310bfddsi19138905qvx.343.2024.03.08.02.23.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 02:23:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-96825-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eMTB0dxI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-96825-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-96825-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id DED561C21A29 for ; Fri, 8 Mar 2024 10:23:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0BE0E54776; Fri, 8 Mar 2024 10:23:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eMTB0dxI" 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 1B1CFD29E; Fri, 8 Mar 2024 10:23:02 +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=1709893383; cv=none; b=kYvwi/y7jK5bj19NKzXvzV3OCcP2DeVyJIrpfZ892TalY5b9VxJ8j+sq6OVAff2Eqc2GW4K7yFoDEfbn09ZNcGqYCZLAkUB9LUVn89spwSOWY/VJr9OLi0FWdI4COO1SbcGfU8cUWT27+VeOkFcNahA6pQvvzoKMzV6WZGexams= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709893383; c=relaxed/simple; bh=lHycvlNl7OVIrzQI78hPFaTIMft0lPdksi6rDoX3W/g=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=u17qCdi7+wZwI/MJGL12KcM9hrN2Annuc14QnmgXOWaDYIt4uWlB0T3wVvabU3TvgHbP9VVb4R5g6hzfQU8aFqRb4rP2a8fjXEYssnRYaTmj8BaDtUUEPMWnJK8yYDTs12atDKzwty7BAlR7er6SV4pMK461FekqNbAnECLRWA4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eMTB0dxI; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E1BFC433C7; Fri, 8 Mar 2024 10:22:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709893382; bh=lHycvlNl7OVIrzQI78hPFaTIMft0lPdksi6rDoX3W/g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=eMTB0dxIOS+2itv74DP87TT3a7S3lfZoD0+2Ls0iMrgdCcuIV4TZHR8C/py3lEoLM rGXHcOX82vv7YXrL1/xhf67lvGXpZQbd+56lYq8J4pfE1vSC4Z9QmS9P8uZkL4AnaS UE+ngGFia7kmUXjyWDby8Q4Cd9pZqA2t88xVQTlABBPsGJEFng7d1B4ndq/wO4Spkp nhGLBhuH+r3uinoM2tful9m8gThPphuZ2QPQ8mte4TEAThEeCy4ovpQm1GN6JR0HEX mCHXeItsOiBq9vlmwyPHb0GtJgonfjHk4SSF350AxdKeECKF73Js76nM3nPgm2jTIn 10tpVfabCXnxQ== Date: Fri, 8 Mar 2024 11:22:52 +0100 From: Niklas Cassel To: Manivannan Sadhasivam Cc: Jingoo Han , Gustavo Pimentel , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Marek Vasut , Yoshihiro Shimoda , Thierry Reding , Jonathan Hunter , Kishon Vijay Abraham I , Vidya Sagar , Vignesh Raghavendra , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Minghuan Lian , Mingkai Hu , Roy Zang , Kunihiko Hayashi , Masami Hiramatsu , Kishon Vijay Abraham I , Jesper Nilsson , Srikanth Thokala , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-tegra@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@axis.com Subject: Re: [PATCH v9 06/10] PCI: dwc: ep: Call dw_pcie_ep_init_registers() API directly from all glue drivers Message-ID: References: <20240304-pci-dbi-rework-v9-0-29d433d99cda@linaro.org> <20240304-pci-dbi-rework-v9-6-29d433d99cda@linaro.org> <20240308053624.GB3789@thinkpad> <20240308094947.GH3789@thinkpad> 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: <20240308094947.GH3789@thinkpad> On Fri, Mar 08, 2024 at 03:19:47PM +0530, Manivannan Sadhasivam wrote: > > > > > @@ -467,6 +467,13 @@ static int dra7xx_add_pcie_ep(struct dra7xx_pcie *dra7xx, > > > > > return ret; > > > > > } > > > > > > > > > > + ret = dw_pcie_ep_init_registers(ep); > > > > > + if (ret) { > > > > > > > > Here you are using if (ret) to error check the return from > > > > dw_pcie_ep_init_registers(). > > > > > > > > > > > > > index c0c62533a3f1..8392894ed286 100644 > > > > > --- a/drivers/pci/controller/dwc/pci-keystone.c > > > > > +++ b/drivers/pci/controller/dwc/pci-keystone.c > > > > > @@ -1286,6 +1286,13 @@ static int ks_pcie_probe(struct platform_device *pdev) > > > > > ret = dw_pcie_ep_init(&pci->ep); > > > > > if (ret < 0) > > > > > goto err_get_sync; > > > > > + > > > > > + ret = dw_pcie_ep_init_registers(&pci->ep); > > > > > + if (ret < 0) { > > > > > > > > Here you are using if (ret < 0) to error check the return from > > > > dw_pcie_ep_init_registers(). Please be consistent. > > > > > > > > > > I maintained the consistency w.r.t individual drivers. Please check them > > > individually. > > > > > > If I maintain consistency w.r.t this patch, then the style will change within > > > the drivers. > > > > Personally, I disagree with that. > > > > All glue drivers should use the same way of checking dw_pcie_ep_init(), > > depending on the kdoc of dw_pcie_ep_init(). > > > > If the kdoc for dw_pcie_ep_init() says returns 0 on success, > > then I think that it is strictly more correct to do: > > > > ret = dw_pcie_ep_init() > > if (ret) { > > > > } > > > > And if a glue driver doesn't look like that, then I think we should change > > them. (Same reasoning for dw_pcie_ep_init_registers().) > > > > > > If you read code that looks like: > > ret = dw_pcie_ep_init() > > if (ret < 0) { > > > > } > > > > then you assume that is is a function with a kdoc that says it can return 0 > > or a positive value on success, e.g. a function that returns an index in an > > array. > > > > But if you read the same function from the individual drivers, it could present > a different opinion because the samantics is different than others. Is there any glue driver where a positive result from dw_pcie_ep_init() is considered valid? > > I'm not opposed to keeping the API semantics consistent, but we have to take > account of the drivers style as well. kdoc > "driver style" IMO, but you are the maintainer, I just offered my 50 cents :) Kind regards, Niklas