Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2563606c authored by Linus Walleij's avatar Linus Walleij
Browse files

Merge tag 'gpiod-flags-for-4.3' of git://git.pengutronix.de/git/ukl/linux into devel

The last patch in this series makes the flags parameter for the various
gpiod_get* functions mandatory and so allows to remove an ugly cpp hack
introduced in commit 39b2bbe3 (gpio: add flags argument to gpiod_get*()
functions) for v3.17-rc1.

The other nine commits fix the last remaining users of these functions that
don't pass flags yet. (Only etraxfs-uart wasn't fixed; this driver's use of the
gpiod functions needs fixing anyhow.)
parents 01540314 b17d1bf1
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -59,13 +59,13 @@ static int devm_gpiod_match_array(struct device *dev, void *res, void *data)
 * automatically disposed on driver detach. See gpiod_get() for detailed
 * information about behavior and return values.
 */
struct gpio_desc *__must_check __devm_gpiod_get(struct device *dev,
struct gpio_desc *__must_check devm_gpiod_get(struct device *dev,
					      const char *con_id,
					      enum gpiod_flags flags)
{
	return devm_gpiod_get_index(dev, con_id, 0, flags);
}
EXPORT_SYMBOL(__devm_gpiod_get);
EXPORT_SYMBOL(devm_gpiod_get);

/**
 * devm_gpiod_get_optional - Resource-managed gpiod_get_optional()
@@ -77,13 +77,13 @@ EXPORT_SYMBOL(__devm_gpiod_get);
 * are automatically disposed on driver detach. See gpiod_get_optional() for
 * detailed information about behavior and return values.
 */
struct gpio_desc *__must_check __devm_gpiod_get_optional(struct device *dev,
struct gpio_desc *__must_check devm_gpiod_get_optional(struct device *dev,
						       const char *con_id,
						       enum gpiod_flags flags)
{
	return devm_gpiod_get_index_optional(dev, con_id, 0, flags);
}
EXPORT_SYMBOL(__devm_gpiod_get_optional);
EXPORT_SYMBOL(devm_gpiod_get_optional);

/**
 * devm_gpiod_get_index - Resource-managed gpiod_get_index()
@@ -96,7 +96,7 @@ EXPORT_SYMBOL(__devm_gpiod_get_optional);
 * automatically disposed on driver detach. See gpiod_get_index() for detailed
 * information about behavior and return values.
 */
struct gpio_desc *__must_check __devm_gpiod_get_index(struct device *dev,
struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev,
						    const char *con_id,
						    unsigned int idx,
						    enum gpiod_flags flags)
@@ -120,7 +120,7 @@ struct gpio_desc *__must_check __devm_gpiod_get_index(struct device *dev,

	return desc;
}
EXPORT_SYMBOL(__devm_gpiod_get_index);
EXPORT_SYMBOL(devm_gpiod_get_index);

/**
 * devm_get_gpiod_from_child - get a GPIO descriptor from a device's child node
@@ -182,7 +182,7 @@ EXPORT_SYMBOL(devm_get_gpiod_from_child);
 * gpiod_get_index_optional() for detailed information about behavior and
 * return values.
 */
struct gpio_desc *__must_check __devm_gpiod_get_index_optional(struct device *dev,
struct gpio_desc *__must_check devm_gpiod_get_index_optional(struct device *dev,
							     const char *con_id,
							     unsigned int index,
							     enum gpiod_flags flags)
@@ -197,7 +197,7 @@ struct gpio_desc *__must_check __devm_gpiod_get_index_optional(struct device *de

	return desc;
}
EXPORT_SYMBOL(__devm_gpiod_get_index_optional);
EXPORT_SYMBOL(devm_gpiod_get_index_optional);

/**
 * devm_gpiod_get_array - Resource-managed gpiod_get_array()
+8 −8
Original line number Diff line number Diff line
@@ -1902,12 +1902,12 @@ EXPORT_SYMBOL_GPL(gpiod_count);
 * dev, -ENOENT if no GPIO has been assigned to the requested function, or
 * another IS_ERR() code if an error occurred while trying to acquire the GPIO.
 */
struct gpio_desc *__must_check __gpiod_get(struct device *dev, const char *con_id,
struct gpio_desc *__must_check gpiod_get(struct device *dev, const char *con_id,
					 enum gpiod_flags flags)
{
	return gpiod_get_index(dev, con_id, 0, flags);
}
EXPORT_SYMBOL_GPL(__gpiod_get);
EXPORT_SYMBOL_GPL(gpiod_get);

/**
 * gpiod_get_optional - obtain an optional GPIO for a given GPIO function
@@ -1919,13 +1919,13 @@ EXPORT_SYMBOL_GPL(__gpiod_get);
 * the requested function it will return NULL. This is convenient for drivers
 * that need to handle optional GPIOs.
 */
struct gpio_desc *__must_check __gpiod_get_optional(struct device *dev,
struct gpio_desc *__must_check gpiod_get_optional(struct device *dev,
						  const char *con_id,
						  enum gpiod_flags flags)
{
	return gpiod_get_index_optional(dev, con_id, 0, flags);
}
EXPORT_SYMBOL_GPL(__gpiod_get_optional);
EXPORT_SYMBOL_GPL(gpiod_get_optional);


/**
@@ -1982,7 +1982,7 @@ static int gpiod_configure_flags(struct gpio_desc *desc, const char *con_id,
 * requested function and/or index, or another IS_ERR() code if an error
 * occurred while trying to acquire the GPIO.
 */
struct gpio_desc *__must_check __gpiod_get_index(struct device *dev,
struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
					       const char *con_id,
					       unsigned int idx,
					       enum gpiod_flags flags)
@@ -2031,7 +2031,7 @@ struct gpio_desc *__must_check __gpiod_get_index(struct device *dev,

	return desc;
}
EXPORT_SYMBOL_GPL(__gpiod_get_index);
EXPORT_SYMBOL_GPL(gpiod_get_index);

/**
 * fwnode_get_named_gpiod - obtain a GPIO from firmware node
@@ -2100,7 +2100,7 @@ EXPORT_SYMBOL_GPL(fwnode_get_named_gpiod);
 * specified index was assigned to the requested function it will return NULL.
 * This is convenient for drivers that need to handle optional GPIOs.
 */
struct gpio_desc *__must_check __gpiod_get_index_optional(struct device *dev,
struct gpio_desc *__must_check gpiod_get_index_optional(struct device *dev,
							const char *con_id,
							unsigned int index,
							enum gpiod_flags flags)
@@ -2115,7 +2115,7 @@ struct gpio_desc *__must_check __gpiod_get_index_optional(struct device *dev,

	return desc;
}
EXPORT_SYMBOL_GPL(__gpiod_get_index_optional);
EXPORT_SYMBOL_GPL(gpiod_get_index_optional);

/**
 * gpiod_hog - Hog the specified GPIO desc given the provided flags
+2 −15
Original line number Diff line number Diff line
@@ -373,7 +373,7 @@ static int edp_gpio_config(struct edp_ctrl *ctrl)
	struct device *dev = &ctrl->pdev->dev;
	int ret;

	ctrl->panel_hpd_gpio = devm_gpiod_get(dev, "panel-hpd");
	ctrl->panel_hpd_gpio = devm_gpiod_get(dev, "panel-hpd", GPIOD_IN);
	if (IS_ERR(ctrl->panel_hpd_gpio)) {
		ret = PTR_ERR(ctrl->panel_hpd_gpio);
		ctrl->panel_hpd_gpio = NULL;
@@ -381,13 +381,7 @@ static int edp_gpio_config(struct edp_ctrl *ctrl)
		return ret;
	}

	ret = gpiod_direction_input(ctrl->panel_hpd_gpio);
	if (ret) {
		pr_err("%s: Set direction for hpd failed, %d\n", __func__, ret);
		return ret;
	}

	ctrl->panel_en_gpio = devm_gpiod_get(dev, "panel-en");
	ctrl->panel_en_gpio = devm_gpiod_get(dev, "panel-en", GPIOD_OUT_LOW);
	if (IS_ERR(ctrl->panel_en_gpio)) {
		ret = PTR_ERR(ctrl->panel_en_gpio);
		ctrl->panel_en_gpio = NULL;
@@ -395,13 +389,6 @@ static int edp_gpio_config(struct edp_ctrl *ctrl)
		return ret;
	}

	ret = gpiod_direction_output(ctrl->panel_en_gpio, 0);
	if (ret) {
		pr_err("%s: Set direction for panel_en failed, %d\n",
				__func__, ret);
		return ret;
	}

	DBG("gpio on");

	return 0;
+7 −15
Original line number Diff line number Diff line
@@ -375,24 +375,16 @@ static int panel_probe(struct platform_device *pdev)
		dev_info(&pdev->dev, "found backlight\n");
	}

	panel_mod->enable_gpio = devm_gpiod_get(&pdev->dev, "enable");
	panel_mod->enable_gpio = devm_gpiod_get_optional(&pdev->dev, "enable",
							 GPIOD_OUT_LOW);
	if (IS_ERR(panel_mod->enable_gpio)) {
		ret = PTR_ERR(panel_mod->enable_gpio);
		if (ret != -ENOENT) {
		dev_err(&pdev->dev, "failed to request enable GPIO\n");
		goto fail_backlight;
	}

		/* Optional GPIO is not here, continue silently. */
		panel_mod->enable_gpio = NULL;
	} else {
		ret = gpiod_direction_output(panel_mod->enable_gpio, 0);
		if (ret < 0) {
			dev_err(&pdev->dev, "failed to setup GPIO\n");
			goto fail_backlight;
		}
	if (panel_mod->enable_gpio)
		dev_info(&pdev->dev, "found enable GPIO\n");
	}

	mod = &panel_mod->base;
	pdev->dev.platform_data = mod;
+1 −5
Original line number Diff line number Diff line
@@ -488,16 +488,12 @@ static int stk3310_gpio_probe(struct i2c_client *client)
	dev = &client->dev;

	/* gpio interrupt pin */
	gpio = devm_gpiod_get_index(dev, STK3310_GPIO, 0);
	gpio = devm_gpiod_get_index(dev, STK3310_GPIO, 0, GPIOD_IN);
	if (IS_ERR(gpio)) {
		dev_err(dev, "acpi gpio get index failed\n");
		return PTR_ERR(gpio);
	}

	ret = gpiod_direction_input(gpio);
	if (ret)
		return ret;

	ret = gpiod_to_irq(gpio);
	dev_dbg(dev, "GPIO resource, no:%d irq:%d\n", desc_to_gpio(gpio), ret);

Loading