Add a con_id parameter to skl_int3472_register_led() to allow callers to specify both the LED name suffix and lookup con_id instead of hardcoding "privacy". This prepares for registering additional LED types with different names. While at it, rename the privacy LED's GPIO con_id from "privacy-led" to "privacy" in int3472_get_con_id_and_polarity() and pass it directly to skl_int3472_register_led(), reducing churn when adding new LED types. No functional change.
Unified · Split
| @@ -212,7 +212,7 @@ static void int3472_get_con_id_and_polarity(struct int3472_discrete_device *int3 · 211 unmodified lines | ||
| 212 | 212 | *gpio_flags = GPIO_ACTIVE_HIGH; |
| 213 | 213 | break; |
| 214 | 214 | case INT3472_GPIO_TYPE_PRIVACY_LED: |
| 215 | − *con_id = "privacy-led"; | |
| 215 | + *con_id = "privacy"; | |
| 216 | 216 | *gpio_flags = GPIO_ACTIVE_HIGH; |
| 217 | 217 | break; |
| 218 | 218 | case INT3472_GPIO_TYPE_HOTPLUG_DETECT: |
| @@ -354,7 +354,7 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares, · 135 unmodified lines | ||
| 354 | 354 | |
| 355 | 355 | break; |
| 356 | 356 | case INT3472_GPIO_TYPE_PRIVACY_LED: |
| 357 | − ret = skl_int3472_register_led(int3472, gpio); | |
| 357 | + ret = skl_int3472_register_led(int3472, gpio, con_id); | |
| 358 | 358 | if (ret) |
| 359 | 359 | err_msg = "Failed to register LED\n"; |
| 360 | 360 | |
| @@ -14,7 +14,8 @@ static int int3472_led_set(struct led_classdev *led_cdev, enum led_brightness br · 13 unmodified lines | ||
| 14 | 14 | return 0; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | −int skl_int3472_register_led(struct int3472_discrete_device *int3472, struct gpio_desc *gpio) | |
| 17 | +int skl_int3472_register_led(struct int3472_discrete_device *int3472, struct gpio_desc *gpio, | |
| 18 | + const char *con_id) | |
| 18 | 19 | { |
| 19 | 20 | struct int3472_led *led = &int3472->led; |
| 20 | 21 | char *p; |
| @@ -27,7 +28,7 @@ int skl_int3472_register_led(struct int3472_discrete_device *int3472, struct gpi · 6 unmodified lines | ||
| 27 | 28 | |
| 28 | 29 | /* Generate the name, replacing the ':' in the ACPI devname with '_' */ |
| 29 | 30 | snprintf(led->name, sizeof(led->name), |
| 30 | − "%s::privacy_led", acpi_dev_name(int3472->sensor)); | |
| 31 | + "%s::%s_led", acpi_dev_name(int3472->sensor), con_id); | |
| 31 | 32 | p = strchr(led->name, ':'); |
| 32 | 33 | if (p) |
| 33 | 34 | *p = '_'; |
| @@ -42,7 +43,7 @@ int skl_int3472_register_led(struct int3472_discrete_device *int3472, struct gpi · 8 unmodified lines | ||
| 42 | 43 | |
| 43 | 44 | led->lookup.provider = led->name; |
| 44 | 45 | led->lookup.dev_id = int3472->sensor_name; |
| 45 | − led->lookup.con_id = "privacy"; | |
| 46 | + led->lookup.con_id = con_id; | |
| 46 | 47 | led_add_lookup(&led->lookup); |
| 47 | 48 | |
| 48 | 49 | return 0; |
| @@ -161,7 +161,8 @@ int skl_int3472_register_regulator(struct int3472_discrete_device *int3472, · 160 unmodified lines | ||
| 161 | 161 | const char *second_sensor); |
| 162 | 162 | void skl_int3472_unregister_regulator(struct int3472_discrete_device *int3472); |
| 163 | 163 | |
| 164 | −int skl_int3472_register_led(struct int3472_discrete_device *int3472, struct gpio_desc *gpio); | |
| 164 | +int skl_int3472_register_led(struct int3472_discrete_device *int3472, struct gpio_desc *gpio, | |
| 165 | + const char *con_id); | |
| 165 | 166 | void skl_int3472_unregister_led(struct int3472_discrete_device *int3472); |
| 166 | 167 | |
| 167 | 168 | #endif |