diff mbox

[v2,5/7] Input: pwm-beeper - suppress error message on probe defer

Message ID 20170119224057.9995-5-dmitry.torokhov@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dmitry Torokhov Jan. 19, 2017, 10:40 p.m. UTC
From: David Lechner <david@lechnology.com>

This suppress printing an error message when pwm_get returns -EPROBE_DEFER.
Otherwise you get a bunch of noise in the kernel log.

Signed-off-by: David Lechner <david@lechnology.com>
Patchwork-Id: 9499915
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/misc/pwm-beeper.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Thierry Reding Jan. 20, 2017, 10:16 a.m. UTC | #1
On Thu, Jan 19, 2017 at 02:40:55PM -0800, Dmitry Torokhov wrote:
> From: David Lechner <david@lechnology.com>
> 
> This suppress printing an error message when pwm_get returns -EPROBE_DEFER.
> Otherwise you get a bunch of noise in the kernel log.
> 
> Signed-off-by: David Lechner <david@lechnology.com>
> Patchwork-Id: 9499915
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
>  drivers/input/misc/pwm-beeper.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c
> index 04c8ad3827d9..9964c46468d3 100644
> --- a/drivers/input/misc/pwm-beeper.c
> +++ b/drivers/input/misc/pwm-beeper.c
> @@ -108,7 +108,8 @@ static int pwm_beeper_probe(struct platform_device *pdev)
>  	beeper->pwm = devm_pwm_get(dev, NULL);
>  	if (IS_ERR(beeper->pwm)) {
>  		error = PTR_ERR(beeper->pwm);
> -		dev_err(dev, "Failed to request pwm device: %d\n", error);
> +		if (error != -EPROBE_DEFER)
> +			dev_err(dev, "Failed to request pwm device\n");

This also drops the error code from the message. I suspect that this was
intentional because failure to probe will print out the error code
anyway. Might be worth mentioning that in the commit message?

Either way:

Reviewed-by: Thierry Reding <thierry.reding@gmail.com>
David Lechner Jan. 20, 2017, 6:43 p.m. UTC | #2
On 01/20/2017 04:16 AM, Thierry Reding wrote:
> On Thu, Jan 19, 2017 at 02:40:55PM -0800, Dmitry Torokhov wrote:
>> From: David Lechner <david@lechnology.com>
>>
>> This suppress printing an error message when pwm_get returns -EPROBE_DEFER.
>> Otherwise you get a bunch of noise in the kernel log.
>>
>> Signed-off-by: David Lechner <david@lechnology.com>
>> Patchwork-Id: 9499915
>> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
>> ---
>>  drivers/input/misc/pwm-beeper.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c
>> index 04c8ad3827d9..9964c46468d3 100644
>> --- a/drivers/input/misc/pwm-beeper.c
>> +++ b/drivers/input/misc/pwm-beeper.c
>> @@ -108,7 +108,8 @@ static int pwm_beeper_probe(struct platform_device *pdev)
>>  	beeper->pwm = devm_pwm_get(dev, NULL);
>>  	if (IS_ERR(beeper->pwm)) {
>>  		error = PTR_ERR(beeper->pwm);
>> -		dev_err(dev, "Failed to request pwm device: %d\n", error);
>> +		if (error != -EPROBE_DEFER)
>> +			dev_err(dev, "Failed to request pwm device\n");
>
> This also drops the error code from the message. I suspect that this was
> intentional because failure to probe will print out the error code
> anyway. Might be worth mentioning that in the commit message?

Yes, it was intentional for that reason. And in fact we could do the 
same thing to the error messages that are touched in patch 2/7 of this 
series.

>
> Either way:
>
> Reviewed-by: Thierry Reding <thierry.reding@gmail.com>
>

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c
index 04c8ad3827d9..9964c46468d3 100644
--- a/drivers/input/misc/pwm-beeper.c
+++ b/drivers/input/misc/pwm-beeper.c
@@ -108,7 +108,8 @@  static int pwm_beeper_probe(struct platform_device *pdev)
 	beeper->pwm = devm_pwm_get(dev, NULL);
 	if (IS_ERR(beeper->pwm)) {
 		error = PTR_ERR(beeper->pwm);
-		dev_err(dev, "Failed to request pwm device: %d\n", error);
+		if (error != -EPROBE_DEFER)
+			dev_err(dev, "Failed to request pwm device\n");
 		return error;
 	}