On Mon, 9 Mar 2009, Andy Walls wrote: > On Mon, 2009-03-09 at 08:16 +0100, Hans Verkuil wrote: > > On Monday 09 March 2009 02:07:33 Trent Piepho wrote: > > > > > > Switching on the whole ioctl makes the switch statement a lot less > > > efficient. I'd rather just put a if (_IOC_TYPE(cmd) != 'V') return 0; in > > > there. That should fix the non-v4l2 ioctls, right? > > > > That was my first thought as well, but I realized that this is one area > > where you really do not want to take any risk. > > > > Personally I think this code is overoptimization. In my view the performance > > advantage is minimal while reducing the readability of the code. > > On x86_64, I counted 3 bytes per switch case saved. For the 22 switch > cases: a total of 66 bytes saved. If compiled code size reduction is > the efficiency measure, I suspect there are probably lower hanging fruit > to be picked. True, it's no big gain. On x86-32 it's 4 bytes per case, but adding in the "if(_IOC_TYPE..." code ends up eating most of the savings, for a net savings of 16 bytes total. I suppose using the full cmd does have an advantage if any of the v4l2 ioctls ever get a new version with a different struct size but the same NR value. Or if this code gets used for any non-'V' ioctls. So Mauro, please go ahead can take Hans' patch, but could you merge it at git, so there is no broken window between the two? -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html