linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] media: atomisp_gmin_platform: Switch to use acpi_evaluate_dsm_typed()
@ 2022-07-15 16:06 Andy Shevchenko
  2022-07-17  8:42 ` Sakari Ailus
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2022-07-15 16:06 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Hans de Goede, linux-media, linux-staging,
	linux-kernel
  Cc: Sakari Ailus, Greg Kroah-Hartman, Andy Shevchenko

The acpi_evaluate_dsm_typed() provides a way to check the type of the
object evaluated by _DSM call. Use it instead of open coded variant.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
index bf527b366ab3..d4cfda07f7fb 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
@@ -1207,16 +1207,13 @@ static int gmin_get_config_dsm_var(struct device *dev,
 	if (!strcmp(var, "CamClk"))
 		return -EINVAL;
 
-	obj = acpi_evaluate_dsm(handle, &atomisp_dsm_guid, 0, 0, NULL);
+	/* Return on unexpected object type */
+	obj = acpi_evaluate_dsm_typed(handle, &atomisp_dsm_guid, 0, 0, NULL, ACPI_TYPE_PACKAGE);
 	if (!obj) {
 		dev_info_once(dev, "Didn't find ACPI _DSM table.\n");
 		return -EINVAL;
 	}
 
-	/* Return on unexpected object type */
-	if (obj->type != ACPI_TYPE_PACKAGE)
-		return -EINVAL;
-
 #if 0 /* Just for debugging purposes */
 	for (i = 0; i < obj->package.count; i++) {
 		union acpi_object *cur = &obj->package.elements[i];
-- 
2.35.1


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

* Re: [PATCH v1 1/1] media: atomisp_gmin_platform: Switch to use acpi_evaluate_dsm_typed()
  2022-07-15 16:06 [PATCH v1 1/1] media: atomisp_gmin_platform: Switch to use acpi_evaluate_dsm_typed() Andy Shevchenko
@ 2022-07-17  8:42 ` Sakari Ailus
  0 siblings, 0 replies; 2+ messages in thread
From: Sakari Ailus @ 2022-07-17  8:42 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Mauro Carvalho Chehab, Hans de Goede, linux-media, linux-staging,
	linux-kernel, Sakari Ailus, Greg Kroah-Hartman

Hi Andy,

On Fri, Jul 15, 2022 at 07:06:41PM +0300, Andy Shevchenko wrote:
> The acpi_evaluate_dsm_typed() provides a way to check the type of the
> object evaluated by _DSM call. Use it instead of open coded variant.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
> index bf527b366ab3..d4cfda07f7fb 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
> @@ -1207,16 +1207,13 @@ static int gmin_get_config_dsm_var(struct device *dev,
>  	if (!strcmp(var, "CamClk"))
>  		return -EINVAL;
>  
> -	obj = acpi_evaluate_dsm(handle, &atomisp_dsm_guid, 0, 0, NULL);
> +	/* Return on unexpected object type */
> +	obj = acpi_evaluate_dsm_typed(handle, &atomisp_dsm_guid, 0, 0, NULL, ACPI_TYPE_PACKAGE);

Can you please run:

	$ ./scripts/checkpatch.pl --strict --max-line-length=80

I.e. the preferred line length is 80 or less, unless there are other
reasons to keep it longer.

>  	if (!obj) {
>  		dev_info_once(dev, "Didn't find ACPI _DSM table.\n");
>  		return -EINVAL;
>  	}
>  
> -	/* Return on unexpected object type */
> -	if (obj->type != ACPI_TYPE_PACKAGE)
> -		return -EINVAL;
> -
>  #if 0 /* Just for debugging purposes */
>  	for (i = 0; i < obj->package.count; i++) {
>  		union acpi_object *cur = &obj->package.elements[i];

-- 
Kind regards,

Sakari Ailus

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

end of thread, other threads:[~2022-07-17  8:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-15 16:06 [PATCH v1 1/1] media: atomisp_gmin_platform: Switch to use acpi_evaluate_dsm_typed() Andy Shevchenko
2022-07-17  8:42 ` Sakari Ailus

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).