Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp806652rwd; Thu, 25 May 2023 04:22:24 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6pMhBC/T+qJFtXYE5vrh/Ou1fV4x/DT8SkBVAeW0FpS2Dhps6q9Zwy3Q0rxoCrVuK0890p X-Received: by 2002:a05:6a20:7489:b0:10e:457f:2548 with SMTP id p9-20020a056a20748900b0010e457f2548mr5990442pzd.37.1685013744331; Thu, 25 May 2023 04:22:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685013744; cv=none; d=google.com; s=arc-20160816; b=Ok8Puay+WHR3v5Kw+bDt6laOUWpkfBHv9QsWb3ARnIEL+DcMTujCol5IPiQzr3uf29 cHCfwupoeVJG53eyCLIUkfnL8jqyP1Y/WqEu569JLuWw4ZLzStayUOIXF4uGrcI+ywUg rYVzcOIrnZXCJ6m/dbgvzKoIN6l0R3ZewN+UosPOYUe5nfoAfPVwKrb+grtFUrk/vu3g Hro/9QOAVigBuHLVF7WoO3aAa7lYMCJ1RWx4vs/L/Cy5Jck0xnF8FRaPXYYOlvBq2F4W 4igo9NPt5OQAJWevTsl5lRpzBtpNGR7wnS8oo/TV+bja17oNuiJOhr7j0O3uegeHNLvS Sxag== 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 :dkim-signature; bh=7pnqEDqTdXXIQOBLwb2FYHGZeiwAvkXUoR0xGIGm1tA=; b=N31AWo9cxWkZ2/Wc2U42A8kByGc1LABgPiZmIT9gJ3cJgA/IpIn1KJxd3buKE8rkp6 5VtKtX378+7hCYvvOvbriti2REGwAZDrOJhnLK5f0TiOXYW8YoQ+8uf0WyIApg1WO7HR GklV7qEokN86iN17b7hv2flmXQuFGYccuS1+AQiRzIGrayXvAMPE6bW6gSJPFRwX5xYO 7MbBoD4eFit1FZd3qRny1olCVt2mquUI+sbRqeV9v6nVNlcNqlYVNqZBxB7S4YFH9Coo arzK2K+lWm8UBOnPTAdtS3+EBrqvgVUCNxrbHFLLi3/AI5UulUb6WE6D3CipbL4YAyGl TSFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=Y5fWM8sv; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d4-20020aa797a4000000b0064d5dcc9b8asi1294738pfq.125.2023.05.25.04.22.10; Thu, 25 May 2023 04:22:24 -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=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=Y5fWM8sv; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240755AbjEYLL5 (ORCPT + 99 others); Thu, 25 May 2023 07:11:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240294AbjEYLLw (ORCPT ); Thu, 25 May 2023 07:11:52 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADBB1191; Thu, 25 May 2023 04:11:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=7pnqEDqTdXXIQOBLwb2FYHGZeiwAvkXUoR0xGIGm1tA=; b=Y5fWM8svQePSKhhdt6bnlWPjdN pZ6uBLzdn+6ZLX66yd6iAQSOPELpAsm2thocsaCrSBICaQtZpH+w3bUnUeot4cjW6uoEiJiKCNeEo Hn0UM8Oruh62o+WHwv+tl/PZnTilFT6xDZElEoyuozcUNcdyGxv0ln3N6Tg1Z5bTdz4KuHbdZTdI0 v2NBZQ7iyQDxoBpGtCoF5ZRHR0YuQHEmi39yJynaQ4m0hD2JXpm1ux/qofPOcxXtoejMnAD2T2VSz UjuSYtERGhniQnzXMm9lrmwgxVsD3ZwcekQwK/a061aLpV7X72NKqDLos/hahiKnIEIhHTZCBX9nb JX3EUG6Q==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:49710) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q28sj-0003y0-FZ; Thu, 25 May 2023 12:11:45 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1q28sc-0002ct-V3; Thu, 25 May 2023 12:11:38 +0100 Date: Thu, 25 May 2023 12:11:38 +0100 From: "Russell King (Oracle)" To: Maxime Chevallier Cc: Mark Brown , davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, alexis.lothore@bootlin.com, thomas.petazzoni@bootlin.com, Andrew Lunn , Jakub Kicinski , Eric Dumazet , Paolo Abeni , Florian Fainelli , Heiner Kallweit , Vladimir Oltean , Ioana Ciornei , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Maxime Coquelin , Jose Abreu , Alexandre Torgue , Giuseppe Cavallaro Subject: Re: [PATCH net-next v2 1/4] net: mdio: Introduce a regmap-based mdio driver Message-ID: References: <20230525101126.370108-1-maxime.chevallier@bootlin.com> <20230525101126.370108-2-maxime.chevallier@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230525101126.370108-2-maxime.chevallier@bootlin.com> Sender: Russell King (Oracle) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,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 On Thu, May 25, 2023 at 12:11:23PM +0200, Maxime Chevallier wrote: > +struct mii_bus *devm_mdio_regmap_register(struct device *dev, > + const struct mdio_regmap_config *config) > +{ > + struct mdio_regmap_config *mrc; > + struct mii_bus *mii; > + int rc; > + > + if (!config->parent) > + return ERR_PTR(-EINVAL); > + > + mii = devm_mdiobus_alloc_size(config->parent, sizeof(*mrc)); > + if (!mii) > + return ERR_PTR(-ENOMEM); > + > + mrc = mii->priv; > + memcpy(mrc, config, sizeof(*mrc)); > + > + mrc->regmap = config->regmap; > + mrc->valid_addr = config->valid_addr; You have just memcpy'd everything from config into mrc. Doesn't this already include "regmap" and "valid_addr" ? However, these are the only two things used, so does it really make sense to allocate the full mdio_regmap_config structure, or would a smaller data structure (of one pointer and one u8) be more appropriate? -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!