lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 25 Mar 2024 11:24:56 +0800
From: Tzung-Bi Shih <tzungbi@...nel.org>
To: Stephen Horvath <s.horvath@...look.com.au>
Cc: Lee Jones <lee@...nel.org>, Benson Leung <bleung@...omium.org>,
	Guenter Roeck <groeck@...omium.org>,
	chrome-platform@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] platform/chrome: cros_kbd_led_backlight:
 Automatically enable keyboard backlight control if feature present in EC

On Fri, Mar 22, 2024 at 08:27:58PM +1000, Stephen Horvath wrote:
> I also fixed a bug that seemed like there was some confusion between
> `cros_ec_dev` and `cros_ec_device`, so I'm not sure if this module even
> worked until now.

If they aren't part of commit message, please put them after "---".  Please
separate to an independent patch if they fix different things.

> diff --git a/drivers/platform/chrome/cros_kbd_led_backlight.c b/drivers/platform/chrome/cros_kbd_led_backlight.c
> index 793fd3f1015d..06e9a57536af 100644
> --- a/drivers/platform/chrome/cros_kbd_led_backlight.c
> +++ b/drivers/platform/chrome/cros_kbd_led_backlight.c
> @@ -171,12 +171,15 @@ static int keyboard_led_init_ec_pwm(struct platform_device *pdev)
>  {
>  	struct keyboard_led *keyboard_led = platform_get_drvdata(pdev);
>  
> -	keyboard_led->ec = dev_get_drvdata(pdev->dev.parent);
> -	if (!keyboard_led->ec) {
> +	struct cros_ec_dev *parent_ec = dev_get_drvdata(pdev->dev.parent);

I'm not sure if it really fixes anything.  See [1] or [2].

[1]: https://elixir.bootlin.com/linux/v6.8/source/drivers/platform/chrome/cros_ec_lpc.c#L417
[2]: https://elixir.bootlin.com/linux/v6.8/source/drivers/platform/chrome/cros_ec_spi.c#L759

> @@ -200,8 +203,10 @@ static int keyboard_led_probe(struct platform_device *pdev)
>  	int error;
>  
>  	drvdata = device_get_match_data(&pdev->dev);
> -	if (!drvdata)
> -		return -EINVAL;
> +	if (!drvdata) {
> +		/* Assume EC if no match data is provided */
> +		drvdata = &keyboard_led_drvdata_ec_pwm;
> +	}

By current design, the `drvdata` should be provided by either ACPI or OF match.

> @@ -236,22 +241,10 @@ static const struct acpi_device_id keyboard_led_acpi_match[] = {
>  MODULE_DEVICE_TABLE(acpi, keyboard_led_acpi_match);
>  #endif
>  
> -#ifdef CONFIG_OF
> -static const struct of_device_id keyboard_led_of_match[] = {
> -	{
> -		.compatible = "google,cros-kbd-led-backlight",
> -		.data = &keyboard_led_drvdata_ec_pwm,
> -	},
> -	{}
> -};
> -MODULE_DEVICE_TABLE(of, keyboard_led_of_match);
> -#endif
> -
>  static struct platform_driver keyboard_led_driver = {
>  	.driver		= {
>  		.name	= "chromeos-keyboard-leds",
>  		.acpi_match_table = ACPI_PTR(keyboard_led_acpi_match),
> -		.of_match_table = of_match_ptr(keyboard_led_of_match),

The patch is ruining the use cases in OF world (e.g. [3]).

[3]: https://elixir.bootlin.com/linux/v6.8/source/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi#L1154

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