Received: by 2002:a25:d80d:0:0:0:0:0 with SMTP id p13csp164804ybg; Sat, 23 May 2020 10:18:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwwvSxH2kimfVOB/2cjBGtZQ7aoeabqj9wKanEOqpRKpRncAClBchPV7WwNrpT5wXrN7ir X-Received: by 2002:a17:906:bce3:: with SMTP id op3mr11885368ejb.230.1590254311024; Sat, 23 May 2020 10:18:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590254311; cv=none; d=google.com; s=arc-20160816; b=btxcNPw5SjQEGcS1cm3VGGbR8WjCw5RTGp5JhREKKFFTOeSQbZj1oqzuGKKMp2Uyu6 MNunRHXP8W8TLl7bYRxlk/w00F1JrCBOUX+yyyv00vI9J7nShWCLXHYAKmS+usoB1tAW nERFrpRPOC+CDqxXhAqDr5OCApPOC0bURVYsZfIo/HX1NnbyVebAf8Xmff1WkzukJ/IC efvbt3AE1I/EVeN1acPPed1KcgmU2bC9FAEIeObizZ5CMWJv156gYGisf7JZCx5WCho2 WuWiTaq0G4yq/JCuCCIx6/cPTuI5+zFXfhGMqURn0lU7inPBYITeCPLTN41T14ndXO/3 keuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Czt3i//zTkguKQxXhUH7a9GNOXEnucs8NHDFHkHZKq0=; b=YkiOE03dGssM9yldIPtVmz1Hj38HK8h15ijpXEqE/ynQndncENwqac4+5Z/i7I1xyL 5qsHZdViPwiJRTePKpDVk0jqKxg0ieoQJO89vV89CfRnvsSIq5YMKSsQrcX66M2rsUJ0 ULPCuHCr4HhHeOs42YPFmfyR/A8rTu12+KJ79z0v+KbDWq1/hqk09B0blEsGaGJ4zM0d 5FkE00tbbLGH4J98Eib7pzcaGPjuPPfqxN3/tcORzWJ+SbAdgYB2VtKJPx2ljXoiV029 DqDcQjJqXAtPqtDRVshq/SzU08q0qUyEA0POatES4deZRgC7fe93KUHu0tap5v4IjJK6 NeWA== ARC-Authentication-Results: i=1; mx.google.com; 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 oy4si6567125ejb.433.2020.05.23.10.18.08; Sat, 23 May 2020 10:18:31 -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; 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 S2388078AbgEWRQY (ORCPT + 99 others); Sat, 23 May 2020 13:16:24 -0400 Received: from foss.arm.com ([217.140.110.172]:53302 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387571AbgEWRQY (ORCPT ); Sat, 23 May 2020 13:16:24 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 96FBB1FB; Sat, 23 May 2020 10:16:23 -0700 (PDT) Received: from [192.168.122.166] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 317E93F305; Sat, 23 May 2020 10:16:23 -0700 (PDT) Subject: Re: [RFC 03/11] net: phy: refactor c45 phy identification sequence To: Andrew Lunn Cc: netdev@vger.kernel.org, davem@davemloft.net, f.fainelli@gmail.com, hkallweit1@gmail.com, linux@armlinux.org.uk, madalin.bucur@oss.nxp.com, calvin.johnson@oss.nxp.com, linux-kernel@vger.kernel.org References: <20200522213059.1535892-1-jeremy.linton@arm.com> <20200522213059.1535892-4-jeremy.linton@arm.com> <20200523152800.GM610998@lunn.ch> From: Jeremy Linton Message-ID: <1c111763-a46c-35c2-149c-b1af8b60d7e7@arm.com> Date: Sat, 23 May 2020 12:16:18 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200523152800.GM610998@lunn.ch> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Thanks for taking a look at this! On 5/23/20 10:28 AM, Andrew Lunn wrote: > On Fri, May 22, 2020 at 04:30:51PM -0500, Jeremy Linton wrote: >> Lets factor out the phy id logic, and make it generic >> so that it can be used for c22 and c45. >> >> Signed-off-by: Jeremy Linton >> --- >> drivers/net/phy/phy_device.c | 65 +++++++++++++++++++----------------- >> 1 file changed, 35 insertions(+), 30 deletions(-) >> >> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c >> index 7746c07b97fe..f0761fa5e40b 100644 >> --- a/drivers/net/phy/phy_device.c >> +++ b/drivers/net/phy/phy_device.c >> @@ -695,6 +695,29 @@ static int get_phy_c45_devs_in_pkg(struct mii_bus *bus, int addr, int dev_addr, >> return 0; >> } >> >> +static int _get_phy_id(struct mii_bus *bus, int addr, int dev_addr, >> + u32 *phy_id, bool c45) > > Hi Jeremy > > How about read_phy_id() so you can avoid the _ prefix. Yes, that sounds good. > >> static bool valid_phy_id(int val) >> { >> return (val > 0 && ((val & 0x1fffffff) != 0x1fffffff)); >> @@ -715,17 +738,17 @@ static bool valid_phy_id(int val) >> */ >> static int get_phy_c45_ids(struct mii_bus *bus, int addr, u32 *phy_id, >> struct phy_c45_device_ids *c45_ids) { >> - int phy_reg; >> - int i, reg_addr; >> + int ret; >> + int i; >> const int num_ids = ARRAY_SIZE(c45_ids->device_ids); >> u32 *devs = &c45_ids->devices_in_package; >> >> /* Find first non-zero Devices In package. Device zero is reserved >> * for 802.3 c45 complied PHYs, so don't probe it at first. >> */ >> - for (i = 1; i < num_ids && *devs == 0; i++) { >> - phy_reg = get_phy_c45_devs_in_pkg(bus, addr, i, devs); >> - if (phy_reg < 0) >> + for (i = 0; i < num_ids && *devs == 0; i++) { >> + ret = get_phy_c45_devs_in_pkg(bus, addr, i, devs); >> + if (ret < 0) >> return -EIO; > > Renaming reg_addr to ret does not belong in this patch. Sure, that makes sense. The rename was a last min change when I was shuffling the args around. Thanks,