i2c: Make i2c_unregister_device() NULL-aware
Subsystems (17)
PATCH 1/15 i2c: Make i2c_unregister_device() NULL-aware
It's a common pattern to be NULL-aware when freeing resources.
--- drivers/i2c/i2c-core-base.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/i2c/i2c-core-base.c +3 -2
@@ -808,6 +808,8 @@ EXPORT_SYMBOL_GPL(i2c_new_device);*/ void i2c_unregister_device (struct i2c_client *client) { +if (!client) +return ;if (client->dev.of_node)of_node_clear_flag (client->dev.of_node,OF_POPULATED );if (ACPI_COMPANION (&client->dev))
@@ -1417,8 +1419,7 @@ static int __unregister_client(struct device *dev, void *dummy)static int __unregister_dummy (struct device *dev,void *dummy) {struct i2c_client *client =i2c_verify_client (dev); -if (client) -i2c_unregister_device (client); +i2c_unregister_device (client);return 0 ; }
Signature · 1 line
2.14.2
PATCH 2/15 i2c: taos-evm: Remove duplicate NULL check
Since i2c_unregister_device() became NULL-aware we may remove duplicate NULL check.
--- drivers/i2c/busses/i2c-taos-evm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/i2c/busses/i2c-taos-evm.c +1 -2
@@ -282,8 +282,7 @@ static void taos_disconnect(struct serio *serio) {struct taos_data *taos =serio_get_drvdata (serio); -if (taos->client) -i2c_unregister_device (taos->client); +i2c_unregister_device (taos->client);i2c_del_adapter (&taos->adapter);serio_close (serio);kfree (taos);
Signature · 1 line
2.14.2
Re: [PATCH v1 02/15] i2c: taos-evm: Remove duplicate NULL check
Quoted 14 lines · Andy Shevchenko
Since
i2c_unregister_device()became NULL-aware we may remove duplicate NULL check.Cc Jean Delvare <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>--- drivers/i2c/busses/i2c-taos-evm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/i2c/busses/i2c-taos-evm.c +0
-0
drivers/i2c/busses/i2c-taos-evm.c static void taos_disconnect(struct serio *serio) · line 288
Quoted 9 lines
drivers/i2c/busses/i2c-taos-evm.c +1
-2@@ -282,8 +282,7 @@ static void taos_disconnect(struct serio *serio) {struct taos_data *taos =serio_get_drvdata (serio); -if (taos->client) -i2c_unregister_device (taos->client); +i2c_unregister_device (taos->client);i2c_del_adapter (&taos->adapter);serio_close (serio);kfree (taos);
Signature · 2 lines
Jean Delvare SUSE L3 Support
Wolfram Sang
AppliedRe: [PATCH v1 02/15] i2c: taos-evm: Remove duplicate NULL check
In reply to Andy ShevchenkoQuoted 5 lines · Andy Shevchenko
Since
i2c_unregister_device()became NULL-aware we may remove duplicate NULL check.Cc Jean Delvare <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>
Applied to for-next, thanks!
PATCH 3/15 i2c: thunderx: Remove duplicate NULL check
In reply to Andy ShevchenkoSince i2c_unregister_device() became NULL-aware we may remove duplicate NULL check.
--- drivers/i2c/busses/i2c-thunderx-pcidrv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/i2c/busses/i2c-thunderx-pcidrv.c +1 -2
@@ -149,8 +149,7 @@ static int thunder_i2c_smbus_setup(struct octeon_i2c *i2c,static void thunder_i2c_smbus_remove (struct octeon_i2c *i2c) { -if (i2c->ara) -i2c_unregister_device (i2c->ara); +i2c_unregister_device (i2c->ara); } static int thunder_i2c_probe_pci(struct pci_dev *pdev,
Signature · 1 line
2.14.2
Wolfram Sang
AppliedRe: [PATCH v1 03/15] i2c: thunderx: Remove duplicate NULL check
Quoted 6 lines · Andy Shevchenko
Since
i2c_unregister_device()became NULL-aware we may remove duplicate NULL check.Cc Jan Glauber <[email protected]>Cc David Daney <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>
Applied to for-next, thanks!
PATCH 4/15 ipmi_ssif: Remove duplicate NULL check
In reply to Andy ShevchenkoSince i2c_unregister_device() became NULL-aware we may remove duplicate NULL check.
--- drivers/char/ipmi/ipmi_ssif.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/char/ipmi/ipmi_ssif.c +1 -2
@@ -2072,8 +2072,7 @@ static int ssif_platform_remove(struct platform_device *dev)return 0 ;mutex_lock (&ssif_infos_mutex); -if (addr_info->client) -i2c_unregister_device (addr_info->client); +i2c_unregister_device (addr_info->client);list_del (&addr_info->link);kfree (addr_info);
Signature · 6 lines
2.14.2 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Re: [PATCH v1 04/15] ipmi_ssif: Remove duplicate NULL check
Quoted 3 lines · Andy Shevchenko
Since
i2c_unregister_device()became NULL-aware we may remove duplicate
NULL check.
Anyone?
Wolfram, I think if no one picks this soon it's quite safe to push it through i2c tree.
Quoted 23 lines
Cc Corey Minyard <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>--- drivers/char/ipmi/ipmi_ssif.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/char/ipmi/ipmi_ssif.c +1
-2@@ -2072,8 +2072,7 @@ static int ssif_platform_remove(struct platform_device *dev)return 0 ;mutex_lock (&ssif_infos_mutex); -if (addr_info->client) -i2c_unregister_device (addr_info->client); +i2c_unregister_device (addr_info->client);list_del (&addr_info->link);
kfree(addr_info);
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
Re: [PATCH v1 04/15] ipmi_ssif: Remove duplicate NULL check
Quoted 9 lines · Andy Shevchenko
Quoted 3 lines · Andy Shevchenko
Since
i2c_unregister_device()became NULL-aware we may remove duplicate
NULL check.Anyone?
Wolfram, I think if no one picks this soon it's quite safe to push it through i2c tree.
I'll pick this up for the next release.
-corey
Quoted 16 lines
Quoted 16 lines
Cc Corey Minyard <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>--- drivers/char/ipmi/ipmi_ssif.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/char/ipmi/ipmi_ssif.c +0
-0@@ -2072,8 +2072,7 @@ static int ssif_platform_remove(struct platform_device *dev)return 0 ;
Quoted 7 lines
Quoted 7 lines
drivers/char/ipmi/ipmi_ssif.c +1
-2mutex_lock (&ssif_infos_mutex); -if (addr_info->client) -i2c_unregister_device (addr_info->client); +i2c_unregister_device (addr_info->client);list_del (&addr_info->link);kfree(addr_info);
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Re: [PATCH v1 04/15] ipmi_ssif: Remove duplicate NULL check
Quoted 6 lines · Corey Minyard
Quoted 5 lines · Andy Shevchenko
Quoted 3 lines · Andy Shevchenko
Since
i2c_unregister_device()became NULL-aware we may remove duplicate
NULL check.
Quoted 8 lines
Quoted 6 lines
Anyone?
Wolfram, I think if no one picks this soon it's quite safe to push it
through i2c tree.I'll pick this up for the next release.
Thanks!
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
PATCH 5/15 gpio: max732x: Remove duplicate NULL check
In reply to Andy ShevchenkoSince i2c_unregister_device() became NULL-aware we may remove duplicate NULL check.
--- drivers/gpio/gpio-max732x.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpio/gpio-max732x.c +2 -4
@@ -709,8 +709,7 @@ static int max732x_probe(struct i2c_client *client,return 0 ; out_failed: -if (chip->client_dummy) -i2c_unregister_device (chip->client_dummy); +i2c_unregister_device (chip->client_dummy);return ret; }
@@ -734,8 +733,7 @@ static int max732x_remove(struct i2c_client *client)gpiochip_remove (&chip->gpio_chip);/* unregister any dummy i2c_client */ -if (chip->client_dummy) -i2c_unregister_device (chip->client_dummy); +i2c_unregister_device (chip->client_dummy);return 0 ; }
Signature · 1 line
2.14.2
Re: [PATCH v1 05/15] gpio: max732x: Remove duplicate NULL check
Quoted 6 lines · Andy Shevchenko
Since
i2c_unregister_device()became NULL-aware we may remove duplicate NULL check.Cc Linus Walleij <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>
For some reason this was missed since halloween.
Patch applied.
Yours,
Linus Walleij
PATCH 6/15 drm/bridge: analogix-anx78xx: Remove duplicate NULL check
In reply to Andy ShevchenkoSince i2c_unregister_device() became NULL-aware we may remove duplicate NULL check.
--- drivers/gpu/drm/bridge/analogix-anx78xx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/bridge/analogix-anx78xx.c +1 -2
@@ -1303,8 +1303,7 @@ static void unregister_i2c_dummy_clients(struct anx78xx *anx78xx)unsigned int i;for (i =0 ; i <ARRAY_SIZE (anx78xx->i2c_dummy); i++) -if (anx78xx->i2c_dummy[i]) -i2c_unregister_device (anx78xx->i2c_dummy[i]); +i2c_unregister_device (anx78xx->i2c_dummy[i]); }static const struct regmap_config anx78xx_regmap_config = {
Signature · 1 line
2.14.2
PATCH 7/15 drm/i2c/sil164: Remove duplicate NULL check
In reply to Andy ShevchenkoSince i2c_unregister_device() became NULL-aware we may remove duplicate NULL check.
--- drivers/gpu/drm/i2c/sil164_drv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/i2c/sil164_drv.c +1 -2
@@ -326,8 +326,7 @@ sil164_encoder_destroy(struct drm_encoder *encoder) {struct sil164_priv *priv =to_sil164_priv (encoder); -if (priv->duallink_slave) -i2c_unregister_device (priv->duallink_slave); +i2c_unregister_device (priv->duallink_slave);kfree (priv);drm_i2c_encoder_destroy (encoder);
Signature · 1 line
2.14.2
PATCH 8/15 drm/i2c: tda998x: Remove duplicate NULL check
In reply to Andy ShevchenkoSince i2c_unregister_device() became NULL-aware we may remove duplicate NULL check.
--- drivers/gpu/drm/i2c/tda998x_drv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/i2c/tda998x_drv.c +1 -2
@@ -1602,8 +1602,7 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv)/* if encoder_init fails, the encoder slave is never registered, * so cleanup here: */ -if (priv->cec) -i2c_unregister_device (priv->cec); +i2c_unregister_device (priv->cec);return -ENXIO ; }
Signature · 1 line
2.14.2
Re: [PATCH v1 08/15] drm/i2c: tda998x: Remove duplicate NULL check
Quoted 4 lines · Andy Shevchenko
Since
i2c_unregister_device()became NULL-aware we may remove duplicate NULL check.Cc Russell King <[email protected]>
Thanks.
Quoted 24 lines
Cc David Airlie <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>--- drivers/gpu/drm/i2c/tda998x_drv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/gpu/drm/i2c/tda998x_drv.c +1
-2@@ -1602,8 +1602,7 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv)/* if encoder_init fails, the encoder slave is never registered, * so cleanup here: */ -if (priv->cec) -i2c_unregister_device (priv->cec); +i2c_unregister_device (priv->cec);return -ENXIO ; }Signature · 1 line
2.14.2
Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up According to speedtest.net: 8.21Mbps down 510kbps up
Re: [PATCH v1 08/15] drm/i2c: tda998x: Remove duplicate NULL check
Quoted 7 lines · Russell King - ARM Linux
Quoted 4 lines · Andy Shevchenko
Since
i2c_unregister_device()became NULL-aware we may remove duplicate NULL check.Cc Russell King <[email protected]>Acked-by Russell King <[email protected]>
commit 7b43dd19c9b1 ("i2c: Make i2c_unregister_device() NULL-aware") seems to be the thing that makes this possible. So these three patches lgtm -> pushed to drm-misc-next.
Quoted 36 lines
Thanks.
Quoted 24 lines
Cc David Airlie <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>--- drivers/gpu/drm/i2c/tda998x_drv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/gpu/drm/i2c/tda998x_drv.c +1
-2@@ -1602,8 +1602,7 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv)/* if encoder_init fails, the encoder slave is never registered, * so cleanup here: */ -if (priv->cec) -i2c_unregister_device (priv->cec); +i2c_unregister_device (priv->cec);return -ENXIO ; }Signature · 1 line
2.14.2Signature · 7 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up According to speedtest.net: 8.21Mbps down 510kbps up _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 2 lines
Ville Syrjälä Intel OTC
Re: [PATCH v1 08/15] drm/i2c: tda998x: Remove duplicate NULL check
Quoted 7 lines · Ville Syrjälä
Quoted 5 lines · Russell King - ARM Linux
Quoted 4 lines · Andy Shevchenko
Since
i2c_unregister_device()became NULL-aware we may remove duplicate
NULL check.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Cc Russell King <[email protected]>Acked-by Russell King <[email protected]>commit
7b43dd19c9b1("i2c: Makei2c_unregister_device()NULL-aware") seems to be the thing that makes this possible. So these three patches lgtm -> pushed to drm-misc-next.
Thanks, Ville!
Quoted 42 lines
Quoted 40 lines
Thanks.
Quoted 27 lines
Cc David Airlie <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>--- drivers/gpu/drm/i2c/tda998x_drv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/gpu/drm/i2c/tda998x_drv.c +1
-2@@ -1602,8 +1602,7 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv)/* if encoder_init fails, the encoder slave is never registered, * so cleanup here: */ -if (priv->cec) -i2c_unregister_device (priv->cec); +i2c_unregister_device (priv->cec);return -ENXIO ;}
Signature · 1 line
2.14.2Signature · 8 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up According to speedtest.net: 8.21Mbps down 510kbps up _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
PATCH 9/15 hwmon: (w83781d) Remove duplicate NULL check
In reply to Andy ShevchenkoSince i2c_unregister_device() became NULL-aware we may remove duplicate NULL check.
--- drivers/hwmon/w83781d.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/hwmon/w83781d.c +4 -8
@@ -1246,10 +1246,8 @@ w83781d_probe(struct i2c_client *client, const struct i2c_device_id *id) exit_remove_files:w83781d_remove_files (dev); -if (data->lm75[0 ]) -i2c_unregister_device (data->lm75[0 ]); -if (data->lm75[1 ]) -i2c_unregister_device (data->lm75[1 ]); +i2c_unregister_device (data->lm75[0 ]); +i2c_unregister_device (data->lm75[1 ]);return err; }
@@ -1262,10 +1260,8 @@ w83781d_remove(struct i2c_client *client)hwmon_device_unregister (data->hwmon_dev);w83781d_remove_files (dev); -if (data->lm75[0 ]) -i2c_unregister_device (data->lm75[0 ]); -if (data->lm75[1 ]) -i2c_unregister_device (data->lm75[1 ]); +i2c_unregister_device (data->lm75[0 ]); +i2c_unregister_device (data->lm75[1 ]);return 0 ; }
Signature · 1 line
2.14.2
Re: [PATCH v1 09/15] hwmon: (w83781d) Remove duplicate NULL check
Quoted 31 lines · Andy Shevchenko
Since
i2c_unregister_device()became NULL-aware we may remove duplicate NULL check.Cc Jean Delvare <[email protected]>Cc Guenter Roeck <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>--- drivers/hwmon/w83781d.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)drivers/hwmon/w83781d.c +2
-4@@ -1246,10 +1246,8 @@ w83781d_probe(struct i2c_client *client, const struct i2c_device_id *id) exit_remove_files:w83781d_remove_files (dev); -if (data->lm75[0 ]) -i2c_unregister_device (data->lm75[0 ]); -if (data->lm75[1 ]) -i2c_unregister_device (data->lm75[1 ]); +i2c_unregister_device (data->lm75[0 ]); +i2c_unregister_device (data->lm75[1 ]);return err; }@@ -1262,10 +1260,8 @@ w83781d_remove(struct i2c_client *client)hwmon_device_unregister (data->hwmon_dev);w83781d_remove_files (dev);
drivers/hwmon/w83781d.c w83781d_remove(struct i2c_client *client) · line 1267
Quoted 10 lines
drivers/hwmon/w83781d.c +2
-4-if (data->lm75[0 ]) -i2c_unregister_device (data->lm75[0 ]); -if (data->lm75[1 ]) -i2c_unregister_device (data->lm75[1 ]); +i2c_unregister_device (data->lm75[0 ]); +i2c_unregister_device (data->lm75[1 ]);return 0 ; }
Signature · 2 lines
Jean Delvare SUSE L3 Support
Guenter Roeck
maintainerRe: [PATCH v1 09/15] hwmon: (w83781d) Remove duplicate NULL check
In reply to Andy ShevchenkoQuoted 7 lines · Andy Shevchenko
Since
i2c_unregister_device()became NULL-aware we may remove duplicate NULL check.Cc Jean Delvare <[email protected]>Cc Guenter Roeck <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>
I'll keep the hwmon patches from this series on hold until the changes to i2c_unregister_device make it into the tree. Ok with me if the patches are merged through some other tree.
Guenter
Quoted 35 lines
--- drivers/hwmon/w83781d.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)drivers/hwmon/w83781d.c +4
-8@@ -1246,10 +1246,8 @@ w83781d_probe(struct i2c_client *client, const struct i2c_device_id *id) exit_remove_files:w83781d_remove_files (dev); -if (data->lm75[0 ]) -i2c_unregister_device (data->lm75[0 ]); -if (data->lm75[1 ]) -i2c_unregister_device (data->lm75[1 ]); +i2c_unregister_device (data->lm75[0 ]); +i2c_unregister_device (data->lm75[1 ]);return err; }@@ -1262,10 +1260,8 @@ w83781d_remove(struct i2c_client *client)hwmon_device_unregister (data->hwmon_dev);w83781d_remove_files (dev); -if (data->lm75[0 ]) -i2c_unregister_device (data->lm75[0 ]); -if (data->lm75[1 ]) -i2c_unregister_device (data->lm75[1 ]); +i2c_unregister_device (data->lm75[0 ]); +i2c_unregister_device (data->lm75[1 ]);return 0 ; }
Re: [PATCH v1 09/15] hwmon: (w83781d) Remove duplicate NULL check
Quoted 10 lines · Guenter Roeck
Quoted 8 lines · Andy Shevchenko
Since
i2c_unregister_device()became NULL-aware we may remove duplicate
NULL check.Cc Jean Delvare <[email protected]>Cc Guenter Roeck <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>
Quoted 4 lines
I'll keep the hwmon patches from this series on hold until the changes to
i2c_unregister_devicemake it into the tree. Ok with me if the patches
are merged through some other tree.
Wolfram, what do you think?
At least we have couple of options:
- apply i2c core patch now and wait until rc1
- apply everything through i2c tree
- ...
Quoted 41 lines
Guenter
Quoted 36 lines
--- drivers/hwmon/w83781d.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)drivers/hwmon/w83781d.c +4
-8@@ -1246,10 +1246,8 @@ w83781d_probe(struct i2c_client *client, const struct i2c_device_id *id) exit_remove_files:w83781d_remove_files (dev ); -if (data->lm75[0 ]) -i2c_unregister_device (data->lm75[0 ]); -if (data->lm75[1 ]) -i2c_unregister_device (data->lm75[1 ]); +i2c_unregister_device (data->lm75[0 ]); +i2c_unregister_device (data->lm75[1 ]);return err; }@@ -1262,10 +1260,8 @@ w83781d_remove(struct i2c_client *client)hwmon_device_unregister (data->hwmon_dev);w83781d_remove_files (dev); -if (data->lm75[0 ]) -i2c_unregister_device (data->lm75[0 ]); -if (data->lm75[1 ]) -i2c_unregister_device (data->lm75[1 ]); +i2c_unregister_device (data->lm75[0 ]); +i2c_unregister_device (data->lm75[1 ]);return 0 ; }
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
Wolfram Sang
Acked-byRe: [PATCH v1 09/15] hwmon: (w83781d) Remove duplicate NULL check
Quoted 6 lines
Quoted 5 lines
I'll keep the hwmon patches from this series on hold until the changes to
i2c_unregister_devicemake it into the tree. Ok with me if the patches
are merged through some other tree.
Quoted 6 lines
Wolfram, what do you think?
At least we have couple of options:
- apply i2c core patch now and wait until rc1
- apply everything through i2c tree
- ...
I just applied patches 1-3 to my for-4.15 branch. So, other subsystems could pick it at rc1 time. If you are going to resend, you can add my
to all of the remaining patches.
Re: [PATCH v1 09/15] hwmon: (w83781d) Remove duplicate NULL check
Quoted 13 lines · Wolfram Sang
Quoted 6 lines
Quoted 5 lines
I'll keep the hwmon patches from this series on hold until the changes
toi2c_unregister_devicemake it into the tree. Ok with me if the patches
are merged through some other tree.Quoted 6 lines
Wolfram, what do you think?
At least we have couple of options:
- apply i2c core patch now and wait until rc1
- apply everything through i2c tree
- ...
Quoted 6 lines
I just applied patches 1-3 to my for-4.15 branch. So, other subsystems could pick it at rc1 time. If you are going to resend, you can add my
Acked-by Wolfram Sang <[email protected]>to all of the remaining patches.
Noted, thanks!
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
A message that is not in the archive (sent off-list or not yet received): 20171031142149.32512-1-andriy.shevchenko-VuQAYsv1563Yd54FQh9/[email protected]
PATCH 13/15 iio: imu: inv_mpu6050: Remove duplicate NULL check
Since i2c_unregister_device() became NULL-aware we may remove duplicate NULL check.
--- drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c +1 -2
@@ -196,8 +196,7 @@ void inv_mpu_acpi_delete_mux_client(struct i2c_client *client) {struct inv_mpu6050_state *st =iio_priv (dev_get_drvdata (&client->dev)); -if (st->mux_client) -i2c_unregister_device (st->mux_client); +i2c_unregister_device (st->mux_client); }#else
Signature · 1 line
2.14.2
Re: [PATCH v1 13/15] iio: imu: inv_mpu6050: Remove duplicate NULL check
Quoted 9 lines · On Tue, 31 Oct 2017 16:21:47 +0200 Andy Shevchenko…
Since
i2c_unregister_device()became NULL-aware we may remove duplicate NULL check.Cc Jonathan Cameron <[email protected]>Cc Hartmut Knaack <[email protected]>Cc Lars-Peter Clausen <[email protected]>Cc Peter Meerwald-Stadler <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>
Applied to the togreg branch of iio.git. Thanks,
Jonathan
Quoted 18 lines
--- drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c +1
-2@@ -196,8 +196,7 @@ void inv_mpu_acpi_delete_mux_client(struct i2c_client *client) {struct inv_mpu6050_state *st =iio_priv (dev_get_drvdata (&client->dev)); -if (st->mux_client) -i2c_unregister_device (st->mux_client); +i2c_unregister_device (st->mux_client); }#else
PATCH 10/15 hwmon: (w83791d) Remove duplicate NULL check
In reply to Andy ShevchenkoSince i2c_unregister_device() became NULL-aware we may remove duplicate NULL check.
--- drivers/hwmon/w83791d.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
drivers/hwmon/w83791d.c +5 -10
@@ -1316,8 +1316,7 @@ static int w83791d_detect_subclients(struct i2c_client *client)/* Undo inits in case of errors */ error_sc_1: -if (data->lm75[0 ] !=NULL ) -i2c_unregister_device (data->lm75[0 ]); +i2c_unregister_device (data->lm75[0 ]); error_sc_0:return err; }
@@ -1434,10 +1433,8 @@ static int w83791d_probe(struct i2c_client *client, error4:sysfs_remove_group (&client->dev.kobj, &w83791d_group); error3: -if (data->lm75[0 ] !=NULL ) -i2c_unregister_device (data->lm75[0 ]); -if (data->lm75[1 ] !=NULL ) -i2c_unregister_device (data->lm75[1 ]); +i2c_unregister_device (data->lm75[0 ]); +i2c_unregister_device (data->lm75[1 ]);return err; }
@@ -1448,10 +1445,8 @@ static int w83791d_remove(struct i2c_client *client)hwmon_device_unregister (data->hwmon_dev);sysfs_remove_group (&client->dev.kobj, &w83791d_group); -if (data->lm75[0 ] !=NULL ) -i2c_unregister_device (data->lm75[0 ]); -if (data->lm75[1 ] !=NULL ) -i2c_unregister_device (data->lm75[1 ]); +i2c_unregister_device (data->lm75[0 ]); +i2c_unregister_device (data->lm75[1 ]);return 0 ; }
Signature · 1 line
2.14.2
Re: [PATCH v1 10/15] hwmon: (w83791d) Remove duplicate NULL check
Quoted 42 lines · Andy Shevchenko
Since
i2c_unregister_device()became NULL-aware we may remove duplicate NULL check.Cc Marc Hulsman <[email protected]>Cc Jean Delvare <[email protected]>Cc Guenter Roeck <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>--- drivers/hwmon/w83791d.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)drivers/hwmon/w83791d.c +3
-6@@ -1316,8 +1316,7 @@ static int w83791d_detect_subclients(struct i2c_client *client)/* Undo inits in case of errors */ error_sc_1: -if (data->lm75[0 ] !=NULL ) -i2c_unregister_device (data->lm75[0 ]); +i2c_unregister_device (data->lm75[0 ]); error_sc_0:return err; }@@ -1434,10 +1433,8 @@ static int w83791d_probe(struct i2c_client *client, error4:sysfs_remove_group (&client->dev.kobj, &w83791d_group); error3: -if (data->lm75[0 ] !=NULL ) -i2c_unregister_device (data->lm75[0 ]); -if (data->lm75[1 ] !=NULL ) -i2c_unregister_device (data->lm75[1 ]); +i2c_unregister_device (data->lm75[0 ]); +i2c_unregister_device (data->lm75[1 ]);return err; }@@ -1448,10 +1445,8 @@ static int w83791d_remove(struct i2c_client *client)hwmon_device_unregister (data->hwmon_dev);sysfs_remove_group (&client->dev.kobj, &w83791d_group);
drivers/hwmon/w83791d.c static int w83791d_remove(struct i2c_client *client) · line 1452
Quoted 10 lines
drivers/hwmon/w83791d.c +2
-4-if (data->lm75[0 ] !=NULL ) -i2c_unregister_device (data->lm75[0 ]); -if (data->lm75[1 ] !=NULL ) -i2c_unregister_device (data->lm75[1 ]); +i2c_unregister_device (data->lm75[0 ]); +i2c_unregister_device (data->lm75[1 ]);return 0 ; }
Signature · 2 lines
Jean Delvare SUSE L3 Support
PATCH 11/15 hwmon: (w83792d) Remove duplicate NULL check
In reply to Andy ShevchenkoSince i2c_unregister_device() became NULL-aware we may remove duplicate NULL check.
--- drivers/hwmon/w83792d.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
drivers/hwmon/w83792d.c +5 -10
@@ -981,8 +981,7 @@ w83792d_detect_subclients(struct i2c_client *new_client)/* Undo inits in case of errors */ ERROR_SC_1: -if (data->lm75[0 ] !=NULL ) -i2c_unregister_device (data->lm75[0 ]); +i2c_unregister_device (data->lm75[0 ]); ERROR_SC_0:return err; }
@@ -1456,10 +1455,8 @@ w83792d_probe(struct i2c_client *client, const struct i2c_device_id *id)for (i =0 ; i <ARRAY_SIZE (w83792d_group_fan); i++)sysfs_remove_group (&dev->kobj, &w83792d_group_fan[i]); exit_i2c_unregister: -if (data->lm75[0 ] !=NULL ) -i2c_unregister_device (data->lm75[0 ]); -if (data->lm75[1 ] !=NULL ) -i2c_unregister_device (data->lm75[1 ]); +i2c_unregister_device (data->lm75[0 ]); +i2c_unregister_device (data->lm75[1 ]);return err; }
@@ -1475,10 +1472,8 @@ w83792d_remove(struct i2c_client *client)sysfs_remove_group (&client->dev.kobj, &w83792d_group_fan[i]); -if (data->lm75[0 ] !=NULL ) -i2c_unregister_device (data->lm75[0 ]); -if (data->lm75[1 ] !=NULL ) -i2c_unregister_device (data->lm75[1 ]); +i2c_unregister_device (data->lm75[0 ]); +i2c_unregister_device (data->lm75[1 ]);return 0 ; }
Signature · 1 line
2.14.2
Re: [PATCH v1 11/15] hwmon: (w83792d) Remove duplicate NULL check
Quoted 41 lines · Andy Shevchenko
Since
i2c_unregister_device()became NULL-aware we may remove duplicate NULL check.Cc Jean Delvare <[email protected]>Cc Guenter Roeck <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>--- drivers/hwmon/w83792d.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)drivers/hwmon/w83792d.c +3
-6@@ -981,8 +981,7 @@ w83792d_detect_subclients(struct i2c_client *new_client)/* Undo inits in case of errors */ ERROR_SC_1: -if (data->lm75[0 ] !=NULL ) -i2c_unregister_device (data->lm75[0 ]); +i2c_unregister_device (data->lm75[0 ]); ERROR_SC_0:return err; }@@ -1456,10 +1455,8 @@ w83792d_probe(struct i2c_client *client, const struct i2c_device_id *id)for (i =0 ; i <ARRAY_SIZE (w83792d_group_fan); i++)sysfs_remove_group (&dev->kobj, &w83792d_group_fan[i]); exit_i2c_unregister: -if (data->lm75[0 ] !=NULL ) -i2c_unregister_device (data->lm75[0 ]); -if (data->lm75[1 ] !=NULL ) -i2c_unregister_device (data->lm75[1 ]); +i2c_unregister_device (data->lm75[0 ]); +i2c_unregister_device (data->lm75[1 ]);return err; }@@ -1475,10 +1472,8 @@ w83792d_remove(struct i2c_client *client)sysfs_remove_group (&client->dev.kobj, &w83792d_group_fan[i]);
drivers/hwmon/w83792d.c w83792d_remove(struct i2c_client *client) · line 1479
Quoted 10 lines
drivers/hwmon/w83792d.c +2
-4-if (data->lm75[0 ] !=NULL ) -i2c_unregister_device (data->lm75[0 ]); -if (data->lm75[1 ] !=NULL ) -i2c_unregister_device (data->lm75[1 ]); +i2c_unregister_device (data->lm75[0 ]); +i2c_unregister_device (data->lm75[1 ]);return 0 ; }
Signature · 2 lines
Jean Delvare SUSE L3 Support
PATCH 12/15 hwmon: (w83793) Remove duplicate NULL check
In reply to Andy ShevchenkoSince i2c_unregister_device() became NULL-aware we may remove duplicate NULL check.
--- drivers/hwmon/w83793.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
drivers/hwmon/w83793.c +5 -10
@@ -1564,10 +1564,8 @@ static int w83793_remove(struct i2c_client *client)for (i =0 ; i <ARRAY_SIZE (w83793_temp); i++)device_remove_file (dev, &w83793_temp[i].dev_attr); -if (data->lm75[0 ] !=NULL ) -i2c_unregister_device (data->lm75[0 ]); -if (data->lm75[1 ] !=NULL ) -i2c_unregister_device (data->lm75[1 ]); +i2c_unregister_device (data->lm75[0 ]); +i2c_unregister_device (data->lm75[1 ]);/* Decrease data reference counter */ mutex_lock (&watchdog_data_mutex);
@@ -1625,8 +1623,7 @@ w83793_detect_subclients(struct i2c_client *client)/* Undo inits in case of errors */ ERROR_SC_1: -if (data->lm75[0 ] !=NULL ) -i2c_unregister_device (data->lm75[0 ]); +i2c_unregister_device (data->lm75[0 ]); ERROR_SC_0:return err; }
@@ -1962,10 +1959,8 @@ static int w83793_probe(struct i2c_client *client,for (i =0 ; i <ARRAY_SIZE (w83793_temp); i++)device_remove_file (dev, &w83793_temp[i].dev_attr); -if (data->lm75[0 ] !=NULL ) -i2c_unregister_device (data->lm75[0 ]); -if (data->lm75[1 ] !=NULL ) -i2c_unregister_device (data->lm75[1 ]); +i2c_unregister_device (data->lm75[0 ]); +i2c_unregister_device (data->lm75[1 ]); free_mem:kfree (data); exit:
Signature · 1 line
2.14.2
Re: [PATCH v1 12/15] hwmon: (w83793) Remove duplicate NULL check
Quoted 42 lines · Andy Shevchenko
Since
i2c_unregister_device()became NULL-aware we may remove duplicate NULL check.Cc Rudolf Marek <[email protected]>Cc Jean Delvare <[email protected]>Cc Guenter Roeck <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>--- drivers/hwmon/w83793.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)drivers/hwmon/w83793.c +3
-6@@ -1564,10 +1564,8 @@ static int w83793_remove(struct i2c_client *client)for (i =0 ; i <ARRAY_SIZE (w83793_temp); i++)device_remove_file (dev, &w83793_temp[i].dev_attr); -if (data->lm75[0 ] !=NULL ) -i2c_unregister_device (data->lm75[0 ]); -if (data->lm75[1 ] !=NULL ) -i2c_unregister_device (data->lm75[1 ]); +i2c_unregister_device (data->lm75[0 ]); +i2c_unregister_device (data->lm75[1 ]);/* Decrease data reference counter */ mutex_lock (&watchdog_data_mutex);@@ -1625,8 +1623,7 @@ w83793_detect_subclients(struct i2c_client *client)/* Undo inits in case of errors */ ERROR_SC_1: -if (data->lm75[0 ] !=NULL ) -i2c_unregister_device (data->lm75[0 ]); +i2c_unregister_device (data->lm75[0 ]); ERROR_SC_0:return err; }@@ -1962,10 +1959,8 @@ static int w83793_probe(struct i2c_client *client,for (i =0 ; i <ARRAY_SIZE (w83793_temp); i++)device_remove_file (dev, &w83793_temp[i].dev_attr);
drivers/hwmon/w83793.c static int w83793_probe(struct i2c_client *client, · line 1966
Quoted 10 lines
drivers/hwmon/w83793.c +2
-4-if (data->lm75[0 ] !=NULL ) -i2c_unregister_device (data->lm75[0 ]); -if (data->lm75[1 ] !=NULL ) -i2c_unregister_device (data->lm75[1 ]); +i2c_unregister_device (data->lm75[0 ]); +i2c_unregister_device (data->lm75[1 ]); free_mem:kfree (data); exit:
Signature · 2 lines
Jean Delvare SUSE L3 Support
PATCH 14/15 media: adv7180: Remove duplicate checks
In reply to Andy ShevchenkoSince i2c_unregister_device() became NULL-aware we may remove duplicate checks.
--- drivers/media/i2c/adv7180.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/media/i2c/adv7180.c +4 -8
@@ -1366,11 +1366,9 @@ static int adv7180_probe(struct i2c_client *client, err_free_ctrl:adv7180_exit_controls (state); err_unregister_vpp_client: -if (state->chip_info->flags &ADV7180_FLAG_I2P ) -i2c_unregister_device (state->vpp_client); +i2c_unregister_device (state->vpp_client); err_unregister_csi_client: -if (state->chip_info->flags &ADV7180_FLAG_MIPI_CSI2 ) -i2c_unregister_device (state->csi_client); +i2c_unregister_device (state->csi_client);mutex_destroy (&state->mutex);return ret; }
@@ -1388,10 +1386,8 @@ static int adv7180_remove(struct i2c_client *client)media_entity_cleanup (&sd->entity);adv7180_exit_controls (state); -if (state->chip_info->flags &ADV7180_FLAG_I2P ) -i2c_unregister_device (state->vpp_client); -if (state->chip_info->flags &ADV7180_FLAG_MIPI_CSI2 ) -i2c_unregister_device (state->csi_client); +i2c_unregister_device (state->vpp_client); +i2c_unregister_device (state->csi_client);adv7180_set_power_pin (state, false);
Signature · 1 line
2.14.2
PATCH 15/15 media: i2c: adv748x: Remove duplicate NULL check
In reply to Andy ShevchenkoSince i2c_unregister_device() became NULL-aware we may remove duplicate NULL check.
--- drivers/media/i2c/adv748x/adv748x-core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/media/i2c/adv748x/adv748x-core.c +2 -4
@@ -225,10 +225,8 @@ static void adv748x_unregister_clients(struct adv748x_state *state) {unsigned int i; -for (i =1 ; i <ARRAY_SIZE (state->i2c_clients); ++i) { -if (state->i2c_clients[i]) -i2c_unregister_device (state->i2c_clients[i]); - } +for (i =1 ; i <ARRAY_SIZE (state->i2c_clients); ++i) +i2c_unregister_device (state->i2c_clients[i]); }static int adv748x_initialise_clients (struct adv748x_state *state)
Signature · 1 line
2.14.2
Re: [PATCH v1 15/15] media: i2c: adv748x: Remove duplicate NULL check
Hi Andy,
Thankyou for the patch.
Quoted 7 lines · Andy Shevchenko
Since
i2c_unregister_device()became NULL-aware we may remove duplicate NULL check.Cc Kieran Bingham <[email protected]>Cc Mauro Carvalho Chehab <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>
Quoted 22 lines
--- drivers/media/i2c/adv748x/adv748x-core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/media/i2c/adv748x/adv748x-core.c +2
-4@@ -225,10 +225,8 @@ static void adv748x_unregister_clients(struct adv748x_state *state) {unsigned int i; -for (i =1 ; i <ARRAY_SIZE (state->i2c_clients); ++i) { -if (state->i2c_clients[i]) -i2c_unregister_device (state->i2c_clients[i]); - } +for (i =1 ; i <ARRAY_SIZE (state->i2c_clients); ++i) +i2c_unregister_device (state->i2c_clients[i]); }static int adv748x_initialise_clients (struct adv748x_state *state)
Wolfram Sang
AppliedQuoted 3 lines · Andy Shevchenko
It's a common pattern to be NULL-aware when freeing resources.
Signed-off-by Andy Shevchenko <[email protected]>
Applied to for-next, thanks!