Re: [PATCH v1] chipidea: issue message when some calls fail in -probe()

2014-11-28 Thread Andy Shevchenko
On Mon, 2014-11-17 at 08:50 +0800, Peter Chen wrote:
 On Thu, Nov 13, 2014 at 05:59:47PM +0200, Andy Shevchenko wrote:
  There is no message when PHY is not enabled, IRQ line can't be acquired, or
  debugfs registration fails. This patch adds the messages.
  

[]

 Yes, I find the probe does not show warning for -ENODEV and -ENXIO,
 I have changed request_irq to devm_request_irq at my next tree,
 rebase it, and send your v2 please.

I found the way how to get an error code for built-in drivers. I doubt
we need that patch at all.

-- 
Andy Shevchenko andriy.shevche...@intel.com
Intel Finland Oy

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


Re: [PATCH v1] chipidea: issue message when some calls fail in -probe()

2014-11-16 Thread Peter Chen
On Thu, Nov 13, 2014 at 05:59:47PM +0200, Andy Shevchenko wrote:
 There is no message when PHY is not enabled, IRQ line can't be acquired, or
 debugfs registration fails. This patch adds the messages.
 
 Signed-off-by: Andy Shevchenko andriy.shevche...@linux.intel.com
 ---
  drivers/usb/chipidea/core.c | 16 
  1 file changed, 12 insertions(+), 4 deletions(-)
 
 diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
 index c57448a..ffd2457 100644
 --- a/drivers/usb/chipidea/core.c
 +++ b/drivers/usb/chipidea/core.c
 @@ -659,8 +659,10 @@ static int ci_hdrc_probe(struct platform_device *pdev)
  
   /* if both generic PHY and USB PHY layers aren't enabled */
   if (PTR_ERR(ci-phy) == -ENOSYS 
 - PTR_ERR(ci-usb_phy) == -ENXIO)
 + PTR_ERR(ci-usb_phy) == -ENXIO) {
 + dev_err(dev, PHY and USB PHY layers aren't enabled\n);
   return -ENXIO;
 + }
  
   if (IS_ERR(ci-phy)  IS_ERR(ci-usb_phy))
   return -EPROBE_DEFER;
 @@ -761,16 +763,22 @@ static int ci_hdrc_probe(struct platform_device *pdev)
   platform_set_drvdata(pdev, ci);
   ret = request_irq(ci-irq, ci_irq, IRQF_SHARED, ci-platdata-name,
 ci);
 - if (ret)
 + if (ret) {
 + dev_err(dev, can't acquire IRQ line %d\n, ci-irq);
   goto stop;
 + }
  
   if (ci_otg_is_fsm_mode(ci))
   ci_hdrc_otg_fsm_start(ci);
  
   ret = dbg_create_files(ci);
 - if (!ret)
 - return 0;
 + if (ret) {
 + dev_err(dev, can't register debugfs files\n);
 + goto release_irq;
 + }
 + return 0;
  
 +release_irq:
   free_irq(ci-irq, ci);
  stop:
   ci_role_destroy(ci);
 -- 
 2.1.3
 

Yes, I find the probe does not show warning for -ENODEV and -ENXIO,
I have changed request_irq to devm_request_irq at my next tree,
rebase it, and send your v2 please.

-- 

Best Regards,
Peter Chen
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v1] chipidea: issue message when some calls fail in -probe()

2014-11-14 Thread Peter Chen
On Thu, Nov 13, 2014 at 05:59:47PM +0200, Andy Shevchenko wrote:
 There is no message when PHY is not enabled, IRQ line can't be acquired, or
 debugfs registration fails. This patch adds the messages.
 

But you get the error return value from probe, it indicates the probe has
failed, usually, we don't add more error information at probe.

Peter
 Signed-off-by: Andy Shevchenko andriy.shevche...@linux.intel.com
 ---
  drivers/usb/chipidea/core.c | 16 
  1 file changed, 12 insertions(+), 4 deletions(-)
 
 diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
 index c57448a..ffd2457 100644
 --- a/drivers/usb/chipidea/core.c
 +++ b/drivers/usb/chipidea/core.c
 @@ -659,8 +659,10 @@ static int ci_hdrc_probe(struct platform_device *pdev)
  
   /* if both generic PHY and USB PHY layers aren't enabled */
   if (PTR_ERR(ci-phy) == -ENOSYS 
 - PTR_ERR(ci-usb_phy) == -ENXIO)
 + PTR_ERR(ci-usb_phy) == -ENXIO) {
 + dev_err(dev, PHY and USB PHY layers aren't enabled\n);
   return -ENXIO;
 + }
  
   if (IS_ERR(ci-phy)  IS_ERR(ci-usb_phy))
   return -EPROBE_DEFER;
 @@ -761,16 +763,22 @@ static int ci_hdrc_probe(struct platform_device *pdev)
   platform_set_drvdata(pdev, ci);
   ret = request_irq(ci-irq, ci_irq, IRQF_SHARED, ci-platdata-name,
 ci);
 - if (ret)
 + if (ret) {
 + dev_err(dev, can't acquire IRQ line %d\n, ci-irq);
   goto stop;
 + }
  
   if (ci_otg_is_fsm_mode(ci))
   ci_hdrc_otg_fsm_start(ci);
  
   ret = dbg_create_files(ci);
 - if (!ret)
 - return 0;
 + if (ret) {
 + dev_err(dev, can't register debugfs files\n);
 + goto release_irq;
 + }
 + return 0;
  
 +release_irq:
   free_irq(ci-irq, ci);
  stop:
   ci_role_destroy(ci);
 -- 
 2.1.3
 

-- 

Best Regards,
Peter Chen
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v1] chipidea: issue message when some calls fail in -probe()

2014-11-14 Thread Andy Shevchenko
On Fri, 2014-11-14 at 15:58 +0800, Peter Chen wrote:
 On Thu, Nov 13, 2014 at 05:59:47PM +0200, Andy Shevchenko wrote:
  There is no message when PHY is not enabled, IRQ line can't be acquired, or
  debugfs registration fails. This patch adds the messages.
  
 
 But you get the error return value from probe, it indicates the probe has
 failed, usually, we don't add more error information at probe.

I spend more than hour to understand what is happening in my case. I
compiled in the module and didn't get why probe failed.

With this patch applied I would have understood this like in couple of
minutes.

I think it is very useful to save time of debugging.

 
 Peter
  Signed-off-by: Andy Shevchenko andriy.shevche...@linux.intel.com
  ---
   drivers/usb/chipidea/core.c | 16 
   1 file changed, 12 insertions(+), 4 deletions(-)
  
  diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
  index c57448a..ffd2457 100644
  --- a/drivers/usb/chipidea/core.c
  +++ b/drivers/usb/chipidea/core.c
  @@ -659,8 +659,10 @@ static int ci_hdrc_probe(struct platform_device *pdev)
   
  /* if both generic PHY and USB PHY layers aren't enabled */
  if (PTR_ERR(ci-phy) == -ENOSYS 
  -   PTR_ERR(ci-usb_phy) == -ENXIO)
  +   PTR_ERR(ci-usb_phy) == -ENXIO) {
  +   dev_err(dev, PHY and USB PHY layers aren't enabled\n);
  return -ENXIO;
  +   }
   
  if (IS_ERR(ci-phy)  IS_ERR(ci-usb_phy))
  return -EPROBE_DEFER;
  @@ -761,16 +763,22 @@ static int ci_hdrc_probe(struct platform_device *pdev)
  platform_set_drvdata(pdev, ci);
  ret = request_irq(ci-irq, ci_irq, IRQF_SHARED, ci-platdata-name,
ci);
  -   if (ret)
  +   if (ret) {
  +   dev_err(dev, can't acquire IRQ line %d\n, ci-irq);
  goto stop;
  +   }
   
  if (ci_otg_is_fsm_mode(ci))
  ci_hdrc_otg_fsm_start(ci);
   
  ret = dbg_create_files(ci);
  -   if (!ret)
  -   return 0;
  +   if (ret) {
  +   dev_err(dev, can't register debugfs files\n);
  +   goto release_irq;
  +   }
  +   return 0;
   
  +release_irq:
  free_irq(ci-irq, ci);
   stop:
  ci_role_destroy(ci);
  -- 
  2.1.3
  
 


-- 
Andy Shevchenko andriy.shevche...@intel.com
Intel Finland Oy

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


[PATCH v1] chipidea: issue message when some calls fail in -probe()

2014-11-13 Thread Andy Shevchenko
There is no message when PHY is not enabled, IRQ line can't be acquired, or
debugfs registration fails. This patch adds the messages.

Signed-off-by: Andy Shevchenko andriy.shevche...@linux.intel.com
---
 drivers/usb/chipidea/core.c | 16 
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index c57448a..ffd2457 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -659,8 +659,10 @@ static int ci_hdrc_probe(struct platform_device *pdev)
 
/* if both generic PHY and USB PHY layers aren't enabled */
if (PTR_ERR(ci-phy) == -ENOSYS 
-   PTR_ERR(ci-usb_phy) == -ENXIO)
+   PTR_ERR(ci-usb_phy) == -ENXIO) {
+   dev_err(dev, PHY and USB PHY layers aren't enabled\n);
return -ENXIO;
+   }
 
if (IS_ERR(ci-phy)  IS_ERR(ci-usb_phy))
return -EPROBE_DEFER;
@@ -761,16 +763,22 @@ static int ci_hdrc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, ci);
ret = request_irq(ci-irq, ci_irq, IRQF_SHARED, ci-platdata-name,
  ci);
-   if (ret)
+   if (ret) {
+   dev_err(dev, can't acquire IRQ line %d\n, ci-irq);
goto stop;
+   }
 
if (ci_otg_is_fsm_mode(ci))
ci_hdrc_otg_fsm_start(ci);
 
ret = dbg_create_files(ci);
-   if (!ret)
-   return 0;
+   if (ret) {
+   dev_err(dev, can't register debugfs files\n);
+   goto release_irq;
+   }
+   return 0;
 
+release_irq:
free_irq(ci-irq, ci);
 stop:
ci_role_destroy(ci);
-- 
2.1.3

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