summaryrefslogtreecommitdiffstats
path: root/drivers/spmi
diff options
context:
space:
mode:
authorKiran Gunda <kgunda@codeaurora.org>2017-07-28 12:40:38 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-08-28 13:51:19 +0200
commitf2f3156472b09aed3c7f3ec38db4d09f15a58f0d (patch)
treefdf712c721069e63739a63035327ff556b2908ac /drivers/spmi
parent02abec3616c1b2027efc7e08abf7fc0d2436a837 (diff)
downloadlinux-f2f3156472b09aed3c7f3ec38db4d09f15a58f0d.tar.bz2
spmi: pmic-arb: clean up pmic_arb_find_apid function
Clean up the pmic_arb_find_apid() by using the local variables to improve the code readability. Signed-off-by: Kiran Gunda <kgunda@codeaurora.org> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/spmi')
-rw-r--r--drivers/spmi/spmi-pmic-arb.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c
index 530fa11416e0..530d41021928 100644
--- a/drivers/spmi/spmi-pmic-arb.c
+++ b/drivers/spmi/spmi-pmic-arb.c
@@ -762,23 +762,22 @@ static int pmic_arb_offset_v1(struct spmi_pmic_arb *pmic_arb, u8 sid, u16 addr,
static u16 pmic_arb_find_apid(struct spmi_pmic_arb *pmic_arb, u16 ppid)
{
+ struct apid_data *apidd = &pmic_arb->apid_data[pmic_arb->last_apid];
u32 regval, offset;
- u16 apid;
- u16 id;
+ u16 id, apid;
/*
- * PMIC_ARB_REG_CHNL is a table in HW mapping channel to ppid.
+ * PMIC_ARB_REG_APID is a table in HW mapping apid to ppid.
* ppid_to_apid is an in-memory invert of that table.
*/
- for (apid = pmic_arb->last_apid; ; apid++) {
+ for (apid = pmic_arb->last_apid; ; apid++, apidd++) {
offset = PMIC_ARB_REG_APID(apid);
if (offset >= pmic_arb->core_size)
break;
regval = readl_relaxed(pmic_arb->cnfg +
SPMI_OWNERSHIP_TABLE_REG(apid));
- pmic_arb->apid_data[apid].owner =
- SPMI_OWNERSHIP_PERIPH2OWNER(regval);
+ apidd->owner = SPMI_OWNERSHIP_PERIPH2OWNER(regval);
regval = readl_relaxed(pmic_arb->core + offset);
if (!regval)
@@ -786,7 +785,7 @@ static u16 pmic_arb_find_apid(struct spmi_pmic_arb *pmic_arb, u16 ppid)
id = (regval >> 8) & PMIC_ARB_PPID_MASK;
pmic_arb->ppid_to_apid[id] = apid | PMIC_ARB_APID_VALID;
- pmic_arb->apid_data[apid].ppid = id;
+ apidd->ppid = id;
if (id == ppid) {
apid |= PMIC_ARB_APID_VALID;
break;