Re: [PATCH 2/8] ARM OMAP2+ GPMC: add bus children

2015-03-03 Thread Robert Abel
Hi Roger,

On Tue, Mar 3, 2015 at 11:09 AM, Roger Quadros rog...@ti.com wrote:
 If that is the case then I'd rather not check for return value of 
 of_platform_populate().
 Failure in populating GPMC child's children is already out of scope of GPMC 
 driver.

Well, I'd rather leave it in for now. If something *does* break in the
future, the user will at least get a message about it.

Regards,

Robert
--
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 2/8] ARM OMAP2+ GPMC: add bus children

2015-03-03 Thread Roger Quadros
Hi Robert,

On 27/02/15 17:08, Robert Abel wrote:
 Hi Roger,
 
 On Fri, Feb 27, 2015 at 11:24 AM, Roger Quadros rog...@ti.com wrote:
 + /* is child a common bus? */
 + if (of_match_node(of_default_bus_match_table, child))
 + /* create children and other common bus children */
 + if (of_platform_populate(child, of_default_bus_match_table, 
 NULL, pdev-dev))
 + goto err_child_fail;

 this would print failed to create gpmc child but we have already created
 the gpmc child in the first of_platform_device_create() call.
 A more appropriate message would be failed to populate all children of 
 child-name

 Also do you want to return failure?
 it will result in of_node_put() of the child and another print message
 about probing gpmc child %s failed in gpmc_probe_dt().

 IMO if the GPMC node's child was created fine then we shouldn't return error.
 
 As of_platform_populate _always_ return 0 no matter what, the only way
 to reach that message is if probing the child failed.

GPMCs child is already probed. It is the child's child we are talking about
in of_platform_populate.

 As I cannot see into the future when of_platform_populate might
 actually be changed to return meaningful codes, we shouldn't try to
 foresee what the actual problem might be today either. This is a
 battle for another day.
 

If that is the case then I'd rather not check for return value of 
of_platform_populate().
Failure in populating GPMC child's children is already out of scope of GPMC 
driver.

cheers,
-roger
--
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 2/8] ARM OMAP2+ GPMC: add bus children

2015-02-27 Thread Robert Abel
Hi Roger,

On Fri, Feb 27, 2015 at 11:24 AM, Roger Quadros rog...@ti.com wrote:
 + /* is child a common bus? */
 + if (of_match_node(of_default_bus_match_table, child))
 + /* create children and other common bus children */
 + if (of_platform_populate(child, of_default_bus_match_table, 
 NULL, pdev-dev))
 + goto err_child_fail;

 this would print failed to create gpmc child but we have already created
 the gpmc child in the first of_platform_device_create() call.
 A more appropriate message would be failed to populate all children of 
 child-name

 Also do you want to return failure?
 it will result in of_node_put() of the child and another print message
 about probing gpmc child %s failed in gpmc_probe_dt().

 IMO if the GPMC node's child was created fine then we shouldn't return error.

As of_platform_populate _always_ return 0 no matter what, the only way
to reach that message is if probing the child failed.
As I cannot see into the future when of_platform_populate might
actually be changed to return meaningful codes, we shouldn't try to
foresee what the actual problem might be today either. This is a
battle for another day.

Regards,

Robert
--
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 2/8] ARM OMAP2+ GPMC: add bus children

2015-02-27 Thread Roger Quadros
Hi Robert,

On 26/02/15 16:45, Robert ABEL wrote:
 This patch adds support for spawning buses as children of the GPMC.
 
 Signed-off-by: Robert ABEL ra...@cit-ec.uni-bielefeld.de
 ---
  drivers/memory/omap-gpmc.c | 17 +++--
  1 file changed, 15 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
 index 5cabac8..74a8c52 100644
 --- a/drivers/memory/omap-gpmc.c
 +++ b/drivers/memory/omap-gpmc.c
 @@ -27,6 +27,7 @@
  #include linux/of_address.h
  #include linux/of_mtd.h
  #include linux/of_device.h
 +#include linux/of_platform.h
  #include linux/omap-gpmc.h
  #include linux/mtd/nand.h
  #include linux/pm_runtime.h
 @@ -1800,8 +1801,20 @@ static int gpmc_probe_generic_child(struct 
 platform_device *pdev,
   gpmc_cs_enable_mem(cs);
  
  no_timings:
 - if (of_platform_device_create(child, NULL, pdev-dev))
 - return 0;
 +
 + /* create platform device, NULL on error or when disabled */
 + if (!of_platform_device_create(child, NULL, pdev-dev))
 + goto err_child_fail;
 +
 + /* is child a common bus? */
 + if (of_match_node(of_default_bus_match_table, child))
 + /* create children and other common bus children */
 + if (of_platform_populate(child, of_default_bus_match_table, 
 NULL, pdev-dev))
 + goto err_child_fail;

this would print failed to create gpmc child but we have already created
the gpmc child in the first of_platform_device_create() call.
A more appropriate message would be failed to populate all children of 
child-name

Also do you want to return failure?
it will result in of_node_put() of the child and another print message
about probing gpmc child %s failed in gpmc_probe_dt().

IMO if the GPMC node's child was created fine then we shouldn't return error.

 +
 + return 0;
 +
 +err_child_fail:
  
   dev_err(pdev-dev, failed to create gpmc child %s\n, child-name);
   ret = -ENODEV;
 

cheers,
-roger
--
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 2/8] ARM OMAP2+ GPMC: add bus children

2015-02-26 Thread Robert ABEL
This patch adds support for spawning buses as children of the GPMC.

Signed-off-by: Robert ABEL ra...@cit-ec.uni-bielefeld.de
---
 drivers/memory/omap-gpmc.c | 17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index 5cabac8..74a8c52 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -27,6 +27,7 @@
 #include linux/of_address.h
 #include linux/of_mtd.h
 #include linux/of_device.h
+#include linux/of_platform.h
 #include linux/omap-gpmc.h
 #include linux/mtd/nand.h
 #include linux/pm_runtime.h
@@ -1800,8 +1801,20 @@ static int gpmc_probe_generic_child(struct 
platform_device *pdev,
gpmc_cs_enable_mem(cs);
 
 no_timings:
-   if (of_platform_device_create(child, NULL, pdev-dev))
-   return 0;
+
+   /* create platform device, NULL on error or when disabled */
+   if (!of_platform_device_create(child, NULL, pdev-dev))
+   goto err_child_fail;
+
+   /* is child a common bus? */
+   if (of_match_node(of_default_bus_match_table, child))
+   /* create children and other common bus children */
+   if (of_platform_populate(child, of_default_bus_match_table, 
NULL, pdev-dev))
+   goto err_child_fail;
+
+   return 0;
+
+err_child_fail:
 
dev_err(pdev-dev, failed to create gpmc child %s\n, child-name);
ret = -ENODEV;
-- 
2.3.0

--
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