Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Svyatoslav Ryhel" <clamor95@gmail.com>
Cc: devicetree@vger.kernel.org, conor+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH v1 5/6] video: backlight: lm3533_bl: Set initial mapping mode from DT
Date: Sun, 17 May 2026 09:28:41 +0000	[thread overview]
Message-ID: <20260517092842.EB1FFC2BCB0@smtp.kernel.org> (raw)
In-Reply-To: <20260517074306.30937-6-clamor95@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The driver unconditionally clears the hardware linear mapping mode if the new DT property is absent, breaking existing configurations.
- [High] The `linear` sysfs attribute is exposed to userspace before hardware initialization completes, allowing userspace configurations to be silently discarded.
--

commit cebf8bbd6f9d389030ebbf6dbf1725031e2f46a7
Author: Svyatoslav Ryhel <clamor95@gmail.com>

video: backlight: lm3533_bl: Set initial mapping mode from DT

This commit adds support to configure the initial backlight mapping mode
(linear or exponential) from the device tree instead of leaving it
unconfigured. It also updates the linear sysfs attribute handling to use
similar patterns.

> diff --git a/drivers/video/backlight/lm3533_bl.c b/drivers/video/backlight/lm3533_bl.c
> index 42da652df58d9..be9114b7e0ad7 100644
> --- a/drivers/video/backlight/lm3533_bl.c
> +++ b/drivers/video/backlight/lm3533_bl.c

[ ... ]

> @@ -253,8 +247,15 @@ static struct attribute_group lm3533_bl_attribute_group = {
>  
>  static int lm3533_bl_setup(struct lm3533_bl *bl)
>  {
> +	int id = lm3533_bl_get_ctrlbank_id(bl);
>  	int ret;
>  
> +	ret = lm3533_update(bl->lm3533, LM3533_REG_CTRLBANK_AB_BCONF,
> +			    bl->linear ? CTRLBANK_AB_BCONF_MODE(id) : 0,
> +			    CTRLBANK_AB_BCONF_MODE(id));

Could this break existing hardware configurations where the DT property is
absent but the bootloader already configured linear mode?

Previously, this register was left unconfigured. Because
device_property_read_bool() returns false when the property is missing, this
unconditionally forces the mapping mode to exponential (0), silently reverting
any existing setups lacking the new ti,linear-mapping-mode property.

[ ... ]

> @@ -333,6 +334,9 @@ static int lm3533_bl_probe(struct platform_device *pdev)
>  	bl->pwm = 0;
>  	device_property_read_u32(&pdev->dev, "ti,pwm-config-mask", &bl->pwm);
>  
> +	bl->linear = device_property_read_bool(&pdev->dev,
> +					       "ti,linear-mapping-mode");
> +
>  	ret = lm3533_bl_setup(bl);

Does this sequence silently discard userspace configuration?

Earlier in lm3533_bl_probe(), sysfs_create_group() creates the linear sysfs
attribute before we read the device properties and call lm3533_bl_setup().

If a udev rule writes to the linear attribute, it will update the hardware
register via store_linear(), but the setup function here will subsequently
overwrite the register with the bl->linear value cached from DT, discarding
the userspace setting.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260517074306.30937-1-clamor95@gmail.com?part=5

  reply	other threads:[~2026-05-17  9:28 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-17  7:43 [PATCH v1 0/6] mfd: lm3533: convert to OF bindings, improve support Svyatoslav Ryhel
2026-05-17  7:43 ` [PATCH v1 1/6] dt-bindings: leds: Document TI LM3533 LED controller Svyatoslav Ryhel
2026-05-17  7:58   ` sashiko-bot
2026-05-17 13:44   ` Jonathan Cameron
2026-05-17 14:26     ` Svyatoslav Ryhel
2026-05-17  7:43 ` [PATCH v1 2/6] mfd: lm3533: Convert to use OF bindings Svyatoslav Ryhel
2026-05-17  7:55   ` Andy Shevchenko
2026-05-17 10:11     ` Svyatoslav Ryhel
2026-05-17  8:32   ` sashiko-bot
2026-05-17 11:10   ` Svyatoslav Ryhel
2026-05-17  7:43 ` [PATCH v1 3/6] mfd: lm3533: Add support for VIN power supply Svyatoslav Ryhel
2026-05-17  8:47   ` sashiko-bot
2026-05-17  7:43 ` [PATCH v1 4/6] mfd: lm3533: set DMA mask Svyatoslav Ryhel
2026-05-17  9:09   ` sashiko-bot
2026-05-17  7:43 ` [PATCH v1 5/6] video: backlight: lm3533_bl: Set initial mapping mode from DT Svyatoslav Ryhel
2026-05-17  9:28   ` sashiko-bot [this message]
2026-05-17  7:43 ` [PATCH v1 6/6] video: leds: backlight: lm3533: Support getting LED sources " Svyatoslav Ryhel
2026-05-17  9:45   ` sashiko-bot
2026-05-17  7:59 ` [PATCH v1 0/6] mfd: lm3533: convert to OF bindings, improve support Andy Shevchenko
2026-05-17 10:13   ` Svyatoslav Ryhel
2026-05-17 10:20     ` Andy Shevchenko
2026-05-17 10:34       ` Svyatoslav Ryhel
2026-05-17 10:40         ` Andy Shevchenko
2026-05-17 10:44           ` Svyatoslav Ryhel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260517092842.EB1FFC2BCB0@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=clamor95@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox