Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp529000ybv; Thu, 20 Feb 2020 02:58:14 -0800 (PST) X-Google-Smtp-Source: APXvYqz5ohfmIg8J0wuNV7bxw+HYuBUkuankWwYQazqEWeoHPYb6UbZbo9ZgccnmYXmephqU2HnD X-Received: by 2002:a05:6808:b15:: with SMTP id s21mr1419363oij.123.1582196294626; Thu, 20 Feb 2020 02:58:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582196294; cv=none; d=google.com; s=arc-20160816; b=txo/fFWmgRfyjhxDNfw6Dw33tHkL4Y+cWNwxtetggO99KbJrKRExc/F5j+bm3xjs3k nwKIbapKuDKOhh4p/O2w7pDkSZ0eX2IFQWFZpdmGKwfIIrWvk9Y9BVrmm+blo9IL4xEl sZ9geJAhGiudpIPVkg2HDAhLROs0qWhKfm9L6F8N7rZ9Mt+fDdXhjLJfns3l3F1GQw7L 1lMe+38YJGNMMAqqqKgH6Y6BReUf3I0WL6YeJ4oHIF/Q9wz+G+iAzCeT3fUdMee8BL/L 2/rqCIUYfpZaAHTtRcxgB9Zk+2j8nJgjfNG26RK3ljrHSnVZQKY7naaRJH2u6dTMDSPq 19vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=ohsADroNpv+KSMV/L0R3M9PWJP7P1hyivzJRJ9NvuW4=; b=Xa7DOrvSW13sE0N1f7If9V452rBhblraJpnz1tEFfdSTqAuAg8vbl8cBs6rPzKuR2p wjONZqOYDO/r9XtvusPT1gpmbLN6Iw/9K1FsBb1+3uwN9pEd9jxNOP93QYA8G6FdlG8l 0Uc645aSY/SwXCrh6856cR+70RP+5A1RzQaPWQOOzD+zz6gLo3GV/AeZy5dGyaubwqyx If/IEm4mk+g7At0x0OyKGogO3ntPC6Q+xuhdpRAp+Dl89QJ/4qieEF+6QGYYuXgaxd9I 7hauPmckCTFcOT//hbas1PjfVylBeb9x5XsIyY8wLjXMfHc+JP2KFjbZVnZfvlCI14cX QGaA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e15si1558141otq.237.2020.02.20.02.58.02; Thu, 20 Feb 2020 02:58:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727789AbgBTK5Y (ORCPT + 99 others); Thu, 20 Feb 2020 05:57:24 -0500 Received: from mga03.intel.com ([134.134.136.65]:50598 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727662AbgBTK5Y (ORCPT ); Thu, 20 Feb 2020 05:57:24 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Feb 2020 02:57:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,464,1574150400"; d="scan'208";a="224826205" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga007.jf.intel.com with ESMTP; 20 Feb 2020 02:57:20 -0800 Received: from andy by smile with local (Exim 4.93) (envelope-from ) id 1j4jWE-003VkL-Fe; Thu, 20 Feb 2020 12:57:22 +0200 Date: Thu, 20 Feb 2020 12:57:22 +0200 From: Andy Shevchenko To: Dilip Kota Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kishon@ti.com, robh@kernel.org, cheol.yong.kim@intel.com, chuanhua.lei@linux.intel.com, qi-ming.wu@intel.com, yixin.zhu@intel.com Subject: Re: [PATCH v2 2/2] phy: intel: Add driver support for Combophy Message-ID: <20200220105722.GB10400@smile.fi.intel.com> References: <208fcb9660abd560aeab077442d158d84a3dddee.1582021248.git.eswara.kota@linux.intel.com> <20200219101435.GM10400@smile.fi.intel.com> <3c73c805-55a6-dcc0-4cd4-dd452f1d002d@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3c73c805-55a6-dcc0-4cd4-dd452f1d002d@linux.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 20, 2020 at 05:58:41PM +0800, Dilip Kota wrote: > On 2/19/2020 6:14 PM, Andy Shevchenko wrote: > > On Wed, Feb 19, 2020 at 11:31:30AM +0800, Dilip Kota wrote: ... > > return regmap_update_bits(..., mask, val); > > > > ? > Still it is taking more than 80 characters with mask, need to be in 2 lines > > return regmap_update_bits(..., > ???????????????????????????????????????????????????? mask, val); It's up to maintainer, I was talking about use of temporary variable for mask. > > > +static int intel_cbphy_pcie_refclk_cfg(struct intel_cbphy_iphy *iphy, bool set) > > > +{ > > > + struct intel_combo_phy *cbphy = iphy->parent; > > > + const u32 pad_dis_cfg_off = 0x174; > > > + u32 val, bitn; > > > + > > > + bitn = cbphy->id * 2 + iphy->id; > > > + > > > + /* Register: 0 is enable, 1 is disable */ > > > + val = set ? 0 : BIT(bitn); > > > + > > > + return regmap_update_bits(cbphy->syscfg, pad_dis_cfg_off, BIT(bitn), > > > + val); > > Ditto. > Here it can with go in single line with mask, Here I meant all changes from previous function, yes, temporary variable mask in particular. > > > +} ... > > > + case PHY_PCIE_MODE: > > > + cb_mode = (aggr == PHY_DL_MODE) ? > > > + PCIE_DL_MODE : PCIE0_PCIE1_MODE; > > I think one line is okay here. > its taking 82 characters. Up to maintainer, but I consider the two lines approach is worse to read. > > > + break; ... > > > + ret = intel_cbphy_iphy_cfg(iphy, > > > + intel_cbphy_pcie_en_pad_refclk); > > One line is fine here. > It is taking 81 characters, so kept in 2 lines. Ditto. > > > + if (ret) > > > + return ret; ... > > > + ret = intel_cbphy_iphy_cfg(iphy, > > > + intel_cbphy_pcie_dis_pad_refclk); > > Ditto. > 82 characters here. Ditto. > > > + if (ret) > > > + return ret; ... > > > + ret = fwnode_property_get_reference_args(dev_fwnode(dev), > > > + "intel,syscfg", NULL, 1, 0, > > > + &ref); > > > + if (ret < 0) > > > + return ret; > > > + > > > + fwnode_handle_put(ref.fwnode); > > Why here? > > Instructed to do: > > " Caller is responsible to call fwnode_handle_put() on the returned ? > args->fwnode pointer" Right... > > > + cbphy->id = ref.args[0]; > > > + cbphy->syscfg = device_node_to_regmap(ref.fwnode->dev->of_node); ...and here you called unreferenced one. Is it okay? If it's still being referenced, that is fine, but otherwise it may gone already. > > > + ret = fwnode_property_get_reference_args(dev_fwnode(dev), "intel,hsio", > > > + NULL, 1, 0, &ref); > > > + if (ret < 0) > > > + return ret; > > > + > > > + fwnode_handle_put(ref.fwnode); > > > + cbphy->bid = ref.args[0]; > > > + cbphy->hsiocfg = device_node_to_regmap(ref.fwnode->dev->of_node); > > Ditto. > > > > > + if (!device_property_read_u32(dev, "intel,phy-mode", &prop)) { > > Hmm... Why to mix device_property_*() vs. fwnode_property_*() ? > device_property_* are wrapper functions to fwnode_property_*(). > Calling the fwnode_property_*() ending up doing the same work of > device_property_*(). > > If the best practice is to maintain symmetry, will call fwnode_property_*(). The best practice to keep consistency as much as possible. If you call two similar APIs in one scope, it's not okay. -- With Best Regards, Andy Shevchenko