Re: [PATCH v7 3/7] drivers/i2c: Add port structure to FSI algorithm

2018-05-31 Thread Eddie James
On 05/30/2018 04:16 PM, Benjamin Herrenschmidt wrote: On Wed, 2018-05-30 at 10:47 -0500, Eddie James wrote: + if (!list_empty(&i2c->ports)) { My gosh, this is done already in list_for_each*() No, list_for_each_entry does NOT check if the list is empty or if the first entry is NULL. N

Re: [PATCH v7 3/7] drivers/i2c: Add port structure to FSI algorithm

2018-05-30 Thread Andy Shevchenko
On Thu, May 31, 2018 at 1:34 AM, Benjamin Herrenschmidt wrote: > On Thu, 2018-05-31 at 00:27 +0300, Andy Shevchenko wrote: >> On Wed, May 30, 2018 at 6:47 PM, Eddie James >> wrote: >> > On 05/29/2018 06:19 PM, Andy Shevchenko wrote: >> > > On Wed, May 30, 2018 at 1:24 AM, Eddie James >> > > wro

Re: [PATCH v7 3/7] drivers/i2c: Add port structure to FSI algorithm

2018-05-30 Thread Benjamin Herrenschmidt
On Thu, 2018-05-31 at 00:27 +0300, Andy Shevchenko wrote: > On Wed, May 30, 2018 at 6:47 PM, Eddie James > wrote: > > On 05/29/2018 06:19 PM, Andy Shevchenko wrote: > > > On Wed, May 30, 2018 at 1:24 AM, Eddie James > > > wrote: > > > > static int fsi_i2c_probe(struct device *dev) > > > > {

Re: [PATCH v7 3/7] drivers/i2c: Add port structure to FSI algorithm

2018-05-30 Thread Andy Shevchenko
On Thu, May 31, 2018 at 12:27 AM, Andy Shevchenko wrote: > On Wed, May 30, 2018 at 6:47 PM, Eddie James > wrote: >> On 05/29/2018 06:19 PM, Andy Shevchenko wrote: + devm_kfree(dev, port); >>> This hurts my eyes. Why?! > >> What would you suggest instead? > Why are y

Re: [PATCH v7 3/7] drivers/i2c: Add port structure to FSI algorithm

2018-05-30 Thread Andy Shevchenko
On Wed, May 30, 2018 at 6:47 PM, Eddie James wrote: > On 05/29/2018 06:19 PM, Andy Shevchenko wrote: >> On Wed, May 30, 2018 at 1:24 AM, Eddie James >> wrote: >>> static int fsi_i2c_probe(struct device *dev) >>> { >> >> Isn't below somehow repeats of_i2c_register_devices() ? >> Why not to us

Re: [PATCH v7 3/7] drivers/i2c: Add port structure to FSI algorithm

2018-05-30 Thread Benjamin Herrenschmidt
On Wed, 2018-05-30 at 10:47 -0500, Eddie James wrote: > > > + if (!list_empty(&i2c->ports)) { > > > > My gosh, this is done already in list_for_each*() > > No, list_for_each_entry does NOT check if the list is empty or if the > first entry is NULL. NULL is never valid for a list. It does

Re: [PATCH v7 3/7] drivers/i2c: Add port structure to FSI algorithm

2018-05-30 Thread Eddie James
On 05/29/2018 06:19 PM, Andy Shevchenko wrote: On Wed, May 30, 2018 at 1:24 AM, Eddie James wrote: From: "Edward A. James" Add and initialize I2C adapters for each port on the FSI-attached I2C master. Ports for each master are defined in the devicetree. +#include +static int fsi_i2c_se

Re: [PATCH v7 3/7] drivers/i2c: Add port structure to FSI algorithm

2018-05-30 Thread Eddie James
On 05/29/2018 06:19 PM, Andy Shevchenko wrote: On Wed, May 30, 2018 at 1:24 AM, Eddie James wrote: From: "Edward A. James" Add and initialize I2C adapters for each port on the FSI-attached I2C master. Ports for each master are defined in the devicetree. +#include +static int fsi_i2c_se

Re: [PATCH v7 3/7] drivers/i2c: Add port structure to FSI algorithm

2018-05-29 Thread Andy Shevchenko
On Wed, May 30, 2018 at 1:24 AM, Eddie James wrote: > From: "Edward A. James" > > Add and initialize I2C adapters for each port on the FSI-attached I2C > master. Ports for each master are defined in the devicetree. > +#include > +static int fsi_i2c_set_port(struct fsi_i2c_port *port) > +{ > +

[PATCH v7 3/7] drivers/i2c: Add port structure to FSI algorithm

2018-05-29 Thread Eddie James
From: "Edward A. James" Add and initialize I2C adapters for each port on the FSI-attached I2C master. Ports for each master are defined in the devicetree. Signed-off-by: Edward A. James --- drivers/i2c/busses/i2c-fsi.c | 96 1 file changed, 96 inser