Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp621332ybt; Wed, 1 Jul 2020 06:25:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqV8tfxMnSh80Ynn6Zi8oTH7YUU4Va6EKmMythVfp57IJn8tVsGBAihFB+XZn8Gf3at9cF X-Received: by 2002:a17:907:11ce:: with SMTP id va14mr14103203ejb.189.1593609938919; Wed, 01 Jul 2020 06:25:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593609938; cv=none; d=google.com; s=arc-20160816; b=TmcJzJfrWSE8AMln5L/mDkE+Hyuug6lWj5Ut2Lez40ZHeImjs0KvtsWR0obfm2Ok+i VWVwS+txooJHTiHn6+9HZ547Ex5uZsqWrmiaXXy/XC4CRLENpDvmsqH6yXTi3+fmzSKk 2LvOOtl84RsOZqU9Q9AHPJBO+wyAdUHWwTumv4wdRTtIyeJHXVehePrq2keiogi4V+r9 E2bmKV10abEVqx53A0RMep0XVbmSgLR8lYFPqZjfcsLUWAuDvJrbVuqf/VRKqur2ahR5 KZANqWilF8yOEYPtmBAK7h3YxgZK9svYMBVTgpn08viv2p8vfbKfCQ4gDR2ECHFKagFl rS+w== 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; bh=lPpCLMDZyf53f3f744RKl80oU973cN3DrPB6VeXr3l0=; b=HkPsDPvyYwWU/h3yfEXz68unGUTKI19VbOdemF+j038wjvBcFHOrFJxTU7+e6917Ur RdbDld3zHwqESWHlZwK6Hf32xeQHAMJGQH0154HIUaTsgH/VjBKv3j4KvTUehhXuPIsz ZDpnRWXB7d3tO9wf18bycQt0kPb4xIGBN+E3sRq09qRDwt+2HemJbvNLPiIo08jXXt1C 2frytYAfT0901D6AG99Wg6rUp6dFGi1+iV4JW6MNrKDBKfTQtawZtaHaRUkftmzFwlUm odfVmxB2nhC/huoOlRwon/T/16mF5+8nhXSB9vb6nT0V4vmJWdqdnYk/x9muowuW5wrt 5jzQ== 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 z2si3939404ejc.595.2020.07.01.06.25.14; Wed, 01 Jul 2020 06:25:38 -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 S1730729AbgGANZI (ORCPT + 99 others); Wed, 1 Jul 2020 09:25:08 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:41412 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728941AbgGANZH (ORCPT ); Wed, 1 Jul 2020 09:25:07 -0400 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1jqcjO-0039OF-3I; Wed, 01 Jul 2020 15:24:54 +0200 Date: Wed, 1 Jul 2020 15:24:54 +0200 From: Andrew Lunn To: Calvin Johnson Cc: Jeremy Linton , Russell King - ARM Linux admin , Jon , Cristi Sovaiala , Ioana Ciornei , Andy Shevchenko , Florian Fainelli , Madalin Bucur , netdev@vger.kernel.org, linux-acpi@vger.kernel.org, linux.cj@gmail.com, "David S. Miller" , Heiner Kallweit , Jakub Kicinski , linux-kernel@vger.kernel.org Subject: Re: [net-next PATCH v2 1/3] net: phy: introduce find_phy_device() Message-ID: <20200701132454.GF718441@lunn.ch> References: <20200701061233.31120-1-calvin.johnson@oss.nxp.com> <20200701061233.31120-2-calvin.johnson@oss.nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200701061233.31120-2-calvin.johnson@oss.nxp.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +struct phy_device *find_phy_device(struct fwnode_handle *fwnode) We should consider the naming convention. All phylib phy functions start with phy_. We already have phy_find_first(), so maybe phy_find_by_fwnode() to follow the pattern? > +{ > + struct fwnode_handle *fwnode_mdio; > + struct platform_device *pdev; > + struct mii_bus *mdio; > + struct device *dev; > + int addr; > + int err; > + > + fwnode_mdio = fwnode_find_reference(fwnode, "mdio-handle", 0); > + dev = bus_find_device_by_fwnode(&platform_bus_type, fwnode_mdio); > + if (IS_ERR_OR_NULL(dev)) > + return NULL; > + pdev = to_platform_device(dev); > + mdio = platform_get_drvdata(pdev); That is a big assumption to make. Please take a look at the class_find_device_by_*() functions, as used by of_mdio_find_bus(), mdio_find_bus(), etc. Andrew