lkml.org 
[lkml]   [2021]   [Jun]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v9 2/5] regulator: hi6421v600-regulator: fix platform drvdata
> @@ -231,7 +228,7 @@ static int hi6421_spmi_regulator_probe(struct platform_device *pdev)
> {
> struct device *pmic_dev = pdev->dev.parent;
> struct regulator_config config = { };
> - struct hi6421_spmi_reg_priv *priv;
> + struct hi6421_spmi_reg_info *sreg;
> struct hi6421_spmi_reg_info *info;
> struct device *dev = &pdev->dev;
> struct hi6421_spmi_pmic *pmic;
> @@ -247,18 +244,17 @@ static int hi6421_spmi_regulator_probe(struct platform_device *pdev)
> if (WARN_ON(!pmic))
> return -ENODEV;
>
> - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> - if (!priv)
> + sreg = devm_kzalloc(dev, sizeof(*sreg), GFP_KERNEL);
> + if (!sreg)
> return -ENOMEM;
>
> - mutex_init(&priv->enable_mutex);
> - platform_set_drvdata(pdev, priv);
> + sreg->enable_mutex = &pmic->enable_mutex;
>
> for (i = 0; i < ARRAY_SIZE(regulator_info); i++) {
> info = &regulator_info[i];
>
> config.dev = pdev->dev.parent;
> - config.driver_data = info;
> + config.driver_data = sreg;

This won't work and that was what my patch fixed.
e.g. When you call
struct hi6421_spmi_reg_info *sreg = rdev_get_drvdata(rdev);
sreg->eco_mode_mask and sreg->eco_uA will always be 0.

Regards,
Axel

\
 
 \ /
  Last update: 2021-06-26 05:42    [W:0.087 / U:0.476 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site