Skip to contentSkip to conversation

mfd: qcom-spmi-pmic: Don't access non-existing registers

PATCH Applied Stephen Boyd 2 participants 3 messages Nov 18, 2015 – Jan 11, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mfd: qcom-spmi-pmic: Don't access non-existing registers

From: "Ivan T. Ivanov" <[email protected]>

Revision ID registers are available only on devices with Slave IDs that are even, so don't make access to unavailable registers.

[sboyd at codeaurora.org: Consider all slave ids that are even]
---
 drivers/mfd/qcom-spmi-pmic.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mfd/qcom-spmi-pmic.c +3 -1
index af6ac1c4b45c..8653e8b9bb4f 100644
@@ -127,7 +127,9 @@ static int pmic_spmi_probe(struct spmi_device *sdev)
 	if (IS_ERR(regmap))
 		return PTR_ERR(regmap);
 
-	pmic_spmi_show_revid(regmap, &sdev->dev);
+	/* Only the first slave id for a PMIC contains this information */
+	if (sdev->usid % 2 == 0)
+		pmic_spmi_show_revid(regmap, &sdev->dev);
 
 	return of_platform_populate(root, NULL, NULL, &sdev->dev);
 }
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#1 lore raw
Quoted 10 lines · Stephen Boyd

From: "Ivan T. Ivanov" <[email protected]>

Revision ID registers are available only on devices with Slave IDs that are even, so don't make access to unavailable registers.

[sboyd at codeaurora.org: Consider all slave ids that are even]

---

Ping?

Quoted 18 lines
 drivers/mfd/qcom-spmi-pmic.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mfd/qcom-spmi-pmic.c +3 -1
index af6ac1c4b45c..8653e8b9bb4f 100644
@@ -127,7 +127,9 @@ static int pmic_spmi_probe(struct spmi_device *sdev)
 	if (IS_ERR(regmap))
 		return PTR_ERR(regmap);
 
-	pmic_spmi_show_revid(regmap, &sdev->dev);
+	/* Only the first slave id for a PMIC contains this information */
+	if (sdev->usid % 2 == 0)
+		pmic_spmi_show_revid(regmap, &sdev->dev);
 
 	return of_platform_populate(root, NULL, NULL, &sdev->dev);
 }
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
Applied
#2 lore raw
In reply to Stephen Boyd
Quoted 6 lines · Stephen Boyd

From: "Ivan T. Ivanov" <[email protected]>

Revision ID registers are available only on devices with Slave IDs that are even, so don't make access to unavailable registers.

Quoted 6 lines
[sboyd at codeaurora.org: Consider all slave ids that are even]
---
 drivers/mfd/qcom-spmi-pmic.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Applied, thanks.

Quoted 15 lines
drivers/mfd/qcom-spmi-pmic.c +3 -1
index af6ac1c4b45c..8653e8b9bb4f 100644
@@ -127,7 +127,9 @@ static int pmic_spmi_probe(struct spmi_device *sdev)
 	if (IS_ERR(regmap))
 		return PTR_ERR(regmap);
 
-	pmic_spmi_show_revid(regmap, &sdev->dev);
+	/* Only the first slave id for a PMIC contains this information */
+	if (sdev->usid % 2 == 0)
+		pmic_spmi_show_revid(regmap, &sdev->dev);
 
 	return of_platform_populate(root, NULL, NULL, &sdev->dev);
 }
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog