ACPI: x86: Move acpi_cmos_rtc to x86 folder
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 4 Apr 2024 18:23:40 +0000 (21:23 +0300)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 8 Apr 2024 14:39:24 +0000 (16:39 +0200)
acpi_cmos_rtc is built solely for x86, move it to the respective folder.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/Makefile
drivers/acpi/acpi_cmos_rtc.c [deleted file]
drivers/acpi/x86/Makefile
drivers/acpi/x86/cmos_rtc.c [new file with mode: 0644]

index f84de92b07136cf59e166ebd5d9258bb1b1d9189..5e14aa11c2cbf9e7d546a18b301e1c9b2482b3cb 100644 (file)
@@ -55,7 +55,6 @@ acpi-y                                += event.o
 acpi-y                         += evged.o
 acpi-y                         += sysfs.o
 acpi-y                         += property.o
-acpi-$(CONFIG_X86)             += acpi_cmos_rtc.o
 acpi-$(CONFIG_DEBUG_FS)                += debugfs.o
 acpi-y                         += acpi_lpat.o
 acpi-$(CONFIG_ACPI_FPDT)       += acpi_fpdt.o
diff --git a/drivers/acpi/acpi_cmos_rtc.c b/drivers/acpi/acpi_cmos_rtc.c
deleted file mode 100644 (file)
index 9b55d15..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * ACPI support for CMOS RTC Address Space access
- *
- * Copyright (C) 2013, Intel Corporation
- * Authors: Lan Tianyu <tianyu.lan@intel.com>
- */
-
-#define pr_fmt(fmt) "ACPI: " fmt
-
-#include <linux/acpi.h>
-#include <linux/device.h>
-#include <linux/err.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/mc146818rtc.h>
-
-#include "internal.h"
-
-static const struct acpi_device_id acpi_cmos_rtc_ids[] = {
-       { "PNP0B00" },
-       { "PNP0B01" },
-       { "PNP0B02" },
-       {}
-};
-
-static acpi_status
-acpi_cmos_rtc_space_handler(u32 function, acpi_physical_address address,
-                     u32 bits, u64 *value64,
-                     void *handler_context, void *region_context)
-{
-       int i;
-       u8 *value = (u8 *)value64;
-
-       if (address > 0xff || !value64)
-               return AE_BAD_PARAMETER;
-
-       if (function != ACPI_WRITE && function != ACPI_READ)
-               return AE_BAD_PARAMETER;
-
-       spin_lock_irq(&rtc_lock);
-
-       for (i = 0; i < DIV_ROUND_UP(bits, 8); ++i, ++address, ++value)
-               if (function == ACPI_READ)
-                       *value = CMOS_READ(address);
-               else
-                       CMOS_WRITE(*value, address);
-
-       spin_unlock_irq(&rtc_lock);
-
-       return AE_OK;
-}
-
-int acpi_install_cmos_rtc_space_handler(acpi_handle handle)
-{
-       acpi_status status;
-
-       status = acpi_install_address_space_handler(handle,
-                       ACPI_ADR_SPACE_CMOS,
-                       &acpi_cmos_rtc_space_handler,
-                       NULL, NULL);
-       if (ACPI_FAILURE(status)) {
-               pr_err("Error installing CMOS-RTC region handler\n");
-               return -ENODEV;
-       }
-
-       return 1;
-}
-EXPORT_SYMBOL_GPL(acpi_install_cmos_rtc_space_handler);
-
-void acpi_remove_cmos_rtc_space_handler(acpi_handle handle)
-{
-       if (ACPI_FAILURE(acpi_remove_address_space_handler(handle,
-                       ACPI_ADR_SPACE_CMOS, &acpi_cmos_rtc_space_handler)))
-               pr_err("Error removing CMOS-RTC region handler\n");
-}
-EXPORT_SYMBOL_GPL(acpi_remove_cmos_rtc_space_handler);
-
-static int acpi_cmos_rtc_attach_handler(struct acpi_device *adev, const struct acpi_device_id *id)
-{
-       return acpi_install_cmos_rtc_space_handler(adev->handle);
-}
-
-static void acpi_cmos_rtc_detach_handler(struct acpi_device *adev)
-{
-       acpi_remove_cmos_rtc_space_handler(adev->handle);
-}
-
-static struct acpi_scan_handler cmos_rtc_handler = {
-       .ids = acpi_cmos_rtc_ids,
-       .attach = acpi_cmos_rtc_attach_handler,
-       .detach = acpi_cmos_rtc_detach_handler,
-};
-
-void __init acpi_cmos_rtc_init(void)
-{
-       acpi_scan_add_handler(&cmos_rtc_handler);
-}
index bd17dd2c2c5bbf23ed7a7350e6209dd913161c62..b97b1bcf84049504fdcb8bbd7863ba453e768b7f 100644 (file)
@@ -1,4 +1,5 @@
 obj-$(CONFIG_ACPI)     += acpi-x86.o
 acpi-x86-y             += apple.o
