Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp909552rwd; Thu, 25 May 2023 05:51:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ48Vc26sAQq3ItguHaBv1Tlbc9Jm1Y9XC97KbNTUXySZmFlSRgNqc3we8QroFH3hc4kXmFi X-Received: by 2002:a17:90a:4495:b0:250:a6bd:cb4a with SMTP id t21-20020a17090a449500b00250a6bdcb4amr1569272pjg.29.1685019083492; Thu, 25 May 2023 05:51:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685019083; cv=none; d=google.com; s=arc-20160816; b=G/OxEGLVZnr26awF8weGXqpHZYI3b7ZGNkAgWbV1j9NEdlQ8MaYFSft+HXtV4Uchnj CVZNTDp0JKJYgiczaZ3Numd65dFob5f41mwbBCvvMM4tsOcbuPe0r1qLfvBXAc+ibV9G l1YmuJY22Zwa18MvvHi6T+O72S+jopXriraZYcqVIbg9Bjy2Oc3SUlJmxKrBp7wUKqVb YvQVEwOrvp/qS0lN9UGtlcEsd4AaeimewY1uCZthi0ZyNYia68bHBSEY/ygoYd/Zau/s uJNDzhUAIzcsB0tDSYOROmG0OZkPQozbwHFC3x70S1nwQH7u1Mjt+FJiNJrLwZBWSpej j/oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=LATq8y11VRK+GDnUyeoDnyHykvQtZzA+fhIGVKjKY/U=; b=OPje/wWI9IfbR9IGPcHqkVidZpZs3AmHz0dW1nnOk7ofIAsAobJAW0LWu9e8KHeZyb vEfyO8M39lQhj/c0anvro9qBErxFKiW5tldUqCWAtLGF8nqZJZBxxs1/7v4apSop34Kf U0U4m6bxhdcw/6k89ThtYRIGp12A+YiIFz6VcVT7ZDWTklew42xAbo6YA5Mwle/bCqQK wVVJ7zMixAz2eRChoAszUO65T1yGnOCLUgJr6G80/jJs2AzSL0qOS5KLiq60YxnqTSvj SRjNz7iwcv6c53N1cdHQ1zZQdadeHlTC5+8M5RS9oaHRci0bAP11/gkEz49v5nT3PJPz pjYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=OGofsE+m; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ms13-20020a17090b234d00b00255fcc84078si1726094pjb.41.2023.05.25.05.51.09; Thu, 25 May 2023 05:51:23 -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=@bootlin.com header.s=gm1 header.b=OGofsE+m; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236270AbjEYMlb (ORCPT + 99 others); Thu, 25 May 2023 08:41:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230464AbjEYMl3 (ORCPT ); Thu, 25 May 2023 08:41:29 -0400 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::223]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 096E69B; Thu, 25 May 2023 05:41:27 -0700 (PDT) X-GND-Sasl: maxime.chevallier@bootlin.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1685018486; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LATq8y11VRK+GDnUyeoDnyHykvQtZzA+fhIGVKjKY/U=; b=OGofsE+mR6iQKrs/9UPk/kfzFlZ3sYngSppWGdbBDEN8LMeuuBybN3pbzUOaLcG8BOVY50 TAuIl6LQPms5JDcysh30Vv7UULvEuwIbFjnaiCyKyCV7u8OXbUNwJ6up6P8zquak+GVywq kr/RCiEH0Di34lJxSHTINUqeOkldbzSHoGWllzmKKvCoEh7GLPVEVVQcuQVRB5d5ZFbrk2 yPo88m59D6AQdd8LOoXAkps0ThJVqa/tH4eowLWICFcVoBW62NDHZP/YPlLT74SNWy19Ee lvu37L8+0b4ZpgLOwhByES6qIRs3fNSOb0DkjWrzyWLRomw4fC7xBf9n4tWguA== X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com X-GND-Sasl: maxime.chevallier@bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 70B8660007; Thu, 25 May 2023 12:41:23 +0000 (UTC) Date: Thu, 25 May 2023 14:41:22 +0200 From: Maxime Chevallier To: "Russell King (Oracle)" 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: <20230525144122.3d2d8aba@pc-7.home> In-Reply-To: References: <20230525101126.370108-1-maxime.chevallier@bootlin.com> <20230525101126.370108-2-maxime.chevallier@bootlin.com> Organization: Bootlin X-Mailer: Claws Mail 4.1.1 (GTK 3.24.37; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, 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 Hello Russell, On Thu, 25 May 2023 12:11:38 +0100 "Russell King (Oracle)" wrote: > 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" ? Oh right... good catch, thanks ! > 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? > You are correct, other fields are unused so I'll use a new struct for the mii->priv field. Thank you for reviewing, Best regards, Maxime