Skip to contentSkip to conversation

PWM Backlight: Fix a bug which could cause the PWM backlight driver use the wrong PWM chip and fail the driver probing if multiple PWM chips exist. This defect could also cause the unintended PWM chip used and unaccessable by other drivers. The patch will check the error state first and allow a deferral PWM backlight probing if the intended PWM driver is not loaded at the probing moment.

PATCH In review ryang 3 participants 4 messages Sep 3, 2014 – Sep 4, 2014

Subsystems (3)
lore
Share & tools
lore

ryang

author
#0 lore raw

PATCH 1/1 PWM Backlight: Fix a bug which could cause the PWM backlight driver use the wrong PWM chip and fail the driver probing if multiple PWM chips exist. This defect could also cause the unintended PWM chip used and unaccessable by other drivers. The patch will check the error state first and allow a deferral PWM backlight probing if the intended PWM driver is not loaded at the probing moment.

---
 drivers/video/backlight/pwm_bl.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/video/backlight/pwm_bl.c +3 -0
index b85983e..e0014a5 100644
@@ -273,6 +273,9 @@ static int pwm_backlight_probe(struct platform_device *pdev)
 
 	pb->pwm = devm_pwm_get(&pdev->dev, NULL);
 	if (IS_ERR(pb->pwm)) {
+		ret = PTR_ERR(pb->pwm);
+		if (ret == -EPROBE_DEFER)
+			goto err_alloc;
 		dev_err(&pdev->dev, "unable to request PWM, trying legacy API\n");
 
 		pb->pwm = pwm_request(data->pwm_id, "pwm-backlight");
Signature · 1 line
1.9.1
#1 lore raw

I'm guessing this is your first patch.

Please read: Documentation/SubmittingPatches

A few notes for you search for and read about in the above document.

- Subject line formatting (short, succinct)
- Commit logs (present, descriptive [what changed and why], succinct)
- Authorship (full/real names only)

Quoted 19 lines
---
 drivers/video/backlight/pwm_bl.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/video/backlight/pwm_bl.c +3 -0
index b85983e..e0014a5 100644
@@ -273,6 +273,9 @@ static int pwm_backlight_probe(struct platform_device *pdev)
 
 	pb->pwm = devm_pwm_get(&pdev->dev, NULL);
 	if (IS_ERR(pb->pwm)) {
+		ret = PTR_ERR(pb->pwm);
+		if (ret == -EPROBE_DEFER)
+			goto err_alloc;
 		dev_err(&pdev->dev, "unable to request PWM, trying legacy API\n");
 
 		pb->pwm = pwm_request(data->pwm_id, "pwm-backlight");
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#2 lore raw
Quoted 9 lines

I'm guessing this is your first patch.

Please read: Documentation/SubmittingPatches

A few notes for you search for and read about in the above document.

- Subject line formatting (short, succinct)
- Commit logs (present, descriptive [what changed and why], succinct)
- Authorship (full/real names only)

You also need to CC [email protected] on all patches.

Quoted 20 lines
Quoted 19 lines
---
 drivers/video/backlight/pwm_bl.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/video/backlight/pwm_bl.c +3 -0
index b85983e..e0014a5 100644
@@ -273,6 +273,9 @@ static int pwm_backlight_probe(struct platform_device *pdev)
 
 	pb->pwm = devm_pwm_get(&pdev->dev, NULL);
 	if (IS_ERR(pb->pwm)) {
+		ret = PTR_ERR(pb->pwm);
+		if (ret == -EPROBE_DEFER)
+			goto err_alloc;
 		dev_err(&pdev->dev, "unable to request PWM, trying legacy API\n");
 
 		pb->pwm = pwm_request(data->pwm_id, "pwm-backlight");
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#3 lore raw

RE: [PATCH 1/1] PWM Backlight: Fix a bug which could cause the PWM backlight driver use the wrong PWM chip and fail the driver probing if multiple PWM chips exist. This defect could also cause the unintended PWM chip used and unaccessable by other dri...

Hi Lee,
It is great to get your reply. No, this is a second one, actually it is a resend. This time I just followed Thierry's instruction using the git patch and send-mail commands.

Robert

-----Original Message-----
From: Lee Jones [mailto:[email protected]]
Sent: Thursday, September 04, 2014 2:40 AM
To: ryang
Cc: [email protected]; [email protected]; [email protected]; Yang, Robert; [email protected]
Subject: Re: [PATCH 1/1] PWM Backlight: Fix a bug which could cause the PWM backlight driver use the wrong PWM chip and fail the driver probing if multiple PWM chips exist. This defect could also cause the unintended PWM chip used and unaccessable by other dri...

Quoted 9 lines

I'm guessing this is your first patch.

Please read: Documentation/SubmittingPatches

A few notes for you search for and read about in the above document.

- Subject line formatting (short, succinct)
- Commit logs (present, descriptive [what changed and why], succinct)
- Authorship (full/real names only)

You also need to CC [email protected] on all patches.

Quoted 21 lines
Quoted 21 lines
---
 drivers/video/backlight/pwm_bl.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/video/backlight/pwm_bl.c +3 -0
index b85983e..e0014a5 100644
@@ -273,6 +273,9 @@ static int pwm_backlight_probe(struct
 platform_device *pdev)
 
    pb->pwm = devm_pwm_get(&pdev->dev, NULL);
    if (IS_ERR(pb->pwm)) {
+           ret = PTR_ERR(pb->pwm);
+           if (ret == -EPROBE_DEFER)
+                   goto err_alloc;
            dev_err(&pdev->dev, "unable to request PWM, trying legacy
 API\n");
Quoted 2 lines
Quoted 1 line
            pb->pwm = pwm_request(data->pwm_id, "pwm-backlight");

--
Lee Jones
Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Please be advised that this email may contain confidential information. If you are not the intended recipient, please notify us by email by replying to the sender and delete this message. The sender disclaims that the content of this email constitutes an offer to enter into, or the acceptance of, any agreement; provided that the foregoing does not invalidate the binding effect of any digital or other electronic reproduction of a manual signature that is included in any attachment.