Skip to content

Commit fc22b06

Browse files
Sakari Ailusij-intel
authored andcommitted
platform/x86: int3472: Use correct type for "polarity", call it gpio_flags
Struct gpiod_lookup flags field's type is unsigned long. Thus use unsigned long for values to be assigned to that field. Similarly, also call the field gpio_flags which it really is. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20250211072841.7713-2-sakari.ailus@linux.intel.com Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
1 parent 9cff907 commit fc22b06

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

drivers/platform/x86/intel/int3472/discrete.c

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static void skl_int3472_log_sensor_module_name(struct int3472_discrete_device *i
5555

5656
static int skl_int3472_fill_gpiod_lookup(struct gpiod_lookup *table_entry,
5757
struct acpi_resource_gpio *agpio,
58-
const char *func, u32 polarity)
58+
const char *func, unsigned long gpio_flags)
5959
{
6060
char *path = agpio->resource_source.string_ptr;
6161
struct acpi_device *adev;
@@ -70,14 +70,14 @@ static int skl_int3472_fill_gpiod_lookup(struct gpiod_lookup *table_entry,
7070
if (!adev)
7171
return -ENODEV;
7272

73-
*table_entry = GPIO_LOOKUP(acpi_dev_name(adev), agpio->pin_table[0], func, polarity);
73+
*table_entry = GPIO_LOOKUP(acpi_dev_name(adev), agpio->pin_table[0], func, gpio_flags);
7474

7575
return 0;
7676
}
7777

7878
static int skl_int3472_map_gpio_to_sensor(struct int3472_discrete_device *int3472,
7979
struct acpi_resource_gpio *agpio,
80-
const char *func, u32 polarity)
80+
const char *func, unsigned long gpio_flags)
8181
{
8282
int ret;
8383

@@ -87,7 +87,7 @@ static int skl_int3472_map_gpio_to_sensor(struct int3472_discrete_device *int347
8787
}
8888

8989
ret = skl_int3472_fill_gpiod_lookup(&int3472->gpios.table[int3472->n_sensor_gpios],
90-
agpio, func, polarity);
90+
agpio, func, gpio_flags);
9191
if (ret)
9292
return ret;
9393

