netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: brgl@bgdev.pl
Cc: robh+dt@kernel.org, matthias.bgg@gmail.com, john@phrozen.org,
	sean.wang@mediatek.com, Mark-MC.Lee@mediatek.com,
	kuba@kernel.org, arnd@arndb.de, fparent@baylibre.com,
	hkallweit1@gmail.com, edwin.peer@broadcom.com,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org,
	stephane.leprovost@mediatek.com, pedro.tsai@mediatek.com,
	andrew.perepech@mediatek.com, bgolaszewski@baylibre.com
Subject: Re: [PATCH v2 05/14] net: core: provide priv_to_netdev()
Date: Mon, 11 May 2020 13:41:17 -0700 (PDT)	[thread overview]
Message-ID: <20200511.134117.1336222619714836904.davem@davemloft.net> (raw)
In-Reply-To: <20200511150759.18766-6-brgl@bgdev.pl>

From: Bartosz Golaszewski <brgl@bgdev.pl>
Date: Mon, 11 May 2020 17:07:50 +0200

> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> Appropriate amount of extra memory for private data is allocated at
> the end of struct net_device. We have a helper - netdev_priv() - that
> returns its address but we don't have the reverse: a function which
> given the address of the private data, returns the address of struct
> net_device.
> 
> This has caused many drivers to store the pointer to net_device in
> the private data structure, which basically means storing the pointer
> to a structure in this very structure.
> 
> This patch proposes to add priv_to_netdev() - a helper which converts
> the address of the private data to the address of the associated
> net_device.
> 
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>

Sorry, please don't do this.  We had this almost two decades ago and
explicitly removed it intentionally.

Store the back pointer in your software state just like everyone else
does.

  parent reply	other threads:[~2020-05-11 20:41 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-11 15:07 [PATCH v2 00/14] mediatek: add support for MediaTek Ethernet MAC Bartosz Golaszewski
2020-05-11 15:07 ` [PATCH v2 01/14] dt-bindings: arm: add a binding document for MediaTek PERICFG controller Bartosz Golaszewski
2020-05-19 18:28   ` Rob Herring
2020-05-20  9:19     ` Bartosz Golaszewski
2020-05-11 15:07 ` [PATCH v2 02/14] dt-bindings: net: add a binding document for MediaTek Ethernet MAC Bartosz Golaszewski
2020-05-11 15:07 ` [PATCH v2 03/14] net: ethernet: mediatek: rename Kconfig prompt Bartosz Golaszewski
2020-05-11 15:07 ` [PATCH v2 04/14] net: ethernet: mediatek: remove unnecessary spaces from Makefile Bartosz Golaszewski
2020-05-11 15:07 ` [PATCH v2 05/14] net: core: provide priv_to_netdev() Bartosz Golaszewski
2020-05-11 16:39   ` Andrew Lunn
2020-05-11 20:41   ` David Miller [this message]
2020-05-12  6:04     ` Bartosz Golaszewski
2020-05-12 19:30       ` David Miller
2020-05-11 15:07 ` [PATCH v2 06/14] net: move devres helpers into a separate source file Bartosz Golaszewski
2020-05-11 15:07 ` [PATCH v2 07/14] net: devres: define a separate devres structure for devm_alloc_etherdev() Bartosz Golaszewski
2020-05-11 15:07 ` [PATCH v2 08/14] net: devres: provide devm_register_netdev() Bartosz Golaszewski
2020-05-11 15:07 ` [PATCH v2 09/14] net: ethernet: mtk-eth-mac: new driver Bartosz Golaszewski
2020-05-11 19:24   ` Florian Fainelli
2020-05-12  6:35     ` Bartosz Golaszewski
2020-05-11 15:07 ` [PATCH v2 10/14] ARM64: dts: mediatek: add pericfg syscon to mt8516.dtsi Bartosz Golaszewski
2020-05-11 15:07 ` [PATCH v2 11/14] ARM64: dts: mediatek: add the ethernet node " Bartosz Golaszewski
2020-05-11 15:07 ` [PATCH v2 12/14] ARM64: dts: mediatek: add an alias for ethernet0 for pumpkin boards Bartosz Golaszewski
2020-05-11 15:07 ` [PATCH v2 13/14] ARM64: dts: mediatek: add ethernet pins " Bartosz Golaszewski
2020-05-11 15:07 ` [PATCH v2 14/14] ARM64: dts: mediatek: enable ethernet on " Bartosz Golaszewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200511.134117.1336222619714836904.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=Mark-MC.Lee@mediatek.com \
    --cc=andrew.perepech@mediatek.com \
    --cc=arnd@arndb.de \
    --cc=bgolaszewski@baylibre.com \
    --cc=brgl@bgdev.pl \
    --cc=devicetree@vger.kernel.org \
    --cc=edwin.peer@broadcom.com \
    --cc=fparent@baylibre.com \
    --cc=hkallweit1@gmail.com \
    --cc=john@phrozen.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pedro.tsai@mediatek.com \
    --cc=robh+dt@kernel.org \
    --cc=sean.wang@mediatek.com \
    --cc=stephane.leprovost@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).