Re: [PATCH] platform/chrome: cros_ec_lightbar: Check if ec supports suspend commands

From: Brady Norander

Date: Thu Oct 30 2025 - 09:23:47 EST


On 10/26/25 23:54, Tzung-Bi Shih wrote:
On Thu, Oct 23, 2025 at 07:42:40PM -0400, Brady Norander wrote:
@@ -550,7 +557,7 @@ static int cros_ec_lightbar_probe(struct platform_device *pd)
return -ENODEV;
/* Take control of the lightbar from the EC. */
- lb_manual_suspend_ctrl(ec_dev, 1);
+ has_manual_suspend = (lb_manual_suspend_ctrl(ec_dev, 1) >= 0);

The driver doesn't emit an error if lb_manual_suspend_ctrl() returns an
error in the first place. However, I think `has_manual_suspend` should
only check for -22. E.g.:

has_manual_suspend = lb_manual_suspend_ctrl(...) != -EINVAL;

Thanks for the review.
I originally decided to catch all errors to be on the safe side. After thinking about it some more, I agree that it should only check for
-EINVAL. Will send a v2.