Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4216084pxb; Mon, 8 Feb 2021 10:34:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJz4isSsw5pnYywZFMy/7zfVmhLrxMv8SzAZ0faDU7MTYzfhmW821xHkhIc0ARM13nTHVHEn X-Received: by 2002:a05:6402:2210:: with SMTP id cq16mr3504571edb.148.1612809266885; Mon, 08 Feb 2021 10:34:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612809266; cv=none; d=google.com; s=arc-20160816; b=Ysao7ZhasgRXMcAa9WsD31PXbCn8iRREmC9oZFJ0iX8L7LVKQYr/nCnR50StDdHfO0 FZFFC+Y4SJU4Zi38SBo8U0fk0ANOWlmzUx2TnFw0hLkPQuKvmas96joagBxI/JjJAOXB 90GU4zHodO7fITr2a9b18egNvC2U6Dn3RsfI4EkduaLLeAoGjA19iJ3X9aDxM1VkVQ9o nHzECTVEtzAqJeCm1+bMvQ9wGmOFoa0Ib7vpKiFyo5z/0AV2unrjkfoEO5EoLPZlQRAc 8pdw8LXHTDwhJ0kav0XULzrZedYhfvZEYnJBqypj7RrnbqkiZ5J+1euE/Kb5S9FnWWmV lgUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=WsJCNxoOgawUj7Zr3PeZyr3znV20VI9UZXxnXDXzdvs=; b=Ae9ayTt1SsgzuqcsMOjGT6KdYXS+PWcVfnOwm7WDU6VTSRAmFqjLOZTzVo75sHzPyp d2dVwkJe7y27FfWo5bcLq6IBNfRwHxtPExywv3QaagDeIBFGUBUWRULMWpLQ0F7YbSc2 Abi1z0IZjjMxMWIzp1RETsv4CUhsqy1wYXxP3Cnw3zUWO/w2tq1aolpwZRFPApF/vvYL dMASQIbRk/0iFDnZdSaq4Rk7SHqS9W3oaXDEs/nRFDpxmKEkmc1vEkfHgGd6Daca/acZ C0+SKxYPO5Sj7P5zBO/2qc0J3jurUiinOyZQkqDz/cd+IYtuoNqv7ZVxUnLb394NCwbz 2KkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=U0OD2796; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y18si12420767edw.35.2021.02.08.10.34.02; Mon, 08 Feb 2021 10:34:26 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=U0OD2796; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235747AbhBHSc6 (ORCPT + 99 others); Mon, 8 Feb 2021 13:32:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231283AbhBHQRV (ORCPT ); Mon, 8 Feb 2021 11:17:21 -0500 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0CCDC061786; Mon, 8 Feb 2021 08:16:41 -0800 (PST) Received: by mail-pf1-x42b.google.com with SMTP id m6so10033487pfk.1; Mon, 08 Feb 2021 08:16:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WsJCNxoOgawUj7Zr3PeZyr3znV20VI9UZXxnXDXzdvs=; b=U0OD2796M2UhURPNe4IChEOVyT/iAmYNvaDyk30Rqz9ncMVbwvASefx+TLV/Lqbunw 1KmGPVpqLXajRiDDHRTcb83gUCO+FNJpH2utz+SZQ99OCaeaSKzVV+k5/Pz/k2IfLhf5 H19aU9TDyuwDC6TbDu4CnhjufcmNEeSzAC9H24HORJMfbQBGIboVlee0FLAjMLd9Aukp vGmMl69XEdRIU5pv8JrxtaOM2nhzLrrDuUtCYtT7P17JcGYG1IDvySaQEvDIsGRujrbg wJdw0tPeC89VzCLkD1RB+YMSlwEdeSrmlLJM2jTad4KdtZunXpyl4+il47IFIV3EBLBV 0qMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WsJCNxoOgawUj7Zr3PeZyr3znV20VI9UZXxnXDXzdvs=; b=FLY1JLwbHOWtAsWWT07QQR3mtZMmMCIMaqU0kLB6lTNW57LPni+lAHpxaNTB2/igUB lhc793WjaBtYT2XQTRVSYWYAMSrivcSWMzfH37nmLSNg2jaWoTuW/fsB1yb4fhYhAw6n gdn5afiXbRCOMc8ArY8nNM4vhSQiKkt+HMcCfLq6OfwoYuNtQ0nxo7n2jnYmf7EN48Wq AX1uoGdGkMIocIPOUi5pbvQloZdyheaxHj478pOvrcHh19YqjUgn9JGb8CdGB7PoM3ny k65LQZFfKkq1b+kdK5ZcbzwH9cBfsM++1eufmpoKWYIN70MepqG5eUUy0avnitIogbrh M+0A== X-Gm-Message-State: AOAM530yt7gEj+wuvcnFiGwQ4zmai5sYN3QL0/1rzEahhO+LhJMckrc3 EduzwSecdFpBf02uEcOFthkzp65KAE5K7Q/2Eto= X-Received: by 2002:a62:445:0:b029:19c:162b:bbef with SMTP id 66-20020a6204450000b029019c162bbbefmr19016500pfe.40.1612801001178; Mon, 08 Feb 2021 08:16:41 -0800 (PST) MIME-Version: 1.0 References: <20210208151244.16338-1-calvin.johnson@oss.nxp.com> <20210208151244.16338-11-calvin.johnson@oss.nxp.com> In-Reply-To: <20210208151244.16338-11-calvin.johnson@oss.nxp.com> From: Andy Shevchenko Date: Mon, 8 Feb 2021 18:16:24 +0200 Message-ID: Subject: Re: [net-next PATCH v5 10/15] net: mdio: Add ACPI support code for mdio To: Calvin Johnson Cc: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap , Laurentiu Tudor , Linux Kernel Mailing List , "linux.cj" , Diana Madalina Craciun , netdev , linux-arm Mailing List , ACPI Devel Maling List , "David S. Miller" , Heiner Kallweit , Jakub Kicinski Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 8, 2021 at 5:14 PM Calvin Johnson wrote: > > Define acpi_mdiobus_register() to Register mii_bus and create PHYs for > each ACPI child node. ... > +/** > + * acpi_mdiobus_register - Register mii_bus and create PHYs from the ACPI ASL. > + * Redundant blank line. > + * @mdio: pointer to mii_bus structure > + * @fwnode: pointer to fwnode of MDIO bus. > + * > + * This function registers the mii_bus structure and registers a phy_device > + * for each child node of @fwnode. > + */ > +int acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode) > +{ > + struct fwnode_handle *child; > + u32 addr; > + int ret; > + > + /* Mask out all PHYs from auto probing. */ > + mdio->phy_mask = ~0; I would rather see GENMASK(31, 0) here because in case the type of the variable is changed we will need to amend this anyway. > + ret = mdiobus_register(mdio); > + if (ret) > + return ret; > + mdio->dev.fwnode = fwnode; Shouldn't it be rather ACPI_SET_COMPANION() as other bus / drivers do? > +/* Loop over the child nodes and register a phy_device for each PHY */ Indentation. > + fwnode_for_each_child_node(fwnode, child) { > + ret = acpi_get_local_address(ACPI_HANDLE_FWNODE(child), &addr); > + if ((ret) || addr >= PHY_MAX_ADDR) Too many parentheses. > + continue; > + > + ret = fwnode_mdiobus_register_phy(mdio, child, addr); > + if (ret == -ENODEV) > + dev_err(&mdio->dev, > + "MDIO device at address %d is missing.\n", > + addr); > + } > + return 0; > +} ... > +/* > + * ACPI helpers for the MDIO (Ethernet PHY) API > + * > + */ It's one line AFAICT! ... > +#include > +#include This seems a bit inconsistent with the below. I see the user of mdiobus_register(). It's the only header should be included. Everything else would be forward declared like struct fwnode_handle; > +#if IS_ENABLED(CONFIG_ACPI_MDIO) > +int acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode); > +#else /* CONFIG_ACPI_MDIO */ > +static inline int acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode) > +{ > + /* > + * Fall back to mdiobus_register() function to register a bus. > + * This way, we don't have to keep compat bits around in drivers. > + */ > + > + return mdiobus_register(mdio); > +} > +#endif -- With Best Regards, Andy Shevchenko