diff mbox series

[v3] ACPI: PM: Use max() for clearer D3 state selection in acpi_dev_pm_get_state

Message ID 20240716143839.584288-1-prabhakar.pujeri@gmail.com (mailing list archive)
State Changes Requested, archived
Headers show
Series [v3] ACPI: PM: Use max() for clearer D3 state selection in acpi_dev_pm_get_state | expand

Commit Message

Prabhakar Pujeri July 16, 2024, 2:38 p.m. UTC
Signed-off-by: Prabhakar Pujeri <prabhakar.pujeri@gmail.com>
---
 drivers/acpi/device_pm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Rafael J. Wysocki July 17, 2024, 11:55 a.m. UTC | #1
On Tue, Jul 16, 2024 at 4:44 PM Prabhakar Pujeri
<prabhakar.pujeri@gmail.com> wrote:
>
> Signed-off-by: Prabhakar Pujeri <prabhakar.pujeri@gmail.com>
> ---
>  drivers/acpi/device_pm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
> index 3b4d048c4941..81fc266ef18a 100644
> --- a/drivers/acpi/device_pm.c
> +++ b/drivers/acpi/device_pm.c
> @@ -760,7 +760,7 @@ static int acpi_dev_pm_get_state(struct device *dev, struct acpi_device *adev,
>                         if (!adev->power.states[ret].flags.valid)
>                                 ret = ACPI_STATE_D3_COLD;
>
> -                       d_max = ret > d_min ? ret : d_min;
> +                       d_max = max_t(ret, d_min);

Does this compile?

>                 } else {
>                         return -ENODATA;
>                 }
> --
> 2.45.2
>
>
diff mbox series

Patch

diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
index 3b4d048c4941..81fc266ef18a 100644
--- a/drivers/acpi/device_pm.c
+++ b/drivers/acpi/device_pm.c
@@ -760,7 +760,7 @@  static int acpi_dev_pm_get_state(struct device *dev, struct acpi_device *adev,
 			if (!adev->power.states[ret].flags.valid)
 				ret = ACPI_STATE_D3_COLD;
 
-			d_max = ret > d_min ? ret : d_min;
+			d_max = max_t(ret, d_min);
 		} else {
 			return -ENODATA;
 		}