Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp540834pxu; Wed, 14 Oct 2020 07:40:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+UY5TM2XCTh1ZzCTHHYfVjV/wPmPUm3c/q1WhWw+ly8Qq5ppgnYl5Ru/981NveTiE8mOQ X-Received: by 2002:a17:906:f988:: with SMTP id li8mr5523111ejb.93.1602686442800; Wed, 14 Oct 2020 07:40:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602686442; cv=none; d=google.com; s=arc-20160816; b=N8F7s6rP3EbE+C0qFCCHw8kw2vs8Dvo5Ovlc9xV8zwi+9QfK17c68rpp4ZnCkBXk06 nxXcB8shD7DNL9BLrwhPhCBSUVQjWvIuFzUNQEofPyFqgSUgLdvtNFccPlUJ/CI9jNOb ia5Ph8skkluhyYo0dhc+miyEN5DyFnas2DjVMiFbW6rmJ/WO2H6wXI1RhkXEXgIrC+Ph u180lYasOxHLxSUAlL7qnhPd1Tyi+tPfj3E4sBuwtSXUar8Rt3YBwcjzL6FFO1fK05Al SIjYITxVUS6UfR7E+2wKeG9bYZJ3Xz4OPg4/DjjlMUV1TVfIwiurSjVume9ef7dVgw88 buRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=CAZydlicr6iDmsmBRxa2+Vc6d131hXksVkD+EkZjLWo=; b=xc5rNouG8rAphdaijLC7dAJAXxUqqbUnuxGRzXs7DZC+AtaDEhsW3PnzuuTgB8NefM 2BXpBlO4wO1RswK3Ue2DTF/UgQPSsldCsm4/OfPzxYm+GsHQDhOoq4oue13tsLPLfiKV zMW/0pK/3Js8dre3PaT0e2OcI990zcFJI/tU7bAMDwaVh0QEtCNA8o/B5hfcxA4e+mj9 WOvDHfJJtK/0SIu0jpH2IiQ63RFGvFr9T0FJu9pViO5Mlf+FAipmI3AI8ZlnI14KcliS diF2Z6zym8WFowRxaCUAiniZt7f9l9T3nmWX1AtfXlluonN9EiPL2BaVz1DWVYb/hfFm ddng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=jMkplRfr; 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=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bi17si2419502edb.582.2020.10.14.07.40.20; Wed, 14 Oct 2020 07:40:42 -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=@nvidia.com header.s=n1 header.b=jMkplRfr; 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=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729707AbgJNIiG (ORCPT + 99 others); Wed, 14 Oct 2020 04:38:06 -0400 Received: from hqnvemgate25.nvidia.com ([216.228.121.64]:4074 "EHLO hqnvemgate25.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726269AbgJNIiD (ORCPT ); Wed, 14 Oct 2020 04:38:03 -0400 Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Wed, 14 Oct 2020 01:37:03 -0700 Received: from [10.19.100.177] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 14 Oct 2020 08:37:59 +0000 Subject: Re: [PATCH v3 10/15] phy: tegra: xusb: Add wake/sleepwalk for Tegra210 To: Thierry Reding CC: , , , , , , , , References: <20200909081041.3190157-1-jckuo@nvidia.com> <20200909081041.3190157-11-jckuo@nvidia.com> <20200928134057.GK3065790@ulmo> From: JC Kuo X-Nvconfidentiality: public Message-ID: Date: Wed, 14 Oct 2020 16:37:57 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200928134057.GK3065790@ulmo> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1602664623; bh=CAZydlicr6iDmsmBRxa2+Vc6d131hXksVkD+EkZjLWo=; h=Subject:To:CC:References:From:X-Nvconfidentiality:Message-ID:Date: User-Agent:MIME-Version:In-Reply-To:Content-Type:Content-Language: Content-Transfer-Encoding:X-Originating-IP:X-ClientProxiedBy; b=jMkplRfrnatkfiOKOy/291TSZPod/eZAbY5LO23SsyEQcuHCW9t6C+8bdDHzKv3x5 il1rEFfZYAgcMfI/dp1JCEMEQw+Z1UfqHuXU9Snqxp/gQZWkrHPv5lU/E/vD00gYe7 gMGaXx2WrTANBGi3tPGTHrDGFHVqDMVl5SOpzm9B2HAgetMhlkHtBUo1o0gEePblgI M6EQgETjhnIoOX2Sb6oegY3ah96BdFtqtZNWYwjWCCgHU4VcY7zQEBfJE+Oy2IAMN2 PZQQHishMwT3EBhpK/onEgHbEtknr9bW8gyNU18Fjp2AFLL3wZLz6YjhWqXsiGlaY8 Mzhyrmd+tWR5g== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/28/20 9:40 PM, Thierry Reding wrote: > On Wed, Sep 09, 2020 at 04:10:36PM +0800, JC Kuo wrote: > [...] >> diff --git a/drivers/phy/tegra/xusb-tegra210.c b/drivers/phy/tegra/xusb-tegra210.c > [...] > > Could we add function pointers to struct tegra_xusb_lane_ops for all of > these? That would allow us to assign them once during probe and then we > don't have to bother with these is_*() functions and multiplexing but > instead just call ->enable_phy_wake() and ->disable_phy_wake() directly. Yes, I will implement in this way. Thanks for the suggestion. > >> + >> + > > There's an extra blank line here. > I will remove it. Thanks. >> static struct tegra_xusb_pad * >> tegra210_sata_pad_probe(struct tegra_xusb_padctl *padctl, >> const struct tegra_xusb_pad_soc *soc, >> @@ -2293,6 +3225,8 @@ tegra210_xusb_padctl_probe(struct device *dev, >> const struct tegra_xusb_padctl_soc *soc) >> { >> struct tegra210_xusb_padctl *padctl; >> + struct device_node *node, *np = dev->of_node; > > We only need dev->of_node once, so I don't think we need to store it in > a local variable. Just make this: > > struct device_node *np; > >> + struct platform_device *pmc_dev; > > I'd call this pdev, which is the canonical name for variables pointing > to a platform device. > >> int err; >> >> padctl = devm_kzalloc(dev, sizeof(*padctl), GFP_KERNEL); >> @@ -2306,6 +3240,23 @@ tegra210_xusb_padctl_probe(struct device *dev, >> if (err < 0) >> return ERR_PTR(err); >> >> + node = of_parse_phandle(np, "nvidia,pmc", 0); >> + if (!node) { > > And make this: > > np = of_parse_phandle(dev->of_node, "nvidia,pmc", 0); > if (!np) { > >> + dev_info(dev, "nvidia,pmc property is missing\n"); > > It might be better for this to be a warning, to make it easier to catch. > >> + goto no_pmc; >> + } >> + >> + pmc_dev = of_find_device_by_node(node); >> + if (!pmc_dev) { >> + dev_info(dev, "pmc device is not available\n"); > > Same here. Also s/pmc/PMC/ in the message > >> + goto no_pmc; > > Maybe call the label "out", "done" or something similar. "no_pmc" makes > it sound like it's meant for error cases, which makes it confusing when > you fallthrough for the success case as well. > I will amend accordingly. Thanks. > Actually, in this case it might be easier to just return here instead of > using a goto. > >> + } >> + >> + padctl->regmap = dev_get_regmap(&pmc_dev->dev, "usb_sleepwalk"); >> + if (!padctl->regmap) >> + dev_info(dev, "pmc regmap is not available.\n"); > > Do we perhaps want to defer probe here? The return value of dev_get_regmap() doesn't tell if PMC driver is loaded. I will add the following to for defer probe. if (!device_is_bound(&pdev->dev)) return -EPROBE_DEFER; > > Thierry > Thanks for review. JC