2024-03-05 08:13:03

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH v2 0/7] backlight: Simplify probe in few drivers

Hi,

Simplify old code in few backlight drivers.

Changes in v2
=============
1. Patch #1: Drop "Error :" msg.
2. Add Rb tags.
Link to v1: https://lore.kernel.org/r/[email protected]

Best regards,
Krzysztof

---
Krzysztof Kozlowski (7):
backlight: gpio: Simplify with dev_err_probe()
backlight: l4f00242t03: Simplify with dev_err_probe()
backlight: bd6107: Handle deferred probe
backlight: as3711_bl: Handle deferred probe
backlight: lm3630a_bl: Handle deferred probe
backlight: lm3630a_bl: Simplify probe return on gpio request error
backlight: pandora_bl: Drop unneeded ENOMEM error message

drivers/video/backlight/as3711_bl.c | 6 ++----
drivers/video/backlight/bd6107.c | 9 +++------
drivers/video/backlight/gpio_backlight.c | 10 +++-------
drivers/video/backlight/l4f00242t03.c | 34 +++++++++++++-------------------
drivers/video/backlight/lm3630a_bl.c | 13 +++++-------
drivers/video/backlight/pandora_bl.c | 4 +---
6 files changed, 28 insertions(+), 48 deletions(-)
---
base-commit: 1870cdc0e8dee32e3c221704a2977898ba4c10e8
change-id: 20240304-backlight-probe-31dee1efe662

Best regards,
--
Krzysztof Kozlowski <[email protected]>



2024-03-05 08:13:05

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH v2 3/7] backlight: bd6107: Handle deferred probe

Don't pollute dmesg on deferred probe and simplify the code with
dev_err_probe().

Reviewed-by: Daniel Thompson <[email protected]>
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/video/backlight/bd6107.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/video/backlight/bd6107.c b/drivers/video/backlight/bd6107.c
index c95a12bf0ce2..b1e7126380ef 100644
--- a/drivers/video/backlight/bd6107.c
+++ b/drivers/video/backlight/bd6107.c
@@ -119,7 +119,6 @@ static int bd6107_probe(struct i2c_client *client)
struct backlight_device *backlight;
struct backlight_properties props;
struct bd6107 *bd;
- int ret;

if (pdata == NULL) {
dev_err(&client->dev, "No platform data\n");
@@ -147,11 +146,9 @@ static int bd6107_probe(struct i2c_client *client)
* the reset.
*/
bd->reset = devm_gpiod_get(&client->dev, "reset", GPIOD_OUT_HIGH);
- if (IS_ERR(bd->reset)) {
- dev_err(&client->dev, "unable to request reset GPIO\n");
- ret = PTR_ERR(bd->reset);
- return ret;
- }
+ if (IS_ERR(bd->reset))
+ return dev_err_probe(&client->dev, PTR_ERR(bd->reset),
+ "unable to request reset GPIO\n");

memset(&props, 0, sizeof(props));
props.type = BACKLIGHT_RAW;

--
2.34.1


2024-03-05 08:13:31

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH v2 4/7] backlight: as3711_bl: Handle deferred probe

Don't pollute dmesg on deferred probe and simplify the code with
dev_err_probe().

Reviewed-by: Daniel Thompson <[email protected]>
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/video/backlight/as3711_bl.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/video/backlight/as3711_bl.c b/drivers/video/backlight/as3711_bl.c
index 28437c2da0f5..e6f66bb35ef5 100644
--- a/drivers/video/backlight/as3711_bl.c
+++ b/drivers/video/backlight/as3711_bl.c
@@ -383,10 +383,8 @@ static int as3711_backlight_probe(struct platform_device *pdev)

if (pdev->dev.parent->of_node) {
ret = as3711_backlight_parse_dt(&pdev->dev);
- if (ret < 0) {
- dev_err(&pdev->dev, "DT parsing failed: %d\n", ret);
- return ret;
- }
+ if (ret < 0)
+ return dev_err_probe(&pdev->dev, ret, "DT parsing failed\n");
}

if (!pdata->su1_fb && !pdata->su2_fb) {

--
2.34.1


2024-03-05 08:15:36

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH v2 5/7] backlight: lm3630a_bl: Handle deferred probe

Don't pollute dmesg on deferred probe and simplify the code with
dev_err_probe().

