platform/x86: intel_skl_int3472: Provide skl_int3472_unregister_clock()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Fri, 18 Jun 2021 12:55:14 +0000 (15:55 +0300)
committerHans de Goede <hdegoede@redhat.com>
Tue, 22 Jun 2021 09:15:22 +0000 (11:15 +0200)
For the sake of APIs to be properly layered provide
skl_int3472_unregister_clock().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Daniel Scally <djrscally@gmail.com>
Tested-by: Daniel Scally <djrscally@gmail.com>
Link: https://lore.kernel.org/r/20210618125516.53510-6-andriy.shevchenko@linux.intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/platform/x86/intel-int3472/intel_skl_int3472_clk_and_regulator.c
drivers/platform/x86/intel-int3472/intel_skl_int3472_common.h
drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c

index 60c7128..1700e75 100644 (file)
@@ -130,6 +130,12 @@ out_free_init_name:
        return ret;
 }
 
+void skl_int3472_unregister_clock(struct int3472_discrete_device *int3472)
+{
+       clkdev_drop(int3472->clock.cl);
+       clk_unregister(int3472->clock.clk);
+}
+
 int skl_int3472_register_regulator(struct int3472_discrete_device *int3472,
                                   struct acpi_resource_gpio *agpio)
 {
index 50f73c6..714fde7 100644 (file)
@@ -111,7 +111,9 @@ int skl_int3472_tps68470_probe(struct i2c_client *client);
 union acpi_object *skl_int3472_get_acpi_buffer(struct acpi_device *adev,
                                               char *id);
 int skl_int3472_fill_cldb(struct acpi_device *adev, struct int3472_cldb *cldb);
+
 int skl_int3472_register_clock(struct int3472_discrete_device *int3472);
+void skl_int3472_unregister_clock(struct int3472_discrete_device *int3472);
 
 int skl_int3472_register_regulator(struct int3472_discrete_device *int3472,
                                   struct acpi_resource_gpio *agpio);
index 2638d37..17c6fe8 100644 (file)
@@ -400,10 +400,9 @@ int skl_int3472_discrete_remove(struct platform_device *pdev)
        struct int3472_discrete_device *int3472 = platform_get_drvdata(pdev);
 
        gpiod_remove_lookup_table(&int3472->gpios);
-       clk_unregister(int3472->clock.clk);
 
-       if (int3472->clock.cl)
-               clkdev_drop(int3472->clock.cl);
+       if (int3472->clock.ena_gpio)
+               skl_int3472_unregister_clock(int3472);
 
        gpiod_put(int3472->clock.ena_gpio);
        gpiod_put(int3472->clock.led_gpio);