From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753582AbdGJIEY (ORCPT ); Mon, 10 Jul 2017 04:04:24 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:42862 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752491AbdGJIEW (ORCPT ); Mon, 10 Jul 2017 04:04:22 -0400 Date: Mon, 10 Jul 2017 09:04:07 +0100 (WEST) Message-Id: <20170710.090407.1592129544725682024.davem@davemloft.net> To: Jason@zx2c4.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] netdevice: add netdev_pub helper function From: David Miller In-Reply-To: <20170710031959.7496-1-Jason@zx2c4.com> References: <20150612.142058.1085284048217032168.davem@davemloft.net> <20170710031959.7496-1-Jason@zx2c4.com> X-Mailer: Mew version 6.7 on Emacs 25.2 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Mon, 10 Jul 2017 01:04:16 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Jason A. Donenfeld" Date: Mon, 10 Jul 2017 05:19:58 +0200 > Being able to utilize this makes code a lot simpler and cleaner. It's > easier in many cases for drivers to pass around their private data > structure, while occationally needing to dip into net_device, rather > than the other way around, which results in tons of calls to netdev_priv > in the top of every single function, which makes everything confusing > and less clear. Additionally, this enables a "correct" way of doing such > a thing, instead of having drivers attempt to reinvent the wheel and > screw it up. > > Signed-off-by: Jason A. Donenfeld I disagree. Assuming one can go from the driver private to the netdev object trivially is a worse assumption than the other way around, and locks us into the current implementation of how the netdev and driver private memory is allocated. If you want to style your driver such that the private is passed around instead of the netdev, put a pointer back to the netdev object in your private data structure. Which is exactly what the ioc3-eth driver ought to be doing.