mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-02 20:36:47 +07:00
pwm_backlight: Validate dft_brightness in main probe function
Move the dft_brightness validity check from the DT parsing function to the main probe. In this way we can validate it in case we are booting with or without DT. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
This commit is contained in:
parent
928c44775b
commit
83cfd72669
@ -134,12 +134,6 @@ static int pwm_backlight_parse_dt(struct device *dev,
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (value >= data->max_brightness) {
|
||||
dev_warn(dev, "invalid default brightness level: %u, using %u\n",
|
||||
value, data->max_brightness - 1);
|
||||
value = data->max_brightness - 1;
|
||||
}
|
||||
|
||||
data->dft_brightness = value;
|
||||
data->max_brightness--;
|
||||
}
|
||||
@ -248,6 +242,13 @@ static int pwm_backlight_probe(struct platform_device *pdev)
|
||||
goto err_alloc;
|
||||
}
|
||||
|
||||
if (data->dft_brightness > data->max_brightness) {
|
||||
dev_warn(&pdev->dev,
|
||||
"invalid default brightness level: %u, using %u\n",
|
||||
data->dft_brightness, data->max_brightness);
|
||||
data->dft_brightness = data->max_brightness;
|
||||
}
|
||||
|
||||
bl->props.brightness = data->dft_brightness;
|
||||
backlight_update_status(bl);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user