Message ID | 20180325124903.2909-2-boris.brezillon@bootlin.com |
---|---|
State | Accepted |
Headers | show |
Series | i2c: Prepare things for I3C | expand |
On Sun, Mar 25, 2018 at 02:49:01PM +0200, Boris Brezillon wrote: > The only user of i2c_board_info->archdata is the OF parsing code and it > just pass a zero-initialized object which has the same effect as leaving > ->archdata to NULL since the client object is allocated with kzalloc(). > > Get rid of this useless field. Generally positive on this one, yet would like to know how did you test there are no users left? > > Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> > --- > Changes in v4: > - patch added in v4 > --- > drivers/i2c/i2c-core-base.c | 4 ---- > drivers/i2c/i2c-core-of.c | 2 -- > include/linux/i2c.h | 2 -- > 3 files changed, 8 deletions(-) > > diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c > index c8bfe008f208..0d710eae5422 100644 > --- a/drivers/i2c/i2c-core-base.c > +++ b/drivers/i2c/i2c-core-base.c > @@ -717,10 +717,6 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info) > client->adapter = adap; > > client->dev.platform_data = info->platform_data; > - > - if (info->archdata) > - client->dev.archdata = *info->archdata; > - > client->flags = info->flags; > client->addr = info->addr; > > diff --git a/drivers/i2c/i2c-core-of.c b/drivers/i2c/i2c-core-of.c > index c405270a98b4..15bd51eca37b 100644 > --- a/drivers/i2c/i2c-core-of.c > +++ b/drivers/i2c/i2c-core-of.c > @@ -27,7 +27,6 @@ static struct i2c_client *of_i2c_register_device(struct i2c_adapter *adap, > { > struct i2c_client *client; > struct i2c_board_info info = {}; > - struct dev_archdata dev_ad = {}; > u32 addr; > int ret; > > @@ -56,7 +55,6 @@ static struct i2c_client *of_i2c_register_device(struct i2c_adapter *adap, > } > > info.addr = addr; > - info.archdata = &dev_ad; > info.of_node = of_node_get(node); > > if (of_property_read_bool(node, "host-notify")) > diff --git a/include/linux/i2c.h b/include/linux/i2c.h > index 44ad14e016b5..aeb655772ef8 100644 > --- a/include/linux/i2c.h > +++ b/include/linux/i2c.h > @@ -394,7 +394,6 @@ static inline bool i2c_detect_slave_mode(struct device *dev) { return false; } > * @addr: stored in i2c_client.addr > * @dev_name: Overrides the default <busnr>-<addr> dev_name if set > * @platform_data: stored in i2c_client.dev.platform_data > - * @archdata: copied into i2c_client.dev.archdata > * @of_node: pointer to OpenFirmware device node > * @fwnode: device node supplied by the platform firmware > * @properties: additional device properties for the device > @@ -419,7 +418,6 @@ struct i2c_board_info { > unsigned short addr; > const char *dev_name; > void *platform_data; > - struct dev_archdata *archdata; > struct device_node *of_node; > struct fwnode_handle *fwnode; > const struct property_entry *properties; > -- > 2.14.1 >
On Tue, 3 Apr 2018 15:34:27 +0200 Wolfram Sang <wsa@the-dreams.de> wrote: > On Sun, Mar 25, 2018 at 02:49:01PM +0200, Boris Brezillon wrote: > > The only user of i2c_board_info->archdata is the OF parsing code and it > > just pass a zero-initialized object which has the same effect as leaving > > ->archdata to NULL since the client object is allocated with kzalloc(). > > > > Get rid of this useless field. > > Generally positive on this one, yet would like to know how did you test > there are no users left? Just did: git grep -l i2c_board_info | xargs git grep archdata and since there's no macro to fill ->archdata, it should return all lines where board_info->archdata is set or read. For the record git grep -l i2c_board_info | xargs git grep archdata gives: drivers/i2c/i2c-core-base.c: if (info->archdata) drivers/i2c/i2c-core-base.c: client->dev.archdata = *info->archdata; drivers/i2c/i2c-core-of.c: struct dev_archdata dev_ad = {}; drivers/i2c/i2c-core-of.c: info.archdata = &dev_ad; include/linux/i2c.h: * @archdata: copied into i2c_client.dev.archdata include/linux/i2c.h: struct dev_archdata *archdata; > > > > > Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> > > --- > > Changes in v4: > > - patch added in v4 > > --- > > drivers/i2c/i2c-core-base.c | 4 ---- > > drivers/i2c/i2c-core-of.c | 2 -- > > include/linux/i2c.h | 2 -- > > 3 files changed, 8 deletions(-) > > > > diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c > > index c8bfe008f208..0d710eae5422 100644 > > --- a/drivers/i2c/i2c-core-base.c > > +++ b/drivers/i2c/i2c-core-base.c > > @@ -717,10 +717,6 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info) > > client->adapter = adap; > > > > client->dev.platform_data = info->platform_data; > > - > > - if (info->archdata) > > - client->dev.archdata = *info->archdata; > > - > > client->flags = info->flags; > > client->addr = info->addr; > > > > diff --git a/drivers/i2c/i2c-core-of.c b/drivers/i2c/i2c-core-of.c > > index c405270a98b4..15bd51eca37b 100644 > > --- a/drivers/i2c/i2c-core-of.c > > +++ b/drivers/i2c/i2c-core-of.c > > @@ -27,7 +27,6 @@ static struct i2c_client *of_i2c_register_device(struct i2c_adapter *adap, > > { > > struct i2c_client *client; > > struct i2c_board_info info = {}; > > - struct dev_archdata dev_ad = {}; > > u32 addr; > > int ret; > > > > @@ -56,7 +55,6 @@ static struct i2c_client *of_i2c_register_device(struct i2c_adapter *adap, > > } > > > > info.addr = addr; > > - info.archdata = &dev_ad; > > info.of_node = of_node_get(node); > > > > if (of_property_read_bool(node, "host-notify")) > > diff --git a/include/linux/i2c.h b/include/linux/i2c.h > > index 44ad14e016b5..aeb655772ef8 100644 > > --- a/include/linux/i2c.h > > +++ b/include/linux/i2c.h > > @@ -394,7 +394,6 @@ static inline bool i2c_detect_slave_mode(struct device *dev) { return false; } > > * @addr: stored in i2c_client.addr > > * @dev_name: Overrides the default <busnr>-<addr> dev_name if set > > * @platform_data: stored in i2c_client.dev.platform_data > > - * @archdata: copied into i2c_client.dev.archdata > > * @of_node: pointer to OpenFirmware device node > > * @fwnode: device node supplied by the platform firmware > > * @properties: additional device properties for the device > > @@ -419,7 +418,6 @@ struct i2c_board_info { > > unsigned short addr; > > const char *dev_name; > > void *platform_data; > > - struct dev_archdata *archdata; > > struct device_node *of_node; > > struct fwnode_handle *fwnode; > > const struct property_entry *properties; > > -- > > 2.14.1 > >
On Sun, Mar 25, 2018 at 02:49:01PM +0200, Boris Brezillon wrote: > The only user of i2c_board_info->archdata is the OF parsing code and it > just pass a zero-initialized object which has the same effect as leaving > ->archdata to NULL since the client object is allocated with kzalloc(). > > Get rid of this useless field. > > Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> Applied to for-next, thanks! I need some extra time to look at the other two, but I am sure we will have them ready for the next merge window. But this one shall already get some more testing...
diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c index c8bfe008f208..0d710eae5422 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c @@ -717,10 +717,6 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info) client->adapter = adap; client->dev.platform_data = info->platform_data; - - if (info->archdata) - client->dev.archdata = *info->archdata; - client->flags = info->flags; client->addr = info->addr; diff --git a/drivers/i2c/i2c-core-of.c b/drivers/i2c/i2c-core-of.c index c405270a98b4..15bd51eca37b 100644 --- a/drivers/i2c/i2c-core-of.c +++ b/drivers/i2c/i2c-core-of.c @@ -27,7 +27,6 @@ static struct i2c_client *of_i2c_register_device(struct i2c_adapter *adap, { struct i2c_client *client; struct i2c_board_info info = {}; - struct dev_archdata dev_ad = {}; u32 addr; int ret; @@ -56,7 +55,6 @@ static struct i2c_client *of_i2c_register_device(struct i2c_adapter *adap, } info.addr = addr; - info.archdata = &dev_ad; info.of_node = of_node_get(node); if (of_property_read_bool(node, "host-notify")) diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 44ad14e016b5..aeb655772ef8 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -394,7 +394,6 @@ static inline bool i2c_detect_slave_mode(struct device *dev) { return false; } * @addr: stored in i2c_client.addr * @dev_name: Overrides the default <busnr>-<addr> dev_name if set * @platform_data: stored in i2c_client.dev.platform_data - * @archdata: copied into i2c_client.dev.archdata * @of_node: pointer to OpenFirmware device node * @fwnode: device node supplied by the platform firmware * @properties: additional device properties for the device @@ -419,7 +418,6 @@ struct i2c_board_info { unsigned short addr; const char *dev_name; void *platform_data; - struct dev_archdata *archdata; struct device_node *of_node; struct fwnode_handle *fwnode; const struct property_entry *properties;
The only user of i2c_board_info->archdata is the OF parsing code and it just pass a zero-initialized object which has the same effect as leaving ->archdata to NULL since the client object is allocated with kzalloc(). Get rid of this useless field. Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> --- Changes in v4: - patch added in v4 --- drivers/i2c/i2c-core-base.c | 4 ---- drivers/i2c/i2c-core-of.c | 2 -- include/linux/i2c.h | 2 -- 3 files changed, 8 deletions(-)