[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] x86/aepi: Fully remove dead code



These were marked "currently dead" in commit e681c0408564 ("ACPI/ERST: fix
signed/unsigned type conflicts") in 2014.  They're no-less dead 12 years
later.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <jbeulich@xxxxxxxx>
CC: Roger Pau Monné <roger@xxxxxxxxxxxxxx>
CC: Teddy Astie <teddy.astie@xxxxxxxxxx>
---
 xen/arch/x86/cpu/mcheck/mce-apei.c |  40 ----
 xen/drivers/acpi/apei/erst.c       | 286 -----------------------------
 2 files changed, 326 deletions(-)

diff --git a/xen/arch/x86/cpu/mcheck/mce-apei.c 
b/xen/arch/x86/cpu/mcheck/mce-apei.c
index 0b1c9902c0bd..f5737aa14630 100644
--- a/xen/arch/x86/cpu/mcheck/mce-apei.c
+++ b/xen/arch/x86/cpu/mcheck/mce-apei.c
@@ -87,43 +87,3 @@ int apei_write_mce(struct mce *m)
 
        return erst_write(&rcd.hdr);
 }
-
-#ifndef NDEBUG /* currently dead code */
-
-ssize_t apei_read_mce(struct mce *m, u64 *record_id)
-{
-       struct cper_mce_record rcd;
-       ssize_t len;
-
-       if (!m || !record_id)
-               return -EINVAL;
-
-       len = erst_read_next(&rcd.hdr, sizeof(rcd));
-       if (len <= 0)
-               return len;
-       /* Can not skip other records in storage via ERST unless clear them */
-       else if (len != sizeof(rcd) ||
-                uuid_le_cmp(rcd.hdr.creator_id, CPER_CREATOR_MCE)) {
-               printk(KERN_WARNING
-                       "MCE-APEI: Can not skip the unknown record in ERST");
-               return -EIO;
-       }
-
-       memcpy(m, &rcd.mce, sizeof(*m));
-       *record_id = rcd.hdr.record_id;
-
-       return sizeof(*m);
-}
-
-/* Check whether there is record in ERST */
-bool apei_check_mce(void)
-{
-       return erst_get_record_count() > 0;
-}
-
-int apei_clear_mce(u64 record_id)
-{
-       return erst_clear(record_id);
-}
-
-#endif /* currently dead code */
diff --git a/xen/drivers/acpi/apei/erst.c b/xen/drivers/acpi/apei/erst.c
index 76f799c0ab44..195b527cfda4 100644
--- a/xen/drivers/acpi/apei/erst.c
+++ b/xen/drivers/acpi/apei/erst.c
@@ -382,74 +382,6 @@ static int erst_get_erange(struct erst_erange *range)
        return 0;
 }
 
-#ifndef NDEBUG /* currently dead code */
-
-static ssize_t __erst_get_record_count(void)
-{
-       struct apei_exec_context ctx;
-       int rc;
-       u64 output;
-       ssize_t count;
-
-       erst_exec_ctx_init(&ctx);
-       rc = apei_exec_run(&ctx, ACPI_ERST_GET_RECORD_COUNT);
-       if (rc)
-               return rc;
-       count = output = apei_exec_ctx_get_output(&ctx);
-       return count >= 0 && count == output ? count : -ERANGE;
-}
-
-ssize_t erst_get_record_count(void)
-{
-       ssize_t count;
-       unsigned long flags;
-
-       if (!erst_enabled)
-               return -ENODEV;
-
-       spin_lock_irqsave(&erst_lock, flags);
-       count = __erst_get_record_count();
-       spin_unlock_irqrestore(&erst_lock, flags);
-
-       return count;
-}
-
-static int __erst_get_next_record_id(u64 *record_id)
-{
-       struct apei_exec_context ctx;
-       int rc;
-
-       erst_exec_ctx_init(&ctx);
-       rc = apei_exec_run(&ctx, ACPI_ERST_GET_RECORD_ID);
-       if (rc)
-               return rc;
-       *record_id = apei_exec_ctx_get_output(&ctx);
-
-       return 0;
-}
-
-/*
- * Get the record ID of an existing error record on the persistent
- * storage. If there is no error record on the persistent storage, the
- * returned record_id is APEI_ERST_INVALID_RECORD_ID.
- */
-int erst_get_next_record_id(u64 *record_id)
-{
-       int rc;
-       unsigned long flags;
-
-       if (!erst_enabled)
-               return -ENODEV;
-
-       spin_lock_irqsave(&erst_lock, flags);
-       rc = __erst_get_next_record_id(record_id);
-       spin_unlock_irqrestore(&erst_lock, flags);
-
-       return rc;
-}
-
-#endif /* currently dead code */
-
 static int __erst_write_to_storage(u64 offset)
 {
        struct apei_exec_context ctx;
@@ -489,92 +421,6 @@ static int __erst_write_to_storage(u64 offset)
        return erst_errno(val);
 }
 
