Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3078023iog; Mon, 20 Jun 2022 10:43:29 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s+Rird+EQzM/1eesDyRNbQpwfgLtyIdKo96dzQ+w0eNW0v9tC/zytxYmHf2gk8OWO3+Y/j X-Received: by 2002:a17:907:c71b:b0:718:d0a2:a447 with SMTP id ty27-20020a170907c71b00b00718d0a2a447mr22231070ejc.157.1655747009099; Mon, 20 Jun 2022 10:43:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655747009; cv=none; d=google.com; s=arc-20160816; b=klCCifODPQBLynB347a5/eUn+jHQyitOxbywf5Y4f6w+0GfGi2xqx6fM0NYmiPoGRO hoKujn/I8YIpO+nSjxFBMwN2TMMgPjN/sORWi9LRDGNtPARexSYjfA81pJZK9Cm7TSs3 UXDwirG9boRm9xwAnrED2qRSNeXMzK6/OMKD0ROf9/rQibEjX8dXoV6E+4Kyq9T9Kh3F 24noiTmFV7orj0KtpQHBIv8HZF7hq3rM8kVu2TVUzJwoqPUP00aMoFHLhaVP58SJ1l2g W0inFA7LZgXgqqDU1wXdDC9UZi0Tz2gz+tLcAfjFhbSrpEzlX02bMVeWE3085Tj8crTB 8D+w== 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=fklMhhhn1YtEdjdCJrli7xuqHtMvWEe7WoA0QiA2c0c=; b=J7j5bizmWFBM+p39Q/NSaZcNMaWK1lwDWTqRKVktPQhwUFqTT0zSLSq2zgOLnnAl0Z VPmeWLLfS8D6C4Ace+v3XaWSYHYoscbC4ACCi5hRcPl1IWmuO0obSLCYPxGPLxdZOPeM X4GMzFQ8mOPNJYUqUk3Z8JdEshU4s4gmZtswFjFIBZwtXZ66k1LYgENb2yPd7hCf3EZA 7k6NArJ3T+dEsZMQCSzf4T92IDjdcIKnSFKczOzHYNxuuzGc9jhypMCOry3PwEQqxB2T o/Z4gVcyeL51NsXa8J1yyRzDB0uhahIef1VmSWgKOL+/Z3lIsUxOpnbpmEBJLQI6MBEM w49g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dKWdKAyL; 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 g3-20020a056402424300b0043378facf6csi16542106edb.144.2022.06.20.10.43.03; Mon, 20 Jun 2022 10:43:29 -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=dKWdKAyL; 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 S241884AbiFTRZp (ORCPT + 99 others); Mon, 20 Jun 2022 13:25:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232421AbiFTRZm (ORCPT ); Mon, 20 Jun 2022 13:25:42 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E48891EAC9; Mon, 20 Jun 2022 10:25:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655745941; x=1687281941; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=BbgzJRwAzZfGnN6+fsR430k9tPyCeFnjovUdsDb86xE=; b=dKWdKAyLLj1Meq1T7fN60BxFeHP5t3A7NFxqvOOR9R2fVdbgaEPeUpx5 /DG+Y3Ux90UN3HVCWddaQicO5q1h5Y3INAJEtTT7s0HUiIZIat+4LuOaE awACAJSkJA1scih7VE5a1k9tQxqk+sG2gjENoDbIy3ZoX9Ho2UbF3yHjp QHrrlwcFpmsqOKG1Xfud2hNnw+Ngn4a4is2B9/xo0SRIY9ToyJdL1e14B Kn7icifMaokzOdzW5BU22LSoG/yPbObPRg9+0Y5XeaSkIk9RZHT7AGhYF ZEESiSwhVv3Vu85oJg6UwGmG+SKoSN5VTPkTc9eCHaoGjrOmKbXHd5gUG g==; X-IronPort-AV: E=McAfee;i="6400,9594,10384"; a="366267955" X-IronPort-AV: E=Sophos;i="5.92,207,1650956400"; d="scan'208";a="366267955" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2022 10:25:41 -0700 X-IronPort-AV: E=Sophos;i="5.92,207,1650956400"; d="scan'208";a="729475487" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2022 10:25:37 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1o3L9Z-000kYr-9m; Mon, 20 Jun 2022 20:25:33 +0300 Date: Mon, 20 Jun 2022 20:25:33 +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, lenb@kernel.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 01/12] net: phy: fixed_phy: switch to fwnode_ API Message-ID: References: <20220620150225.1307946-1-mw@semihalf.com> <20220620150225.1307946-2-mw@semihalf.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220620150225.1307946-2-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,T_SCC_BODY_TEXT_LINE 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 Mon, Jun 20, 2022 at 05:02:14PM +0200, Marcin Wojtas wrote: > This patch allows to use fixed_phy driver and its helper > functions without Device Tree dependency, by swtiching from > of_ to fwnode_ API. ... > -#ifdef CONFIG_OF_GPIO Nice to see this gone, because it's my goal as well. ... > -static struct gpio_desc *fixed_phy_get_gpiod(struct device_node *np) > +static struct gpio_desc *fixed_phy_get_gpiod(struct fwnode_handle *fwnode) > { > - struct device_node *fixed_link_node; > + struct fwnode_handle *fixed_link_node; > struct gpio_desc *gpiod; > - if (!np) > + if (!fwnode) > return NULL; Can be dropped altogether. The following call will fail and return the same. > - fixed_link_node = of_get_child_by_name(np, "fixed-link"); > + fixed_link_node = fwnode_get_named_child_node(fwnode, "fixed-link"); > if (!fixed_link_node) > return NULL; > > @@ -204,7 +203,7 @@ static struct gpio_desc *fixed_phy_get_gpiod(struct device_node *np) > * Linux device associated with it, we simply have obtain > * the GPIO descriptor from the device tree like this. > */ > - gpiod = fwnode_gpiod_get_index(of_fwnode_handle(fixed_link_node), > + gpiod = fwnode_gpiod_get_index(fixed_link_node, > "link", 0, GPIOD_IN, "mdio"); Can fit one line now. > if (IS_ERR(gpiod) && PTR_ERR(gpiod) != -EPROBE_DEFER) { > if (PTR_ERR(gpiod) != -ENOENT) > @@ -212,20 +211,14 @@ static struct gpio_desc *fixed_phy_get_gpiod(struct device_node *np) > fixed_link_node); > gpiod = NULL; > } > - of_node_put(fixed_link_node); > + fwnode_handle_put(fixed_link_node); > > return gpiod; > } ... > - of_node_get(np); > - phy->mdio.dev.of_node = np; > + fwnode_handle_get(fwnode); > + phy->mdio.dev.fwnode = fwnode; Please, use device_set_node(). ... > + fwnode_handle_put(phy->mdio.dev.fwnode); dev_fwnode() -- With Best Regards, Andy Shevchenko