Re: [RFC PATCH 03/33] irqchip/gic-v3-its: Refactor command encoding

From: Thomas Gleixner
Date: Mon Feb 13 2017 - 04:54:41 EST


On Tue, 17 Jan 2017, Marc Zyngier wrote:
> +static void its_mask_encode(u64 *raw_cmd, u64 val, int h, int l)

I'd rather name h/l in a way which makes it clear that they are describing
a bit range. msb/lsb perhaps.

> +{
> + u64 mask = GENMASK_ULL(h, l);

New line missing here.

> + *raw_cmd &= ~mask;
> + *raw_cmd |= (val << l) & mask;
> +}
> +
> static void its_encode_cmd(struct its_cmd_block *cmd, u8 cmd_nr)
> {
> - cmd->raw_cmd[0] &= ~0xffULL;
> - cmd->raw_cmd[0] |= cmd_nr;
> + its_mask_encode(&cmd->raw_cmd[0], cmd_nr, 7, 0);

I assume that the manual provides a name for these bit ranges. Wouldn't it
be helpful to use them in these functions?

Looks good otherwise.

Thanks,

tglx