Skip to contentSkip to conversation

READ/WRITE definitions in drivers/spi/spi-omap-100k.c

DISCUSSION Tejun Heo 3 participants 3 messages Oct 24, 2013 – Oct 29, 2013

lore
Share & tools
lore

Tejun Heo

author
#0 lore raw

Hey, guys.

I was modifying includes in a core header file and got duplicate macro definition warnings on READ / WRITE in drivers/spi/spi-omap-100k.c. Apparently that driver defines READ / WRITE as macros and assigns the opposite values to them from the usual READ / WRITE constants defined in include/linux/fs.h.

I just skimmed through it and there doesn't seem to be any user of the macros. Can we *please* remove these? Please note that READ / WRITE defined in include/linux/fs.h is something which is widely used throughout the kernel and there are multiple interfaces which take those constants. Re-defining them in the other way around in a driver file can lead to subtle issues and just is a bad idea. In general, refraining from using generic symbols without any qualitification in low level drivers would be nice.

Thanks.

Signature · 1 line
tejun
#1 lore raw
Quoted 8 lines · Tejun Heo

Hey, guys.

I was modifying includes in a core header file and got duplicate macro definition warnings on READ / WRITE in drivers/spi/spi-omap-100k.c. Apparently that driver defines READ / WRITE as macros and assigns the opposite values to them from the usual READ / WRITE constants defined in include/linux/fs.h.

Quoted 8 lines

I just skimmed through it and there doesn't seem to be any user of the macros. Can we *please* remove these? Please note that READ / WRITE defined in include/linux/fs.h is something which is widely used throughout the kernel and there are multiple interfaces which take those constants. Re-defining them in the other way around in a driver file can lead to subtle issues and just is a bad idea. In general, refraining from using generic symbols without any qualitification in low level drivers would be nice.

That seems like a good idea, but we better poke the people who wrote the code and the SPI maintainer :-)

Yours,
Linus Walleij

#2 lore raw
Quoted 2 lines · Linus Walleij

That seems like a good idea, but we better poke the people who wrote the code and the SPI maintainer :-)

...or send a patch?