Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3973386pxb; Wed, 13 Oct 2021 17:27:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzw2eNAFpQ5N4B2i3+1+8cDCLc8viVTs0wqao6/v/5wmxm5ZRwXxCdVObgqF/cXmpP1owdY X-Received: by 2002:a50:d80d:: with SMTP id o13mr3937614edj.204.1634171260643; Wed, 13 Oct 2021 17:27:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634171260; cv=none; d=google.com; s=arc-20160816; b=SGsOMFJPLdD2i+BdFV9ALVYavsYpc++0sUVKM20VWYjfS42OVjvZeQX/qrsVv2JmsJ 1VP4dRm1CQdW0mVFtcvp/E9neHZI6u8KJCGsjS4nb4D2qKL1RMFNCW3DKgB1UyChSjwq xKbXUwiK0CyHGf5v7DnTWNB+yV+MxbPluI8K6OdspjrSjSLcukQTxi8QYdhpF9Ac+KdH 8l40FNyecDLsGIa31Qu26cChK3eEqa3cXOr4zOIYwcN/eb2/Kx/CcFRCFHYPFWOXJgbE x6vl8SGb2zDDXDXArhbK1bFoWhAt3soBrXJcg+98mBmqsde/+gUp/I9nT/ES9gQHTPtb owhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=WQJOoETYwItcgXtpmE7br15jNgwnLGW+8N40K0QA2HU=; b=ucAPx6ncz5glrWsPzfyt5fAWdShcT+53Ohl6DMK+MYLAd2mOhdeWtkdxQ9EM7x3Ztd ueZXtEI02SWzbsH5Jf1/rDLVv3m3mNPdQGgE2rtp8PBwK5QjSF6CxKrJdCZsl+95G9sC so28NW+R2yZ/Lx4sm6V8Y3oY+IrSSIbN8021gQC1zJ5tV54NQeQY4aFurHWizaWiZ0gD WRyaoReyjOZjzOeem/X4fEJZE8Anlcm6lJ7VkhfKldGDLA9/cuH4Yul8nmx0B2OH3L8w 0vTy5NJ3Dbv3jIm5epAEx+0XNJv0qo3c0celDZEyZs7Js0a+AI/LM9nZXORaKAuA0S72 6ZRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="e/UUuD5x"; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ga24si1942540ejc.153.2021.10.13.17.27.16; Wed, 13 Oct 2021 17:27:40 -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=@kernel.org header.s=k20201202 header.b="e/UUuD5x"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229771AbhJNA0y (ORCPT + 99 others); Wed, 13 Oct 2021 20:26:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:45924 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229590AbhJNA0y (ORCPT ); Wed, 13 Oct 2021 20:26:54 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B8A5461027; Thu, 14 Oct 2021 00:24:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634171090; bh=EQyzzIBtm6Daq3rcCTVWgSX9T9UCo24CrBF6aaIjRWo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=e/UUuD5x+9osgJYmSh64WUq0hTWyuQlzSxboi3ZAnhaGpAbwlhoGZYL2Zgid7I4nN eWhRqXQF4uutWSCkfKszWjTLLb+/MprsIlF7QGzWxDMAgCpqXLouaLkOazlxGElQuX cFXUHrANRs6RZEMMSW01FCL58qiWtx1sxYeuGY46pScxk8J8keV5yXThkcnZPqsGrH dpWQ92wzi3jGv8wp4fUsiWijrP2NnvzUOCTwx2qtu140p5KIbe4ReKMURiSU0B9sem dfwZDc0dqNEiGyQA1TTG0OTodfDNG6vJligG+ASTgynAhaPIg04tb1U6GpQYuVpOvX df0Bkx7qpC/+g== Date: Wed, 13 Oct 2021 17:24:48 -0700 From: Jakub Kicinski To: Vladimir Oltean Cc: "David S . Miller" , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Rob Herring , Shawn Guo , Andrew Lunn , Heiner Kallweit , Russell King , Vivien Didelot , Vladimir Oltean , Florian Fainelli , Prasanna Vengateshan , Ansuel Smith , Alvin =?UTF-8?B?xaBpcHJhZ2E=?= Subject: Re: [PATCH net-next 6/6] net: dsa: sja1105: parse {rx,tx}-internal-delay-ps properties for RGMII delays Message-ID: <20211013172448.2db3b99b@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <20211013222313.3767605-7-vladimir.oltean@nxp.com> References: <20211013222313.3767605-1-vladimir.oltean@nxp.com> <20211013222313.3767605-7-vladimir.oltean@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some take it or leave it comments, checkpatch pointed out some extra brackets so I had a look at the patch. On Thu, 14 Oct 2021 01:23:13 +0300 Vladimir Oltean wrote: > + int rx_delay = -1, tx_delay = -1; > > + if (!phy_interface_mode_is_rgmii(phy_mode)) > + return 0; > > + of_property_read_u32(port_dn, "rx-internal-delay-ps", &rx_delay); > + of_property_read_u32(port_dn, "tx-internal-delay-ps", &tx_delay); If I'm reading this right you're depending on delays being left as -1 in case the property reads fail. Is this commonly accepted practice? Why not code it up as: u32 rx_delay; if (of_property_read_u32(...)) rx_delay = 0; else if (rx_delay != clamp(rx_delay, ...MIN, ...MAX) goto err; or some such? > + if ((rx_delay && rx_delay < SJA1105_RGMII_DELAY_MIN_PS) || > + (tx_delay && tx_delay < SJA1105_RGMII_DELAY_MIN_PS) || > + (rx_delay > SJA1105_RGMII_DELAY_MAX_PS) || > + (tx_delay > SJA1105_RGMII_DELAY_MAX_PS)) { nit: checkpatch says the brackets around the latter two are unnecessary, just in case it's not for symmetry / on purpose