-#ifndef NDEBUG /* currently dead code */
-
-static int __erst_read_from_storage(u64 record_id, u64 offset)
-{
-       struct apei_exec_context ctx;
-       u64 timeout = FIRMWARE_TIMEOUT;
-       u64 val;
-       int rc;
-
-       erst_exec_ctx_init(&ctx);
-       rc = apei_exec_run(&ctx, ACPI_ERST_BEGIN_READ);
-       if (rc)
-               return rc;
-       apei_exec_ctx_set_input(&ctx, offset);
-       rc = apei_exec_run(&ctx, ACPI_ERST_SET_RECORD_OFFSET);
-       if (rc)
-               return rc;
-       apei_exec_ctx_set_input(&ctx, record_id);
-       rc = apei_exec_run(&ctx, ACPI_ERST_SET_RECORD_ID);
-       if (rc)
-               return rc;
-       rc = apei_exec_run(&ctx, ACPI_ERST_EXECUTE_OPERATION);
-       if (rc)
-               return rc;
-       for (;;) {
-               rc = apei_exec_run(&ctx, ACPI_ERST_CHECK_BUSY_STATUS);
-               if (rc)
-                       return rc;
-               val = apei_exec_ctx_get_output(&ctx);
-               if (!val)
-                       break;
-               if (erst_timedout(&timeout, SPIN_UNIT))
-                       return -EIO;
-       };
-       rc = apei_exec_run(&ctx, ACPI_ERST_GET_COMMAND_STATUS);
-       if (rc)
-               return rc;
-       val = apei_exec_ctx_get_output(&ctx);
-       rc = apei_exec_run(&ctx, ACPI_ERST_END);
-       if (rc)
-               return rc;
-
-       return erst_errno(val);
-}
-
-static int __erst_clear_from_storage(u64 record_id)
-{
-       struct apei_exec_context ctx;
-       u64 timeout = FIRMWARE_TIMEOUT;
-       u64 val;
-       int rc;
-
-       erst_exec_ctx_init(&ctx);
-       rc = apei_exec_run(&ctx, ACPI_ERST_BEGIN_CLEAR);
-       if (rc)
-               return rc;
-       apei_exec_ctx_set_input(&ctx, record_id);
-       rc = apei_exec_run(&ctx, ACPI_ERST_SET_RECORD_ID);
-       if (rc)
-               return rc;
-       rc = apei_exec_run(&ctx, ACPI_ERST_EXECUTE_OPERATION);
-       if (rc)
-               return rc;
-       for (;;) {
-               rc = apei_exec_run(&ctx, ACPI_ERST_CHECK_BUSY_STATUS);
-               if (rc)
-                       return rc;
-               val = apei_exec_ctx_get_output(&ctx);
-               if (!val)
-                       break;
-               if (erst_timedout(&timeout, SPIN_UNIT))
-                       return -EIO;
-       }
-       rc = apei_exec_run(&ctx, ACPI_ERST_GET_COMMAND_STATUS);
-       if (rc)
-               return rc;
-       val = apei_exec_ctx_get_output(&ctx);
-       rc = apei_exec_run(&ctx, ACPI_ERST_END);
-       if (rc)
-               return rc;
-
-       return erst_errno(val);
-}
-
-#endif /* currently dead code */
-
 /* NVRAM ERST Error Log Address Range is not supported yet */
 static int __erst_write_to_nvram(const struct cper_record_header *record)
 {
@@ -582,24 +428,6 @@ static int __erst_write_to_nvram(const struct 
cper_record_header *record)
        return -ENOSYS;
 }
 
