* [PATCH] usb: gadget: fsl: Fix a wrong judgment in fsl_udc_probe()
@ 2020-04-10 1:58 ` Tang Bin
0 siblings, 0 replies; 27+ messages in thread
From: Tang Bin @ 2020-04-10 1:58 UTC (permalink / raw)
To: leoyang.li, balbi, gregkh
Cc: Tang Bin, linux-usb, linux-kernel, Markus.Elfring, linuxppc-dev,
Shengju Zhang
If the function "platform_get_irq()" failed, the negative value
returned will not be detected here, including "-EPROBE_DEFER", which
causes the application to fail to get the correct error message.
Thus it must be fixed.
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
Signed-off-by: Shengju Zhang <zhangshengju@cmss.chinamobile.com>
---
drivers/usb/gadget/udc/fsl_udc_core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c
index ec6eda426..60853ad10 100644
--- a/drivers/usb/gadget/udc/fsl_udc_core.c
+++ b/drivers/usb/gadget/udc/fsl_udc_core.c
@@ -2441,8 +2441,8 @@ static int fsl_udc_probe(struct platform_device *pdev)
udc_controller->max_ep = (dccparams & DCCPARAMS_DEN_MASK) * 2;
udc_controller->irq = platform_get_irq(pdev, 0);
- if (!udc_controller->irq) {
- ret = -ENODEV;
+ if (udc_controller->irq <= 0) {
+ ret = udc_controller->irq ? : -ENODEV;
goto err_iounmap;
}
--
2.20.1.windows.1
^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH] usb: gadget: fsl: Fix a wrong judgment in fsl_udc_probe()
2020-04-10 1:58 ` Tang Bin
(?)
@ 2020-04-10 7:33 ` Markus Elfring
-1 siblings, 0 replies; 27+ messages in thread
From: Markus Elfring @ 2020-04-10 7:33 UTC (permalink / raw)
To: Tang Bin, Li Yang, Greg Kroah-Hartman, Felipe Balbi, linux-usb,
linuxppc-dev
Cc: linux-kernel, kernel-janitors, Shengju Zhang
> If the function "platform_get_irq()" failed, the negative value
> returned will not be detected here, including "-EPROBE_DEFER",
I suggest to adjust this change description.
Wording alternative:
The negative return value (which could eventually be “-EPROBE_DEFER”)
will not be detected here from a failed call of the function “platform_get_irq”.
> which causes the application to fail to get the correct error message.
Will another fine-tuning become relevant also for this wording?
> Thus it must be fixed.
Wording alternative:
Thus adjust the error detection and corresponding exception handling.
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
> Signed-off-by: Shengju Zhang <zhangshengju@cmss.chinamobile.com>
How do you think about to add the tags “Fixes”, “Link” and “Reported-by”?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=c0cc271173b2e1c2d8d0ceaef14e4dfa79eefc0d#n584
usb: gadget: fsl_udc_core: Checking for a failed platform_get_irq() call in fsl_udc_probe()
https://lore.kernel.org/linux-usb/36341bb1-1e00-5eb1-d032-60dcc614ddaf@web.de/
https://lkml.org/lkml/2020/4/8/442
…
> +++ b/drivers/usb/gadget/udc/fsl_udc_core.c
> @@ -2441,8 +2441,8 @@ static int fsl_udc_probe(struct platform_device *pdev)
> udc_controller->max_ep = (dccparams & DCCPARAMS_DEN_MASK) * 2;
>
> udc_controller->irq = platform_get_irq(pdev, 0);
> - if (!udc_controller->irq) {
> - ret = -ENODEV;
> + if (udc_controller->irq <= 0) {
Will such a failure predicate need any more clarification?
How does this check fit to the current software documentation?
> + ret = udc_controller->irq ? : -ENODEV;
Will it be clearer to specify values for all cases in such a conditional operator
(instead of leaving one case empty)?
Regards,
Markus
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] usb: gadget: fsl: Fix a wrong judgment in fsl_udc_probe()
@ 2020-04-10 7:33 ` Markus Elfring
0 siblings, 0 replies; 27+ messages in thread
From: Markus Elfring @ 2020-04-10 7:33 UTC (permalink / raw)
To: Tang Bin, Li Yang, Greg Kroah-Hartman, Felipe Balbi, linux-usb,
linuxppc-dev
Cc: kernel-janitors, linux-kernel, Shengju Zhang
> If the function "platform_get_irq()" failed, the negative value
> returned will not be detected here, including "-EPROBE_DEFER",
I suggest to adjust this change description.
Wording alternative:
The negative return value (which could eventually be “-EPROBE_DEFER”)
will not be detected here from a failed call of the function “platform_get_irq”.
> which causes the application to fail to get the correct error message.
Will another fine-tuning become relevant also for this wording?
> Thus it must be fixed.
Wording alternative:
Thus adjust the error detection and corresponding exception handling.
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
> Signed-off-by: Shengju Zhang <zhangshengju@cmss.chinamobile.com>
How do you think about to add the tags “Fixes”, “Link” and “Reported-by”?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=c0cc271173b2e1c2d8d0ceaef14e4dfa79eefc0d#n584
usb: gadget: fsl_udc_core: Checking for a failed platform_get_irq() call in fsl_udc_probe()
https://lore.kernel.org/linux-usb/36341bb1-1e00-5eb1-d032-60dcc614ddaf@web.de/
https://lkml.org/lkml/2020/4/8/442
…
> +++ b/drivers/usb/gadget/udc/fsl_udc_core.c
> @@ -2441,8 +2441,8 @@ static int fsl_udc_probe(struct platform_device *pdev)
> udc_controller->max_ep = (dccparams & DCCPARAMS_DEN_MASK) * 2;
>
> udc_controller->irq = platform_get_irq(pdev, 0);
> - if (!udc_controller->irq) {
> - ret = -ENODEV;
> + if (udc_controller->irq <= 0) {
Will such a failure predicate need any more clarification?
How does this check fit to the current software documentation?
> + ret = udc_controller->irq ? : -ENODEV;
Will it be clearer to specify values for all cases in such a conditional operator
(instead of leaving one case empty)?
Regards,
Markus
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] usb: gadget: fsl: Fix a wrong judgment in fsl_udc_probe()
@ 2020-04-10 7:33 ` Markus Elfring
0 siblings, 0 replies; 27+ messages in thread
From: Markus Elfring @ 2020-04-10 7:33 UTC (permalink / raw)
To: Tang Bin, Li Yang, Greg Kroah-Hartman, Felipe Balbi, linux-usb,
linuxppc-dev
Cc: linux-kernel, kernel-janitors, Shengju Zhang
> If the function "platform_get_irq()" failed, the negative value
> returned will not be detected here, including "-EPROBE_DEFER",
I suggest to adjust this change description.
Wording alternative:
The negative return value (which could eventually be “-EPROBE_DEFER”)
will not be detected here from a failed call of the function “platform_get_irq”.
> which causes the application to fail to get the correct error message.
Will another fine-tuning become relevant also for this wording?
> Thus it must be fixed.
Wording alternative:
Thus adjust the error detection and corresponding exception handling.
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
> Signed-off-by: Shengju Zhang <zhangshengju@cmss.chinamobile.com>
How do you think about to add the tags “Fixes”, “Link” and “Reported-by”?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=c0cc271173b2e1c2d8d0ceaef14e4dfa79eefc0d#n584
usb: gadget: fsl_udc_core: Checking for a failed platform_get_irq() call in fsl_udc_probe()
https://lore.kernel.org/linux-usb/36341bb1-1e00-5eb1-d032-60dcc614ddaf@web.de/
https://lkml.org/lkml/2020/4/8/442
…
> +++ b/drivers/usb/gadget/udc/fsl_udc_core.c
> @@ -2441,8 +2441,8 @@ static int fsl_udc_probe(struct platform_device *pdev)
> udc_controller->max_ep = (dccparams & DCCPARAMS_DEN_MASK) * 2;
>
> udc_controller->irq = platform_get_irq(pdev, 0);
> - if (!udc_controller->irq) {
> - ret = -ENODEV;
> + if (udc_controller->irq <= 0) {
Will such a failure predicate need any more clarification?
How does this check fit to the current software documentation?
> + ret = udc_controller->irq ? : -ENODEV;
Will it be clearer to specify values for all cases in such a conditional operator
(instead of leaving one case empty)?
Regards,
Markus
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] usb: gadget: fsl: Fix a wrong judgment in fsl_udc_probe()
2020-04-10 7:33 ` Markus Elfring
(?)
@ 2020-04-10 8:05 ` Tang Bin
-1 siblings, 0 replies; 27+ messages in thread
From: Tang Bin @ 2020-04-10 8:05 UTC (permalink / raw)
To: Markus Elfring
Cc: Li Yang, Greg Kroah-Hartman, Felipe Balbi, linux-usb,
linuxppc-dev, linux-kernel, kernel-janitors
Hi Markus
On 2020/4/10 15:33, Markus Elfring wrote:
>> If the function "platform_get_irq()" failed, the negative value
>> returned will not be detected here, including "-EPROBE_DEFER",
> I suggest to adjust this change description.
>
> Wording alternative:
> The negative return value (which could eventually be “-EPROBE_DEFER”)
> will not be detected here from a failed call of the function “platform_get_irq”.
Hardware experiments show that the negative return value is not just
"-EPROBE_DEFER".
>
>> which causes the application to fail to get the correct error message.
> Will another fine-tuning become relevant also for this wording?
Maybe that's not quite accurate.
>
>
>> Thus it must be fixed.
> Wording alternative:
> Thus adjust the error detection and corresponding exception handling.
Got it.
>
>
>> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
>> Signed-off-by: Shengju Zhang <zhangshengju@cmss.chinamobile.com>
> How do you think about to add the tags “Fixes”, “Link” and “Reported-by”?
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=c0cc271173b2e1c2d8d0ceaef14e4dfa79eefc0d#n584
>
> usb: gadget: fsl_udc_core: Checking for a failed platform_get_irq() call in fsl_udc_probe()
> https://lore.kernel.org/linux-usb/36341bb1-1e00-5eb1-d032-60dcc614ddaf@web.de/
> https://lkml.org/lkml/2020/4/8/442
>
> …
>> +++ b/drivers/usb/gadget/udc/fsl_udc_core.c
>> @@ -2441,8 +2441,8 @@ static int fsl_udc_probe(struct platform_device *pdev)
>> udc_controller->max_ep = (dccparams & DCCPARAMS_DEN_MASK) * 2;
>>
>> udc_controller->irq = platform_get_irq(pdev, 0);
>> - if (!udc_controller->irq) {
>> - ret = -ENODEV;
>> + if (udc_controller->irq <= 0) {
> Will such a failure predicate need any more clarification?
>
> How does this check fit to the current software documentation?
Maybe my tags are not suitable.
>
>
>> + ret = udc_controller->irq ? : -ENODEV;
> Will it be clearer to specify values for all cases in such a conditional operator
> (instead of leaving one case empty)?
I don't know what you mean of "instead of leaving one case empty". But
by experiment, "ret = udc_controller->irq ? : -ENODEV" or "ret =
udc_controller->irq < 0 ? udc_controller->irq : -ENODEV" should be
suitable here.
Thank you for your guidance.
Tang Bin
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] usb: gadget: fsl: Fix a wrong judgment in fsl_udc_probe()
@ 2020-04-10 8:05 ` Tang Bin
0 siblings, 0 replies; 27+ messages in thread
From: Tang Bin @ 2020-04-10 8:05 UTC (permalink / raw)
To: Markus Elfring
Cc: Felipe Balbi, Greg Kroah-Hartman, linux-usb, kernel-janitors,
linux-kernel, Li Yang, linuxppc-dev
Hi Markus
On 2020/4/10 15:33, Markus Elfring wrote:
>> If the function "platform_get_irq()" failed, the negative value
>> returned will not be detected here, including "-EPROBE_DEFER",
> I suggest to adjust this change description.
>
> Wording alternative:
> The negative return value (which could eventually be “-EPROBE_DEFER”)
> will not be detected here from a failed call of the function “platform_get_irq”.
Hardware experiments show that the negative return value is not just
"-EPROBE_DEFER".
>
>> which causes the application to fail to get the correct error message.
> Will another fine-tuning become relevant also for this wording?
Maybe that's not quite accurate.
>
>
>> Thus it must be fixed.
> Wording alternative:
> Thus adjust the error detection and corresponding exception handling.
Got it.
>
>
>> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
>> Signed-off-by: Shengju Zhang <zhangshengju@cmss.chinamobile.com>
> How do you think about to add the tags “Fixes”, “Link” and “Reported-by”?
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=c0cc271173b2e1c2d8d0ceaef14e4dfa79eefc0d#n584
>
> usb: gadget: fsl_udc_core: Checking for a failed platform_get_irq() call in fsl_udc_probe()
> https://lore.kernel.org/linux-usb/36341bb1-1e00-5eb1-d032-60dcc614ddaf@web.de/
> https://lkml.org/lkml/2020/4/8/442
>
> …
>> +++ b/drivers/usb/gadget/udc/fsl_udc_core.c
>> @@ -2441,8 +2441,8 @@ static int fsl_udc_probe(struct platform_device *pdev)
>> udc_controller->max_ep = (dccparams & DCCPARAMS_DEN_MASK) * 2;
>>
>> udc_controller->irq = platform_get_irq(pdev, 0);
>> - if (!udc_controller->irq) {
>> - ret = -ENODEV;
>> + if (udc_controller->irq <= 0) {
> Will such a failure predicate need any more clarification?
>
> How does this check fit to the current software documentation?
Maybe my tags are not suitable.
>
>
>> + ret = udc_controller->irq ? : -ENODEV;
> Will it be clearer to specify values for all cases in such a conditional operator
> (instead of leaving one case empty)?
I don't know what you mean of "instead of leaving one case empty". But
by experiment, "ret = udc_controller->irq ? : -ENODEV" or "ret =
udc_controller->irq < 0 ? udc_controller->irq : -ENODEV" should be
suitable here.
Thank you for your guidance.
Tang Bin
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] usb: gadget: fsl: Fix a wrong judgment in fsl_udc_probe()
@ 2020-04-10 8:05 ` Tang Bin
0 siblings, 0 replies; 27+ messages in thread
From: Tang Bin @ 2020-04-10 8:05 UTC (permalink / raw)
To: Markus Elfring
Cc: Li Yang, Greg Kroah-Hartman, Felipe Balbi, linux-usb,
linuxppc-dev, linux-kernel, kernel-janitors
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="windows-1254", Size: 2373 bytes --]
Hi Markus
On 2020/4/10 15:33, Markus Elfring wrote:
>> If the function "platform_get_irq()" failed, the negative value
>> returned will not be detected here, including "-EPROBE_DEFER",
> I suggest to adjust this change description.
>
> Wording alternative:
> The negative return value (which could eventually be â-EPROBE_DEFERâ)
> will not be detected here from a failed call of the function âplatform_get_irqâ.
Hardware experiments show that the negative return value is not just
"-EPROBE_DEFER".
>
>> which causes the application to fail to get the correct error message.
> Will another fine-tuning become relevant also for this wording?
Maybe that's not quite accurate.
>
>
>> Thus it must be fixed.
> Wording alternative:
> Thus adjust the error detection and corresponding exception handling.
Got it.
>
>
>> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
>> Signed-off-by: Shengju Zhang <zhangshengju@cmss.chinamobile.com>
> How do you think about to add the tags âFixesâ, âLinkâ and âReported-byâ?
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?idÀcc271173b2e1c2d8d0ceaef14e4dfa79eefc0d#n584
>
> usb: gadget: fsl_udc_core: Checking for a failed platform_get_irq() call in fsl_udc_probe()
> https://lore.kernel.org/linux-usb/36341bb1-1e00-5eb1-d032-60dcc614ddaf@web.de/
> https://lkml.org/lkml/2020/4/8/442
>
> â¦
>> +++ b/drivers/usb/gadget/udc/fsl_udc_core.c
>> @@ -2441,8 +2441,8 @@ static int fsl_udc_probe(struct platform_device *pdev)
>> udc_controller->max_ep = (dccparams & DCCPARAMS_DEN_MASK) * 2;
>>
>> udc_controller->irq = platform_get_irq(pdev, 0);
>> - if (!udc_controller->irq) {
>> - ret = -ENODEV;
>> + if (udc_controller->irq <= 0) {
> Will such a failure predicate need any more clarification?
>
> How does this check fit to the current software documentation?
Maybe my tags are not suitable.
>
>
>> + ret = udc_controller->irq ? : -ENODEV;
> Will it be clearer to specify values for all cases in such a conditional operator
> (instead of leaving one case empty)?
I don't know what you mean of "instead of leaving one case empty". But
by experiment, "ret = udc_controller->irq ? : -ENODEV" or "ret =
udc_controller->irq < 0 ? udc_controller->irq : -ENODEV" should be
suitable here.
Thank you for your guidance.
Tang Bin
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: usb: gadget: fsl: Fix a wrong judgment in fsl_udc_probe()
2020-04-10 8:05 ` Tang Bin
(?)
@ 2020-04-10 8:30 ` Markus Elfring
-1 siblings, 0 replies; 27+ messages in thread
From: Markus Elfring @ 2020-04-10 8:30 UTC (permalink / raw)
To: Tang Bin, linux-usb, linuxppc-dev
Cc: Li Yang, Greg Kroah-Hartman, Felipe Balbi, Shengju Zhang, LKML,
kernel-janitors
> Hardware experiments show that the negative return value is not just "-EPROBE_DEFER".
How much will this specific error code influence our understanding
of the discussed software situation?
>>> + ret = udc_controller->irq ? : -ENODEV;
>> Will it be clearer to specify values for all cases in such a conditional operator
>> (instead of leaving one case empty)?
>
> I don't know what you mean of "instead of leaving one case empty".
I suggest to reconsider also the proposed specification “… ? : …”.
Regards,
Markus
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: usb: gadget: fsl: Fix a wrong judgment in fsl_udc_probe()
@ 2020-04-10 8:30 ` Markus Elfring
0 siblings, 0 replies; 27+ messages in thread
From: Markus Elfring @ 2020-04-10 8:30 UTC (permalink / raw)
To: Tang Bin, linux-usb, linuxppc-dev
Cc: Felipe Balbi, Greg Kroah-Hartman, kernel-janitors, LKML, Li Yang,
Shengju Zhang
> Hardware experiments show that the negative return value is not just "-EPROBE_DEFER".
How much will this specific error code influence our understanding
of the discussed software situation?
>>> + ret = udc_controller->irq ? : -ENODEV;
>> Will it be clearer to specify values for all cases in such a conditional operator
>> (instead of leaving one case empty)?
>
> I don't know what you mean of "instead of leaving one case empty".
I suggest to reconsider also the proposed specification “… ? : …”.
Regards,
Markus
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: usb: gadget: fsl: Fix a wrong judgment in fsl_udc_probe()
@ 2020-04-10 8:30 ` Markus Elfring
0 siblings, 0 replies; 27+ messages in thread
From: Markus Elfring @ 2020-04-10 8:30 UTC (permalink / raw)
To: Tang Bin, linux-usb, linuxppc-dev
Cc: Li Yang, Greg Kroah-Hartman, Felipe Balbi, Shengju Zhang, LKML,
kernel-janitors
> Hardware experiments show that the negative return value is not just "-EPROBE_DEFER".
How much will this specific error code influence our understanding
of the discussed software situation?
>>> + ret = udc_controller->irq ? : -ENODEV;
>> Will it be clearer to specify values for all cases in such a conditional operator
>> (instead of leaving one case empty)?
>
> I don't know what you mean of "instead of leaving one case empty".
I suggest to reconsider also the proposed specification “… ? : …”.
Regards,
Markus
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: usb: gadget: fsl: Fix a wrong judgment in fsl_udc_probe()
2020-04-10 8:30 ` Markus Elfring
(?)
@ 2020-04-10 9:15 ` Tang Bin
-1 siblings, 0 replies; 27+ messages in thread
From: Tang Bin @ 2020-04-10 9:15 UTC (permalink / raw)
To: Markus Elfring, linux-usb, linuxppc-dev
Cc: Li Yang, Greg Kroah-Hartman, Felipe Balbi, Shengju Zhang, LKML,
kernel-janitors
Hi Markus:
On 2020/4/10 16:30, Markus Elfring wrote:
>> Hardware experiments show that the negative return value is not just "-EPROBE_DEFER".
> How much will this specific error code influence our understanding
> of the discussed software situation?
>
From my superficial knowledge, I think we should not think about it
too complicated. The return value is just zero or negative, and for
these negative return value, such as
"-ENODEV"、"-ENXIO"、"-ENOENT"、“EPROBE_DEFER”,may be the same
effect。But“-EPROBE_DEFER”has another importment function: Driver
requested deferred probing,which is used in cases where the dependency
resource is not ready during the driver initialization process.
>>>> + ret = udc_controller->irq ? : -ENODEV;
>>> Will it be clearer to specify values for all cases in such a conditional operator
>>> (instead of leaving one case empty)?
>> I don't know what you mean of "instead of leaving one case empty".
> I suggest to reconsider also the proposed specification “… ? : …”.
What you mean is the way I'm written?
I have provided two ways of patching, both functional can be verified on
hardware.
Thanks for your patience.
Tang Bin
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: usb: gadget: fsl: Fix a wrong judgment in fsl_udc_probe()
@ 2020-04-10 9:15 ` Tang Bin
0 siblings, 0 replies; 27+ messages in thread
From: Tang Bin @ 2020-04-10 9:15 UTC (permalink / raw)
To: Markus Elfring, linux-usb, linuxppc-dev
Cc: Felipe Balbi, Greg Kroah-Hartman, kernel-janitors, LKML, Li Yang,
Shengju Zhang
Hi Markus:
On 2020/4/10 16:30, Markus Elfring wrote:
>> Hardware experiments show that the negative return value is not just "-EPROBE_DEFER".
> How much will this specific error code influence our understanding
> of the discussed software situation?
>
From my superficial knowledge, I think we should not think about it
too complicated. The return value is just zero or negative, and for
these negative return value, such as
"-ENODEV"、"-ENXIO"、"-ENOENT"、“EPROBE_DEFER”,may be the same
effect。But“-EPROBE_DEFER”has another importment function: Driver
requested deferred probing,which is used in cases where the dependency
resource is not ready during the driver initialization process.
>>>> + ret = udc_controller->irq ? : -ENODEV;
>>> Will it be clearer to specify values for all cases in such a conditional operator
>>> (instead of leaving one case empty)?
>> I don't know what you mean of "instead of leaving one case empty".
> I suggest to reconsider also the proposed specification “… ? : …”.
What you mean is the way I'm written?
I have provided two ways of patching, both functional can be verified on
hardware.
Thanks for your patience.
Tang Bin
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: usb: gadget: fsl: Fix a wrong judgment in fsl_udc_probe()
@ 2020-04-10 9:15 ` Tang Bin
0 siblings, 0 replies; 27+ messages in thread
From: Tang Bin @ 2020-04-10 9:15 UTC (permalink / raw)
To: Markus Elfring, linux-usb, linuxppc-dev
Cc: Li Yang, Greg Kroah-Hartman, Felipe Balbi, Shengju Zhang, LKML,
kernel-janitors
Hi Markus:
On 2020/4/10 16:30, Markus Elfring wrote:
>> Hardware experiments show that the negative return value is not just "-EPROBE_DEFER".
> How much will this specific error code influence our understanding
> of the discussed software situation?
>
From my superficial knowledge, I think we should not think about it
too complicated. The return value is just zero or negative, and for
these negative return value, such as
"-ENODEV"、"-ENXIO"、"-ENOENT"、“EPROBE_DEFER”,may be the same
effect。But“-EPROBE_DEFER”has another importment function: Driver
requested deferred probing,which is used in cases where the dependency
resource is not ready during the driver initialization process.
>>>> + ret = udc_controller->irq ? : -ENODEV;
>>> Will it be clearer to specify values for all cases in such a conditional operator
>>> (instead of leaving one case empty)?
>> I don't know what you mean of "instead of leaving one case empty".
> I suggest to reconsider also the proposed specification “… ? : …”.
What you mean is the way I'm written?
I have provided two ways of patching, both functional can be verified on
hardware.
Thanks for your patience.
Tang Bin
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] usb: gadget: fsl: Fix a wrong judgment in fsl_udc_probe()
2020-04-10 8:05 ` Tang Bin
(?)
@ 2020-04-14 8:30 ` Dan Carpenter
-1 siblings, 0 replies; 27+ messages in thread
From: Dan Carpenter @ 2020-04-14 8:30 UTC (permalink / raw)
To: Tang Bin
Cc: Markus Elfring, Li Yang, Greg Kroah-Hartman, Felipe Balbi,
linux-usb, linuxppc-dev, linux-kernel, kernel-janitors
On Fri, Apr 10, 2020 at 04:05:06PM +0800, Tang Bin wrote:
> >
> >
> > > Thus it must be fixed.
> > Wording alternative:
> > Thus adjust the error detection and corresponding exception handling.
>
> Got it.
Wow...
No, don't listen to Markus when it comes to writing commit messages.
You couldn't find worse advice anywhere. :P
regards,
dan carpenter
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] usb: gadget: fsl: Fix a wrong judgment in fsl_udc_probe()
@ 2020-04-14 8:30 ` Dan Carpenter
0 siblings, 0 replies; 27+ messages in thread
From: Dan Carpenter @ 2020-04-14 8:30 UTC (permalink / raw)
To: Tang Bin
Cc: Felipe Balbi, Greg Kroah-Hartman, linux-usb, kernel-janitors,
linux-kernel, Li Yang, Markus Elfring, linuxppc-dev
On Fri, Apr 10, 2020 at 04:05:06PM +0800, Tang Bin wrote:
> >
> >
> > > Thus it must be fixed.
> > Wording alternative:
> > Thus adjust the error detection and corresponding exception handling.
>
> Got it.
Wow...
No, don't listen to Markus when it comes to writing commit messages.
You couldn't find worse advice anywhere. :P
regards,
dan carpenter
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] usb: gadget: fsl: Fix a wrong judgment in fsl_udc_probe()
@ 2020-04-14 8:30 ` Dan Carpenter
0 siblings, 0 replies; 27+ messages in thread
From: Dan Carpenter @ 2020-04-14 8:30 UTC (permalink / raw)
To: Tang Bin
Cc: Markus Elfring, Li Yang, Greg Kroah-Hartman, Felipe Balbi,
linux-usb, linuxppc-dev, linux-kernel, kernel-janitors
On Fri, Apr 10, 2020 at 04:05:06PM +0800, Tang Bin wrote:
> >
> >
> > > Thus it must be fixed.
> > Wording alternative:
> > Thus adjust the error detection and corresponding exception handling.
>
> Got it.
Wow...
No, don't listen to Markus when it comes to writing commit messages.
You couldn't find worse advice anywhere. :P
regards,
dan carpenter
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] usb: gadget: fsl: Fix a wrong judgment in fsl_udc_probe()
2020-04-14 8:30 ` Dan Carpenter
(?)
@ 2020-04-14 9:13 ` Tang Bin
-1 siblings, 0 replies; 27+ messages in thread
From: Tang Bin @ 2020-04-14 9:13 UTC (permalink / raw)
To: Dan Carpenter
Cc: Markus Elfring, Li Yang, Greg Kroah-Hartman, Felipe Balbi,
linux-usb, linuxppc-dev, linux-kernel, kernel-janitors
Hi
On 2020/4/14 16:30, Dan Carpenter wrote:
> On Fri, Apr 10, 2020 at 04:05:06PM +0800, Tang Bin wrote:
>>>
>>>> Thus it must be fixed.
>>> Wording alternative:
>>> Thus adjust the error detection and corresponding exception handling.
>> Got it.
> Wow...
>
> No, don't listen to Markus when it comes to writing commit messages.
> You couldn't find worse advice anywhere. :P
I'm actively waiting for a reply from the maintainer. Thank you very much.
Tang Bin
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] usb: gadget: fsl: Fix a wrong judgment in fsl_udc_probe()
@ 2020-04-14 9:13 ` Tang Bin
0 siblings, 0 replies; 27+ messages in thread
From: Tang Bin @ 2020-04-14 9:13 UTC (permalink / raw)
To: Dan Carpenter
Cc: Felipe Balbi, Greg Kroah-Hartman, linux-usb, kernel-janitors,
linux-kernel, Li Yang, Markus Elfring, linuxppc-dev
Hi
On 2020/4/14 16:30, Dan Carpenter wrote:
> On Fri, Apr 10, 2020 at 04:05:06PM +0800, Tang Bin wrote:
>>>
>>>> Thus it must be fixed.
>>> Wording alternative:
>>> Thus adjust the error detection and corresponding exception handling.
>> Got it.
> Wow...
>
> No, don't listen to Markus when it comes to writing commit messages.
> You couldn't find worse advice anywhere. :P
I'm actively waiting for a reply from the maintainer. Thank you very much.
Tang Bin
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] usb: gadget: fsl: Fix a wrong judgment in fsl_udc_probe()
@ 2020-04-14 9:13 ` Tang Bin
0 siblings, 0 replies; 27+ messages in thread
From: Tang Bin @ 2020-04-14 9:13 UTC (permalink / raw)
To: Dan Carpenter
Cc: Markus Elfring, Li Yang, Greg Kroah-Hartman, Felipe Balbi,
linux-usb, linuxppc-dev, linux-kernel, kernel-janitors
Hi
On 2020/4/14 16:30, Dan Carpenter wrote:
> On Fri, Apr 10, 2020 at 04:05:06PM +0800, Tang Bin wrote:
>>>
>>>> Thus it must be fixed.
>>> Wording alternative:
>>> Thus adjust the error detection and corresponding exception handling.
>> Got it.
> Wow...
>
> No, don't listen to Markus when it comes to writing commit messages.
> You couldn't find worse advice anywhere. :P
I'm actively waiting for a reply from the maintainer. Thank you very much.
Tang Bin
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] usb: gadget: fsl: Fix a wrong judgment in fsl_udc_probe()
2020-04-14 9:13 ` Tang Bin
(?)
@ 2020-05-22 22:40 ` Li Yang
-1 siblings, 0 replies; 27+ messages in thread
From: Li Yang @ 2020-05-22 22:40 UTC (permalink / raw)
To: Tang Bin
Cc: Dan Carpenter, Felipe Balbi, Greg Kroah-Hartman, linux-usb,
kernel-janitors, lkml, Markus Elfring, linuxppc-dev
On Tue, Apr 14, 2020 at 4:13 AM Tang Bin <tangbin@cmss.chinamobile.com> wrote:
>
> Hi
>
> On 2020/4/14 16:30, Dan Carpenter wrote:
> > On Fri, Apr 10, 2020 at 04:05:06PM +0800, Tang Bin wrote:
> >>>
> >>>> Thus it must be fixed.
> >>> Wording alternative:
> >>> Thus adjust the error detection and corresponding exception handling.
> >> Got it.
> > Wow...
> >
> > No, don't listen to Markus when it comes to writing commit messages.
> > You couldn't find worse advice anywhere. :P
>
> I'm actively waiting for a reply from the maintainer. Thank you very much.
Sorry for the late response.
Acked-by: Li Yang <leoyang.li@nxp.com>
Regards,
Leo
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] usb: gadget: fsl: Fix a wrong judgment in fsl_udc_probe()
@ 2020-05-22 22:40 ` Li Yang
0 siblings, 0 replies; 27+ messages in thread
From: Li Yang @ 2020-05-22 22:40 UTC (permalink / raw)
To: Tang Bin
Cc: Felipe Balbi, Greg Kroah-Hartman, linux-usb, kernel-janitors,
lkml, Markus Elfring, linuxppc-dev, Dan Carpenter
On Tue, Apr 14, 2020 at 4:13 AM Tang Bin <tangbin@cmss.chinamobile.com> wrote:
>
> Hi
>
> On 2020/4/14 16:30, Dan Carpenter wrote:
> > On Fri, Apr 10, 2020 at 04:05:06PM +0800, Tang Bin wrote:
> >>>
> >>>> Thus it must be fixed.
> >>> Wording alternative:
> >>> Thus adjust the error detection and corresponding exception handling.
> >> Got it.
> > Wow...
> >
> > No, don't listen to Markus when it comes to writing commit messages.
> > You couldn't find worse advice anywhere. :P
>
> I'm actively waiting for a reply from the maintainer. Thank you very much.
Sorry for the late response.
Acked-by: Li Yang <leoyang.li@nxp.com>
Regards,
Leo
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] usb: gadget: fsl: Fix a wrong judgment in fsl_udc_probe()
@ 2020-05-22 22:40 ` Li Yang
0 siblings, 0 replies; 27+ messages in thread
From: Li Yang @ 2020-05-22 22:40 UTC (permalink / raw)
To: Tang Bin
Cc: Dan Carpenter, Felipe Balbi, Greg Kroah-Hartman, linux-usb,
kernel-janitors, lkml, Markus Elfring, linuxppc-dev
On Tue, Apr 14, 2020 at 4:13 AM Tang Bin <tangbin@cmss.chinamobile.com> wrote:
>
> Hi
>
> On 2020/4/14 16:30, Dan Carpenter wrote:
> > On Fri, Apr 10, 2020 at 04:05:06PM +0800, Tang Bin wrote:
> >>>
> >>>> Thus it must be fixed.
> >>> Wording alternative:
> >>> Thus adjust the error detection and corresponding exception handling.
> >> Got it.
> > Wow...
> >
> > No, don't listen to Markus when it comes to writing commit messages.
> > You couldn't find worse advice anywhere. :P
>
> I'm actively waiting for a reply from the maintainer. Thank you very much.
Sorry for the late response.
Acked-by: Li Yang <leoyang.li@nxp.com>
Regards,
Leo
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] usb: gadget: fsl: Fix a wrong judgment in fsl_udc_probe()
2020-04-10 1:58 ` Tang Bin
@ 2020-04-10 9:36 ` Sergei Shtylyov
-1 siblings, 0 replies; 27+ messages in thread
From: Sergei Shtylyov @ 2020-04-10 9:36 UTC (permalink / raw)
To: Tang Bin, leoyang.li, balbi, gregkh
Cc: linux-usb, linuxppc-dev, linux-kernel, Markus.Elfring, Shengju Zhang
Hello!
On 10.04.2020 4:58, Tang Bin wrote:
> If the function "platform_get_irq()" failed, the negative value
> returned will not be detected here, including "-EPROBE_DEFER", which
> causes the application to fail to get the correct error message.
> Thus it must be fixed.
>
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
> Signed-off-by: Shengju Zhang <zhangshengju@cmss.chinamobile.com>
> ---
> drivers/usb/gadget/udc/fsl_udc_core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c
> index ec6eda426..60853ad10 100644
> --- a/drivers/usb/gadget/udc/fsl_udc_core.c
> +++ b/drivers/usb/gadget/udc/fsl_udc_core.c
> @@ -2441,8 +2441,8 @@ static int fsl_udc_probe(struct platform_device *pdev)
> udc_controller->max_ep = (dccparams & DCCPARAMS_DEN_MASK) * 2;
>
> udc_controller->irq = platform_get_irq(pdev, 0);
> - if (!udc_controller->irq) {
This check has always been wrong, doesn't account for real errors and
probe deferral...
> - ret = -ENODEV;
> + if (udc_controller->irq <= 0) {
Note that platfrom_get_irq() no longer returns 0 on error.
> + ret = udc_controller->irq ? : -ENODEV;
> goto err_iounmap;
> }
MBR, Sergei
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] usb: gadget: fsl: Fix a wrong judgment in fsl_udc_probe()
@ 2020-04-10 9:36 ` Sergei Shtylyov
0 siblings, 0 replies; 27+ messages in thread
From: Sergei Shtylyov @ 2020-04-10 9:36 UTC (permalink / raw)
To: Tang Bin, leoyang.li, balbi, gregkh
Cc: Markus.Elfring, linux-usb, linuxppc-dev, linux-kernel, Shengju Zhang
Hello!
On 10.04.2020 4:58, Tang Bin wrote:
> If the function "platform_get_irq()" failed, the negative value
> returned will not be detected here, including "-EPROBE_DEFER", which
> causes the application to fail to get the correct error message.
> Thus it must be fixed.
>
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
> Signed-off-by: Shengju Zhang <zhangshengju@cmss.chinamobile.com>
> ---
> drivers/usb/gadget/udc/fsl_udc_core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c
> index ec6eda426..60853ad10 100644
> --- a/drivers/usb/gadget/udc/fsl_udc_core.c
> +++ b/drivers/usb/gadget/udc/fsl_udc_core.c
> @@ -2441,8 +2441,8 @@ static int fsl_udc_probe(struct platform_device *pdev)
> udc_controller->max_ep = (dccparams & DCCPARAMS_DEN_MASK) * 2;
>
> udc_controller->irq = platform_get_irq(pdev, 0);
> - if (!udc_controller->irq) {
This check has always been wrong, doesn't account for real errors and
probe deferral...
> - ret = -ENODEV;
> + if (udc_controller->irq <= 0) {
Note that platfrom_get_irq() no longer returns 0 on error.
> + ret = udc_controller->irq ? : -ENODEV;
> goto err_iounmap;
> }
MBR, Sergei
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] usb: gadget: fsl: Fix a wrong judgment in fsl_udc_probe()
2020-04-10 1:58 ` Tang Bin
@ 2020-04-10 9:47 ` Sergei Shtylyov
-1 siblings, 0 replies; 27+ messages in thread
From: Sergei Shtylyov @ 2020-04-10 9:47 UTC (permalink / raw)
To: Tang Bin, leoyang.li, balbi, gregkh
Cc: linux-usb, linuxppc-dev, linux-kernel, Markus.Elfring, Shengju Zhang
On 10.04.2020 4:58, Tang Bin wrote:
> If the function "platform_get_irq()" failed, the negative value
> returned will not be detected here, including "-EPROBE_DEFER", which
> causes the application to fail to get the correct error message.
> Thus it must be fixed.
platform_get_irq() prints an appropriate error message, the problem is that
the current code calls request_irq() with error code instead of IRQ.
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
> Signed-off-by: Shengju Zhang <zhangshengju@cmss.chinamobile.com>
[...]
MBR, Sergei
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] usb: gadget: fsl: Fix a wrong judgment in fsl_udc_probe()
@ 2020-04-10 9:47 ` Sergei Shtylyov
0 siblings, 0 replies; 27+ messages in thread
From: Sergei Shtylyov @ 2020-04-10 9:47 UTC (permalink / raw)
To: Tang Bin, leoyang.li, balbi, gregkh
Cc: Markus.Elfring, linux-usb, linuxppc-dev, linux-kernel, Shengju Zhang
On 10.04.2020 4:58, Tang Bin wrote:
> If the function "platform_get_irq()" failed, the negative value
> returned will not be detected here, including "-EPROBE_DEFER", which
> causes the application to fail to get the correct error message.
> Thus it must be fixed.
platform_get_irq() prints an appropriate error message, the problem is that
the current code calls request_irq() with error code instead of IRQ.
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
> Signed-off-by: Shengju Zhang <zhangshengju@cmss.chinamobile.com>
[...]
MBR, Sergei
^ permalink raw reply [flat|nested] 27+ messages in thread