Reviewed-by: Daniel Thompson <[email protected]>
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/video/backlight/lm3630a_bl.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/video/backlight/lm3630a_bl.c b/drivers/video/backlight/lm3630a_bl.c
index a3412c936ca2..93fd6dbccc28 100644
--- a/drivers/video/backlight/lm3630a_bl.c
+++ b/drivers/video/backlight/lm3630a_bl.c
@@ -563,10 +563,9 @@ static int lm3630a_probe(struct i2c_client *client)
/* pwm */
if (pdata->pwm_ctrl != LM3630A_PWM_DISABLE) {
pchip->pwmd = devm_pwm_get(pchip->dev, "lm3630a-pwm");
- if (IS_ERR(pchip->pwmd)) {
- dev_err(&client->dev, "fail : get pwm device\n");
- return PTR_ERR(pchip->pwmd);
- }
+ if (IS_ERR(pchip->pwmd))
+ return dev_err_probe(&client->dev, PTR_ERR(pchip->pwmd),
+ "fail : get pwm device\n");

pwm_init_state(pchip->pwmd, &pchip->pwmd_state);
}

--
2.34.1


2024-03-05 08:15:49

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH v2 6/7] backlight: lm3630a_bl: Simplify probe return on gpio request error

Code can be simpler: return directly when devm_gpiod_get_optional()
failed.

Reviewed-by: Daniel Thompson <[email protected]>
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/video/backlight/lm3630a_bl.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/video/backlight/lm3630a_bl.c b/drivers/video/backlight/lm3630a_bl.c
index 93fd6dbccc28..ac0a60e39e39 100644
--- a/drivers/video/backlight/lm3630a_bl.c
+++ b/drivers/video/backlight/lm3630a_bl.c
@@ -543,10 +543,8 @@ static int lm3630a_probe(struct i2c_client *client)

pchip->enable_gpio = devm_gpiod_get_optional(&client->dev, "enable",
GPIOD_OUT_HIGH);
- if (IS_ERR(pchip->enable_gpio)) {
- rval = PTR_ERR(pchip->enable_gpio);
- return rval;
- }
+ if (IS_ERR(pchip->enable_gpio))
+ return PTR_ERR(pchip->enable_gpio);

/* chip initialize */
rval = lm3630a_chip_init(pchip);

--
2.34.1


2024-03-05 08:15:59

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH v2 7/7] backlight: pandora_bl: Drop unneeded ENOMEM error message

Core code already prints detailed information about failure of memory
allocation.

Reviewed-by: Daniel Thompson <[email protected]>
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/video/backlight/pandora_bl.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/video/backlight/pandora_bl.c b/drivers/video/backlight/pandora_bl.c
index f946470ce9f6..51faa889e01f 100644
--- a/drivers/video/backlight/pandora_bl.c
+++ b/drivers/video/backlight/pandora_bl.c
@@ -114,10 +114,8 @@ static int pandora_backlight_probe(struct platform_device *pdev)
u8 r;

priv = devm_kmalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
- if (!priv) {
- dev_err(&pdev->dev, "failed to allocate driver private data\n");
+ if (!priv)
return -ENOMEM;
- }

memset(&props, 0, sizeof(props));
props.max_brightness = MAX_USER_VALUE;

--
2.34.1


2024-03-05 10:04:35

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH v2 0/7] backlight: Simplify probe in few drivers

On Tue, 05 Mar 2024 09:11:55 +0100, Krzysztof Kozlowski wrote:
> Simplify old code in few backlight drivers.
>
> Changes in v2
> =============
> 1. Patch #1: Drop "Error :" msg.
> 2. Add Rb tags.
> Link to v1: https://lore.kernel.org/r/[email protected]
>
> [...]

Applied, thanks!

[1/7] backlight: gpio: Simplify with dev_err_probe()
commit: 2f5929cd930b24a88d6fa73ab08ba857c59f7686
[2/7] backlight: l4f00242t03: Simplify with dev_err_probe()
commit: d3de24fc13465a4b45047d193f729b73e062a881
[3/7] backlight: bd6107: Handle deferred probe
commit: e00b57b4d4464071cb18d03cc8040e103c662d80
[4/7] backlight: as3711_bl: Handle deferred probe
commit: fd9f81bc3f48d5064bfd894eeb0202f5825ea4b1
[5/7] backlight: lm3630a_bl: Handle deferred probe
commit: c7fa2f12e74a437fc8c77b7780131b13acc2fa49
[6/7] backlight: lm3630a_bl: Simplify probe return on gpio request error
commit: dedd6eb26bbb37139d0a0122e4b4ad94f06edaa1
[7/7] backlight: pandora_bl: Drop unneeded ENOMEM error message
commit: 07dbc9e6e2433fe312423096efc037bf47298ed1

--
Lee Jones [李琼斯]