From: Geert Uytterhoeven Date: Thu, 13 Dec 2018 14:20:13 +0000 (+0100) Subject: pinctrl: sh-pfc: Print actual field width for variable-width fields X-Git-Tag: for-linus-20190104~26^2~4^2~1 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=ce16e8dd0db2701265e6dfdb4fbed632b6ff61c2;p=linux-block.git pinctrl: sh-pfc: Print actual field width for variable-width fields The debug code in sh_pfc_write_config_reg() prints the width of the field being modified. However, registers with a variable-width field layout are identified by pinmux_cfg_reg.field_width being zero, hence zeroes are printed instead of the actual field widths. Fix this by printing the Hamming weight of the field mask instead, which is correct for both fixed-width and variable-width fields. Signed-off-by: Geert Uytterhoeven Reviewed-by: Simon Horman --- diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c index a10f7050a74f..f1cfcc8c6544 100644 --- a/drivers/pinctrl/sh-pfc/core.c +++ b/drivers/pinctrl/sh-pfc/core.c @@ -221,7 +221,7 @@ static void sh_pfc_write_config_reg(struct sh_pfc *pfc, dev_dbg(pfc->dev, "write_reg addr = %x, value = 0x%x, field = %u, " "r_width = %u, f_width = %u\n", - crp->reg, value, field, crp->reg_width, crp->field_width); + crp->reg, value, field, crp->reg_width, hweight32(mask)); mask = ~(mask << pos); value = value << pos;