linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Hans de Goede <hdegoede@redhat.com>
Cc: "Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Len Brown <lenb@kernel.org>, Lee Jones <lee.jones@linaro.org>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] ACPI / PMIC: Do not register handlers for unhandled OpRegions
Date: Fri, 25 Oct 2019 10:42:20 +0300	[thread overview]
Message-ID: <20191025074220.GY32742@smile.fi.intel.com> (raw)
In-Reply-To: <20191024213827.144974-2-hdegoede@redhat.com>

On Thu, Oct 24, 2019 at 11:38:24PM +0200, Hans de Goede wrote:
> For some model PMIC's used on Intel boards we do not know how to
> handle the power or thermal opregions because we have no documentation.
> 
> For example in the intel_pmic_chtwc.c driver thermal_table_count is 0,
> which means that our PMIC_THERMAL_OPREGION_ID handler will always fail
> with AE_BAD_PARAMETER, in this case it is better to simply not register
> the handler at all.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/acpi/pmic/intel_pmic.c | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/acpi/pmic/intel_pmic.c b/drivers/acpi/pmic/intel_pmic.c
> index 452041398b34..a371f273f99d 100644
> --- a/drivers/acpi/pmic/intel_pmic.c
> +++ b/drivers/acpi/pmic/intel_pmic.c
> @@ -252,7 +252,7 @@ int intel_pmic_install_opregion_handler(struct device *dev, acpi_handle handle,
>  					struct regmap *regmap,
>  					struct intel_pmic_opregion_data *d)
>  {
> -	acpi_status status;
> +	acpi_status status = AE_OK;
>  	struct intel_pmic_opregion *opregion;
>  	int ret;
>  
> @@ -270,7 +270,8 @@ int intel_pmic_install_opregion_handler(struct device *dev, acpi_handle handle,
>  	opregion->regmap = regmap;
>  	opregion->lpat_table = acpi_lpat_get_conversion_table(handle);
>  
> -	status = acpi_install_address_space_handler(handle,
> +	if (d->power_table_count)
> +		status = acpi_install_address_space_handler(handle,
>  						    PMIC_POWER_OPREGION_ID,
>  						    intel_pmic_power_handler,
>  						    NULL, opregion);
> @@ -279,7 +280,8 @@ int intel_pmic_install_opregion_handler(struct device *dev, acpi_handle handle,
>  		goto out_error;
>  	}
>  
> -	status = acpi_install_address_space_handler(handle,
> +	if (d->thermal_table_count)
> +		status = acpi_install_address_space_handler(handle,
>  						    PMIC_THERMAL_OPREGION_ID,
>  						    intel_pmic_thermal_handler,
>  						    NULL, opregion);
> @@ -301,12 +303,16 @@ int intel_pmic_install_opregion_handler(struct device *dev, acpi_handle handle,
>  	return 0;
>  
>  out_remove_thermal_handler:
> -	acpi_remove_address_space_handler(handle, PMIC_THERMAL_OPREGION_ID,
> -					  intel_pmic_thermal_handler);
> +	if (d->thermal_table_count)
> +		acpi_remove_address_space_handler(handle,
> +						  PMIC_THERMAL_OPREGION_ID,
> +						  intel_pmic_thermal_handler);
>  
>  out_remove_power_handler:
> -	acpi_remove_address_space_handler(handle, PMIC_POWER_OPREGION_ID,
> -					  intel_pmic_power_handler);
> +	if (d->power_table_count)
> +		acpi_remove_address_space_handler(handle,
> +						  PMIC_POWER_OPREGION_ID,
> +						  intel_pmic_power_handler);
>  
>  out_error:
>  	acpi_lpat_free_conversion_table(opregion->lpat_table);
> -- 
> 2.23.0
> 

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2019-10-25  7:42 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-24 21:38 [PATCH 1/4] ACPI / PMIC: Add partial support for Cherry Trail Crystal Cove PMIC Hans de Goede
2019-10-24 21:38 ` [PATCH 1/4] ACPI / PMIC: Do not register handlers for unhandled OpRegions Hans de Goede
2019-10-25  7:42   ` Andy Shevchenko [this message]
2019-10-24 21:38 ` [PATCH 2/4] ACPI / PMIC: Add byt prefix to Crystal Cove PMIC OpRegion driver Hans de Goede
2019-10-25  7:41   ` Andy Shevchenko
2019-10-25  7:48     ` Andy Shevchenko
2019-10-25  8:59     ` Hans de Goede
2019-10-25  9:33       ` Andy Shevchenko
2019-10-25  9:49         ` Rafael J. Wysocki
2019-10-24 21:38 ` [PATCH 3/4] ACPI / PMIC: Add Cherry Trail " Hans de Goede
2019-10-25  7:45   ` Andy Shevchenko
2019-10-25  9:06     ` Hans de Goede
2019-10-25  9:34       ` Andy Shevchenko
2019-10-24 21:38 ` [PATCH 4/4] mfd: intel_soc_pmic_crc: Add "cht_crystal_cove_pmic" cell to CHT cells Hans de Goede
2019-10-25  7:47   ` Andy Shevchenko
2019-11-01  9:01   ` Lee Jones
2019-11-05 23:11     ` Rafael J. Wysocki

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=20191025074220.GY32742@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=lee.jones@linaro.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=rjw@rjwysocki.net \
    /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;
as well as URLs for NNTP newsgroup(s).