Commit 8b5fd0f0 authored by Wolfram Sang's avatar Wolfram Sang Committed by Khalid Elmously

i2c: dev: don't start function name with 'return'

BugLink: https://bugs.launchpad.net/bugs/1883916

commit 72a71f86 upstream.

I stumbled multiple times over 'return_i2c_dev', especially before the
actual 'return res'. It makes the code hard to read, so reanme the
function to 'put_i2c_dev' which also better matches 'get_free_i2c_dev'.
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
Signed-off-by: default avatarBen Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent 01a0f226
...@@ -91,7 +91,7 @@ static struct i2c_dev *get_free_i2c_dev(struct i2c_adapter *adap) ...@@ -91,7 +91,7 @@ static struct i2c_dev *get_free_i2c_dev(struct i2c_adapter *adap)
return i2c_dev; return i2c_dev;
} }
static void return_i2c_dev(struct i2c_dev *i2c_dev) static void put_i2c_dev(struct i2c_dev *i2c_dev)
{ {
spin_lock(&i2c_dev_list_lock); spin_lock(&i2c_dev_list_lock);
list_del(&i2c_dev->list); list_del(&i2c_dev->list);
...@@ -582,7 +582,7 @@ static int i2cdev_attach_adapter(struct device *dev, void *dummy) ...@@ -582,7 +582,7 @@ static int i2cdev_attach_adapter(struct device *dev, void *dummy)
error: error:
cdev_del(&i2c_dev->cdev); cdev_del(&i2c_dev->cdev);
error_cdev: error_cdev:
return_i2c_dev(i2c_dev); put_i2c_dev(i2c_dev);
return res; return res;
} }
...@@ -599,7 +599,7 @@ static int i2cdev_detach_adapter(struct device *dev, void *dummy) ...@@ -599,7 +599,7 @@ static int i2cdev_detach_adapter(struct device *dev, void *dummy)
if (!i2c_dev) /* attach_adapter must have failed */ if (!i2c_dev) /* attach_adapter must have failed */
return 0; return 0;
return_i2c_dev(i2c_dev); put_i2c_dev(i2c_dev);
device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr)); device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr));
cdev_del(&i2c_dev->cdev); cdev_del(&i2c_dev->cdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment