From nobody Sun Jun 14 17:39:21 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF188359A6B for ; Sat, 4 Apr 2026 07:55:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775289348; cv=none; b=tLR1zad93PlJMBHYy2TZZyaRJHEjdS+Bx2lN0z0tgXmsDV7uHrYhUXmYB0vQqzVgu3JgTLDBMJ+gcBjaWM2TFl5V1YneM3m4uQ8We5q+xyZFeTQ55i9nGt2OAMVyy3M99VzRqv9k5KRE5tf7lqI87oqEKxH608dt7y92tkyUXgg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775289348; c=relaxed/simple; bh=AbGlFa4wXzsFnpZYHBfLP4haUwPJLNbaUTgd9sVhUyU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=om/XTuLzsYkvr3RtTjuUv8lCMe8rRfZY7WjwdFkw70mQIbiQ0UmT3Bb53ker5AAEFRMSlD8xiLlyNdbtji33Dq44yvPpcyqftP66bzGQ2LsdCHgMhsv1U/vkhlTryic8pMMK8Y63aIw3D47Gvd7ZpeFErFucyQrZ6Gs3YzRJTM8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=V9k5F3Nz; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="V9k5F3Nz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1775289337; bh=AbGlFa4wXzsFnpZYHBfLP4haUwPJLNbaUTgd9sVhUyU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=V9k5F3NzeU2XdFRA5uKdxspEIvstsvVWzCQzpXdpmAgBRKap9Q33RWZBYWx+2sr5U a1YpJUnA1bvxPRX9QUjTlV4gzGQ7rPhRcMAW2nFGDgBCJfIYQOnlZjUrM4jDN6i+NI TuXEUomDWaLLRRKGUXXUanlk+jXDouxIhPnZ/msQ= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sat, 04 Apr 2026 09:55:26 +0200 Subject: [PATCH 1/5] platform/chrome: cros_kbd_led_backlight: Drop max_brightness from driver data Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260404-cros_kbd_led-cleanup-v1-1-0dc1100d54e3@weissschuh.net> References: <20260404-cros_kbd_led-cleanup-v1-0-0dc1100d54e3@weissschuh.net> In-Reply-To: <20260404-cros_kbd_led-cleanup-v1-0-0dc1100d54e3@weissschuh.net> To: Benson Leung , Tzung-Bi Shih , Lee Jones , Guenter Roeck Cc: chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.15.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1775289335; l=2517; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=AbGlFa4wXzsFnpZYHBfLP4haUwPJLNbaUTgd9sVhUyU=; b=ovIteRo5FQ4RmBYxymkdo3kKx/57iZjO5BH/YHiFey8qm6mAqY8ttd3y/EC3wNzHZXkkZow89 tS7jIShuSlUB6l3SqA5W9aD2s5rjuv97czjzR5d0hMeUAWJpXnrJMLh X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= The maximum brightness is always 100. There is no need to read that from the driver data. Remove the superfluous driver data. Signed-off-by: Thomas Wei=C3=9Fschuh --- drivers/platform/chrome/cros_kbd_led_backlight.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/platform/chrome/cros_kbd_led_backlight.c b/drivers/pla= tform/chrome/cros_kbd_led_backlight.c index f4c2282129f5..39e98e4b9ce6 100644 --- a/drivers/platform/chrome/cros_kbd_led_backlight.c +++ b/drivers/platform/chrome/cros_kbd_led_backlight.c @@ -32,7 +32,6 @@ struct keyboard_led { * @brightness_set_blocking: Set LED brightness level. It can block the * caller for the time required for accessing a * LED device register - * @max_brightness: Maximum brightness. * * See struct led_classdev in include/linux/leds.h for more details. */ @@ -45,12 +44,8 @@ struct keyboard_led_drvdata { enum led_brightness brightness); int (*brightness_set_blocking)(struct led_classdev *led_cdev, enum led_brightness brightness); - - enum led_brightness max_brightness; }; =20 -#define KEYBOARD_BACKLIGHT_MAX 100 - #ifdef CONFIG_ACPI =20 /* Keyboard LED ACPI Device must be defined in firmware */ @@ -116,7 +111,6 @@ static const struct keyboard_led_drvdata keyboard_led_d= rvdata_acpi =3D { .init =3D keyboard_led_init_acpi, .brightness_set =3D keyboard_led_set_brightness_acpi, .brightness_get =3D keyboard_led_get_brightness_acpi, - .max_brightness =3D KEYBOARD_BACKLIGHT_MAX, }; =20 #endif /* CONFIG_ACPI */ @@ -175,7 +169,6 @@ static const struct keyboard_led_drvdata keyboard_led_d= rvdata_ec_pwm_mfd =3D { .init =3D keyboard_led_init_ec_pwm_mfd, .brightness_set_blocking =3D keyboard_led_set_brightness_ec_pwm, .brightness_get =3D keyboard_led_get_brightness_ec_pwm, - .max_brightness =3D KEYBOARD_BACKLIGHT_MAX, }; =20 #else /* IS_ENABLED(CONFIG_MFD_CROS_EC_DEV) */ @@ -215,7 +208,7 @@ static int keyboard_led_probe(struct platform_device *p= dev) =20 keyboard_led->cdev.name =3D "chromeos::kbd_backlight"; keyboard_led->cdev.flags |=3D LED_CORE_SUSPENDRESUME | LED_REJECT_NAME_CO= NFLICT; - keyboard_led->cdev.max_brightness =3D drvdata->max_brightness; + keyboard_led->cdev.max_brightness =3D 100; keyboard_led->cdev.brightness_set =3D drvdata->brightness_set; keyboard_led->cdev.brightness_set_blocking =3D drvdata->brightness_set_bl= ocking; keyboard_led->cdev.brightness_get =3D drvdata->brightness_get; --=20 2.53.0 From nobody Sun Jun 14 17:39:21 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5698C386C3F for ; Sat, 4 Apr 2026 07:55:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775289350; cv=none; b=D0k9eZLjghCoAzL89XjiHKQeBv0JsZDX12ua4YwoDH0YSL/KUJVTYmH1ZqSPkYJ6X0APzsd4k6EIBUwpVHRLT9c15muUujgCmz7XGjGRRWGKYqaZYk9cCFmFxw3rjVxzavxtnC+UXN4l/D1kvQhrImtIMu4oNdOz/mdqvADL7lI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775289350; c=relaxed/simple; bh=M2BPlkL1HI3MlCzRAC6tPaZUt+YgNNhQy7qqPZSLn0Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Psw+I7RdjUdkn7z73/gmZ/8j+JqyuNFJZpR7gm2DSUuM4bKv63HhT0hFfMqf+ASVFfm6oJlea1B/sz67vr0yMHZ3Vt22P95QTt0vGNWT7ZPeIXf0eHQxr+sKPM27UjpjnByaGik1h00o7/3/64BPJZ/ArqW0kPiTBUUcO4tiEio= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=X0561q8O; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="X0561q8O" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1775289337; bh=M2BPlkL1HI3MlCzRAC6tPaZUt+YgNNhQy7qqPZSLn0Y=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=X0561q8OVHjl0Cq8Hf6DcBjBdSJ11gBoG2BMiE/5BqjzPcvNSpuij4XLuMmfwCwU2 2KCy+6wPKyuWlXbFfQFvrAnefA+xIe5CLfscIblZ1xdia4bL3MKSuLtLjOKVJ4FCyX iX57l73zIGXNnwiMqbDc+uK1hrRu0V5GnTZi5jHo= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sat, 04 Apr 2026 09:55:27 +0200 Subject: [PATCH 2/5] platform/chrome: cros_kbd_led_backlight: Pass keyboard_led as parameter Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260404-cros_kbd_led-cleanup-v1-2-0dc1100d54e3@weissschuh.net> References: <20260404-cros_kbd_led-cleanup-v1-0-0dc1100d54e3@weissschuh.net> In-Reply-To: <20260404-cros_kbd_led-cleanup-v1-0-0dc1100d54e3@weissschuh.net> To: Benson Leung , Tzung-Bi Shih , Lee Jones , Guenter Roeck Cc: chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.15.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1775289335; l=2284; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=M2BPlkL1HI3MlCzRAC6tPaZUt+YgNNhQy7qqPZSLn0Y=; b=lwAVjAvPzvcf/QBsg5WfINFTbXCI761ToPcYbqS+RQj2BdqKron7mKf1NqtEZdOuqag6UzLkL HJskOSdNjf2AmiHMD00j5gNsiXpSqj0To1tYPznd6aTXTbhnBZ5nYkA X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Make the code simpler to read by passing the 'struct keyboard_led' as a parameter to the 'init' callbacks instead of relying on the platform device driver data. Signed-off-by: Thomas Wei=C3=9Fschuh --- drivers/platform/chrome/cros_kbd_led_backlight.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/platform/chrome/cros_kbd_led_backlight.c b/drivers/pla= tform/chrome/cros_kbd_led_backlight.c index 39e98e4b9ce6..cca1ed0e00bd 100644 --- a/drivers/platform/chrome/cros_kbd_led_backlight.c +++ b/drivers/platform/chrome/cros_kbd_led_backlight.c @@ -36,7 +36,7 @@ struct keyboard_led { * See struct led_classdev in include/linux/leds.h for more details. */ struct keyboard_led_drvdata { - int (*init)(struct platform_device *pdev); + int (*init)(struct platform_device *pdev, struct keyboard_led *keyboard_l= ed); =20 enum led_brightness (*brightness_get)(struct led_classdev *led_cdev); =20 @@ -89,7 +89,8 @@ keyboard_led_get_brightness_acpi(struct led_classdev *cde= v) return brightness; } =20 -static int keyboard_led_init_acpi(struct platform_device *pdev) +static int keyboard_led_init_acpi(struct platform_device *pdev, + struct keyboard_led *keyboard_led) { acpi_handle handle; acpi_status status; @@ -116,11 +117,11 @@ static const struct keyboard_led_drvdata keyboard_led= _drvdata_acpi =3D { #endif /* CONFIG_ACPI */ =20 #if IS_ENABLED(CONFIG_MFD_CROS_EC_DEV) -static int keyboard_led_init_ec_pwm_mfd(struct platform_device *pdev) +static int keyboard_led_init_ec_pwm_mfd(struct platform_device *pdev, + struct keyboard_led *keyboard_led) { struct cros_ec_dev *ec_dev =3D dev_get_drvdata(pdev->dev.parent); struct cros_ec_device *cros_ec =3D ec_dev->ec_dev; - struct keyboard_led *keyboard_led =3D platform_get_drvdata(pdev); =20 keyboard_led->ec =3D cros_ec; =20 @@ -198,10 +199,9 @@ static int keyboard_led_probe(struct platform_device *= pdev) keyboard_led =3D devm_kzalloc(&pdev->dev, sizeof(*keyboard_led), GFP_KERN= EL); if (!keyboard_led) return -ENOMEM; - platform_set_drvdata(pdev, keyboard_led); =20 if (drvdata->init) { - err =3D drvdata->init(pdev); + err =3D drvdata->init(pdev, keyboard_led); if (err) return err; } --=20 2.53.0 From nobody Sun Jun 14 17:39:21 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4789338CFF8 for ; Sat, 4 Apr 2026 07:55:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775289353; cv=none; b=r8i73cYX4+vP3hOFTzPjv+dVJcQzptsr4Com3uskLvOTdhMHDwlNK3ZSmAy3YUz3s3+7MW6vTIoK9wNKQ5bg5RjKo2W+En1X5rU7eCP+rh9I1z8HKKbMC+dx0uQzVlMZx0FnARg0iDF5h9vSyNbtIRg3GA48wnq2BlKFlKSVNtA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775289353; c=relaxed/simple; bh=rZMYkk6lPe8wYOaFW6xfLGDgUrO8Ua/S0/vkmCso82A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JyPBrFUSMCIAJWoORfKyicjpS2NTLkZxn6UYz4ubahfYKnkpAqKo79AWp1qhsb4S3LJVYNhSPNFKXQETDjZ9+wahO399aKMXy9ypWNCRl36y3HCghtxI9gx9vn6/Iz0niIRVNNn0OkBZiYjgCuFXOcYR18/hUeczg9iCPQezEBc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=nVxxYTIc; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="nVxxYTIc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1775289337; bh=rZMYkk6lPe8wYOaFW6xfLGDgUrO8Ua/S0/vkmCso82A=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=nVxxYTIcQmdkdsYGiot1R0NcLt1tVNydpPGvga9mpCnNMnI7U4C3fKZk2T4E3KhOf Q8J5/jFZ7mlOzWpEgqIZFCfoH7XypLXfu4RMnnyBfzrlytyeZXut1iu4Wstlu93tGF U0yKAs7/rUilr2u1foPmsPZ4Of/BmJagGcPGvHWE= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sat, 04 Apr 2026 09:55:28 +0200 Subject: [PATCH 3/5] platform/chrome: cros_kbd_led_backlight: Drop CONFIG_MFD_CROS_EC_DEV ifdeffery Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260404-cros_kbd_led-cleanup-v1-3-0dc1100d54e3@weissschuh.net> References: <20260404-cros_kbd_led-cleanup-v1-0-0dc1100d54e3@weissschuh.net> In-Reply-To: <20260404-cros_kbd_led-cleanup-v1-0-0dc1100d54e3@weissschuh.net> To: Benson Leung , Tzung-Bi Shih , Lee Jones , Guenter Roeck Cc: chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.15.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1775289335; l=1386; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=rZMYkk6lPe8wYOaFW6xfLGDgUrO8Ua/S0/vkmCso82A=; b=OBchiDxWEj41P+BNpyBm2FrBdlqWozRP5IuK4lgnS4xaUZOQVQ+3JSaOsuH2d84r0HJOwmQVX yT+p7aDhUcJCeYf2wEzZrrmsLfmqrxY3poC36Axz6JkzRfJMlwvFAuD X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= The ifdeffery is unnecessary, as the compiler can already optimize away all of the mfd-specific code based on the IS_ENABLED() in keyboard_led_is_mfd_device(). Signed-off-by: Thomas Wei=C3=9Fschuh --- drivers/platform/chrome/cros_kbd_led_backlight.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/platform/chrome/cros_kbd_led_backlight.c b/drivers/pla= tform/chrome/cros_kbd_led_backlight.c index cca1ed0e00bd..80dc52833dc9 100644 --- a/drivers/platform/chrome/cros_kbd_led_backlight.c +++ b/drivers/platform/chrome/cros_kbd_led_backlight.c @@ -116,7 +116,6 @@ static const struct keyboard_led_drvdata keyboard_led_d= rvdata_acpi =3D { =20 #endif /* CONFIG_ACPI */ =20 -#if IS_ENABLED(CONFIG_MFD_CROS_EC_DEV) static int keyboard_led_init_ec_pwm_mfd(struct platform_device *pdev, struct keyboard_led *keyboard_led) { @@ -172,12 +171,6 @@ static const struct keyboard_led_drvdata keyboard_led_= drvdata_ec_pwm_mfd =3D { .brightness_get =3D keyboard_led_get_brightness_ec_pwm, }; =20 -#else /* IS_ENABLED(CONFIG_MFD_CROS_EC_DEV) */ - -static const struct keyboard_led_drvdata keyboard_led_drvdata_ec_pwm_mfd = =3D {}; - -#endif /* IS_ENABLED(CONFIG_MFD_CROS_EC_DEV) */ - static int keyboard_led_is_mfd_device(struct platform_device *pdev) { return IS_ENABLED(CONFIG_MFD_CROS_EC_DEV) && mfd_get_cell(pdev); --=20 2.53.0 From nobody Sun Jun 14 17:39:21 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 272C838C42F for ; Sat, 4 Apr 2026 07:55:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775289354; cv=none; b=VPZL0Gt8Sn2pu4u4If2oH0xdiQkHpi6naBy8I+542SeY/0LNHMvrzs9X+1ihLMkUyRZbgH8A9ey2UH5s4PcSuqDTwe6yF7/eN8f/LL/NOvKLpW6KnsBD7vZhdvLzoqCY9W+9vn8SJTYZxjE2OFIk95ZD6Rcl50IlkGyXkCW527M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775289354; c=relaxed/simple; bh=tzXGR8ydX1rF/V86lNPqa+YFNyOTF+OTb9Rk9SsVNQU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pOMq0pCCK3HQFYeKQEtXnfL2Ru8rT09mcvuESkfelNl2F0qN0YbgE8gUvHUW4NUZvIwUC0gu5CBOFvmnHplgpdXTBVXwg2eHn8CP2jgoTbkMq/c+4v+cyb6/MXL5s/ccdg/sFVtuXW5Mw13pMUCCSwVF9baJGkNHEs9oKLK0RJE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=EjylFkP1; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="EjylFkP1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1775289337; bh=tzXGR8ydX1rF/V86lNPqa+YFNyOTF+OTb9Rk9SsVNQU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=EjylFkP17WcGOEGlMkOxteLQc6RraZsKH7vldp/F5Uq9ygnRt6YogEYJuatlE5WDL d8TgRiofHTiUDYu/yhL1b4bXcVMPfz6D/nYC/nVOrlVUg3aVCLggcv9SbAp0gyFU72 +DNbtmr+JFT+TEmgolAAZaCZQdp82OhGkjJoAPAA= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sat, 04 Apr 2026 09:55:29 +0200 Subject: [PATCH 4/5] mfd: cros_ec: Add a helper to retrieve the EC device from the MFD parent Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260404-cros_kbd_led-cleanup-v1-4-0dc1100d54e3@weissschuh.net> References: <20260404-cros_kbd_led-cleanup-v1-0-0dc1100d54e3@weissschuh.net> In-Reply-To: <20260404-cros_kbd_led-cleanup-v1-0-0dc1100d54e3@weissschuh.net> To: Benson Leung , Tzung-Bi Shih , Lee Jones , Guenter Roeck Cc: chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.15.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1775289335; l=1028; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=tzXGR8ydX1rF/V86lNPqa+YFNyOTF+OTb9Rk9SsVNQU=; b=Ozm+k9J+hzmooRvn2D65KhmzIwgfLS8U2ru/i7Xaco7EzrQ8FnI+SSnpEFZ7G+tnoQt3UiNJb Vnp9BFgyZOIClp/O7DyomHW7kVRMBXTu4zKps2pN/gy5cU02ETwqUyc X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= The 'struct cros_ec_dev' needs to be retrieved from the MFD parent device through a non-typesafe API. This logic is duplicated over all CrOS EC drivers and it is not obvious what is going on. Add a dedicated helper function which makes clear what is happening. Signed-off-by: Thomas Wei=C3=9Fschuh --- include/linux/mfd/cros_ec.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h new file mode 100644 index 000000000000..ea5b007accfc --- /dev/null +++ b/include/linux/mfd/cros_ec.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef __LINUX_MFD_CROS_EC_H +#define __LINUX_MFD_CROS_EC_H + +#include + +struct cros_ec_dev; +struct platform_device; + +static __always_inline struct cros_ec_dev *cros_ec_mfd_get_ec_dev(struct p= latform_device *pdev) +{ + return dev_get_drvdata(pdev->dev.parent); +} + +#endif /* __LINUX_MFD_CROS_EC_H */ --=20 2.53.0 From nobody Sun Jun 14 17:39:21 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F93F386565 for ; Sat, 4 Apr 2026 07:55:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775289360; cv=none; b=Bag4DKxIloXO0RUg+FWSCFz6YW1DUgBFT2sYXHpDcbjZUQwLtO/o3lSa+YBOugPcW6/7wX9awepGnpDst2MSEaXIARyZkjYc8o8BNzllhoj4A/vAZU+L0MhWKzJTt9mbHe19A1gVzfTVTKQtatlMpu8glyWpE/MJ68ob8IqiWpA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775289360; c=relaxed/simple; bh=jLcN/sgi7unGmJQao0t+kwBlJj+Ly6jJZJFfbLQhKRQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=W/35ObBApZ7jOVgiPbaO9IlUHx89YMenB989qrpZb+VDMhbK62o6bmatqy+clSaQ+Ld+SVCOSNkP7BsrYdpq0+uSUJZYHqGWDWnCNPYkwdzGcaqkOppWJ+9MOvYDyRvEinzRseBQr9m1++/fBnDoX/IBTeSRmtuNMiZGX+K9fv8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=KAlkjErO; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="KAlkjErO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1775289337; bh=jLcN/sgi7unGmJQao0t+kwBlJj+Ly6jJZJFfbLQhKRQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=KAlkjErO7dsaECt2CKFWXUgZlX0tio2c+sn/Iyt6FcaFOmprAS2NixveKctX0+B3/ TsuPgdrDtNTJEaRGFQSjxNUX/bWI5X7lKj0kNDcSHzxOUeUHFjmu24lB8bgdAhRJR2 qxoFYhPXIu/JmojPjUAEEDU1RA0Osv9BYRtUbu2g= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sat, 04 Apr 2026 09:55:30 +0200 Subject: [PATCH 5/5] platform/chrome: cros_kbd_led_backlight: Use cros_ec_mfd_get_ec_dev() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260404-cros_kbd_led-cleanup-v1-5-0dc1100d54e3@weissschuh.net> References: <20260404-cros_kbd_led-cleanup-v1-0-0dc1100d54e3@weissschuh.net> In-Reply-To: <20260404-cros_kbd_led-cleanup-v1-0-0dc1100d54e3@weissschuh.net> To: Benson Leung , Tzung-Bi Shih , Lee Jones , Guenter Roeck Cc: chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.15.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1775289335; l=1174; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=jLcN/sgi7unGmJQao0t+kwBlJj+Ly6jJZJFfbLQhKRQ=; b=ew9QQf8kbE/nk8/NDtY1Tpn8FzRqjQdzWYIZXL0wzUW0CxGvFfdy4EejajTVtOg2nLaRShTtA aNdk0+pjvbaA1I6/FwjR9YWEmVQINoqN0x0qCpsf2mNfeIlqEXzZq7D X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Use the new standard helper to make the code a bit easier to read. Signed-off-by: Thomas Wei=C3=9Fschuh --- drivers/platform/chrome/cros_kbd_led_backlight.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/platform/chrome/cros_kbd_led_backlight.c b/drivers/pla= tform/chrome/cros_kbd_led_backlight.c index 80dc52833dc9..f97dc4cf6bbb 100644 --- a/drivers/platform/chrome/cros_kbd_led_backlight.c +++ b/drivers/platform/chrome/cros_kbd_led_backlight.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -119,7 +120,7 @@ static const struct keyboard_led_drvdata keyboard_led_d= rvdata_acpi =3D { static int keyboard_led_init_ec_pwm_mfd(struct platform_device *pdev, struct keyboard_led *keyboard_led) { - struct cros_ec_dev *ec_dev =3D dev_get_drvdata(pdev->dev.parent); + struct cros_ec_dev *ec_dev =3D cros_ec_mfd_get_ec_dev(pdev); struct cros_ec_device *cros_ec =3D ec_dev->ec_dev; =20 keyboard_led->ec =3D cros_ec; --=20 2.53.0