-#ifndef NDEBUG /* currently dead code */
-
-static int __erst_read_to_erange_from_nvram(u64 record_id, u64 *offset)
-{
-       printk(KERN_WARNING
-               "NVRAM ERST Log Address Range is not implemented yet\n");
-       return -ENOSYS;
-}
-
-static int __erst_clear_from_nvram(u64 record_id)
-{
-       printk(KERN_WARNING
-               "NVRAM ERST Log Address Range is not implemented yet\n");
-       return -ENOSYS;
-}
-
-#endif /* currently dead code */
-
 int erst_write(const struct cper_record_header *record)
 {
        int rc;
@@ -639,120 +467,6 @@ int erst_write(const struct cper_record_header *record)
        return rc;
 }
 
-#ifndef NDEBUG /* currently dead code */
-
-static int __erst_read_to_erange(u64 record_id, u64 *offset)
-{
-       int rc;
-
-       if (erst_erange.attr & ERST_RANGE_NVRAM)
-               return __erst_read_to_erange_from_nvram(
-                       record_id, offset);
-
-       rc = __erst_read_from_storage(record_id, 0);
-       if (rc)
-               return rc;
-       *offset = 0;
-
-       return 0;
-}
-
-static ssize_t __erst_read(u64 record_id, struct cper_record_header *record,
-                          size_t buflen)
-{
-       int rc;
-       u64 offset;
-       ssize_t len;
-       struct cper_record_header *rcd_tmp;
-
-       rc = __erst_read_to_erange(record_id, &offset);
-       if (rc)
-               return rc;
-       rcd_tmp = erst_erange.vaddr + offset;
-       if (rcd_tmp->record_length > buflen)
-               return -ENOBUFS;
-       len = rcd_tmp->record_length;
-       if (len < 0)
-               return -ERANGE;
-       memcpy(record, rcd_tmp, len);
-
-       return len;
-}
-
-/*
- * If return value > buflen, the buffer size is not big enough,
- * else if return value < 0, something goes wrong,
- * else everything is OK, and return value is record length
- */
-ssize_t erst_read(u64 record_id, struct cper_record_header *record,
-                 size_t buflen)
-{
-       ssize_t len;
-       unsigned long flags;
-
-       if (!erst_enabled)
-               return -ENODEV;
-
-       spin_lock_irqsave(&erst_lock, flags);
-       len = __erst_read(record_id, record, buflen);
-       spin_unlock_irqrestore(&erst_lock, flags);
-       return len;
-}
-
-/*
- * If return value > buflen, the buffer size is not big enough,
- * else if return value = 0, there is no more record to read,
- * else if return value < 0, something goes wrong,
- * else everything is OK, and return value is record length
- */
-ssize_t erst_read_next(struct cper_record_header *record, size_t buflen)
-{
-       int rc;
-       ssize_t len;
-       unsigned long flags;
-       u64 record_id;
-
-       if (!erst_enabled)
-               return -ENODEV;
-
-       spin_lock_irqsave(&erst_lock, flags);
-       rc = __erst_get_next_record_id(&record_id);
-       if (rc) {
-               spin_unlock_irqrestore(&erst_lock, flags);
-               return rc;
-       }
-       /* no more record */
-       if (record_id == APEI_ERST_INVALID_RECORD_ID) {
-               spin_unlock_irqrestore(&erst_lock, flags);
-               return 0;
-       }
-
-       len = __erst_read(record_id, record, buflen);
-       spin_unlock_irqrestore(&erst_lock, flags);
-
-       return len;
-}
-
-int erst_clear(u64 record_id)
-{
-       int rc;
-       unsigned long flags;
-
-       if (!erst_enabled)
-               return -ENODEV;
-
-       spin_lock_irqsave(&erst_lock, flags);
-       if (erst_erange.attr & ERST_RANGE_NVRAM)
-               rc = __erst_clear_from_nvram(record_id);
-       else
-               rc = __erst_clear_from_storage(record_id);
-       spin_unlock_irqrestore(&erst_lock, flags);
-
-       return rc;
-}
-
-#endif /* currently dead code */
-
 static int __init erst_check_table(struct acpi_table_erst *erst_tab)
 {
        if (erst_tab->header.length < sizeof(*erst_tab))
-- 
2.39.5




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.