[v4,2/2,RESEND] extcon: qcom-spmi: Switch to platform_get_irq_byname_optional

Message ID 20221228133058.213886-3-bryan.odonoghue@linaro.org
State New
Headers
Series Fix pm8941-misc extcon interrupt dependency assumptions |

Commit Message

Bryan O'Donoghue Dec. 28, 2022, 1:30 p.m. UTC
  Valid configurations for the extcon interrupt declarations are

- usb_id
- usb_vbus
- (usb_id | usb_vbus)

In the case of a standalone usb_id or usb_vbus failure to find one of the
interrupts shouldn't generate a warning message. A warning is already in
place if both IRQs are missing.

Switch to using platform_get_irq_byname_optional() in order to facilitate
this behaviour.

Suggested-by: Marijn Suijten <marijn.suijten@somainline.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 drivers/extcon/extcon-qcom-spmi-misc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Marijn Suijten Dec. 28, 2022, 10:54 p.m. UTC | #1
On 2022-12-28 13:30:58, Bryan O'Donoghue wrote:
> Valid configurations for the extcon interrupt declarations are
> 
> - usb_id
> - usb_vbus
> - (usb_id | usb_vbus)
> 
> In the case of a standalone usb_id or usb_vbus failure to find one of the
> interrupts shouldn't generate a warning message. A warning is already in
> place if both IRQs are missing.
> 
> Switch to using platform_get_irq_byname_optional() in order to facilitate
> this behaviour.
> 
> Suggested-by: Marijn Suijten <marijn.suijten@somainline.org>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>

Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>

> ---
>  drivers/extcon/extcon-qcom-spmi-misc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/extcon/extcon-qcom-spmi-misc.c b/drivers/extcon/extcon-qcom-spmi-misc.c
> index eb02cb962b5e1..f72e90ceca53d 100644
> --- a/drivers/extcon/extcon-qcom-spmi-misc.c
> +++ b/drivers/extcon/extcon-qcom-spmi-misc.c
> @@ -123,7 +123,7 @@ static int qcom_usb_extcon_probe(struct platform_device *pdev)
>  	if (ret)
>  		return ret;
>  
> -	info->id_irq = platform_get_irq_byname(pdev, "usb_id");
> +	info->id_irq = platform_get_irq_byname_optional(pdev, "usb_id");
>  	if (info->id_irq > 0) {
>  		ret = devm_request_threaded_irq(dev, info->id_irq, NULL,
>  					qcom_usb_irq_handler,
> @@ -136,7 +136,7 @@ static int qcom_usb_extcon_probe(struct platform_device *pdev)
>  		}
>  	}
>  
> -	info->vbus_irq = platform_get_irq_byname(pdev, "usb_vbus");
> +	info->vbus_irq = platform_get_irq_byname_optional(pdev, "usb_vbus");
>  	if (info->vbus_irq > 0) {
>  		ret = devm_request_threaded_irq(dev, info->vbus_irq, NULL,
>  					qcom_usb_irq_handler,
> -- 
> 2.34.1
>
  
Chanwoo Choi Jan. 10, 2023, 1:27 p.m. UTC | #2
On 22. 12. 28. 22:30, Bryan O'Donoghue wrote:
> Valid configurations for the extcon interrupt declarations are
> 
> - usb_id
> - usb_vbus
> - (usb_id | usb_vbus)
> 
> In the case of a standalone usb_id or usb_vbus failure to find one of the
> interrupts shouldn't generate a warning message. A warning is already in
> place if both IRQs are missing.
> 
> Switch to using platform_get_irq_byname_optional() in order to facilitate
> this behaviour.
> 
> Suggested-by: Marijn Suijten <marijn.suijten@somainline.org>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
>  drivers/extcon/extcon-qcom-spmi-misc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/extcon/extcon-qcom-spmi-misc.c b/drivers/extcon/extcon-qcom-spmi-misc.c
> index eb02cb962b5e1..f72e90ceca53d 100644
> --- a/drivers/extcon/extcon-qcom-spmi-misc.c
> +++ b/drivers/extcon/extcon-qcom-spmi-misc.c
> @@ -123,7 +123,7 @@ static int qcom_usb_extcon_probe(struct platform_device *pdev)
>  	if (ret)
>  		return ret;
>  
> -	info->id_irq = platform_get_irq_byname(pdev, "usb_id");
> +	info->id_irq = platform_get_irq_byname_optional(pdev, "usb_id");
>  	if (info->id_irq > 0) {
>  		ret = devm_request_threaded_irq(dev, info->id_irq, NULL,
>  					qcom_usb_irq_handler,
> @@ -136,7 +136,7 @@ static int qcom_usb_extcon_probe(struct platform_device *pdev)
>  		}
>  	}
>  
> -	info->vbus_irq = platform_get_irq_byname(pdev, "usb_vbus");
> +	info->vbus_irq = platform_get_irq_byname_optional(pdev, "usb_vbus");
>  	if (info->vbus_irq > 0) {
>  		ret = devm_request_threaded_irq(dev, info->vbus_irq, NULL,
>  					qcom_usb_irq_handler,

Applied it. Thanks.
  

Patch

diff --git a/drivers/extcon/extcon-qcom-spmi-misc.c b/drivers/extcon/extcon-qcom-spmi-misc.c
index eb02cb962b5e1..f72e90ceca53d 100644
--- a/drivers/extcon/extcon-qcom-spmi-misc.c
+++ b/drivers/extcon/extcon-qcom-spmi-misc.c
@@ -123,7 +123,7 @@  static int qcom_usb_extcon_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	info->id_irq = platform_get_irq_byname(pdev, "usb_id");
+	info->id_irq = platform_get_irq_byname_optional(pdev, "usb_id");
 	if (info->id_irq > 0) {
 		ret = devm_request_threaded_irq(dev, info->id_irq, NULL,
 					qcom_usb_irq_handler,
@@ -136,7 +136,7 @@  static int qcom_usb_extcon_probe(struct platform_device *pdev)
 		}
 	}
 
-	info->vbus_irq = platform_get_irq_byname(pdev, "usb_vbus");
+	info->vbus_irq = platform_get_irq_byname_optional(pdev, "usb_vbus");
 	if (info->vbus_irq > 0) {
 		ret = devm_request_threaded_irq(dev, info->vbus_irq, NULL,
 					qcom_usb_irq_handler,