summaryrefslogtreecommitdiff
path: root/drivers/ata/pata_optidma.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2014-11-19 14:48:59 +0100
committerMichael Turquette <mturquette@linaro.org>2014-11-19 14:03:13 -0800
commit6793b3cd5da817c4be218bd8632f07cf4d2b0d26 (patch)
treeb117746a7b61145a3e252c2531f099f0d5616259 /drivers/ata/pata_optidma.c
parent3c7f4fe810f74649d038809acc4e22a9b8198dd3 (diff)
clk_mux: Fix set_parent doing the wrong thing when INDEX_BIT && index >= 3
If CLK_MUX_INDEX_BIT is set, then each bit turns on / off a single parent, so theoretically multiple parents could be enabled at the same time, but in practice only one bit should ever be 1. So to select parent 0, set the register (*) to 0x01, to select parent 1 set it 0x02, parent 2, 0x04, parent 3, 0x08, etc. But the current code does: if (mux->flags & CLK_MUX_INDEX_BIT) index = (1 << ffs(index)); Which means that: For an input index of 0, ffs returns 0, so we set the register to 0x01, ok. For an input index of 1, ffs returns 1, so we set the register to 0x02, ok. For an input index of 2, ffs returns 2, so we set the register to 0x04, ok. For an input index of 3, ffs returns 1, so we set the register to 0x02, not good! The code should simply be: if (mux->flags & CLK_MUX_INDEX_BIT) index = 1 << index; Which always does the right thing, this commit fixes this. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Michael Turquette <mturquette@linaro.org>
Diffstat (limited to 'drivers/ata/pata_optidma.c')
0 files changed, 0 insertions, 0 deletions