Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp187668imn; Wed, 27 Jul 2022 03:38:55 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u9V1i5DSa8RhQR+5HRt1AF7Iiq/uqwihSCv92ujJCAgFvl82k+6SRcsojeECcSoptjmo1a X-Received: by 2002:a17:902:7c88:b0:16c:e485:51b1 with SMTP id y8-20020a1709027c8800b0016ce48551b1mr20091203pll.34.1658918334934; Wed, 27 Jul 2022 03:38:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658918334; cv=none; d=google.com; s=arc-20160816; b=Vf9EeiXZ6j4k6mQ1R3w0XiH53I0ynh5jCYOgB6YBSoDVk/6JMDXPUqnI2mrxDdse6U tKWniDCl9AMyiuHwgqtXleBHVY5VV6YGqndmX/CIb5WXSUOPrr2jDNU2evyZ7LAWNKAP 5Hpji3PXnUQBwk8sgYfcXePMha5sdxVEWU9G3qSTWlRlNF0DFZVPXMk0i61SVpvCb5vo AGWoEuoexFjHZZsAofcdkzNTAFDdxWI733UCJZBTSXcAkGSxF4m1Y0Gp9zYrfQrovhUr bASgQeySk4edWZtL3sICKyXo0j/pZ30AI9PUAAHlh+PJT1Z6JpU3SUFSYTSQW7C5DbKf /y/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=UVEZkoEVJhYCYyb11iyLkaBB8wN9nlVxdMuqwLI51rA=; b=ICrXuPNQmkxSy46AE1ECIXoXT5kCILlwgKH3JpgPQYUx7SajFwehZlGh9rHDfGPLHi bKGE8A5d5LiZi0bu7W1oKuf2IG15NhtDr1MQ+EnkECpMsAbkeU1C+GMv7WCqT9SoJqws IIlqVA0IBqG0fwlkSSAkOqzGdQSsTKWdAD3ED7G80Gmkdcyt8M2JG0WdMZFlea7KJl6u WP/ETTY422LpEpUjVB8mmwlqmAF0yPma6wCkURakY2Ih1Zgl4zZQ6/WDw8BNEEmjVdB7 +IrQxMwU0ubm6ExfZRdYcZX+/b0V4hgQor4gZi8CbIZ3BDhKwb1aMLqGeS+r0Cl1ch4T aigg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Zx58KOKc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mw17-20020a17090b4d1100b001f2043193cfsi2049767pjb.124.2022.07.27.03.38.40; Wed, 27 Jul 2022 03:38:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Zx58KOKc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231513AbiG0K2p (ORCPT + 99 others); Wed, 27 Jul 2022 06:28:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230265AbiG0K2o (ORCPT ); Wed, 27 Jul 2022 06:28:44 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DB0843332; Wed, 27 Jul 2022 03:28:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1658917723; x=1690453723; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=RrV1tcJSu8Z7rFc6jziP1hGDQZbJGn8+5xabDMaGm1I=; b=Zx58KOKcnSK5uglwKp0vdA3HOfPf5sF9lGuh3dHORhG7FCTcCOAh95tq Qw/pfM8gdsetcK4TYFwErH2eyT5V/6YUQraJZw6gkCeiCCMnstsYIHZVd 1TzcWHv4uzISzL+IhJKXkrvPSi8VHKdrjPfK02tmxm2PHuaooNpxgkdZH k1SBTKtfACs6fyiw/3f/yJbOAgbvHVqy1TigCPoqvMkm1RQnvwkY3V0g3 0sTaQinwDm+B0v7MTPD/lZTMajcSMqar3p8ARDTP11lca0bJMnmuTm8DW 2D/Sfy8N0h/O2sTdoKtxrvshJZZs0G5Jo91kXkwHnnkOkX2koFhfWs7Zw w==; X-IronPort-AV: E=McAfee;i="6400,9594,10420"; a="289392832" X-IronPort-AV: E=Sophos;i="5.93,195,1654585200"; d="scan'208";a="289392832" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jul 2022 03:28:43 -0700 X-IronPort-AV: E=Sophos;i="5.93,195,1654585200"; d="scan'208";a="742603318" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jul 2022 03:28:37 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1oGeHK-001cRI-0x; Wed, 27 Jul 2022 13:28:34 +0300 Date: Wed, 27 Jul 2022 13:28:34 +0300 From: Andy Shevchenko To: Marcin Wojtas Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, netdev@vger.kernel.org, rafael@kernel.org, sean.wang@mediatek.com, Landen.Chao@mediatek.com, linus.walleij@linaro.org, andrew@lunn.ch, vivien.didelot@gmail.com, f.fainelli@gmail.com, olteanv@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux@armlinux.org.uk, hkallweit1@gmail.com, gjb@semihalf.com, jaz@semihalf.com, tn@semihalf.com, Samer.El-Haj-Mahmoud@arm.com, upstream@semihalf.com Subject: Re: [net-next: PATCH v3 2/8] net: mdio: switch fixed-link PHYs API to fwnode_ Message-ID: References: <20220727064321.2953971-1-mw@semihalf.com> <20220727064321.2953971-3-mw@semihalf.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220727064321.2953971-3-mw@semihalf.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 27, 2022 at 08:43:15AM +0200, Marcin Wojtas wrote: > fixed-link PHYs API is used by DSA and a number of drivers > and was depending on of_. Switch to fwnode_ so to make it > hardware description agnostic and allow to be used in ACPI > world as well. ... > + /* Old binding */ > + len = fwnode_property_count_u32(fwnode, "fixed-link"); > + if (len == 5) > + return true; > + > + return false; Can be return len == 5; or return fwnode_...(...) == 5; Original also good, so up to you, ... > + if (fwnode_property_read_u32(fixed_link_node, "speed", > + &status.speed)) { > + fwnode_handle_put(fixed_link_node); > + return -EINVAL; > + } Why shadowing actual error code? Either ret = fwnode_...(...); if (ret) { ... return ret; } or add a comment explaining the above magic transformations. ... > + /* Old binding */ > + if (fwnode_property_read_u32_array(fwnode, "fixed-link", fixed_link_prop, > + ARRAY_SIZE(fixed_link_prop)) == 0) { > + status.link = 1; > + status.duplex = fixed_link_prop[1]; > + status.speed = fixed_link_prop[2]; > + status.pause = fixed_link_prop[3]; > + status.asym_pause = fixed_link_prop[4]; > + goto register_phy; > + } > + > + return -ENODEV; Ditto. -- With Best Regards, Andy Shevchenko