lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKew6eWfPyC5ExJmEsgnRdsLsjAqc+zXCnVMzyyiqbEp1RUerw@mail.gmail.com>
Date:	Fri, 1 Jun 2012 10:51:29 +0530
From:	Yadwinder Singh Brar <yadi.brar01@...il.com>
To:	Jonghwa Lee <jonghwa3.lee@...sung.com>
Cc:	linux-kernel@...r.kernel.org, Liam Girdwood <lrg@...com>,
	Mark Brown <broonie@...nsource.wolfsonmicro.com>,
	Chiwoong Byun <woong.byun@...sung.com>,
	Myungjoo Ham <myungjoo.ham@...sung.com>,
	Kyungmin Park <kyungmin.park@...sung.com>
Subject: Re: [PATCH] regulator: MAX77686: Add Maxim 77686 regulator driver

> +static __devinit int max77686_pmic_probe(struct platform_device *pdev)
> +{
> +       struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent);
> +       struct max77686_platform_data *pdata = dev_get_platdata(iodev->dev);
> +       struct regulator_dev **rdev;
> +       struct max77686_data *max77686;
> +       int i,  size;
> +       int ret = 0;
> +       struct regulator_config config;
> +
> +       dev_dbg(&pdev->dev, "%s\n", __func__);
> +
> +       max77686 = devm_kzalloc(&pdev->dev, sizeof(struct max77686_data),
> +                               GFP_KERNEL);
> +       if (!max77686)
> +               return -ENOMEM;
> +
> +       size = sizeof(struct regulator_dev *) * MAX77686_REGULATORS;
> +       max77686->rdev = devm_kzalloc(&pdev->dev, size, GFP_KERNEL);
> +       if (!max77686->rdev)
> +               return -ENOMEM;
> +
> +       rdev = max77686->rdev;
> +       max77686->dev = &pdev->dev;
> +       max77686->iodev = iodev;
> +       if (pdata)
> +               max77686->num_regulators = pdata->num_regulators;
> +       platform_set_drvdata(pdev, max77686);
> +
> +       max77686->ramp_delay = RAMP_RATE_NO_CTRL; /* Set 0x3 for RAMP */
> +       regmap_update_bits(max77686->iodev->regmap,
> +                       MAX77686_REG_BUCK2CTRL1, MAX77686_RAMP_RATE_MASK,
> +                       max77686->ramp_delay << 6);
> +       regmap_update_bits(max77686->iodev->regmap,
> +                       MAX77686_REG_BUCK3CTRL1, MAX77686_RAMP_RATE_MASK,
> +                       max77686->ramp_delay << 6);
> +       regmap_update_bits(max77686->iodev->regmap,
> +                       MAX77686_REG_BUCK4CTRL1, MAX77686_RAMP_RATE_MASK,
> +                       max77686->ramp_delay << 6);
> +
> +       if (pdata->num_regulators == MAX77686_REGULATORS) {

I was expecting this check inside the if(pdata) { ... } earlier at
starting of probe
because it looks more appropriate(good)  their :).
Anyways, this can also work.

> +               for (i = 0; i < MAX77686_REGULATORS; i++) {
> +                       config.dev = max77686->dev;
> +                       config.regmap = iodev->regmap;
> +                       config.driver_data = max77686;
> +                       config.init_data = pdata->regulators[i].initdata;
> +
> +                       rdev[i] = regulator_register(&regulators[i], &config);
> +
> +                       if (IS_ERR(rdev[i])) {
> +                               ret = PTR_ERR(rdev[i]);
> +                               dev_err(max77686->dev,
> +                               "regulator init failed for %d\n", i);
> +                               rdev[i] = NULL;
> +                               goto err;
> +                       }
> +               }
> +       } else {
> +               dev_err(max77686->dev,
> +                        "Lack of initial data for regulator's initialiation\n");
> +               return -EINVAL;
> +       }
> +       return 0;


Reviewed-by: Yadwinder Singh Brar <yadi.brar@...sung.com>

Regards,
Yadwinder.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