Skip to content

Commit c9c20ee

Browse files
jwrdegoededtor
authored andcommitted
Input: goodix - fix compilation when ACPI support is disabled
acpi_evaluate_object() and acpi_execute_simple_method() are not part of the group of ACPI related functions which get stubbed by include/linux/acpi.h when ACPI support is disabled, so the IRQ_PIN_ACCESS_ACPI_METHOD handling code must be stubbed out. For consistency use the same #if condition as which is used to replace goodix_add_acpi_gpio_mappings with a stub. Fixes: c5fca48 ("Input: goodix - add support for controlling the IRQ pin through ACPI methods") Reported-by: kbuild test robot <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/20200401014529.GL75430@dtor-ws [dtor: stubbed out the ACPI method accessors] Reviewed-by: Bastien Nocera <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 10ad484 commit c9c20ee

File tree

1 file changed

+42
-13
lines changed

1 file changed

+42
-13
lines changed

drivers/input/touchscreen/goodix.c

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@
6363
#define MAX_CONTACTS_LOC 5
6464
#define TRIGGER_LOC 6
6565

66+
/* Our special handling for GPIO accesses through ACPI is x86 specific */
67+
#if defined CONFIG_X86 && defined CONFIG_ACPI
68+
#define ACPI_GPIO_SUPPORT
69+
#endif
70+
6671
struct goodix_ts_data;
6772

6873
enum goodix_irq_pin_access_method {
@@ -600,12 +605,42 @@ static int goodix_send_cfg(struct goodix_ts_data *ts, const u8 *cfg, int len)
600605
return 0;
601606
}
602607

603-
static int goodix_irq_direction_output(struct goodix_ts_data *ts,
604-
int value)
608+
#ifdef ACPI_GPIO_SUPPORT
609+
static int goodix_pin_acpi_direction_input(struct goodix_ts_data *ts)
605610
{
606-
struct device *dev = &ts->client->dev;
611+
acpi_handle handle = ACPI_HANDLE(&ts->client->dev);
607612
acpi_status status;
608613

614+
status = acpi_evaluate_object(handle, "INTI", NULL, NULL);
615+
return ACPI_SUCCESS(status) ? 0 : -EIO;
616+
}
617+
618+
static int goodix_pin_acpi_output_method(struct goodix_ts_data *ts, int value)
619+
{
620+
acpi_handle handle = ACPI_HANDLE(&ts->client->dev);
621+
acpi_status status;
622+
623+
status = acpi_execute_simple_method(handle, "INTO", value);
624+
return ACPI_SUCCESS(status) ? 0 : -EIO;
625+
}
626+
#else
627+
static int goodix_pin_acpi_direction_input(struct goodix_ts_data *ts)
628+
{
629+
dev_err(&ts->client->dev,
630+
"%s called on device without ACPI support\n", __func__);
631+
return -EINVAL;
632+
}
633+
634+
static int goodix_pin_acpi_output_method(struct goodix_ts_data *ts, int value)
635+
{
636+
dev_err(&ts->client->dev,
637+
"%s called on device without ACPI support\n", __func__);
638+
return -EINVAL;
639+
}
640+
#endif
641+
642+
static int goodix_irq_direction_output(struct goodix_ts_data *ts, int value)
643+
{
609644
switch (ts->irq_pin_access_method) {
610645
case IRQ_PIN_ACCESS_NONE:
611646
dev_err(&ts->client->dev,
@@ -621,32 +656,26 @@ static int goodix_irq_direction_output(struct goodix_ts_data *ts,
621656
*/
622657
return gpiod_direction_output_raw(ts->gpiod_int, value);
623658
case IRQ_PIN_ACCESS_ACPI_METHOD:
624-
status = acpi_execute_simple_method(ACPI_HANDLE(dev),
625-
"INTO", value);
626-
return ACPI_SUCCESS(status) ? 0 : -EIO;
659+
return goodix_pin_acpi_output_method(ts, value);
627660
}
628661

629662
return -EINVAL; /* Never reached */
630663
}
631664

632665
static int goodix_irq_direction_input(struct goodix_ts_data *ts)
633666
{
634-
struct device *dev = &ts->client->dev;
635-
acpi_status status;
636-
637667
switch (ts->irq_pin_access_method) {
638668
case IRQ_PIN_ACCESS_NONE:
639669
dev_err(&ts->client->dev,
640670
"%s called without an irq_pin_access_method set\n",
641671
__func__);
642672
return -EINVAL;
643673
case IRQ_PIN_ACCESS_GPIO:
674+
return gpiod_direction_input(ts->gpiod_int);
644675
case IRQ_PIN_ACCESS_ACPI_GPIO:
645676
return gpiod_direction_input(ts->gpiod_int);
646677
case IRQ_PIN_ACCESS_ACPI_METHOD:
647-
status = acpi_evaluate_object(ACPI_HANDLE(dev), "INTI",
648-
NULL, NULL);
649-
return ACPI_SUCCESS(status) ? 0 : -EIO;
678+
return goodix_pin_acpi_direction_input(ts);
650679
}
651680

652681
return -EINVAL; /* Never reached */
@@ -710,7 +739,7 @@ static int goodix_reset(struct goodix_ts_data *ts)
710739
return 0;
711740
}
712741

713-
#if defined CONFIG_X86 && defined CONFIG_ACPI
742+
#ifdef ACPI_GPIO_SUPPORT
714743
#include <asm/cpu_device_id.h>
715744
#include <asm/intel-family.h>
716745

0 commit comments

Comments
 (0)