Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp473673rwo; Fri, 21 Jul 2023 15:16:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlHtwdVbmgcEXnURQiUxId45m8NiodIuNyi3HIM189UuTulgLyJJfX8E8PjJxm6nRW/uKbqJ X-Received: by 2002:a19:2d05:0:b0:4fb:9595:15e9 with SMTP id k5-20020a192d05000000b004fb959515e9mr1853470lfj.22.1689977787388; Fri, 21 Jul 2023 15:16:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689977787; cv=none; d=google.com; s=arc-20160816; b=ON4AMen9I4x1N2N0xBqzj4txeOfw+WffhyHAzlxGXXXjwHKe/Kh0H2y9OcdPFZ9/Xb XnOQzMAIYys+Z86devYQvsmWwjc9nivCJIHDDAzvzYc4oXCMf4xxf7vmV3ELYBaHWQ6R RoOFnwC81/dUzTedrIF+eVBkDj2epzVR3XaHF/uiyd54NAbKJzs6eBV1GPxVQnIoNj6I G3QkBW7SmYddD3gg1WnfMKdM7jdyvTyMOMbhhYDz5iArCiqj6/M8jl5A3ek9J5pBFK1H r0pxDMMeG6muewpxi4PQl4a/aP7xcldAg9YhUcgCxh2LQ1K5bALNcVuNLzL0+/TDwJUY 9tHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=3UeAOx0ajpTlT5WCtehLjoDaH5qdKZhHVF9hjtMO+no=; fh=whJrdE8wgOo/oTZ4RzCpf0Ow5iirbp2cJpNY43r50mA=; b=bGAoK67/2WRDmRmsEsQPb6Ci6glooGgiIVqaDnEoSPUEvjVbpp5Nlb60wCfAEWruRU ayT6dapksS8b1LgR5Sj1Bw+czJB7Iap3Rji4LdRv2mcckZVilaMTxlOn6jWKbYC6V7OR rXWKhk/7gtMCoDHPpxOn2fhJdydkwd21NZ5tX7FbPn+98onVTWR/Jh3XWh6uxTx3geoO tAsvxR+2HtaJfww8GTgF3LSFXNn/CgrJ+VGlESvF3tFXz2e/HUj9ENlYlOtzLxSCjWo4 zvcmWM9khcVoI0YbR4N6pvQdTCGWpMaEiM/CcCV+NER/ZwAFJGJDvtFlmnSFjYQe27y5 udUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b="rCNQ/SMA"; 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=lunn.ch Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n24-20020a05640206d800b0051dddbd08cdsi2882102edy.356.2023.07.21.15.16.02; Fri, 21 Jul 2023 15:16:27 -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=@lunn.ch header.s=20171124 header.b="rCNQ/SMA"; 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=lunn.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229536AbjGUV6M (ORCPT + 99 others); Fri, 21 Jul 2023 17:58:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229451AbjGUV6L (ORCPT ); Fri, 21 Jul 2023 17:58:11 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93B26E65; Fri, 21 Jul 2023 14:58:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=3UeAOx0ajpTlT5WCtehLjoDaH5qdKZhHVF9hjtMO+no=; b=rCNQ/SMAUMJ9GQxyqAdU0wXO0L meIKipc28uNzSrk8grgu3HGM92qy+K/WaLhHJerxzxArqOurBaENiA61zkCA3l5N2XyuOvLU+lE2M 93A7YnEyLPqebJrMqWltQDJ02wGkr/bsNx73kqbPATEJ8PfrL4dcQaaho/pShFpYna+s=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1qMy8B-001uIp-P8; Fri, 21 Jul 2023 23:57:47 +0200 Date: Fri, 21 Jul 2023 23:57:47 +0200 From: Andrew Lunn To: nick.hawkins@hpe.com Cc: verdun@hpe.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 2/5] net: hpe: Add GXP UMAC MDIO Message-ID: <64a33933-cdf7-4cc1-9a77-5bbdc925fdff@lunn.ch> References: <20230721212044.59666-1-nick.hawkins@hpe.com> <20230721212044.59666-3-nick.hawkins@hpe.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230721212044.59666-3-nick.hawkins@hpe.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 > drivers/net/ethernet/hpe/gxp-umac-mdio.c | 158 +++++++++++++++++++++++ This looks to be a standalone MDIO driver. So please move it into drivers/net/mdio. > +config NET_VENDOR_HPE > + bool "HPE device" > + default y > + depends on ARCH_HPE Please add || COMPILE_TEST > + help > + Say y here to support the HPE network devices. > + The GXP contains two Ethernet MACs that can be > + connected externally to several physical devices. > + From an external interface perspective the BMC > + provides two SERDES interface connections capable > + of either SGMII or 1000Base-X operation. The BMC > + also provides a RMII interface for sideband > + connections to external Ethernet controllers. > + > +if NET_VENDOR_HPE > + > +config GXP_UMAC_MDIO > + tristate "GXP UMAC mdio support" > + depends on ARCH_HPE You probably also need depends on OF_MDIO && HAS_IOMEM depends on MDIO_DEVRES > +static int umac_mdio_read(struct mii_bus *bus, int phy_id, int reg) > +{ > + struct umac_mdio_priv *umac_mdio = bus->priv; > + unsigned int value; > + unsigned int status; > + int ret; Networking uses reverse christmas tree. Please sort these longest to shorted. ... > + ret = readl_poll_timeout(umac_mdio->base + UMAC_MII, status, > + !(status & UMAC_MII_MOWNER), 1000, 100000); > + if (ret) { > + dev_err(bus->parent, "mdio read time out\n"); > + return -ETIMEDOUT; return ret; Don't transform error codes. > +static int umac_mdio_write(struct mii_bus *bus, int phy_id, int reg, u16 value) > +{ > + struct umac_mdio_priv *umac_mdio = bus->priv; > + unsigned int status; > + int ret; > + ret = readl_poll_timeout(umac_mdio->base + UMAC_MII, status, > + !(status & UMAC_MII_MOWNER), 1000, 100000); > + if (ret) { > + dev_err(bus->parent, "mdio read time out\n"); > + return -ETIMEDOUT; > + } You can simplify this, do a dev_err() inside an if, and then unconditionally return ret; > +static int umac_mdio_probe(struct platform_device *pdev) > +{ > + struct resource *res; > + struct mii_bus *bus; > + struct umac_mdio_priv *umac_mdio; > + > + int ret; More sorting needed. And no blank lines please. Andrew