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 Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux