RE: [net-next 1/1] virtual-bus: Implementation of Virtual Bus

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> From: Jason Gunthorpe <jgg@xxxxxxxx>
> 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.




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux