Received: by 2002:ab2:5c0e:0:b0:1ef:a325:1205 with SMTP id i14csp215052lqk; Thu, 14 Mar 2024 00:23:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVBDIo6ZC6qnCi+zXuRjKumbxjI1Bz1lYhqD9bmvNdpElhMKLL0GbydmZEIq34r6T5BwKXmflzD2iUbn1z5Z+cvljYRGxYGWZP5tjCBpg== X-Google-Smtp-Source: AGHT+IG0SLS9qKfAdeEeno/c7JrFGCyLi2PZv8vn7atQ0n3qh0ARBXtqsMPyDf7+2KQeQ+SkDiRF X-Received: by 2002:a05:620a:55a3:b0:789:c545:b684 with SMTP id vr3-20020a05620a55a300b00789c545b684mr1100010qkn.2.1710401006030; Thu, 14 Mar 2024 00:23:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710401006; cv=pass; d=google.com; s=arc-20160816; b=SwW+WabFGHRlJ+pzWoV+PTXEF+hC+GMWlfxIRfeTBjBy1YRJpkDpekyu/UWwmjGWGS CrCMxbjIBzqR1oep1Anbea/yzE1BC1r6X5LSPsYo4gSKRH3ciro+WxP6GOIHXJVa/YYk J2m/eGEWEnAMFngX4L9DpURxEVD3DIaQIiJ+Mpgt7N7TYHpMMTHrl4MiN6xa/80obF2l ncoj6zNT3zDg7F68846h+4D8ZUArLyUxrlJ/gWyeCsA+sicqXZ0yTy9F+9yp1XXjBRbk vbQuj9/KG8N8PsOw6vXEfUha8k+cVsdrzmpu8DYG4Z1rSoi02N7tnI9KVKhvW62+c7is HXlw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=2Hg0QBhHNwXtR+/hf03RzKTokT9XhPWy1qXzqNjgPKw=; fh=lGEiRU+aQpKSt7SUJUBbEwhxnszK63uNEKebr+GvDVM=; b=Fd7NYrHIvilaUVm6rq2hnB9DTNCvdpUyHbS58cZyB5o5gTigwxYX5JRS1DBHJ3qro8 7puNP7GtgaxMD1lDVKNsHJPbTMUrXZx/zXkNzEiZZeT81Hg0QBcNEZvluSn1GDrv4dxc dQ3PdXjr4cfdlD8CKr6yYHBSCfg7I7RQjk7Udx6HXKlTAHmbrlYARyxYSjSTkdPLWuR3 uUGny6MLEQKdCkTHIZ63EnFZHtTiAPITo9Y+ZVvJGHvsDB71Kc9fGUdPMTDDijQv7Pim WgoeYWS3moZxF+/2i14XS97uZ8kF4pBCEC67gOMEYbB3M5OaTOBzhyKSSAna55U2xoid wkSA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MaCuFtT1; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-102929-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102929-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id i21-20020a05620a0a1500b0078836eafeccsi965416qka.62.2024.03.14.00.23.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 00:23:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-102929-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MaCuFtT1; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-102929-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102929-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 B18B01C220CC for ; Thu, 14 Mar 2024 07:23:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 403835D738; Thu, 14 Mar 2024 07:22:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="MaCuFtT1" Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E9B75C61C for ; Thu, 14 Mar 2024 07:22:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710400943; cv=none; b=riMvyoLyBBu8NypGIXT7Qb11Be33bYV/3ag6nBBW44uBdDZvFooxwP2+x/v+EfZEp1dbgf/YYk+LKM+prNUldSrk9xrgc6cmA4ksRQ5DOUc7WkwXvG0Vp698ODMxae1YXGhkBeetCGv0txQvnAwOiGzF91rrL4+OzpoKaWDFMek= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710400943; c=relaxed/simple; bh=n+DhiitdzCy6PlCjUMm0H6SMuSpk93mlHftoxOwzpbs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=peZr9DO2xnzOu+pU47+0RHEsOdqA9378xfNodFPYKPtujZKABuwrTuiXzM2MIcanWfB9jWXs1UXvhsqXMKFdFYNoQ6S4Kq0Q/ZBG82Xf81hY6DvOlZ1S222bdncW8C3L2LYxELYPB9LlEoeejJJpQS92XiR6u1Y8GAvtms4fOkw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=MaCuFtT1; arc=none smtp.client-ip=209.85.215.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-5e4613f2b56so526049a12.1 for ; Thu, 14 Mar 2024 00:22:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710400940; x=1711005740; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=2Hg0QBhHNwXtR+/hf03RzKTokT9XhPWy1qXzqNjgPKw=; b=MaCuFtT1txVGTv/VHGoD12w6G1l1lilNPoJLxc9Mk27j4Jp4utucTNyi1EL6HOWA6j MSkMPEw4ssLdo7mU9dzwbWTuxa8hmpPh1hxPQCs4tgCv/X00ByHGlkrQKfwQ7j8x/WWg tLFGtQl9FnGQ7yJapj4cA5ye1BTBUBUex34N/xMBspTE29YTDLZxveNwisQ7DUdBtjI7 jbS5QvJQollqjBeM3P0l8GF1A6BJlbyoML1JQKzZm/FG8PgrcVIB5Y3n07ZbDMWmO+vw /EBarJNjanR9EVg0u3psNGmouCfyv3Gaq0T4y70IiXbR4XH8jjZGl3oeGNVf5LfEFw/P mdlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710400940; x=1711005740; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2Hg0QBhHNwXtR+/hf03RzKTokT9XhPWy1qXzqNjgPKw=; b=N4y32igagFbfy82rS3QYkhMj/UVRWphuhyqtCy1/IFHY9atrWMZ6cc/jCIkxVU2tUs 5Ke0VBJNQY5G6jDrqcntXk7T4ld6h6i6SgGK9yFEmzzWGVmcetQ5rvuWFEYRHhckM2dJ pJmXThi0N2WmL2yZ7m9Pu0YmsTDrnxZDmIc+SZz5LA/lPP8kNstVdGobCsKnj52L4AP/ LbTI40nJceh1xZDPlmbDU9yps9nv7gxddDpK3eal65DUIvUmhFnuzIJ/M0j+Kf6iJa+E Dxr0ZOLwMQVeEIfn70Nj78Rc5CL6EfPggBpzpLeMQnLmPhV2Zxq0Cw6Y6zq+b1Tr7yTT cejQ== X-Forwarded-Encrypted: i=1; AJvYcCV5AeZmKentxvFAWbTIFtG0SV75HmbLOZqNQWy6eBtB6gKxO051e/GUTnqxl5bByPIuhyU5Nm5q5EMVTqC7hy47E9M46Co463IOzID5 X-Gm-Message-State: AOJu0YwiuWOAx7UrY1GPi8fVXXIKimhnvPlUyg0CS4ySXqN6uVE0kZgs /+OQfq7DhEoVCKtr9N4DQwC5y5FIfWOyIRHWCWJxxZ/A/YKWI+Kk5vHRqGYHuw== X-Received: by 2002:a17:902:7594:b0:1dc:cc77:5668 with SMTP id j20-20020a170902759400b001dccc775668mr937645pll.51.1710400939560; Thu, 14 Mar 2024 00:22:19 -0700 (PDT) Received: from thinkpad ([117.207.30.211]) by smtp.gmail.com with ESMTPSA id c7-20020a170902d48700b001dddeb10d83sm881090plg.223.2024.03.14.00.22.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 00:22:19 -0700 (PDT) Date: Thu, 14 Mar 2024 12:52:07 +0530 From: Manivannan Sadhasivam To: Niklas Cassel 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: <20240314072207.GC4831@thinkpad> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Fri, Mar 08, 2024 at 11:22:52AM +0100, Niklas Cassel wrote: > 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 :) > Those valuable 50 cents :) Looking at it again, I think you are right. We should honor the API over driver's own style. I've changed the semantics in next version, thanks! - Mani -- மணிவண்ணன் சதாசிவம்