From: Jason Gunthorpe <jgg@ziepe.ca>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: Nipun Gupta <nipun.gupta@amd.com>,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
masahiroy@kernel.org, nathan@kernel.org, ndesaulniers@google.com,
nicolas@fjasle.eu, git@amd.com, harpreet.anand@amd.com,
pieter.jansen-van-vuuren@amd.com, nikhil.agarwal@amd.com,
michal.simek@amd.com
Subject: Re: [PATCH v2] vfio/cdx: add support for CDX bus
Date: Mon, 17 Apr 2023 10:18:42 -0300 [thread overview]
Message-ID: <ZD1HMkbdhQpAYs7P@ziepe.ca> (raw)
In-Reply-To: <20230414153614.3b72e659.alex.williamson@redhat.com>
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
next prev parent reply other threads:[~2023-04-17 13:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-14 12:34 [PATCH v2] vfio/cdx: add support for CDX bus Nipun Gupta
2023-04-14 21:36 ` Alex Williamson
2023-04-17 5:13 ` Gupta, Nipun
2023-04-17 13:18 ` Jason Gunthorpe [this message]
2023-04-17 13:21 ` Gupta, Nipun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZD1HMkbdhQpAYs7P@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=alex.williamson@redhat.com \
--cc=git@amd.com \
--cc=harpreet.anand@amd.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=michal.simek@amd.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=nicolas@fjasle.eu \
--cc=nikhil.agarwal@amd.com \
--cc=nipun.gupta@amd.com \
--cc=pieter.jansen-van-vuuren@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox