mirror of
https://gitlab.steamos.cloud/holo/steamos-manager.git
synced 2025-07-12 09:22:26 -04:00
power: Don't clone config.battery_charge_limit
This commit is contained in:
parent
88cd9ecbe6
commit
0f2ace9940
1 changed files with 6 additions and 6 deletions
12
src/power.rs
12
src/power.rs
|
@ -422,10 +422,10 @@ pub(crate) async fn get_tdp_limit_range() -> Result<(u32, u32)> {
|
|||
}
|
||||
|
||||
pub(crate) async fn get_max_charge_level() -> Result<i32> {
|
||||
let config = platform_config()
|
||||
.await?
|
||||
let config = platform_config().await?;
|
||||
let config = config
|
||||
.as_ref()
|
||||
.and_then(|config| config.battery_charge_limit.clone())
|
||||
.and_then(|config| config.battery_charge_limit.as_ref())
|
||||
.ok_or(anyhow!("No battery charge limit configured"))?;
|
||||
let base = find_hwmon(config.hwmon_name.as_str()).await?;
|
||||
|
||||
|
@ -440,10 +440,10 @@ pub(crate) async fn get_max_charge_level() -> Result<i32> {
|
|||
pub(crate) async fn set_max_charge_level(limit: i32) -> Result<()> {
|
||||
ensure!((0..=100).contains(&limit), "Invalid limit");
|
||||
let data = limit.to_string();
|
||||
let config = platform_config()
|
||||
.await?
|
||||
let config = platform_config().await?;
|
||||
let config = config
|
||||
.as_ref()
|
||||
.and_then(|config| config.battery_charge_limit.clone())
|
||||
.and_then(|config| config.battery_charge_limit.as_ref())
|
||||
.ok_or(anyhow!("No battery charge limit configured"))?;
|
||||
let base = find_hwmon(config.hwmon_name.as_str()).await?;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue