RE: [PATCH v1 2/2] i2c: Introduce i2c_str_read_write() and make use of it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Andy Shevchenko
> Sent: 02 July 2022 14:59
> 
> str_read_write() returns a string literal "read" or "write" based
> on the value. It also allows to unify usage of a such in the kernel.
> 
> For i2c case introduce a wrapper that takes struct i2c_msg as parameter.
> 
...
> 
> -	DEB2("=== SLAVE ADDRESS %#04x+%c=%#04x\n",
> -	     msg->addr, msg->flags & I2C_M_RD ? 'R' : 'W', addr);
> +	DEB2("=== SLAVE ADDRESS %#04x+%s=%#04x\n", msg->addr, i2c_str_read_write(msg), addr);

You should ask yourself whether this actually makes the code more readable.
Imagine someone who is scan-reading the code to see what it does.
They're not going to be impressed when they've chased through
two searches to find out the code does.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)




[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux