On Fri, Dec 1, 2023 at 10:47 AM Jorge Ramirez <jorge@xxxxxxxxxxxx> wrote: > On Fri, Dec 1, 2023 at 10:39 AM Jorge Ramirez-Ortiz, Foundries <jorge@xxxxxxxxxxxx> wrote: >> On 01/12/23 10:28:52, Linus Walleij wrote: >> > > + const unsigned int mask = EXT_CSD_PART_CONFIG_ACC_RPMB; >> > > int ret = 0; >> > > >> > > - if (part_type == EXT_CSD_PART_CONFIG_ACC_RPMB) { >> > > + if (part_type & mask == mask) { >> > >> > That looks complex, can't we just: >> > >> > if (part_type & EXT_CSD_PART_CONFIG_ACC_RPMB)? >> >> >> I chose to mention the mask nature of the field for clarity - just in >> case - but I'd much rather do your suggestion. So will do :) > > > sorry no, I mispoke (I like clean code so yours looked neat) > we have to compare against EXT_CSD_PART_CONFIG_ACC_RPMB > bitfield since part_type could be EXT_CSD_PART_CONFIG_ACC_BOOT0 (0x1) > in which case we have to skip it. Aha those defines are not flags but enumerators. I get it. Yours, Linus Walleij