<div dir="ltr"><div dir="ltr"><br><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Sep 20, 2019 at 12:08 AM Christian Mauderer <<a href="mailto:list@c-mauderer.de">list@c-mauderer.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 19/09/2019 19:48, Vijay Kumar Banerjee wrote:<br>
> <br>
> <br>
> <br>
> On Thu, Sep 19, 2019 at 10:05 PM Christian Mauderer <<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>> wrote:<br>
> <br>
> Hello Vijay,<br>
> <br>
> sorry for being picky: What happens if something goes wrong during that<br>
> initialization? For example: If the system has a configuration where<br>
> /dev/i2c0 can't be created. In that case it will just silently fail to<br>
> create the i2c-0 which maybe leads to odd errors later.<br>
> <br>
> This is a very good point. <br>
> <br>
> There's already one precedent case how that could be handled: The<br>
> powerpc/mvme3100 BSP. That BSP also initializes an I2C driver with a<br>
> RTEMS_SYSINIT_ITEM. The return value is ignored too. But the<br>
> BSP_i2c_initialize does print error messages.<br>
> <br>
> I would suggest that here too: Check the return value of<br>
> am335x_i2c_bus_register in your new bbb_i2c_0_initialize and at least<br>
> print an error message that i2c0 couldn't be initialized. Most likely<br>
> you should use printk here because it's not sure whether printf would<br>
> work already.<br>
> <br>
> Will it be sufficient to do this:<br>
> ```<br>
> static void bbb_i2c_0_initialize(void)<br>
> {<br>
> int err;<br>
> <br>
> err = am335x_i2c_bus_register(BBB_I2C_0_BUS_PATH,<br>
> AM335X_I2C0_BASE,<br>
> I2C_BUS_CLOCK_DEFAULT,<br>
> BBB_I2C0_IRQ);<br>
> if (err != 0){<br>
> printk("i2c-0 device could not be registered");<br>
> }<br>
> }<br>
> ``` <br>
<br>
You might could add the value of `err` to the output (just at the end in<br>
brackets or similar). Sometimes it is helpful to find the reason.<br>
Otherwise I'm OK with it.<br><br></blockquote><div>Fixed it in the attached v3 of the patch. </div></div></div>