grub-devel
[Top][All Lists]
Advanced

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

[PATCH v3 3/7] ieee1275: Consolidate repeated definitions of IEEE1275_IH


From: Stefan Berger
Subject: [PATCH v3 3/7] ieee1275: Consolidate repeated definitions of IEEE1275_IHANDLE_INVALID
Date: Tue, 26 Nov 2024 15:39:42 -0500

Consoldiate repeated definitions of IEEE1275_IHANDLE_INVALID that are cast
to the type grub_ieee1275_ihandle_t.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
---
 grub-core/commands/ieee1275/ibmvtpm.c | 4 +---
 grub-core/term/ieee1275/serial.c      | 8 +++-----
 include/grub/ieee1275/ieee1275.h      | 1 +
 3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/grub-core/commands/ieee1275/ibmvtpm.c 
b/grub-core/commands/ieee1275/ibmvtpm.c
index a6fee5c51..dd30c7432 100644
--- a/grub-core/commands/ieee1275/ibmvtpm.c
+++ b/grub-core/commands/ieee1275/ibmvtpm.c
@@ -29,8 +29,6 @@
 static grub_ieee1275_ihandle_t tpm_ihandle;
 static grub_uint8_t tpm_version;
 
-#define IEEE1275_IHANDLE_INVALID ((grub_ieee1275_ihandle_t) 0)
-
 static void
 tpm_get_tpm_version (void)
 {
@@ -53,7 +51,7 @@ tpm_init (void)
     {
       if (grub_ieee1275_open ("/vdevice/vtpm", &tpm_ihandle) < 0)
        {
-         tpm_ihandle = IEEE1275_IHANDLE_INVALID;
+         tpm_ihandle = GRUB_IEEE1275_IHANDLE_INVALID;
          return GRUB_ERR_UNKNOWN_DEVICE;
        }
 
diff --git a/grub-core/term/ieee1275/serial.c b/grub-core/term/ieee1275/serial.c
index 9bc44b306..ac2a8f827 100644
--- a/grub-core/term/ieee1275/serial.c
+++ b/grub-core/term/ieee1275/serial.c
@@ -25,8 +25,6 @@
 #include <grub/i18n.h>
 #include <grub/ieee1275/console.h>
 
-#define IEEE1275_IHANDLE_INVALID  ((grub_ieee1275_ihandle_t) 0)
-
 struct ofserial_hash_ent
 {
   char *devpath;
@@ -44,7 +42,7 @@ do_real_config (struct grub_serial_port *port)
 
   if (grub_ieee1275_open (port->elem->devpath, &port->handle)
       || port->handle == (grub_ieee1275_ihandle_t) -1)
-    port->handle = IEEE1275_IHANDLE_INVALID;
+    port->handle = GRUB_IEEE1275_IHANDLE_INVALID;
 
   port->configured = 1;
 }
@@ -58,7 +56,7 @@ serial_hw_fetch (struct grub_serial_port *port)
 
   do_real_config (port);
 
-  if (port->handle == IEEE1275_IHANDLE_INVALID)
+  if (port->handle == GRUB_IEEE1275_IHANDLE_INVALID)
     return -1;
   grub_ieee1275_read (port->handle, &c, 1, &actual);
 
@@ -76,7 +74,7 @@ serial_hw_put (struct grub_serial_port *port, const int c)
 
   do_real_config (port);
 
-  if (port->handle == IEEE1275_IHANDLE_INVALID)
+  if (port->handle == GRUB_IEEE1275_IHANDLE_INVALID)
     return;
 
   grub_ieee1275_write (port->handle, &c0, 1, &actual);
diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h
index dddb38514..c445d0499 100644
--- a/include/grub/ieee1275/ieee1275.h
+++ b/include/grub/ieee1275/ieee1275.h
@@ -60,6 +60,7 @@ struct grub_ieee1275_common_hdr
 typedef grub_uint32_t grub_ieee1275_ihandle_t;
 typedef grub_uint32_t grub_ieee1275_phandle_t;
 
+#define GRUB_IEEE1275_IHANDLE_INVALID  ((grub_ieee1275_ihandle_t) 0)
 #define GRUB_IEEE1275_PHANDLE_INVALID  ((grub_ieee1275_phandle_t) -1)
 
 struct grub_ieee1275_devalias
-- 
2.25.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]