@@ -100,7 +100,7 @@ static int skl_int3472_map_gpio_to_sensor(struct int3472_discrete_device *int347
100100
static struct gpio_desc *
101101
skl_int3472_gpiod_get_from_temp_lookup(struct int3472_discrete_device *int3472,
102102
struct acpi_resource_gpio *agpio,
103-
const char *func, u32 polarity)
103+
const char *func, unsigned long gpio_flags)
104104
{
105105
struct gpio_desc *desc;
106106
int ret;
@@ -111,7 +111,7 @@ skl_int3472_gpiod_get_from_temp_lookup(struct int3472_discrete_device *int3472,
111111
return ERR_PTR(-ENOMEM);
112112

113113
lookup->dev_id = dev_name(int3472->dev);
114-
ret = skl_int3472_fill_gpiod_lookup(&lookup->table[0], agpio, func, polarity);
114+
ret = skl_int3472_fill_gpiod_lookup(&lookup->table[0], agpio, func, gpio_flags);
115115
if (ret)
116116
return ERR_PTR(ret);
117117

@@ -122,32 +122,33 @@ skl_int3472_gpiod_get_from_temp_lookup(struct int3472_discrete_device *int3472,
122122
return desc;
123123
}
124124

125-
static void int3472_get_func_and_polarity(u8 type, const char **func, u32 *polarity)
125+
static void int3472_get_func_and_polarity(u8 type, const char **func,
126+
unsigned long *gpio_flags)
126127
{
127128
switch (type) {
128129
case INT3472_GPIO_TYPE_RESET:
129130
*func = "reset";
130-
*polarity = GPIO_ACTIVE_LOW;
131+
*gpio_flags = GPIO_ACTIVE_LOW;
131132
break;
132133
case INT3472_GPIO_TYPE_POWERDOWN:
133134
*func = "powerdown";
134-
*polarity = GPIO_ACTIVE_LOW;
135+
*gpio_flags = GPIO_ACTIVE_LOW;
135136
break;
136137
case INT3472_GPIO_TYPE_CLK_ENABLE:
137138
*func = "clk-enable";
138-
*polarity = GPIO_ACTIVE_HIGH;
139+
*gpio_flags = GPIO_ACTIVE_HIGH;
139140
break;
140141
case INT3472_GPIO_TYPE_PRIVACY_LED:
141142
*func = "privacy-led";
142-
*polarity = GPIO_ACTIVE_HIGH;
143+
*gpio_flags = GPIO_ACTIVE_HIGH;
143144
break;
144145
case INT3472_GPIO_TYPE_POWER_ENABLE:
145146
*func = "power-enable";
146-
*polarity = GPIO_ACTIVE_HIGH;
147+
*gpio_flags = GPIO_ACTIVE_HIGH;
147148
break;
148149
default:
149150
*func = "unknown";
150-
*polarity = GPIO_ACTIVE_HIGH;
151+
*gpio_flags = GPIO_ACTIVE_HIGH;
151152
break;
152153
}
153154
}
@@ -194,7 +195,7 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,
194195
struct gpio_desc *gpio;
195196
const char *err_msg;
196197
const char *func;
197-
u32 polarity;
198+
unsigned long gpio_flags;
198199
int ret;
199200

200201
if (!acpi_gpio_get_io_resource(ares, &agpio))
@@ -217,7 +218,7 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,
217218

218219
type = FIELD_GET(INT3472_GPIO_DSM_TYPE, obj->integer.value);
219220

220-
int3472_get_func_and_polarity(type, &func, &polarity);
221+
int3472_get_func_and_polarity(type, &func, &gpio_flags);
221222

222223
pin = FIELD_GET(INT3472_GPIO_DSM_PIN, obj->integer.value);
223224
/* Pin field is not really used under Windows and wraps around at 8 bits */
@@ -227,24 +228,24 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,
227228

228229
active_value = FIELD_GET(INT3472_GPIO_DSM_SENSOR_ON_VAL, obj->integer.value);
229230
if (!active_value)
230-
polarity ^= GPIO_ACTIVE_LOW;
231+
gpio_flags ^= GPIO_ACTIVE_LOW;
231232

232233
dev_dbg(int3472->dev, "%s %s pin %d active-%s\n", func,
233234
agpio->resource_source.string_ptr, agpio->pin_table[0],
234-
str_high_low(polarity == GPIO_ACTIVE_HIGH));
235+
str_high_low(gpio_flags == GPIO_ACTIVE_HIGH));
235236

236237
switch (type) {
237238
case INT3472_GPIO_TYPE_RESET:
238239
case INT3472_GPIO_TYPE_POWERDOWN:
239-
ret = skl_int3472_map_gpio_to_sensor(int3472, agpio, func, polarity);
240+
ret = skl_int3472_map_gpio_to_sensor(int3472, agpio, func, gpio_flags);
240241
if (ret)
241242
err_msg = "Failed to map GPIO pin to sensor\n";
242243

243244
break;
244245
case INT3472_GPIO_TYPE_CLK_ENABLE:
245246
case INT3472_GPIO_TYPE_PRIVACY_LED:
246247
case INT3472_GPIO_TYPE_POWER_ENABLE:
247-
gpio = skl_int3472_gpiod_get_from_temp_lookup(int3472, agpio, func, polarity);
248+
gpio = skl_int3472_gpiod_get_from_temp_lookup(int3472, agpio, func, gpio_flags);
248249
if (IS_ERR(gpio)) {
249250
ret = PTR_ERR(gpio);
250251
err_msg = "Failed to get GPIO\n";

0 commit comments

Comments
 (0)