lkml.org 
[lkml]   [2019]   [Nov]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v5 1/2] platform/x86 asus_wmi: Support throttle thermal policy
On Sun, Nov 24, 2019 at 4:07 PM Leonid Maksymchuk <leonmaxx@gmail.com> wrote:
>
> Throttle thermal policy ACPI device is used to control CPU cooling and

> throttling. This patch adds sysfs entry for setting current mode and
> Fn+F5 hotkey that switches to next.

sysfs means ABI. ABI must be documented.

> Policy modes:
> * 0x00 - default
> * 0x01 - overboost
> * 0x02 - silent

> +static int throttle_thermal_policy_check_present(struct asus_wmi *asus)
> +{
> + u32 result;
> + int err;
> +
> + asus->throttle_thermal_policy_available = false;
> +
> + err = asus_wmi_get_devstate(asus,
> + ASUS_WMI_DEVID_THROTTLE_THERMAL_POLICY,
> + &result);
> + if (err) {
> + if (err == -ENODEV)
> + return 0;

> + else

Redundant.

> + return err;
> + }
> +

> + if ((result & ASUS_WMI_DSTS_PRESENCE_BIT))

Too many parentheses.

> + asus->throttle_thermal_policy_available = true;
> +
> + return 0;
> +}

> + pr_info("Set throttle thermal policy: %u\n", value);

Do we really need this message?

> + return scnprintf(buf, PAGE_SIZE, "%d\n",
> + asus->throttle_thermal_policy_mode);

Can it be one line?

> + result = kstrtou8(buf, 10, &new_mode);
> + if (result < 0) {

> + pr_warn("Trying to store invalid value\n");

Redundant. By error code user space will get a message.

> + return result;
> + }



--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2019-11-25 12:13    [W:0.048 / U:0.536 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site