i2c: algo: bit: use str_plural helper in bit_xfer
PATCH 1/1 i2c: algo: bit: use str_plural helper in bit_xfer
Replace the manual ternary "s" pluralizations with str_plural() to simplify the code.
Signed-off-by Thorsten Blum <[email protected]>
--- drivers/i2c/algos/i2c-algo-bit.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/i2c/algos/i2c-algo-bit.c +3 -2
@@ -13,6 +13,7 @@#include <linux/delay.h> #include <linux/errno.h> #include <linux/sched.h> +#include <linux/string_choices.h> #include <linux/i2c.h> #include <linux/i2c-algo-bit.h>
@@ -562,7 +563,7 @@ static int bit_xfer(struct i2c_adapter *i2c_adap, ret =readbytes (i2c_adap, pmsg);if (ret >=1 )bit_dbg (2 , &i2c_adap->dev,"read %d byte%s\n" , - ret, ret ==1 ?"" :"s" ); + ret,str_plural (ret));if (ret < pmsg->len) {if (ret >=0 ) ret = -EIO ;
@@ -573,7 +574,7 @@ static int bit_xfer(struct i2c_adapter *i2c_adap, ret =sendbytes (i2c_adap, pmsg);if (ret >=1 )bit_dbg (2 , &i2c_adap->dev,"wrote %d byte%s\n" , - ret, ret ==1 ?"" :"s" ); + ret,str_plural (ret));if (ret < pmsg->len) {if (ret >=0 ) ret = -EIO ;
Gentle ping?
Quoted 38 lines · Thorsten Blum
Replace the manual ternary "s" pluralizations with
str_plural()to simplify the code.Signed-off-by Thorsten Blum <[email protected]>--- drivers/i2c/algos/i2c-algo-bit.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/i2c/algos/i2c-algo-bit.c +3
-2@@ -13,6 +13,7 @@#include <linux/delay.h> #include <linux/errno.h> #include <linux/sched.h> +#include <linux/string_choices.h> #include <linux/i2c.h> #include <linux/i2c-algo-bit.h> @@ -562,7 +563,7 @@ static int bit_xfer(struct i2c_adapter *i2c_adap, ret =readbytes (i2c_adap, pmsg);if (ret >=1 )bit_dbg (2 , &i2c_adap->dev,"read %d byte%s\n" , - ret, ret ==1 ?"" :"s" ); + ret,str_plural (ret));if (ret < pmsg->len) {if (ret >=0 ) ret = -EIO ;@@ -573,7 +574,7 @@ static int bit_xfer(struct i2c_adapter *i2c_adap, ret =sendbytes (i2c_adap, pmsg);if (ret >=1 )bit_dbg (2 , &i2c_adap->dev,"wrote %d byte%s\n" , - ret, ret ==1 ?"" :"s" ); + ret,str_plural (ret));if (ret < pmsg->len) {if (ret >=0 ) ret = -EIO ;
Hi Thorsten,
Quoted 4 lines · Thorsten Blum
Replace the manual ternary "s" pluralizations with
str_plural()to simplify the code.Signed-off-by Thorsten Blum <[email protected]>
merged to i2c/i2c-host.
Thanks,
Andi