lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZD1HMkbdhQpAYs7P@ziepe.ca>
Date:   Mon, 17 Apr 2023 10:18:42 -0300
From:   Jason Gunthorpe <jgg@...pe.ca>
To:     Alex Williamson <alex.williamson@...hat.com>
Cc:     Nipun Gupta <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@....com,
        harpreet.anand@....com, pieter.jansen-van-vuuren@....com,
        nikhil.agarwal@....com, michal.simek@....com
Subject: Re: [PATCH v2] vfio/cdx: add support for CDX bus

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.

Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