Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp99374pxk; Tue, 1 Sep 2020 17:31:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwn+saKjjIcVXd6AxnHevHH3EL2w0RK4u+3MgL0nQ43GMwbcEFgPLwtKpmFS84FBXck/vBM X-Received: by 2002:a17:906:715b:: with SMTP id z27mr419406ejj.166.1599006717784; Tue, 01 Sep 2020 17:31:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599006717; cv=none; d=google.com; s=arc-20160816; b=Zozsg0VVNEWXuZ9jqe2XeYTCTKB0m759MXDOF6q0V39MYUGaWrkoBQrkvsrxYwnbVW SoeOWN+dGZw1b5KUirBowA12HpHpGsKUh8EQg8rgW7XS7oCTaJfG1fC7BDYA9lDMtf3q 3OAYFjmldAWwoTf9vUZ3s7Ok+B+EAG5AWky653GX1RknN35c11YemlM694trUUlg7wOf Gusun+H9HHvtOI2dTSyGyT/mDF9RfxlKqSNV72rBOiPS831qganPx+F5NMTfwND+GoUA nWSdZ2PaGTkoVNfo5+GQbcicQ4DytRESrdHAHF0cUkcvCsDh2gy8/PXxksJYQc1KL8wP yKZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=HjaQ0ZlWMxc4hcM/J6yHlX+oUlJi3/EznDqTBTHeBhE=; b=tZuzQnlwQJ0SV7PlZ+vaakgRq1DQ3own0uyLo2S5KxhsEw+kpv5scO7Yy78UbQ1Bhu dl67OFwpYQKTcG+laccQO/ldaMnYU7xEwtW49SdLF4u2zCmComx/wBIkZpHv1Ueum3nA q4SOklokmygcfbdCaTClRXucmHWMRHrhzvrorMP6nF7BI70P/g5hldfX/Jz1c7WGVjEz OGESMqy6ipGQYch9XStPS7B0hnoyGL6/xTOih3IP7S8OK4v2BW8b1kNX5LMVFOo1RdJL fRptuuGesjrA5FQJyGH2r97e50Y/AnVv9EXSKH572osR+3Cuq/cFdRanvmCerhVpwzmJ dyrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=chECYSTI; 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 j18si1580639ejv.121.2020.09.01.17.31.15; Tue, 01 Sep 2020 17:31:57 -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 (test mode) header.i=@ideasonboard.com header.s=mail header.b=chECYSTI; 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 S1726622AbgIBAad (ORCPT + 99 others); Tue, 1 Sep 2020 20:30:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726226AbgIBAa0 (ORCPT ); Tue, 1 Sep 2020 20:30:26 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3157AC061245 for ; Tue, 1 Sep 2020 17:30:24 -0700 (PDT) Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 484E9AF2; Wed, 2 Sep 2020 02:30:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1599006618; bh=Es3Qu1HOlBQViv8yzB/gfp+XbKhgKf7hacOkeSX/P7Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=chECYSTIkO54mLocqXGYNY1SYjQrZ0zxnUGhoVi4p0Vg3mXTs4/SiYg/3t5icwp3j e+Kmee1/VfUfVOQXai2UlU5f2bMel5XRqgcC8R9h2sfYQ3a7btjGH4C0aztkcARGSJ yD9baILeueuXuoVc4owF6uH3ThF96LjO6EzuyxZs= Date: Wed, 2 Sep 2020 03:29:56 +0300 From: Laurent Pinchart To: Swapnil Jakhade Cc: vkoul@kernel.org, kishon@ti.com, linux-kernel@vger.kernel.org, maxime@cerno.tech, mparab@cadence.com, yamonkar@cadence.com, nsekhar@ti.com, tomi.valkeinen@ti.com, jsarha@ti.com, praneeth@ti.com Subject: Re: [PATCH v5 2/2] phy: cadence-torrent: Use kernel PHY API to set PHY attributes Message-ID: <20200902002956.GE14351@pendragon.ideasonboard.com> References: <1598293711-23362-1-git-send-email-sjakhade@cadence.com> <1598293711-23362-3-git-send-email-sjakhade@cadence.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1598293711-23362-3-git-send-email-sjakhade@cadence.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Swapnil, Thank you for the patch. On Mon, Aug 24, 2020 at 08:28:31PM +0200, Swapnil Jakhade wrote: > Use generic PHY framework function phy_set_attrs() to set number > of lanes and maximum link rate supported by PHY. > > Signed-off-by: Swapnil Jakhade > Acked-by: Kishon Vijay Abraham I > --- > drivers/phy/cadence/phy-cadence-torrent.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c > index 7116127358ee..eca71467c4a8 100644 > --- a/drivers/phy/cadence/phy-cadence-torrent.c > +++ b/drivers/phy/cadence/phy-cadence-torrent.c > @@ -1710,6 +1710,7 @@ static int cdns_torrent_phy_probe(struct platform_device *pdev) > struct cdns_torrent_phy *cdns_phy; > struct device *dev = &pdev->dev; > struct phy_provider *phy_provider; > + struct phy_attrs torrent_attr; > const struct of_device_id *match; > struct cdns_torrent_data *data; > struct device_node *child; > @@ -1852,6 +1853,12 @@ static int cdns_torrent_phy_probe(struct platform_device *pdev) > cdns_phy->phys[node].num_lanes, > cdns_phy->max_bit_rate / 1000, > cdns_phy->max_bit_rate % 1000); > + > + torrent_attr.bus_width = cdns_phy->phys[node].num_lanes; > + torrent_attr.max_link_rate = cdns_phy->max_bit_rate; > + torrent_attr.mode = PHY_MODE_DP; > + > + phy_set_attrs(gphy, &torrent_attr); Why is this better than accessing the attributes manually as follows ? gphy->attrs.bus_width = cdns_phy->phys[node].num_lanes; gphy->attrs.max_link_rate = cdns_phy->max_bit_rate; gphy->attrs.mode = PHY_MODE_DP; This is called in cdns_torrent_phy_probe(), before the PHY provider is registered, so nothing can access the PHY yet. What race condition are you trying to protect against with usage of phy_set_attrs() ? > } else { > dev_err(dev, "Driver supports only PHY_TYPE_DP\n"); > ret = -ENOTSUPP; -- Regards, Laurent Pinchart