Commit b041c02f authored by Federico Vaga's avatar Federico Vaga

kernel: mask user value before write register

This patch mask the user value before write it on the hardware register.
If the value does not fit the mask it will be printed a warning message.
Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 3ec22d7e
......@@ -471,6 +471,11 @@ static inline void fa_writel(struct fa_dev *fa,
/* */
cur &= ~field->mask; /* clear bits according to the mask */
val = usr_val * (field->mask & -(field->mask));
if (val & ~field->mask)
dev_warn(fa->fmc->hwdev,
"addr 0x%x: value 0x%x doesn't fit mask 0x%x\n",
base_off+field->offset, val, field->mask);
val &= field->mask;
val |= cur;
}
fmc_writel(fa->fmc, val, base_off+field->offset);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment