Hi Andy, On Wed, May 25, 2022 at 08:14:36PM +0300, Andy Shevchenko wrote: > On Wed, May 25, 2022 at 04:01:21PM +0300, Sakari Ailus wrote: > > Unify functions reading ACPI property integer values into a single macro > > using C99 _Generic(). > > > > Also use size_t for the counter instead of int. > > Thanks for an update! > > ... > > > +#define acpi_copy_property_array_uint(items, val, nval) \ > > + ({ \ > > You can define local copies of (read-only) parameters and avoid adding > parentheses each time you access them. Sounds good. > > > + size_t i; \ > > + int ret = 0; \ > > + \ > > + for (i = 0; i < (nval); i++) { \ > > + if ((items)[i].type != ACPI_TYPE_INTEGER) { \ > > + ret = -EPROTO; \ > > + break; \ > > + } \ > > + if ((items)[i].integer.value > _Generic((val), \ > > + u8: U8_MAX, \ > > + u16: U16_MAX, \ > > + u32: U32_MAX, \ > > + u64: U64_MAX, \ > > + default: 0U)) { \ > > I think nobody will die if you add one more TAB to each line and make \ be > consistent column wise. I think it's unlikely, too. Still the above is consistent with the rest of recently merged patches adding similar constructs. -- Kind regards, Sakari Ailus