From: Stefan Berger Date: Tue, 26 Nov 2024 20:39:42 +0000 (-0500) Subject: ieee1275: Consolidate repeated definitions of IEEE1275_IHANDLE_INVALID X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7344b3c7cee8dea94dbc97211c5e6d1925848865;p=thirdparty%2Fgrub.git ieee1275: Consolidate repeated definitions of IEEE1275_IHANDLE_INVALID Consolidate repeated definitions of IEEE1275_IHANDLE_INVALID that are cast to the type grub_ieee1275_ihandle_t. On the occasion add "GRUB_" prefix to the constant name. Signed-off-by: Stefan Berger Reviewed-by: Daniel Kiper --- 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 #include -#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