Re: [PATCH V5 4/6] regulator: Add a regulator driver for the PM8008 PMIC

From: Satya Priya Kakitapalli (Temp)
Date: Fri Feb 11 2022 - 05:36:06 EST



On 2/11/2022 6:27 AM, Bjorn Andersson wrote:
On Tue 08 Feb 08:52 CST 2022, Satya Priya wrote:
diff --git a/drivers/regulator/qcom-pm8008-regulator.c b/drivers/regulator/qcom-pm8008-regulator.c
[..]
+static int pm8008_regulator_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ int id = pdev->id % PM8008_NUM_LDOS;
Why does this driver look completely different from all the other
Qualcomm regulator drivers that we already have, and why do you register
one platform_device per regulator?


Based on Mark's suggestions and the discussion happened here [1], I've changed the design like this.

[1] https://patchwork.kernel.org/project/linux-arm-msm/patch/1637314953-4215-3-git-send-email-quic_c_skakit@xxxxxxxxxxx/


The fundamental difference in design makes it hard to maintain and


you're wasting quite a bit of memory with the unnecessary
platfrom_device objects.


I'm going to change this. I will add only one cell with .name to match with the regulator driver and probe all the regulators using a single loop. That way we don't waste lot of memory by registering multiple regulator platform devices.


Regards,
Bjorn