Commit 57b60ec4 authored by Andy Shevchenko's avatar Andy Shevchenko

gpiolib: acpi: Pass con_id instead of property into acpi_dev_gpio_irq_get_by()

Pass the con_id instead of property so that callers won't repeat
the GPIO suffixes to try.
Acked-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parent 49c02f6e
...@@ -144,7 +144,7 @@ static int pca953x_acpi_get_irq(struct device *dev) ...@@ -144,7 +144,7 @@ static int pca953x_acpi_get_irq(struct device *dev)
if (ret) if (ret)
dev_warn(dev, "can't add GPIO ACPI mapping\n"); dev_warn(dev, "can't add GPIO ACPI mapping\n");
ret = acpi_dev_gpio_irq_get_by(ACPI_COMPANION(dev), "irq-gpios", 0); ret = acpi_dev_gpio_irq_get_by(ACPI_COMPANION(dev), "irq", 0);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
...@@ -1013,7 +1013,7 @@ struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode, ...@@ -1013,7 +1013,7 @@ struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,
/** /**
* acpi_dev_gpio_irq_wake_get_by() - Find GpioInt and translate it to Linux IRQ number * acpi_dev_gpio_irq_wake_get_by() - Find GpioInt and translate it to Linux IRQ number
* @adev: pointer to a ACPI device to get IRQ from * @adev: pointer to a ACPI device to get IRQ from
* @name: optional name of GpioInt resource * @con_id: optional name of GpioInt resource
* @index: index of GpioInt resource (starting from %0) * @index: index of GpioInt resource (starting from %0)
* @wake_capable: Set to true if the IRQ is wake capable * @wake_capable: Set to true if the IRQ is wake capable
* *
...@@ -1024,15 +1024,15 @@ struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode, ...@@ -1024,15 +1024,15 @@ struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,
* The function is idempotent, though each time it runs it will configure GPIO * The function is idempotent, though each time it runs it will configure GPIO
* pin direction according to the flags in GpioInt resource. * pin direction according to the flags in GpioInt resource.
* *
* The function takes optional @name parameter. If the resource has a property * The function takes optional @con_id parameter. If the resource has
* name, then only those will be taken into account. * a @con_id in a property, then only those will be taken into account.
* *
* The GPIO is considered wake capable if the GpioInt resource specifies * The GPIO is considered wake capable if the GpioInt resource specifies
* SharedAndWake or ExclusiveAndWake. * SharedAndWake or ExclusiveAndWake.
* *
* Return: Linux IRQ number (> %0) on success, negative errno on failure. * Return: Linux IRQ number (> %0) on success, negative errno on failure.
*/ */
int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *name, int index, int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *con_id, int index,
bool *wake_capable) bool *wake_capable)
{ {
int idx, i; int idx, i;
...@@ -1043,9 +1043,8 @@ int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *name, in ...@@ -1043,9 +1043,8 @@ int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *name, in
struct acpi_gpio_info info; struct acpi_gpio_info info;
struct gpio_desc *desc; struct gpio_desc *desc;
desc = acpi_get_gpiod_by_index(adev, name, i, &info);
/* Ignore -EPROBE_DEFER, it only matters if idx matches */ /* Ignore -EPROBE_DEFER, it only matters if idx matches */
desc = __acpi_find_gpio(acpi_fwnode_handle(adev), con_id, i, true, &info);
if (IS_ERR(desc) && PTR_ERR(desc) != -EPROBE_DEFER) if (IS_ERR(desc) && PTR_ERR(desc) != -EPROBE_DEFER)
return PTR_ERR(desc); return PTR_ERR(desc);
......
...@@ -428,7 +428,7 @@ static int mlxbf_gige_probe(struct platform_device *pdev) ...@@ -428,7 +428,7 @@ static int mlxbf_gige_probe(struct platform_device *pdev)
priv->rx_irq = platform_get_irq(pdev, MLXBF_GIGE_RECEIVE_PKT_INTR_IDX); priv->rx_irq = platform_get_irq(pdev, MLXBF_GIGE_RECEIVE_PKT_INTR_IDX);
priv->llu_plu_irq = platform_get_irq(pdev, MLXBF_GIGE_LLU_PLU_INTR_IDX); priv->llu_plu_irq = platform_get_irq(pdev, MLXBF_GIGE_LLU_PLU_INTR_IDX);
phy_irq = acpi_dev_gpio_irq_get_by(ACPI_COMPANION(&pdev->dev), "phy-gpios", 0); phy_irq = acpi_dev_gpio_irq_get_by(ACPI_COMPANION(&pdev->dev), "phy", 0);
if (phy_irq < 0) { if (phy_irq < 0) {
dev_err(&pdev->dev, "Error getting PHY irq. Use polling instead"); dev_err(&pdev->dev, "Error getting PHY irq. Use polling instead");
phy_irq = PHY_POLL; phy_irq = PHY_POLL;
......
...@@ -95,7 +95,7 @@ static int cy8c95x0_acpi_get_irq(struct device *dev) ...@@ -95,7 +95,7 @@ static int cy8c95x0_acpi_get_irq(struct device *dev)
if (ret) if (ret)
dev_warn(dev, "can't add GPIO ACPI mapping\n"); dev_warn(dev, "can't add GPIO ACPI mapping\n");
ret = acpi_dev_gpio_irq_get_by(ACPI_COMPANION(dev), "irq-gpios", 0); ret = acpi_dev_gpio_irq_get_by(ACPI_COMPANION(dev), "irq", 0);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
...@@ -1233,7 +1233,7 @@ bool acpi_gpio_get_irq_resource(struct acpi_resource *ares, ...@@ -1233,7 +1233,7 @@ bool acpi_gpio_get_irq_resource(struct acpi_resource *ares,
struct acpi_resource_gpio **agpio); struct acpi_resource_gpio **agpio);
bool acpi_gpio_get_io_resource(struct acpi_resource *ares, bool acpi_gpio_get_io_resource(struct acpi_resource *ares,
struct acpi_resource_gpio **agpio); struct acpi_resource_gpio **agpio);
int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *name, int index, int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *con_id, int index,
bool *wake_capable); bool *wake_capable);
#else #else
static inline bool acpi_gpio_get_irq_resource(struct acpi_resource *ares, static inline bool acpi_gpio_get_irq_resource(struct acpi_resource *ares,
...@@ -1246,7 +1246,7 @@ static inline bool acpi_gpio_get_io_resource(struct acpi_resource *ares, ...@@ -1246,7 +1246,7 @@ static inline bool acpi_gpio_get_io_resource(struct acpi_resource *ares,
{ {
return false; return false;
} }
static inline int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *name, static inline int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *con_id,
int index, bool *wake_capable) int index, bool *wake_capable)
{ {
return -ENXIO; return -ENXIO;
...@@ -1259,10 +1259,10 @@ static inline int acpi_dev_gpio_irq_wake_get(struct acpi_device *adev, int index ...@@ -1259,10 +1259,10 @@ static inline int acpi_dev_gpio_irq_wake_get(struct acpi_device *adev, int index
return acpi_dev_gpio_irq_wake_get_by(adev, NULL, index, wake_capable); return acpi_dev_gpio_irq_wake_get_by(adev, NULL, index, wake_capable);
} }
static inline int acpi_dev_gpio_irq_get_by(struct acpi_device *adev, const char *name, static inline int acpi_dev_gpio_irq_get_by(struct acpi_device *adev, const char *con_id,
int index) int index)
{ {
return acpi_dev_gpio_irq_wake_get_by(adev, name, index, NULL); return acpi_dev_gpio_irq_wake_get_by(adev, con_id, index, NULL);
} }
static inline int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index) static inline int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment