public inbox for [email protected]
 help / color / mirror / Atom feed
From: Zhenyu Wang <[email protected]>
To: Christian Brauner <[email protected]>
Cc: [email protected], Christoph Hellwig <[email protected]>,
	Jan Kara <[email protected]>, Vitaly Kuznetsov <[email protected]>,
	Sean Christopherson <[email protected]>,
	Paolo Bonzini <[email protected]>,
	Thomas Gleixner <[email protected]>,
	Ingo Molnar <[email protected]>, Borislav Petkov <[email protected]>,
	Dave Hansen <[email protected]>,
	[email protected], David Woodhouse <[email protected]>,
	Paul Durrant <[email protected]>, Oded Gabbay <[email protected]>,
	Wu Hao <[email protected]>, Tom Rix <[email protected]>,
	Moritz Fischer <[email protected]>, Xu Yilun <[email protected]>,
	Zhenyu Wang <[email protected]>,
	Zhi Wang <[email protected]>,
	Jani Nikula <[email protected]>,
	Joonas Lahtinen <[email protected]>,
	Rodrigo Vivi <[email protected]>,
	Tvrtko Ursulin <[email protected]>,
	David Airlie <[email protected]>, Daniel Vetter <[email protected]>,
	Leon Romanovsky <[email protected]>, Jason Gunthorpe <[email protected]>,
	Frederic Barrat <[email protected]>,
	Andrew Donnellan <[email protected]>,
	Arnd Bergmann <[email protected]>,
	Greg Kroah-Hartman <[email protected]>,
	Eric Farman <[email protected]>,
	Matthew Rosato <[email protected]>,
	Halil Pasic <[email protected]>,
	Vineeth Vijayan <[email protected]>,
	Peter Oberparleiter <[email protected]>,
	Heiko Carstens <[email protected]>,
	Vasily Gorbik <[email protected]>,
	Alexander Gordeev <[email protected]>,
	Christian Borntraeger <[email protected]>,
	Sven Schnelle <[email protected]>,
	Tony Krowiak <[email protected]>,
	Jason Herne <[email protected]>,
	Harald Freudenberger <[email protected]>,
	"Michael S. Tsirkin" <[email protected]>,
	Jason Wang <[email protected]>,
	Xuan Zhuo <[email protected]>,
	Diana Craciun <[email protected]>,
	Alex Williamson <[email protected]>,
	Eric Auger <[email protected]>, Fei Li <[email protected]>,
	Benjamin LaHaise <[email protected]>,
	Johannes Weiner <[email protected]>,
	Michal Hocko <[email protected]>,
	Roman Gushchin <[email protected]>,
	Shakeel Butt <[email protected]>,
	Muchun Song <[email protected]>,
	Kirti Wankhede <[email protected]>,
	[email protected], [email protected],
	[email protected], [email protected],
	[email protected],
	[email protected], [email protected],
	[email protected], [email protected],
	[email protected],
	[email protected],
	[email protected], [email protected],
	[email protected], [email protected],
	Jens Axboe <[email protected]>,
	Pavel Begunkov <[email protected]>,
	[email protected]
Subject: Re: [PATCH v2 1/4] i915: make inject_virtual_interrupt() void
Date: Thu, 23 Nov 2023 08:24:24 +0800	[thread overview]
Message-ID: <ZV6buHrQy2+CJ7xX@debian-scheme> (raw)
In-Reply-To: <[email protected]>