+acpi-x86-y             += cmos_rtc.o
 acpi-x86-y             += s2idle.o
 acpi-x86-y             += utils.o
diff --git a/drivers/acpi/x86/cmos_rtc.c b/drivers/acpi/x86/cmos_rtc.c
new file mode 100644 (file)
index 0000000..51643ff
--- /dev/null
@@ -0,0 +1,98 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * ACPI support for CMOS RTC Address Space access
+ *
+ * Copyright (C) 2013, Intel Corporation
+ * Authors: Lan Tianyu <tianyu.lan@intel.com>
+ */
+
+#define pr_fmt(fmt) "ACPI: " fmt
+
+#include <linux/acpi.h>
+#include <linux/device.h>
+#include <linux/err.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/mc146818rtc.h>
+
+#include "../internal.h"
+
+static const struct acpi_device_id acpi_cmos_rtc_ids[] = {
+       { "PNP0B00" },
+       { "PNP0B01" },
+       { "PNP0B02" },
+       {}
+};
+
+static acpi_status
+acpi_cmos_rtc_space_handler(u32 function, acpi_physical_address address,
+                     u32 bits, u64 *value64,
+                     void *handler_context, void *region_context)
+{
+       int i;
+       u8 *value = (u8 *)value64;
+
+       if (address > 0xff || !value64)
+               return AE_BAD_PARAMETER;
+
+       if (function != ACPI_WRITE && function != ACPI_READ)
+               return AE_BAD_PARAMETER;
+
+       spin_lock_irq(&rtc_lock);
+
+       for (i = 0; i < DIV_ROUND_UP(bits, 8); ++i, ++address, ++value)
+               if (function == ACPI_READ)
+                       *value = CMOS_READ(address);
+               else
+                       CMOS_WRITE(*value, address);
+
+       spin_unlock_irq(&rtc_lock);
+
+       return AE_OK;
+}
+
+int acpi_install_cmos_rtc_space_handler(acpi_handle handle)
+{
+       acpi_status status;
+
+       status = acpi_install_address_space_handler(handle,
+                       ACPI_ADR_SPACE_CMOS,
+                       &acpi_cmos_rtc_space_handler,
+                       NULL, NULL);
+       if (ACPI_FAILURE(status)) {
+               pr_err("Error installing CMOS-RTC region handler\n");
+               return -ENODEV;
+       }
+
+       return 1;
+}
+EXPORT_SYMBOL_GPL(acpi_install_cmos_rtc_space_handler);
+
+void acpi_remove_cmos_rtc_space_handler(acpi_handle handle)
+{
+       if (ACPI_FAILURE(acpi_remove_address_space_handler(handle,
+                       ACPI_ADR_SPACE_CMOS, &acpi_cmos_rtc_space_handler)))
+               pr_err("Error removing CMOS-RTC region handler\n");
+}
+EXPORT_SYMBOL_GPL(acpi_remove_cmos_rtc_space_handler);
+
+static int acpi_cmos_rtc_attach_handler(struct acpi_device *adev, const struct acpi_device_id *id)
+{
+       return acpi_install_cmos_rtc_space_handler(adev->handle);
+}
+
+static void acpi_cmos_rtc_detach_handler(struct acpi_device *adev)
+{
+       acpi_remove_cmos_rtc_space_handler(adev->handle);
+}
+
+static struct acpi_scan_handler cmos_rtc_handler = {
+       .ids = acpi_cmos_rtc_ids,
+       .attach = acpi_cmos_rtc_attach_handler,
+       .detach = acpi_cmos_rtc_detach_handler,
+};
+
+void __init acpi_cmos_rtc_init(void)
+{
+       acpi_scan_add_handler(&cmos_rtc_handler);
+}