linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vfio: platform: ignore missing reset if disabled at module init
@ 2023-01-25 16:11 Tomasz Duszynski
  2023-01-30  9:05 ` Tian, Kevin
  0 siblings, 1 reply; 4+ messages in thread
From: Tomasz Duszynski @ 2023-01-25 16:11 UTC (permalink / raw)
  To: Eric Auger, Alex Williamson, Cornelia Huck, Kevin Tian,
	Jason Gunthorpe, open list:VFIO PLATFORM DRIVER, open list
  Cc: jerinj, Tomasz Duszynski

If reset requirement was relaxed via module parameter errors caused by
missing reset should not be propagated down to the vfio core.
Otherwise initialization will fail.

Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com>
Fixes: 5f6c7e0831a1 ("vfio/platform: Use the new device life cycle helpers")
---
 drivers/vfio/platform/vfio_platform_common.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/vfio/platform/vfio_platform_common.c b/drivers/vfio/platform/vfio_platform_common.c
index 1a0a238ffa35..c09ffab6fbe6 100644
--- a/drivers/vfio/platform/vfio_platform_common.c
+++ b/drivers/vfio/platform/vfio_platform_common.c
@@ -653,7 +653,8 @@ int vfio_platform_init_common(struct vfio_platform_device *vdev)
 	if (ret && vdev->reset_required)
 		dev_err(dev, "No reset function found for device %s\n",
 			vdev->name);
-	return ret;
+
+	return vdev->reset_required ? ret : 0;
 }
 EXPORT_SYMBOL_GPL(vfio_platform_init_common);
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH] vfio: platform: ignore missing reset if disabled at module init
  2023-01-25 16:11 [PATCH] vfio: platform: ignore missing reset if disabled at module init Tomasz Duszynski
@ 2023-01-30  9:05 ` Tian, Kevin
  2023-01-30  9:53   ` Eric Auger
  2023-01-30 12:31   ` Tomasz Duszynski
  0 siblings, 2 replies; 4+ messages in thread
From: Tian, Kevin @ 2023-01-30  9:05 UTC (permalink / raw)
  To: Tomasz Duszynski, Eric Auger, Alex Williamson, Cornelia Huck,
	Jason Gunthorpe, open list:VFIO PLATFORM DRIVER, open list
  Cc: jerinj

> From: Tomasz Duszynski <tduszynski@marvell.com>
> Sent: Thursday, January 26, 2023 12:11 AM
> @@ -653,7 +653,8 @@ int vfio_platform_init_common(struct
> vfio_platform_device *vdev)
>  	if (ret && vdev->reset_required)
>  		dev_err(dev, "No reset function found for device %s\n",
>  			vdev->name);
> -	return ret;
> +
> +	return vdev->reset_required ? ret : 0;
>  }
>  EXPORT_SYMBOL_GPL(vfio_platform_init_common);

It reads slightly better to me as below:

	if (ret & vdev->reset_required) {
		dev_err(...);
		return ret;
	}

	return 0;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] vfio: platform: ignore missing reset if disabled at module init
  2023-01-30  9:05 ` Tian, Kevin
@ 2023-01-30  9:53   ` Eric Auger
  2023-01-30 12:31   ` Tomasz Duszynski
  1 sibling, 0 replies; 4+ messages in thread
From: Eric Auger @ 2023-01-30  9:53 UTC (permalink / raw)
  To: Tian, Kevin, Tomasz Duszynski, Alex Williamson, Cornelia Huck,
	Jason Gunthorpe, open list:VFIO PLATFORM DRIVER, open list
  Cc: jerinj

Hi,

On 1/30/23 10:05, Tian, Kevin wrote:
>> From: Tomasz Duszynski <tduszynski@marvell.com>
>> Sent: Thursday, January 26, 2023 12:11 AM
>> @@ -653,7 +653,8 @@ int vfio_platform_init_common(struct
>> vfio_platform_device *vdev)
>>  	if (ret && vdev->reset_required)
>>  		dev_err(dev, "No reset function found for device %s\n",
>>  			vdev->name);
>> -	return ret;
>> +
>> +	return vdev->reset_required ? ret : 0;
>>  }
>>  EXPORT_SYMBOL_GPL(vfio_platform_init_common);
> It reads slightly better to me as below:
>
> 	if (ret & vdev->reset_required) {
> 		dev_err(...);
> 		return ret;
> 	}
>
> 	return 0;
>
agreed.

Thanks

Eric


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] vfio: platform: ignore missing reset if disabled at module init
  2023-01-30  9:05 ` Tian, Kevin
  2023-01-30  9:53   ` Eric Auger
@ 2023-01-30 12:31   ` Tomasz Duszynski
  1 sibling, 0 replies; 4+ messages in thread
From: Tomasz Duszynski @ 2023-01-30 12:31 UTC (permalink / raw)
  To: Tian, Kevin, Eric Auger, Alex Williamson, Cornelia Huck,
	Jason Gunthorpe, open list:VFIO PLATFORM DRIVER, open list
  Cc: Jerin Jacob Kollanukkaran

>-----Original Message-----
>From: Tian, Kevin <kevin.tian@intel.com>
>Sent: Monday, January 30, 2023 10:06 AM
>To: Tomasz Duszynski <tduszynski@marvell.com>; Eric Auger <eric.auger@redhat.com>; Alex Williamson
><alex.williamson@redhat.com>; Cornelia Huck <cohuck@redhat.com>; Jason Gunthorpe <jgg@ziepe.ca>;
>open list:VFIO PLATFORM DRIVER <kvm@vger.kernel.org>; open list <linux-kernel@vger.kernel.org>
>Cc: Jerin Jacob Kollanukkaran <jerinj@marvell.com>
>Subject: [EXT] RE: [PATCH] vfio: platform: ignore missing reset if disabled at module init
>
>External Email
>
>----------------------------------------------------------------------
>> From: Tomasz Duszynski <tduszynski@marvell.com>
>> Sent: Thursday, January 26, 2023 12:11 AM @@ -653,7 +653,8 @@ int
>> vfio_platform_init_common(struct vfio_platform_device *vdev)
>>  	if (ret && vdev->reset_required)
>>  		dev_err(dev, "No reset function found for device %s\n",
>>  			vdev->name);
>> -	return ret;
>> +
>> +	return vdev->reset_required ? ret : 0;
>>  }
>>  EXPORT_SYMBOL_GPL(vfio_platform_init_common);
>
>It reads slightly better to me as below:
>
>	if (ret & vdev->reset_required) {
>		dev_err(...);
>		return ret;
>	}
>
>	return 0;

Sure no problem. 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-30 12:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-25 16:11 [PATCH] vfio: platform: ignore missing reset if disabled at module init Tomasz Duszynski
2023-01-30  9:05 ` Tian, Kevin
2023-01-30  9:53   ` Eric Auger
2023-01-30 12:31   ` Tomasz Duszynski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).