[-- Attachment #1: Type: text/plain, Size: 2135 bytes --]

On 2023.11.22 13:48:22 +0100, Christian Brauner wrote:
> The single caller of inject_virtual_interrupt() ignores the return value
> anyway. This allows us to simplify eventfd_signal() in follow-up
> patches.
> 
> Signed-off-by: Christian Brauner <[email protected]>
> ---
>  drivers/gpu/drm/i915/gvt/interrupt.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gvt/interrupt.c b/drivers/gpu/drm/i915/gvt/interrupt.c
> index de3f5903d1a7..9665876b4b13 100644
> --- a/drivers/gpu/drm/i915/gvt/interrupt.c
> +++ b/drivers/gpu/drm/i915/gvt/interrupt.c
> @@ -422,7 +422,7 @@ static void init_irq_map(struct intel_gvt_irq *irq)
>  #define MSI_CAP_DATA(offset) (offset + 8)
>  #define MSI_CAP_EN 0x1
>  
> -static int inject_virtual_interrupt(struct intel_vgpu *vgpu)
> +static void inject_virtual_interrupt(struct intel_vgpu *vgpu)
>  {
>  	unsigned long offset = vgpu->gvt->device_info.msi_cap_offset;
>  	u16 control, data;
> @@ -434,10 +434,10 @@ static int inject_virtual_interrupt(struct intel_vgpu *vgpu)
>  
>  	/* Do not generate MSI if MSIEN is disabled */
>  	if (!(control & MSI_CAP_EN))
> -		return 0;
> +		return;
>  
>  	if (WARN(control & GENMASK(15, 1), "only support one MSI format\n"))
> -		return -EINVAL;
> +		return;
>  
>  	trace_inject_msi(vgpu->id, addr, data);
>  
> @@ -451,10 +451,10 @@ static int inject_virtual_interrupt(struct intel_vgpu *vgpu)
>  	 * returned and don't inject interrupt into guest.
>  	 */
>  	if (!test_bit(INTEL_VGPU_STATUS_ATTACHED, vgpu->status))
> -		return -ESRCH;
> -	if (vgpu->msi_trigger && eventfd_signal(vgpu->msi_trigger, 1) != 1)
> -		return -EFAULT;
> -	return 0;
> +		return;
> +	if (!vgpu->msi_trigger)
> +		return;
> +	eventfd_signal(vgpu->msi_trigger, 1);
>  }

I think it's a little simpler to write as
    if (vgpu->msi_trigger)
            eventfd_signal(vgpu->msi_trigger, 1);

Looks fine with me.

Reviewed-by: Zhenyu Wang <[email protected]>

Thanks!

>  
>  static void propagate_event(struct intel_gvt_irq *irq,
> 
> -- 
> 2.42.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  parent reply	other threads:[~2023-11-23  0:26 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-22 12:48 [PATCH v2 0/4] eventfd: simplify signal helpers Christian Brauner
2023-11-22 12:48 ` [PATCH v2 1/4] i915: make inject_virtual_interrupt() void Christian Brauner
2023-11-22 15:05   ` Jan Kara
2023-11-23  0:24   ` Zhenyu Wang [this message]
2023-11-23 13:11     ` Christian Brauner
2023-11-22 12:48 ` [PATCH v2 2/4] eventfd: simplify eventfd_signal() Christian Brauner
2023-11-22 14:49   ` Xu Yilun
2023-11-22 15:05   ` Jan Kara
2023-11-22 15:19   ` Jani Nikula
2023-11-23 13:18     ` Christian Brauner
2023-11-24  2:02   ` Andrew Donnellan
2023-11-27 16:17   ` Eric Farman
2024-02-06 19:44   ` Stefan Hajnoczi
2024-02-07 14:33     ` Anthony Krowiak
2024-02-07 14:34   ` Paolo Bonzini
2024-02-08  9:02     ` Christian Brauner
2023-11-22 12:48 ` [PATCH v2 3/4] eventfd: simplify eventfd_signal_mask() Christian Brauner
2023-11-22 15:05   ` Jan Kara
2023-11-22 12:48 ` [PATCH v2 4/4] eventfd: make eventfd_signal{_mask}() void Christian Brauner
2023-11-22 15:06   ` Jan Kara
2023-11-23 19:43 ` [PATCH v2 0/4] eventfd: simplify signal helpers Jens Axboe
2023-11-24  7:47 ` Christian Brauner

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=ZV6buHrQy2+CJ7xX@debian-scheme \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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