Skip to content

Commit 57b60ec

Browse files
committed
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: Mika Westerberg <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]>
1 parent 49c02f6 commit 57b60ec

File tree

5 files changed

+12
-13
lines changed

5 files changed

+12
-13
lines changed

drivers/gpio/gpio-pca953x.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ static int pca953x_acpi_get_irq(struct device *dev)
144144
if (ret)
145145
dev_warn(dev, "can't add GPIO ACPI mapping\n");
146146

147-
ret = acpi_dev_gpio_irq_get_by(ACPI_COMPANION(dev), "irq-gpios", 0);
147+
ret = acpi_dev_gpio_irq_get_by(ACPI_COMPANION(dev), "irq", 0);
148148
if (ret < 0)
149149
return ret;
150150

drivers/gpio/gpiolib-acpi.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,
10131013
/**
10141014
* acpi_dev_gpio_irq_wake_get_by() - Find GpioInt and translate it to Linux IRQ number
10151015
* @adev: pointer to a ACPI device to get IRQ from
1016-
* @name: optional name of GpioInt resource
1016+
* @con_id: optional name of GpioInt resource
10171017
* @index: index of GpioInt resource (starting from %0)
10181018
* @wake_capable: Set to true if the IRQ is wake capable
10191019
*
@@ -1024,15 +1024,15 @@ struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,
10241024
* The function is idempotent, though each time it runs it will configure GPIO
10251025
* pin direction according to the flags in GpioInt resource.
10261026
*
1027-
* The function takes optional @name parameter. If the resource has a property
1028-
* name, then only those will be taken into account.
1027+
* The function takes optional @con_id parameter. If the resource has
1028+
* a @con_id in a property, then only those will be taken into account.
10291029
*
10301030
* The GPIO is considered wake capable if the GpioInt resource specifies
10311031
* SharedAndWake or ExclusiveAndWake.
10321032
*
10331033
* Return: Linux IRQ number (> %0) on success, negative errno on failure.
10341034
*/
1035-
int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *name, int index,
1035+
int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *con_id, int index,
10361036
bool *wake_capable)
10371037
{
10381038
int idx, i;
@@ -1043,9 +1043,8 @@ int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *name, in
10431043
struct acpi_gpio_info info;
10441044
struct gpio_desc *desc;
10451045

1046-
desc = acpi_get_gpiod_by_index(adev, name, i, &info);
1047-
10481046
/* Ignore -EPROBE_DEFER, it only matters if idx matches */
1047+
desc = __acpi_find_gpio(acpi_fwnode_handle(adev), con_id, i, true, &info);
10491048
if (IS_ERR(desc) && PTR_ERR(desc) != -EPROBE_DEFER)
10501049
return PTR_ERR(desc);
10511050

drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ static int mlxbf_gige_probe(struct platform_device *pdev)
428428
priv->rx_irq = platform_get_irq(pdev, MLXBF_GIGE_RECEIVE_PKT_INTR_IDX);
429429
priv->llu_plu_irq = platform_get_irq(pdev, MLXBF_GIGE_LLU_PLU_INTR_IDX);
430430

431-
phy_irq = acpi_dev_gpio_irq_get_by(ACPI_COMPANION(&pdev->dev), "phy-gpios", 0);
431+
phy_irq = acpi_dev_gpio_irq_get_by(ACPI_COMPANION(&pdev->dev), "phy", 0);
432432
if (phy_irq < 0) {
433433
dev_err(&pdev->dev, "Error getting PHY irq. Use polling instead");
434434
phy_irq = PHY_POLL;

drivers/pinctrl/pinctrl-cy8c95x0.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static int cy8c95x0_acpi_get_irq(struct device *dev)
9595
if (ret)
9696
dev_warn(dev, "can't add GPIO ACPI mapping\n");
9797

98-
ret = acpi_dev_gpio_irq_get_by(ACPI_COMPANION(dev), "irq-gpios", 0);
98+
ret = acpi_dev_gpio_irq_get_by(ACPI_COMPANION(dev), "irq", 0);
9999
if (ret < 0)
100100
return ret;
101101

include/linux/acpi.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,7 +1233,7 @@ bool acpi_gpio_get_irq_resource(struct acpi_resource *ares,
12331233
struct acpi_resource_gpio **agpio);
12341234
bool acpi_gpio_get_io_resource(struct acpi_resource *ares,
12351235
struct acpi_resource_gpio **agpio);
1236-
int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *name, int index,
1236+
int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *con_id, int index,
12371237
bool *wake_capable);
12381238
#else
12391239
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,
12461246
{
12471247
return false;
12481248
}
1249-
static inline int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *name,
1249+
static inline int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *con_id,
12501250
int index, bool *wake_capable)
12511251
{
12521252
return -ENXIO;
@@ -1259,10 +1259,10 @@ static inline int acpi_dev_gpio_irq_wake_get(struct acpi_device *adev, int index
12591259
return acpi_dev_gpio_irq_wake_get_by(adev, NULL, index, wake_capable);
12601260
}
12611261

1262-
static inline int acpi_dev_gpio_irq_get_by(struct acpi_device *adev, const char *name,
1262+
static inline int acpi_dev_gpio_irq_get_by(struct acpi_device *adev, const char *con_id,
12631263
int index)
12641264
{
1265-
return acpi_dev_gpio_irq_wake_get_by(adev, name, index, NULL);
1265+
return acpi_dev_gpio_irq_wake_get_by(adev, con_id, index, NULL);
12661266
}
12671267

12681268
static inline int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index)

0 commit comments

Comments
 (0)