[gpio:gpio-descriptors-regulator 4/8] drivers/regulator/gpio-regulator.c:345:3: error: 'gflags' undeclared; did you mean 'mf_flags'?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git gpio-descriptors-regulator
head:   3413d5a29dcb45755d49ae228a802630afd51073
commit: 0c61f72a18f31f45ccc589b8af6e892271f3a7f0 [4/8] regulator: fixed/gpio: Pull inversion/OD into gpiolib
config: arm64-defconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout 0c61f72a18f31f45ccc589b8af6e892271f3a7f0
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=arm64 

Note: the gpio/gpio-descriptors-regulator HEAD 3413d5a29dcb45755d49ae228a802630afd51073 builds fine.
      It only hurts bisectibility.

All errors (new ones prefixed by >>):

   drivers/regulator/gpio-regulator.c: In function 'of_get_gpio_regulator_config':
   drivers/regulator/gpio-regulator.c:161:8: error: 'struct gpio_regulator_config' has no member named 'enable_gpio'
     config->enable_gpio = of_get_named_gpio(np, "enable-gpio", 0);
           ^~
   drivers/regulator/gpio-regulator.c:162:12: error: 'struct gpio_regulator_config' has no member named 'enable_gpio'
     if (config->enable_gpio < 0 && config->enable_gpio != -ENOENT)
               ^~
   drivers/regulator/gpio-regulator.c:162:39: error: 'struct gpio_regulator_config' has no member named 'enable_gpio'
     if (config->enable_gpio < 0 && config->enable_gpio != -ENOENT)
                                          ^~
   drivers/regulator/gpio-regulator.c:163:24: error: 'struct gpio_regulator_config' has no member named 'enable_gpio'
      return ERR_PTR(config->enable_gpio);
                           ^~
   drivers/regulator/gpio-regulator.c: In function 'gpio_regulator_probe':
>> drivers/regulator/gpio-regulator.c:345:3: error: 'gflags' undeclared (first use in this function); did you mean 'mf_flags'?
      gflags = GPIOD_OUT_HIGH;
      ^~~~~~
      mf_flags
   drivers/regulator/gpio-regulator.c:345:3: note: each undeclared identifier is reported only once for each function it appears in

vim +345 drivers/regulator/gpio-regulator.c

   134	
   135	static struct gpio_regulator_config *
   136	of_get_gpio_regulator_config(struct device *dev, struct device_node *np,
   137				     const struct regulator_desc *desc)
   138	{
   139		struct gpio_regulator_config *config;
   140		const char *regtype;
   141		int proplen, gpio, i;
   142		int ret;
   143	
   144		config = devm_kzalloc(dev,
   145				sizeof(struct gpio_regulator_config),
   146				GFP_KERNEL);
   147		if (!config)
   148			return ERR_PTR(-ENOMEM);
   149	
   150		config->init_data = of_get_regulator_init_data(dev, np, desc);
   151		if (!config->init_data)
   152			return ERR_PTR(-EINVAL);
   153	
   154		config->supply_name = config->init_data->constraints.name;
   155	
   156		if (of_property_read_bool(np, "enable-at-boot"))
   157			config->enabled_at_boot = true;
   158	
   159		of_property_read_u32(np, "startup-delay-us", &config->startup_delay);
   160	
   161		config->enable_gpio = of_get_named_gpio(np, "enable-gpio", 0);
 > 162		if (config->enable_gpio < 0 && config->enable_gpio != -ENOENT)
   163			return ERR_PTR(config->enable_gpio);
   164	
   165		/* Fetch GPIOs. - optional property*/
   166		ret = of_gpio_count(np);
   167		if ((ret < 0) && (ret != -ENOENT))
   168			return ERR_PTR(ret);
   169	
   170		if (ret > 0) {
   171			config->nr_gpios = ret;
   172			config->gpios = devm_kcalloc(dev,
   173						config->nr_gpios, sizeof(struct gpio),
   174						GFP_KERNEL);
   175			if (!config->gpios)
   176				return ERR_PTR(-ENOMEM);
   177	
   178			proplen = of_property_count_u32_elems(np, "gpios-states");
   179			/* optional property */
   180			if (proplen < 0)
   181				proplen = 0;
   182	
   183			if (proplen > 0 && proplen != config->nr_gpios) {
   184				dev_warn(dev, "gpios <-> gpios-states mismatch\n");
   185				proplen = 0;
   186			}
   187	
   188			for (i = 0; i < config->nr_gpios; i++) {
   189				gpio = of_get_named_gpio(np, "gpios", i);
   190				if (gpio < 0) {
   191					if (gpio != -ENOENT)
   192						return ERR_PTR(gpio);
   193					break;
   194				}
   195				config->gpios[i].gpio = gpio;
   196				config->gpios[i].label = config->supply_name;
   197				if (proplen > 0) {
   198					of_property_read_u32_index(np, "gpios-states",
   199								   i, &ret);
   200					if (ret)
   201						config->gpios[i].flags =
   202								   GPIOF_OUT_INIT_HIGH;
   203				}
   204			}
   205		}
   206	
   207		/* Fetch states. */
   208		proplen = of_property_count_u32_elems(np, "states");
   209		if (proplen < 0) {
   210			dev_err(dev, "No 'states' property found\n");
   211			return ERR_PTR(-EINVAL);
   212		}
   213	
   214		config->states = devm_kcalloc(dev,
   215					proplen / 2,
   216					sizeof(struct gpio_regulator_state),
   217					GFP_KERNEL);
   218		if (!config->states)
   219			return ERR_PTR(-ENOMEM);
   220	
   221		for (i = 0; i < proplen / 2; i++) {
   222			of_property_read_u32_index(np, "states", i * 2,
   223						   &config->states[i].value);
   224			of_property_read_u32_index(np, "states", i * 2 + 1,
   225						   &config->states[i].gpios);
   226		}
   227		config->nr_states = i;
   228	
   229		config->type = REGULATOR_VOLTAGE;
   230		ret = of_property_read_string(np, "regulator-type", &regtype);
   231		if (ret >= 0) {
   232			if (!strncmp("voltage", regtype, 7))
   233				config->type = REGULATOR_VOLTAGE;
   234			else if (!strncmp("current", regtype, 7))
   235				config->type = REGULATOR_CURRENT;
   236			else
   237				dev_warn(dev, "Unknown regulator-type '%s'\n",
   238					 regtype);
   239		}
   240	
   241		return config;
   242	}
   243	
   244	static struct regulator_ops gpio_regulator_current_ops = {
   245		.get_current_limit = gpio_regulator_get_value,
   246		.set_current_limit = gpio_regulator_set_current_limit,
   247	};
   248	
   249	static int gpio_regulator_probe(struct platform_device *pdev)
   250	{
   251		struct gpio_regulator_config *config = dev_get_platdata(&pdev->dev);
   252		struct device_node *np = pdev->dev.of_node;
   253		struct gpio_regulator_data *drvdata;
   254		struct regulator_config cfg = { };
   255		int ptr, ret, state;
   256	
   257		drvdata = devm_kzalloc(&pdev->dev, sizeof(struct gpio_regulator_data),
   258				       GFP_KERNEL);
   259		if (drvdata == NULL)
   260			return -ENOMEM;
   261	
   262		if (np) {
   263			config = of_get_gpio_regulator_config(&pdev->dev, np,
   264							      &drvdata->desc);
   265			if (IS_ERR(config))
   266				return PTR_ERR(config);
   267		}
   268	
   269		drvdata->desc.name = kstrdup(config->supply_name, GFP_KERNEL);
   270		if (drvdata->desc.name == NULL) {
   271			dev_err(&pdev->dev, "Failed to allocate supply name\n");
   272			return -ENOMEM;
   273		}
   274	
   275		if (config->nr_gpios != 0) {
   276			drvdata->gpios = kmemdup(config->gpios,
   277						 config->nr_gpios * sizeof(struct gpio),
   278						 GFP_KERNEL);
   279			if (drvdata->gpios == NULL) {
   280				dev_err(&pdev->dev, "Failed to allocate gpio data\n");
   281				ret = -ENOMEM;
   282				goto err_name;
   283			}
   284	
   285			drvdata->nr_gpios = config->nr_gpios;
   286			ret = gpio_request_array(drvdata->gpios, drvdata->nr_gpios);
   287			if (ret) {
   288				if (ret != -EPROBE_DEFER)
   289					dev_err(&pdev->dev,
   290						"Could not obtain regulator setting GPIOs: %d\n",
   291						ret);
   292				goto err_memgpio;
   293			}
   294		}
   295	
   296		drvdata->states = kmemdup(config->states,
   297					  config->nr_states *
   298						 sizeof(struct gpio_regulator_state),
   299					  GFP_KERNEL);
   300		if (drvdata->states == NULL) {
   301			dev_err(&pdev->dev, "Failed to allocate state data\n");
   302			ret = -ENOMEM;
   303			goto err_stategpio;
   304		}
   305		drvdata->nr_states = config->nr_states;
   306	
   307		drvdata->desc.owner = THIS_MODULE;
   308		drvdata->desc.enable_time = config->startup_delay;
   309	
   310		/* handle regulator type*/
   311		switch (config->type) {
   312		case REGULATOR_VOLTAGE:
   313			drvdata->desc.type = REGULATOR_VOLTAGE;
   314			drvdata->desc.ops = &gpio_regulator_voltage_ops;
   315			drvdata->desc.n_voltages = config->nr_states;
   316			break;
   317		case REGULATOR_CURRENT:
   318			drvdata->desc.type = REGULATOR_CURRENT;
   319			drvdata->desc.ops = &gpio_regulator_current_ops;
   320			break;
   321		default:
   322			dev_err(&pdev->dev, "No regulator type set\n");
   323			ret = -EINVAL;
   324			goto err_memstate;
   325		}
   326	
   327		/* build initial state from gpio init data. */
   328		state = 0;
   329		for (ptr = 0; ptr < drvdata->nr_gpios; ptr++) {
   330			if (config->gpios[ptr].flags & GPIOF_OUT_INIT_HIGH)
   331				state |= (1 << ptr);
   332		}
   333		drvdata->state = state;
   334	
   335		cfg.dev = &pdev->dev;
   336		cfg.init_data = config->init_data;
   337		cfg.driver_data = drvdata;
   338		cfg.of_node = np;
   339	
   340		/*
   341		 * The signal will be inverted by the GPIO core if flagged so in the
   342		 * decriptor.
   343		 */
   344		if (config->enabled_at_boot)
 > 345			gflags = GPIOD_OUT_HIGH;
   346		else
   347			gflags = GPIOD_OUT_LOW;
   348	
   349		cfg.ena_gpiod = devm_gpiod_get_optional(&pdev->dev, "enable", gflags);
   350		if (IS_ERR(cfg.ena_gpiod)) {
   351			ret = PTR_ERR(cfg.ena_gpiod);
   352			goto err_stategpio;
   353		}
   354	
   355		drvdata->dev = regulator_register(&drvdata->desc, &cfg);
   356		if (IS_ERR(drvdata->dev)) {
   357			ret = PTR_ERR(drvdata->dev);
   358			dev_err(&pdev->dev, "Failed to register regulator: %d\n", ret);
   359			goto err_memstate;
   360		}
   361	
   362		platform_set_drvdata(pdev, drvdata);
   363	
   364		return 0;
   365	
   366	err_memstate:
   367		kfree(drvdata->states);
   368	err_stategpio:
   369		gpio_free_array(drvdata->gpios, drvdata->nr_gpios);
   370	err_memgpio:
   371		kfree(drvdata->gpios);
   372	err_name:
   373		kfree(drvdata->desc.name);
   374		return ret;
   375	}
   376	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux