Messages in this thread | | | Date | Sun, 26 Jul 2020 11:24:08 +0800 | From | Kent Gibson <> | Subject | Re: [PATCH v2 05/18] gpiolib: cdev: support GPIO_GET_LINE_IOCTL and GPIOLINE_GET_VALUES_IOCTL |
| |
On Sun, Jul 26, 2020 at 09:12:44AM +0800, Kent Gibson wrote: > On Sat, Jul 25, 2020 at 11:51:54PM +0300, Andy Shevchenko wrote: > > On Sat, Jul 25, 2020 at 7:24 AM Kent Gibson <warthog618@gmail.com> wrote: > > >
[ snip ] > > > > > +static bool padding_not_zeroed(__u32 *padding, int pad_size) > > > +{ > > > + int i, sum = 0; > > > + > > > + for (i = 0; i < pad_size; i++) > > > + sum |= padding[i]; > > > + > > > + return sum; > > > +} > > > > Reimplementation of memchr_inv() ? > > > > I was hoping to find an existing function, surely checking a region is > zeroed is a common thing, right?, so this was a place holder as much > as anything. Not sure memchr_inv fits the bill, but I'll give it a > try... >
I gave it a try. It is a good fit functionally, but in my build it results in a larger object by ~104 bytes. I assume that is because padding_not_zeroed is being inlined, and otherwise optimized, while memchr_inv calls aren't.
As such I'm inclined to leave it as is - unless there are other objections.
Cheers, Kent.
| |