[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CH3PR12MB830804AFBF4623C9CF78F3A3E89C9@CH3PR12MB8308.namprd12.prod.outlook.com>
Date: Mon, 17 Apr 2023 13:21:20 +0000
From: "Gupta, Nipun" <Nipun.Gupta@....com>
To: Jason Gunthorpe <jgg@...pe.ca>,
Alex Williamson <alex.williamson@...hat.com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"masahiroy@...nel.org" <masahiroy@...nel.org>,
"nathan@...nel.org" <nathan@...nel.org>,
"ndesaulniers@...gle.com" <ndesaulniers@...gle.com>,
"nicolas@...sle.eu" <nicolas@...sle.eu>,
"git (AMD-Xilinx)" <git@....com>,
"Anand, Harpreet" <harpreet.anand@....com>,
"Jansen Van Vuuren, Pieter" <pieter.jansen-van-vuuren@....com>,
"Agarwal, Nikhil" <nikhil.agarwal@....com>,
"Simek, Michal" <michal.simek@....com>
Subject: RE: [PATCH v2] vfio/cdx: add support for CDX bus
[AMD Official Use Only - General]
> -----Original Message-----
> From: Jason Gunthorpe <jgg@...pe.ca>
> Sent: Monday, April 17, 2023 6:49 PM
> To: Alex Williamson <alex.williamson@...hat.com>
> Cc: Gupta, Nipun <Nipun.Gupta@....com>; linux-kernel@...r.kernel.org;
> kvm@...r.kernel.org; masahiroy@...nel.org; nathan@...nel.org;
> ndesaulniers@...gle.com; nicolas@...sle.eu; git (AMD-Xilinx) <git@....com>;
> Anand, Harpreet <harpreet.anand@....com>; Jansen Van Vuuren, Pieter
> <pieter.jansen-van-vuuren@....com>; Agarwal, Nikhil
> <nikhil.agarwal@....com>; Simek, Michal <michal.simek@....com>
> Subject: Re: [PATCH v2] vfio/cdx: add support for CDX bus
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> On Fri, Apr 14, 2023 at 03:36:14PM -0600, Alex Williamson wrote:
>
> > > +static int vfio_cdx_init_device(struct vfio_device *core_vdev)
> > > +{
> > > + struct vfio_cdx_device *vdev =
> > > + container_of(core_vdev, struct vfio_cdx_device, vdev);
> > > + struct cdx_device *cdx_dev = to_cdx_device(core_vdev->dev);
> > > +
> > > + vdev->cdx_dev = cdx_dev;
> > > + vdev->dev = &cdx_dev->dev;
> >
> > Both of these seem trivial to factor out of this patch, cdx_device is
> > always available via to_cdx_device(core_vdev->dev) and the struct
> > device is always available via core_vdev->dev. vdev->dev isn't even
> > used anywhere yet. Both the init and release functions here could be
> > dropped afaict.
>
> Yes please, I have a series someplace that gets rid of all these
> redundent ->devs we keep around everwhere.
>
> to_cdx_device(core_vdev->dev) is a good solution, maybe with a static
> inline.
Agree, we have already rolled out v3 which has this change i.e using
to_cdx_dev(core_vdev->dev) instead of storing these again.
Thanks,
Nipun
>
> Jason
Powered by blists - more mailing lists