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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 15 Jun 2012 19:11:48 +0800
From:	Axel Lin <axel.lin@...il.com>
To:	"Kim, Milo" <Milo.Kim@...com>
Cc:	Mark Brown <broonie@...nsource.wolfsonmicro.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"Girdwood, Liam" <lrg@...com>
Subject: Re: [PATCH v2] regulator: add new regulator driver for lp872x

> +
> +static int lp872x_init_dvs(struct lp872x *lp)
> +{
> +       int ret, gpio;
> +       struct lp872x_dvs *dvs = lp->pdata->dvs;
> +
> +       ret = lp872x_check_dvs_validity(lp);
> +       if (ret) {
> +               dev_warn(lp->dev, "invalid dvs data: %d\n", ret);
> +               return ret;
> +       }
> +
> +       gpio = dvs->gpio;
> +
> +       if (!gpio_is_valid(gpio)) {
> +               dev_err(lp->dev, "invalid gpio: %d\n", gpio);
> +               return -EINVAL;
> +       }
> +
> +       ret = gpio_request(gpio, "LP872X DVS");
devm_gpio_request

> +       if (ret) {
> +               dev_err(lp->dev, "gpio request err: %d\n", ret);
> +               return ret;
> +       }
> +
> +       gpio_direction_output(gpio, dvs->init_state);
> +       lp->dvs_pin = dvs->init_state;
> +       lp->dvs_gpio = gpio;
> +
> +       return 0;
> +}
> +
> +static void lp872x_deinit_dvs(struct lp872x *lp)
> +{
> +       if (lp->dvs_gpio)
> +               gpio_free(lp->dvs_gpio);
> +}

If you are using devm_gpio_request in lp872x_init_dvs() , you can just
kill lp872x_deinit_dvs() function.


> +static struct regulator_init_data
> +*lp872x_find_regulator_init_data(int idx, struct lp872x *lp)
> +{
> +       int i;
> +       int base = lp->chipid == LP8725 ? LP8725_ID_BASE : 0;
> +       int id = idx + base;
> +
> +       for (i = 0 ; i < LP872X_MAX_REGULATORS ; i++)
> +               if (lp->pdata->regulator_data[i].id == id)
> +                       break;
                            return lp->pdata->regulator_data[i].init_data;
> +
> +       return (i == LP872X_MAX_REGULATORS) ? NULL :
> +                       lp->pdata->regulator_data[i].init_data;
            return NULL; // seems better readability this way
> +}
> +

> +module_i2c_driver(lp872x_driver);

I think you need to use subsys_initcall() here.

Regulators need to be available early in init in order to allow them
to be available for consumers when requested.
--
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