[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AM0PR05MB48665001B54D3F29A9D4127FD1760@AM0PR05MB4866.eurprd05.prod.outlook.com>
Date: Wed, 13 Nov 2019 06:44:49 +0000
From: Parav Pandit <parav@...lanox.com>
To: Jason Gunthorpe <jgg@...pe.ca>
CC: Greg KH <gregkh@...uxfoundation.org>,
Jeff Kirsher <jeffrey.t.kirsher@...el.com>,
"davem@...emloft.net" <davem@...emloft.net>,
Dave Ertman <david.m.ertman@...el.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
"nhorman@...hat.com" <nhorman@...hat.com>,
"sassmann@...hat.com" <sassmann@...hat.com>,
Kiran Patil <kiran.patil@...el.com>
Subject: RE: [net-next 1/1] virtual-bus: Implementation of Virtual Bus
> From: Jason Gunthorpe <jgg@...pe.ca>
> Sent: Tuesday, November 12, 2019 7:11 PM
>
> > A small improvement below, because get_drvdata() and set_drvdata()
>
> Here it was called 'devdata' not the existing drvdata - so something different, I
> was confused for a bit too..
>
Oh ok. but looks buggy in the patch as virtbus_dev doesn't have devdata field.
Anyways, container_of() is better type checked anyway as below.
+#define virtbus_get_devdata(dev) ((dev)->devdata)
> > is supposed to be called by the bus driver, not its creator. And
> > below data structure achieve strong type checks, no void* casts, and
> > exactly achieves the foo_device example. Isn't it better?
>
> > mlx5_virtbus_device {
> > struct virtbus_device dev;
> > struct mlx5_core_dev *dev;
> > };
>
> This does seem a bit cleaner than using the void * trick (more, OOPy at least)
>
Ok. thanks.
Powered by blists - more mailing lists