Blame SOURCES/0242-cleanup-grub_cpu_to_XXX_compile_time-for-constants.patch

28f7f8
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
27a4da
From: Andrey Borzenkov <arvidjaar@gmail.com>
27a4da
Date: Mon, 22 Sep 2014 20:47:10 +0400
28f7f8
Subject: [PATCH] cleanup: grub_cpu_to_XXX_compile_time for constants
27a4da
27a4da
This tries to catch all cases where grub_cpu_to_XXX was used for constant
27a4da
expressions (including sizeof).
27a4da
---
27a4da
 grub-core/bus/usb/ehci.c         | 44 ++++++++++++++++++++--------------------
27a4da
 grub-core/bus/usb/ohci.c         |  8 ++++----
27a4da
 grub-core/commands/gptsync.c     |  6 +++---
27a4da
 grub-core/disk/mdraid_linux.c    | 12 +++++------
27a4da
 grub-core/disk/scsi.c            |  2 +-
27a4da
 grub-core/disk/usbms.c           |  4 ++--
27a4da
 grub-core/fs/hfs.c               |  2 +-
27a4da
 grub-core/fs/reiserfs.c          | 12 +++++------
27a4da
 grub-core/lib/fdt.c              | 12 +++++------
27a4da
 grub-core/loader/i386/linux.c    |  2 +-
27a4da
 grub-core/loader/i386/pc/linux.c | 12 +++++------
27a4da
 grub-core/loader/i386/xen_file.c |  4 ++--
27a4da
 grub-core/net/arp.c              |  4 ++--
27a4da
 grub-core/net/bootp.c            |  4 ++--
27a4da
 grub-core/net/ip.c               |  2 +-
27a4da
 grub-core/net/net.c              |  2 +-
27a4da
 grub-core/net/tftp.c             |  8 ++++----
27a4da
 grub-core/partmap/acorn.c        |  4 ++--
27a4da
 grub-core/partmap/bsdlabel.c     |  2 +-
27a4da
 grub-core/partmap/gpt.c          |  2 +-
27a4da
 grub-core/partmap/msdos.c        |  4 ++--
27a4da
 grub-core/tests/video_checksum.c |  6 +++---
27a4da
 util/grub-mkfont.c               |  4 ++--
27a4da
 util/grub-mklayout.c             |  2 +-
27a4da
 util/mkimage.c                   | 15 +++++++-------
27a4da
 25 files changed, 90 insertions(+), 89 deletions(-)
27a4da
27a4da
diff --git a/grub-core/bus/usb/ehci.c b/grub-core/bus/usb/ehci.c
28f7f8
index c0feefafe4a..8ece40086ec 100644
27a4da
--- a/grub-core/bus/usb/ehci.c
27a4da
+++ b/grub-core/bus/usb/ehci.c
27a4da
@@ -670,23 +670,23 @@ grub_ehci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid,
27a4da
   for (i = 0; i < (GRUB_EHCI_N_TD - 1); i++)
27a4da
     {
27a4da
       e->td_virt[i].link_td = e->td_phys + (i + 1) * sizeof (struct grub_ehci_td);
27a4da
-      e->td_virt[i].next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
27a4da
-      e->td_virt[i].alt_next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
27a4da
+      e->td_virt[i].next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
27a4da
+      e->td_virt[i].alt_next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
27a4da
     }
27a4da
   e->td_virt[GRUB_EHCI_N_TD - 1].next_td =
27a4da
-    grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
27a4da
+    grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
27a4da
   e->td_virt[GRUB_EHCI_N_TD - 1].alt_next_td =
27a4da
-    grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
27a4da
+    grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
27a4da
   e->tdfree_virt = e->td_virt;
27a4da
   /* Set Terminate in first QH, which is used in framelist */
27a4da
-  e->qh_virt[0].qh_hptr = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE | GRUB_EHCI_HPTR_TYPE_QH);
27a4da
-  e->qh_virt[0].td_overlay.next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
27a4da
+  e->qh_virt[0].qh_hptr = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE | GRUB_EHCI_HPTR_TYPE_QH);
27a4da
+  e->qh_virt[0].td_overlay.next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
27a4da
   e->qh_virt[0].td_overlay.alt_next_td =
27a4da
-    grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
27a4da
+    grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
27a4da
   /* Also set Halted bit in token */
27a4da
-  e->qh_virt[0].td_overlay.token = grub_cpu_to_le32 (GRUB_EHCI_STATUS_HALTED);
27a4da
+  e->qh_virt[0].td_overlay.token = grub_cpu_to_le32_compile_time (GRUB_EHCI_STATUS_HALTED);
27a4da
   /* Set the H bit in first QH used for AL */
27a4da
-  e->qh_virt[1].ep_char = grub_cpu_to_le32 (GRUB_EHCI_H);
27a4da
+  e->qh_virt[1].ep_char = grub_cpu_to_le32_compile_time (GRUB_EHCI_H);
27a4da
   /* Set Terminate into TD in rest of QHs and set horizontal link
27a4da
    * pointer to itself - these QHs will be used for asynchronous
27a4da
    * schedule and they should have valid value in horiz. link */
27a4da
@@ -697,12 +697,12 @@ grub_ehci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid,
27a4da
 						e->qh_chunk) &
27a4da
 			   GRUB_EHCI_POINTER_MASK) | GRUB_EHCI_HPTR_TYPE_QH);
27a4da
       e->qh_virt[i].td_overlay.next_td =
27a4da
-	grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
27a4da
+	grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
27a4da
       e->qh_virt[i].td_overlay.alt_next_td =
27a4da
-	grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
27a4da
+	grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
27a4da
       /* Also set Halted bit in token */
27a4da
       e->qh_virt[i].td_overlay.token =
27a4da
-	grub_cpu_to_le32 (GRUB_EHCI_STATUS_HALTED);
27a4da
+	grub_cpu_to_le32_compile_time (GRUB_EHCI_STATUS_HALTED);
27a4da
     }
27a4da
 
27a4da
   /* Note: QH 0 and QH 1 are reserved and must not be used anywhere.
27a4da
@@ -991,7 +991,7 @@ grub_ehci_find_qh (struct grub_ehci *e, grub_usb_transfer_t transfer)
27a4da
   target = ((transfer->endpoint << GRUB_EHCI_EP_NUM_OFF) |
27a4da
 	    transfer->devaddr) & GRUB_EHCI_TARGET_MASK;
27a4da
   target = grub_cpu_to_le32 (target);
27a4da
-  mask = grub_cpu_to_le32 (GRUB_EHCI_TARGET_MASK);
27a4da
+  mask = grub_cpu_to_le32_compile_time (GRUB_EHCI_TARGET_MASK);
27a4da
 
27a4da
   /* low speed interrupt transfers are linked to the periodic */
27a4da
   /* schedule, everything else to the asynchronous schedule */
27a4da
@@ -1200,7 +1200,7 @@ grub_ehci_transaction (struct grub_ehci *e,
27a4da
   grub_memset ((void *) td, 0, sizeof (struct grub_ehci_td));
27a4da
 
27a4da
   /* Don't point to any TD yet, just terminate.  */
27a4da
-  td->next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
27a4da
+  td->next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
27a4da
   /* Set alternate pointer. When short packet occurs, alternate TD
27a4da
    * will not be really fetched because it is not active. But don't
27a4da
    * forget, EHCI will try to fetch alternate TD every scan of AL
27a4da
@@ -1325,9 +1325,9 @@ grub_ehci_setup_transfer (grub_usb_controller_t dev,
27a4da
   /* Fill whole alternate TD by zeros (= inactive) and set
27a4da
    * Terminate bits and Halt bit */
27a4da
   grub_memset ((void *) cdata->td_alt_virt, 0, sizeof (struct grub_ehci_td));
27a4da
-  cdata->td_alt_virt->next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
27a4da
-  cdata->td_alt_virt->alt_next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
27a4da
-  cdata->td_alt_virt->token = grub_cpu_to_le32 (GRUB_EHCI_STATUS_HALTED);
27a4da
+  cdata->td_alt_virt->next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
27a4da
+  cdata->td_alt_virt->alt_next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
27a4da
+  cdata->td_alt_virt->token = grub_cpu_to_le32_compile_time (GRUB_EHCI_STATUS_HALTED);
27a4da
 
27a4da
   /* Allocate appropriate number of TDs and set */
27a4da
   for (i = 0; i < transfer->transcnt; i++)
27a4da
@@ -1364,7 +1364,7 @@ grub_ehci_setup_transfer (grub_usb_controller_t dev,
27a4da
   cdata->td_last_virt = td;
27a4da
   cdata->td_last_phys = grub_dma_virt2phys (td, e->td_chunk);
27a4da
   /* Last TD should not have set alternate TD */
27a4da
-  cdata->td_last_virt->alt_next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
27a4da
+  cdata->td_last_virt->alt_next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
27a4da
 
27a4da
   grub_dprintf ("ehci", "setup_transfer: cdata=%p, qh=%p\n",
27a4da
 		cdata,cdata->qh_virt);
27a4da
@@ -1377,14 +1377,14 @@ grub_ehci_setup_transfer (grub_usb_controller_t dev,
27a4da
   /* Start transfer: */
27a4da
   /* Unlink possible alternate pointer in QH */
27a4da
   cdata->qh_virt->td_overlay.alt_next_td =
27a4da
-    grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
27a4da
+    grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
27a4da
   /* Link new TDs with QH via next_td */
27a4da
   cdata->qh_virt->td_overlay.next_td =
27a4da
     grub_cpu_to_le32 (grub_dma_virt2phys
27a4da
 		      (cdata->td_first_virt, e->td_chunk));
27a4da
   /* Reset Active and Halted bits in QH to activate Advance Queue,
27a4da
    * i.e. reset token */
27a4da
-  cdata->qh_virt->td_overlay.token = grub_cpu_to_le32 (0);
27a4da
+  cdata->qh_virt->td_overlay.token = grub_cpu_to_le32_compile_time (0);
27a4da
 
27a4da
   /* Finito */
27a4da
   transfer->controller_data = cdata;
27a4da
@@ -1408,9 +1408,9 @@ grub_ehci_pre_finish_transfer (grub_usb_transfer_t transfer)
27a4da
    * safely manipulate with QH TD part. */
27a4da
   cdata->qh_virt->td_overlay.token = (cdata->qh_virt->td_overlay.token
27a4da
 				      |
27a4da
-				      grub_cpu_to_le32
27a4da
+				      grub_cpu_to_le32_compile_time
27a4da
 				      (GRUB_EHCI_STATUS_HALTED)) &
27a4da
-    grub_cpu_to_le32 (~GRUB_EHCI_STATUS_ACTIVE);
27a4da
+    grub_cpu_to_le32_compile_time (~GRUB_EHCI_STATUS_ACTIVE);
27a4da
 
27a4da
   /* Print debug data here if necessary */
27a4da
 
27a4da
diff --git a/grub-core/bus/usb/ohci.c b/grub-core/bus/usb/ohci.c
28f7f8
index 946a4ed7d5b..d27bfe7fb9d 100644
27a4da
--- a/grub-core/bus/usb/ohci.c
27a4da
+++ b/grub-core/bus/usb/ohci.c
27a4da
@@ -314,7 +314,7 @@ grub_ohci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid,
27a4da
   grub_memset ((void *) o->ed_ctrl, 0, sizeof (struct grub_ohci_ed)
27a4da
 	       * GRUB_OHCI_CTRL_EDS);
27a4da
   for (j=0; j < GRUB_OHCI_CTRL_EDS; j++)
27a4da
-    o->ed_ctrl[j].target = grub_cpu_to_le32 (1 << 14); /* skip */
27a4da
+    o->ed_ctrl[j].target = grub_cpu_to_le32_compile_time (1 << 14); /* skip */
27a4da
     
27a4da
   grub_dprintf ("ohci", "EDs-C: chunk=%p, virt=%p, phys=0x%02x\n",
27a4da
                 o->ed_ctrl_chunk, o->ed_ctrl, o->ed_ctrl_addr);
27a4da
@@ -329,7 +329,7 @@ grub_ohci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid,
27a4da
   /* Preset EDs */
27a4da
   grub_memset ((void*)o->ed_bulk, 0, sizeof(struct grub_ohci_ed) * GRUB_OHCI_BULK_EDS);
27a4da
   for (j=0; j < GRUB_OHCI_BULK_EDS; j++)
27a4da
-    o->ed_bulk[j].target = grub_cpu_to_le32 (1 << 14); /* skip */
27a4da
+    o->ed_bulk[j].target = grub_cpu_to_le32_compile_time (1 << 14); /* skip */
27a4da
 
27a4da
   grub_dprintf ("ohci", "EDs-B: chunk=%p, virt=%p, phys=0x%02x\n",
27a4da
                 o->ed_bulk_chunk, o->ed_bulk, o->ed_bulk_addr);
27a4da
@@ -1349,10 +1349,10 @@ grub_ohci_fini_hw (int noreturn __attribute__ ((unused)))
27a4da
       /* Set skip in all EDs */
27a4da
       if (o->ed_bulk)
27a4da
         for (i=0; i < GRUB_OHCI_BULK_EDS; i++)
27a4da
-          o->ed_bulk[i].target |= grub_cpu_to_le32 (1 << 14); /* skip */
27a4da
+          o->ed_bulk[i].target |= grub_cpu_to_le32_compile_time (1 << 14); /* skip */
27a4da
       if (o->ed_ctrl)
27a4da
         for (i=0; i < GRUB_OHCI_CTRL_EDS; i++)
27a4da
-          o->ed_ctrl[i].target |= grub_cpu_to_le32 (1 << 14); /* skip */
27a4da
+          o->ed_ctrl[i].target |= grub_cpu_to_le32_compile_time (1 << 14); /* skip */
27a4da
 
27a4da
       /* We should wait for next SOF to be sure that all EDs are
27a4da
        * unaccessed by OHCI. But OHCI can be non-functional, so
27a4da
diff --git a/grub-core/commands/gptsync.c b/grub-core/commands/gptsync.c
28f7f8
index 3db62887b92..16592e9bbe8 100644
27a4da
--- a/grub-core/commands/gptsync.c
27a4da
+++ b/grub-core/commands/gptsync.c
27a4da
@@ -101,7 +101,7 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)),
27a4da
     }
27a4da
 
27a4da
   /* Check if it is valid.  */
27a4da
-  if (mbr.signature != grub_cpu_to_le16 (GRUB_PC_PARTITION_SIGNATURE))
27a4da
+  if (mbr.signature != grub_cpu_to_le16_compile_time (GRUB_PC_PARTITION_SIGNATURE))
27a4da
     {
27a4da
       grub_device_close (dev);
27a4da
       return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature");
27a4da
@@ -216,7 +216,7 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)),
27a4da
     first_sector--;
27a4da
   mbr.entries[0].flag = 0;
27a4da
   mbr.entries[0].type = GRUB_PC_PARTITION_TYPE_GPT_DISK;
27a4da
-  mbr.entries[0].start = grub_cpu_to_le32 (1);
27a4da
+  mbr.entries[0].start = grub_cpu_to_le32_compile_time (1);
27a4da
   lba_to_chs (1,
27a4da
 	      &(mbr.entries[0].start_sector),
27a4da
 	      &(mbr.entries[0].start_cylinder),
27a4da
@@ -227,7 +227,7 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)),
27a4da
 	      &(mbr.entries[0].end_head));
27a4da
   mbr.entries[0].length = grub_cpu_to_le32 (first_sector);
27a4da
 
27a4da
-  mbr.signature = grub_cpu_to_le16 (GRUB_PC_PARTITION_SIGNATURE);
27a4da
+  mbr.signature = grub_cpu_to_le16_compile_time (GRUB_PC_PARTITION_SIGNATURE);
27a4da
 
27a4da
   if (grub_disk_write (dev->disk, 0, 0, sizeof (mbr), &mbr))
27a4da
     {
27a4da
diff --git a/grub-core/disk/mdraid_linux.c b/grub-core/disk/mdraid_linux.c
28f7f8
index 4aa5882352e..11024ae31e0 100644
27a4da
--- a/grub-core/disk/mdraid_linux.c
27a4da
+++ b/grub-core/disk/mdraid_linux.c
27a4da
@@ -33,16 +33,16 @@ GRUB_MOD_LICENSE ("GPLv3+");
27a4da
 #define grub_md_to_cpu64 grub_be_to_cpu64
27a4da
 #define grub_md_to_cpu32 grub_be_to_cpu32
27a4da
 #define grub_md_to_cpu16 grub_be_to_cpu16
27a4da
-#define grub_cpu_to_md64_compile_time grub_cpu_to_be64
27a4da
-#define grub_cpu_to_md32_compile_time grub_cpu_to_be32
27a4da
-#define grub_cpu_to_md16_compile_time grub_cpu_to_be16
27a4da
+#define grub_cpu_to_md64_compile_time grub_cpu_to_be64_compile_time
27a4da
+#define grub_cpu_to_md32_compile_time grub_cpu_to_be32_compile_time
27a4da
+#define grub_cpu_to_md16_compile_time grub_cpu_to_be16_compile_time
27a4da
 #else
27a4da
 #define grub_md_to_cpu64 grub_le_to_cpu64
27a4da
 #define grub_md_to_cpu32 grub_le_to_cpu32
27a4da
 #define grub_md_to_cpu16 grub_le_to_cpu16
27a4da
-#define grub_cpu_to_md64_compile_time grub_cpu_to_le64
27a4da
-#define grub_cpu_to_md32_compile_time grub_cpu_to_le32
27a4da
-#define grub_cpu_to_md16_compile_time grub_cpu_to_le16
27a4da
+#define grub_cpu_to_md64_compile_time grub_cpu_to_le64_compile_time
27a4da
+#define grub_cpu_to_md32_compile_time grub_cpu_to_le32_compile_time
27a4da
+#define grub_cpu_to_md16_compile_time grub_cpu_to_le16_compile_time
27a4da
 #endif
27a4da
 
27a4da
 #define RESERVED_BYTES			(64 * 1024)
27a4da
diff --git a/grub-core/disk/scsi.c b/grub-core/disk/scsi.c
28f7f8
index b6cb2f42109..92084d0f8ed 100644
27a4da
--- a/grub-core/disk/scsi.c
27a4da
+++ b/grub-core/disk/scsi.c
27a4da
@@ -201,7 +201,7 @@ grub_scsi_read_capacity16 (grub_scsi_t scsi)
27a4da
   rc.opcode = grub_scsi_cmd_read_capacity16;
27a4da
   rc.lun = (scsi->lun << GRUB_SCSI_LUN_SHIFT) | 0x10;
27a4da
   rc.logical_block_addr = 0;
27a4da
-  rc.alloc_len = grub_cpu_to_be32 (sizeof (rcd));
27a4da
+  rc.alloc_len = grub_cpu_to_be32_compile_time (sizeof (rcd));
27a4da
   rc.PMI = 0;
27a4da
   rc.control = 0;
27a4da
 	
27a4da
diff --git a/grub-core/disk/usbms.c b/grub-core/disk/usbms.c
28f7f8
index 2b769bdd8e1..380ca4c4cbf 100644
27a4da
--- a/grub-core/disk/usbms.c
27a4da
+++ b/grub-core/disk/usbms.c
27a4da
@@ -307,7 +307,7 @@ grub_usbms_transfer_bo (struct grub_scsi *scsi, grub_size_t cmdsize, char *cmd,
27a4da
 
27a4da
   /* Setup the request.  */
27a4da
   grub_memset (&cbw, 0, sizeof (cbw));
27a4da
-  cbw.signature = grub_cpu_to_le32 (0x43425355);
27a4da
+  cbw.signature = grub_cpu_to_le32_compile_time (0x43425355);
27a4da
   cbw.tag = tag;
27a4da
   cbw.transfer_length = grub_cpu_to_le32 (size);
27a4da
   cbw.flags = (!read_write) << GRUB_USBMS_DIRECTION_BIT;
27a4da
@@ -414,7 +414,7 @@ CheckCSW:
27a4da
   
27a4da
   /* If phase error or not valid signature, do bulk-only reset device. */
27a4da
   if ((status.status == 2) ||
27a4da
-      (status.signature != grub_cpu_to_le32(0x53425355)))
27a4da
+      (status.signature != grub_cpu_to_le32_compile_time(0x53425355)))
27a4da
     { /* Bulk-only reset device. */
27a4da
       grub_dprintf ("usb", "Bulk-only reset device - bad status\n");
27a4da
       grub_usbms_reset (dev);
27a4da
diff --git a/grub-core/fs/hfs.c b/grub-core/fs/hfs.c
28f7f8
index 1e593059a74..d1dc015455d 100644
27a4da
--- a/grub-core/fs/hfs.c
27a4da
+++ b/grub-core/fs/hfs.c
27a4da
@@ -369,7 +369,7 @@ grub_hfs_mount (grub_disk_t disk)
27a4da
 
27a4da
   /* Lookup the root directory node in the catalog tree using the
27a4da
      volume name.  */
27a4da
-  key.parent_dir = grub_cpu_to_be32 (1);
27a4da
+  key.parent_dir = grub_cpu_to_be32_compile_time (1);
27a4da
   key.strlen = data->sblock.volname[0];
27a4da
   grub_strcpy ((char *) key.str, (char *) (data->sblock.volname + 1));
27a4da
 
27a4da
diff --git a/grub-core/fs/reiserfs.c b/grub-core/fs/reiserfs.c
28f7f8
index ac65054d363..de3d4fa3c64 100644
27a4da
--- a/grub-core/fs/reiserfs.c
27a4da
+++ b/grub-core/fs/reiserfs.c
27a4da
@@ -365,7 +365,7 @@ grub_reiserfs_set_key_offset (struct grub_reiserfs_key *key,
27a4da
     key->u.v1.offset = grub_cpu_to_le32 (value);
27a4da
   else
27a4da
     key->u.v2.offset_type \
27a4da
-      = ((key->u.v2.offset_type & grub_cpu_to_le64 (15ULL << 60))
27a4da
+      = ((key->u.v2.offset_type & grub_cpu_to_le64_compile_time (15ULL << 60))
27a4da
          | grub_cpu_to_le64 (value & (~0ULL >> 4)));
27a4da
 }
27a4da
 
27a4da
@@ -412,7 +412,7 @@ grub_reiserfs_set_key_type (struct grub_reiserfs_key *key,
27a4da
     key->u.v1.type = grub_cpu_to_le32 (type);
27a4da
   else
27a4da
     key->u.v2.offset_type
27a4da
-      = ((key->u.v2.offset_type & grub_cpu_to_le64 (~0ULL >> 4))
27a4da
+      = ((key->u.v2.offset_type & grub_cpu_to_le64_compile_time (~0ULL >> 4))
27a4da
          | grub_cpu_to_le64 ((grub_uint64_t) type << 60));
27a4da
 
27a4da
   assert (grub_reiserfs_get_key_type (key) == grub_type);
27a4da
@@ -997,8 +997,8 @@ grub_reiserfs_open (struct grub_file *file, const char *name)
27a4da
   data = grub_reiserfs_mount (file->device->disk);
27a4da
   if (! data)
27a4da
     goto fail;
27a4da
-  key.directory_id = grub_cpu_to_le32 (1);
27a4da
-  key.object_id = grub_cpu_to_le32 (2);
27a4da
+  key.directory_id = grub_cpu_to_le32_compile_time (1);
27a4da
+  key.object_id = grub_cpu_to_le32_compile_time (2);
27a4da
   key.u.v2.offset_type = 0;
27a4da
   grub_reiserfs_set_key_type (&key, GRUB_REISERFS_DIRECTORY, 2);
27a4da
   grub_reiserfs_set_key_offset (&key, 1);
27a4da
@@ -1289,8 +1289,8 @@ grub_reiserfs_dir (grub_device_t device, const char *path,
27a4da
   data = grub_reiserfs_mount (device->disk);
27a4da
   if (! data)
27a4da
     goto fail;
27a4da
-  root_key.directory_id = grub_cpu_to_le32 (1);
27a4da
-  root_key.object_id = grub_cpu_to_le32 (2);
27a4da
+  root_key.directory_id = grub_cpu_to_le32_compile_time (1);
27a4da
+  root_key.object_id = grub_cpu_to_le32_compile_time (2);
27a4da
   root_key.u.v2.offset_type = 0;
27a4da
   grub_reiserfs_set_key_type (&root_key, GRUB_REISERFS_DIRECTORY, 2);
27a4da
   grub_reiserfs_set_key_offset (&root_key, 1);
27a4da
diff --git a/grub-core/lib/fdt.c b/grub-core/lib/fdt.c
28f7f8
index 907a7bff61f..7e76dc06bbc 100644
27a4da
--- a/grub-core/lib/fdt.c
27a4da
+++ b/grub-core/lib/fdt.c
27a4da
@@ -164,10 +164,10 @@ static int add_subnode (void *fdt, int parentoffset, const char *name)
27a4da
 insert:
27a4da
   grub_memmove (token + entry_size / sizeof(*token), token,
27a4da
                 (grub_addr_t) end - (grub_addr_t) token);
27a4da
-  *token = grub_cpu_to_be32(FDT_BEGIN_NODE);
27a4da
+  *token = grub_cpu_to_be32_compile_time(FDT_BEGIN_NODE);
27a4da
   token[entry_size / sizeof(*token) - 2] = 0;	/* padding bytes */
27a4da
   grub_strcpy((char *) (token + 1), name);
27a4da
-  token[entry_size / sizeof(*token) - 1] = grub_cpu_to_be32(FDT_END_NODE);
27a4da
+  token[entry_size / sizeof(*token) - 1] = grub_cpu_to_be32_compile_time(FDT_END_NODE);
27a4da
   grub_fdt_set_size_dt_struct (fdt, struct_size + entry_size);
27a4da
   return ((grub_addr_t) token - (grub_addr_t) fdt
27a4da
           - grub_fdt_get_off_dt_struct(fdt));
27a4da
@@ -377,7 +377,7 @@ int grub_fdt_set_prop (void *fdt, unsigned int nodeoffset, const char *name,
27a4da
 
27a4da
       prop_name_present = 1;
27a4da
 	  for (i = 0; i < prop_len / sizeof(grub_uint32_t); i++)
27a4da
-        *(prop + 3 + i) = grub_cpu_to_be32 (FDT_NOP);
27a4da
+        *(prop + 3 + i) = grub_cpu_to_be32_compile_time (FDT_NOP);
27a4da
       if (len > ALIGN_UP(prop_len, sizeof(grub_uint32_t)))
27a4da
         {
27a4da
           /* Length of new property value is greater than the space allocated
27a4da
@@ -385,7 +385,7 @@ int grub_fdt_set_prop (void *fdt, unsigned int nodeoffset, const char *name,
27a4da
              nameoff field of the current entry and replace the current entry
27a4da
              with NOP tokens. */
27a4da
           nameoff = grub_be_to_cpu32 (*(prop + 2));
27a4da
-    	  *prop = *(prop + 1) = *(prop + 2) = grub_cpu_to_be32 (FDT_NOP);
27a4da
+          *prop = *(prop + 1) = *(prop + 2) = grub_cpu_to_be32_compile_time (FDT_NOP);
27a4da
           prop = NULL;
27a4da
         }
27a4da
     }
27a4da
@@ -419,7 +419,7 @@ int grub_fdt_set_prop (void *fdt, unsigned int nodeoffset, const char *name,
27a4da
                   struct_end(fdt) - (grub_addr_t) prop);
27a4da
     grub_fdt_set_size_dt_struct (fdt, grub_fdt_get_size_dt_struct (fdt)
27a4da
                                  + prop_entry_size(len));
27a4da
-    *prop = grub_cpu_to_be32 (FDT_PROP);
27a4da
+    *prop = grub_cpu_to_be32_compile_time (FDT_PROP);
27a4da
     *(prop + 2) = grub_cpu_to_be32 (nameoff);
27a4da
   }
27a4da
   *(prop + 1) = grub_cpu_to_be32 (len);
27a4da
@@ -447,7 +447,7 @@ grub_fdt_create_empty_tree (void *fdt, unsigned int size)
27a4da
   et->empty_node.node_end = grub_cpu_to_be32_compile_time (FDT_END_NODE);
27a4da
   et->empty_node.node_start = grub_cpu_to_be32_compile_time (FDT_BEGIN_NODE);
27a4da
   ((struct grub_fdt_empty_tree *) fdt)->header.off_mem_rsvmap =
27a4da
-    grub_cpu_to_be32 (ALIGN_UP (sizeof (grub_fdt_header_t), 8));
27a4da
+    grub_cpu_to_be32_compile_time (ALIGN_UP (sizeof (grub_fdt_header_t), 8));
27a4da
 
27a4da
   grub_fdt_set_off_dt_strings (fdt, sizeof (*et));
27a4da
   grub_fdt_set_off_dt_struct (fdt,
27a4da
diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
28f7f8
index 764cde20318..e3906eb658f 100644
27a4da
--- a/grub-core/loader/i386/linux.c
27a4da
+++ b/grub-core/loader/i386/linux.c
27a4da
@@ -734,7 +734,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
27a4da
 
27a4da
   /* FIXME: 2.03 is not always good enough (Linux 2.4 can be 2.03 and
27a4da
      still not support 32-bit boot.  */
27a4da
-  if (lh.header != grub_cpu_to_le32 (GRUB_LINUX_MAGIC_SIGNATURE)
27a4da
+  if (lh.header != grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE)
27a4da
       || grub_le_to_cpu16 (lh.version) < 0x0203)
27a4da
     {
27a4da
       grub_error (GRUB_ERR_BAD_OS, "version too old for 32-bit boot"
27a4da
diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c
28f7f8
index 60bb31fbf0d..c2e5fa9abcc 100644
27a4da
--- a/grub-core/loader/i386/pc/linux.c
27a4da
+++ b/grub-core/loader/i386/pc/linux.c
27a4da
@@ -201,7 +201,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
27a4da
 
27a4da
       if (grub_le_to_cpu16 (lh.version) >= 0x0201)
27a4da
 	{
27a4da
-	  lh.heap_end_ptr = grub_cpu_to_le32_compile_time (GRUB_LINUX_HEAP_END_OFFSET);
27a4da
+	  lh.heap_end_ptr = grub_cpu_to_le16_compile_time (GRUB_LINUX_HEAP_END_OFFSET);
27a4da
 	  lh.loadflags |= GRUB_LINUX_FLAG_CAN_USE_HEAP;
27a4da
 	}
27a4da
 
27a4da
@@ -209,17 +209,17 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
27a4da
 	lh.cmd_line_ptr = grub_linux_real_target + GRUB_LINUX_CL_OFFSET;
27a4da
       else
27a4da
 	{
27a4da
-	  lh.cl_magic = grub_cpu_to_le32_compile_time (GRUB_LINUX_CL_MAGIC);
27a4da
-	  lh.cl_offset = grub_cpu_to_le32_compile_time (GRUB_LINUX_CL_OFFSET);
27a4da
-	  lh.setup_move_size = grub_cpu_to_le32_compile_time (GRUB_LINUX_CL_OFFSET
27a4da
+	  lh.cl_magic = grub_cpu_to_le16_compile_time (GRUB_LINUX_CL_MAGIC);
27a4da
+	  lh.cl_offset = grub_cpu_to_le16_compile_time (GRUB_LINUX_CL_OFFSET);
27a4da
+	  lh.setup_move_size = grub_cpu_to_le16_compile_time (GRUB_LINUX_CL_OFFSET
27a4da
 						 + maximal_cmdline_size);
27a4da
 	}
27a4da
     }
27a4da
   else
27a4da
     {
27a4da
       /* Your kernel is quite old...  */
27a4da
-      lh.cl_magic = grub_cpu_to_le32_compile_time (GRUB_LINUX_CL_MAGIC);
27a4da
-      lh.cl_offset = grub_cpu_to_le32_compile_time (GRUB_LINUX_CL_OFFSET);
27a4da
+      lh.cl_magic = grub_cpu_to_le16_compile_time (GRUB_LINUX_CL_MAGIC);
27a4da
+      lh.cl_offset = grub_cpu_to_le16_compile_time (GRUB_LINUX_CL_OFFSET);
27a4da
 
27a4da
       setup_sects = GRUB_LINUX_DEFAULT_SETUP_SECTS;
27a4da
 
27a4da
diff --git a/grub-core/loader/i386/xen_file.c b/grub-core/loader/i386/xen_file.c
28f7f8
index ff23235f064..58362189098 100644
27a4da
--- a/grub-core/loader/i386/xen_file.c
27a4da
+++ b/grub-core/loader/i386/xen_file.c
27a4da
@@ -38,8 +38,8 @@ grub_xen_file (grub_file_t file)
27a4da
   if (grub_file_read (file, &lh, sizeof (lh)) != sizeof (lh))
27a4da
     goto fail;
27a4da
 
27a4da
-  if (lh.boot_flag != grub_cpu_to_le16 (0xaa55)
27a4da
-      || lh.header != grub_cpu_to_le32 (GRUB_LINUX_MAGIC_SIGNATURE)
27a4da
+  if (lh.boot_flag != grub_cpu_to_le16_compile_time (0xaa55)
27a4da
+      || lh.header != grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE)
27a4da
       || grub_le_to_cpu16 (lh.version) < 0x0208)
27a4da
     {
27a4da
       grub_error (GRUB_ERR_BAD_OS, "version too old for xen boot");
27a4da
diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c
28f7f8
index d62d0cc1e01..8cc390b0e28 100644
27a4da
--- a/grub-core/net/arp.c
27a4da
+++ b/grub-core/net/arp.c
27a4da
@@ -81,11 +81,11 @@ grub_net_arp_send_request (struct grub_net_network_level_interface *inf,
27a4da
     return err;
27a4da
 
27a4da
   arp_header = (struct arphdr *) nb.data;
27a4da
-  arp_header->hrd = grub_cpu_to_be16 (GRUB_NET_ARPHRD_ETHERNET);
27a4da
+  arp_header->hrd = grub_cpu_to_be16_compile_time (GRUB_NET_ARPHRD_ETHERNET);
27a4da
   arp_header->hln = 6;
27a4da
   arp_header->pro = grub_cpu_to_be16 (etherpro);
27a4da
   arp_header->pln = addrlen;
27a4da
-  arp_header->op = grub_cpu_to_be16 (ARP_REQUEST);
27a4da
+  arp_header->op = grub_cpu_to_be16_compile_time (ARP_REQUEST);
27a4da
   aux = (grub_uint8_t *) arp_header + sizeof (*arp_header);
27a4da
   /* Sender hardware address.  */
27a4da
   grub_memcpy (aux, &inf->hwaddress.mac, 6);
27a4da
diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
28f7f8
index 46ce8135ac5..b4b8159cdad 100644
27a4da
--- a/grub-core/net/bootp.c
27a4da
+++ b/grub-core/net/bootp.c
27a4da
@@ -767,8 +767,8 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)),
27a4da
 	  grub_netbuff_push (nb, sizeof (*udph));
27a4da
 
27a4da
 	  udph = (struct udphdr *) nb->data;
27a4da
-	  udph->src = grub_cpu_to_be16 (68);
27a4da
-	  udph->dst = grub_cpu_to_be16 (67);
27a4da
+	  udph->src = grub_cpu_to_be16_compile_time (68);
27a4da
+	  udph->dst = grub_cpu_to_be16_compile_time (67);
27a4da
 	  udph->chksum = 0;
27a4da
 	  udph->len = grub_cpu_to_be16 (nb->tail - nb->data);
27a4da
 	  target.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4;
27a4da
diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c
28f7f8
index c6971f9fcd2..5a609544403 100644
27a4da
--- a/grub-core/net/ip.c
27a4da
+++ b/grub-core/net/ip.c
27a4da
@@ -611,7 +611,7 @@ grub_net_send_ip6_packet (struct grub_net_network_level_interface *inf,
27a4da
   grub_netbuff_push (nb, sizeof (*iph));
27a4da
   iph = (struct ip6hdr *) nb->data;
27a4da
 
27a4da
-  iph->version_class_flow = grub_cpu_to_be32 ((6 << 28));
27a4da
+  iph->version_class_flow = grub_cpu_to_be32_compile_time ((6 << 28));
27a4da
   iph->len = grub_cpu_to_be16 (nb->tail - nb->data - sizeof (*iph));
27a4da
   iph->protocol = proto;
27a4da
   iph->ttl = 0xff;
27a4da
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
28f7f8
index 36fc0d8b2e8..fc6f714bf7f 100644
27a4da
--- a/grub-core/net/net.c
27a4da
+++ b/grub-core/net/net.c
27a4da
@@ -306,7 +306,7 @@ grub_net_ipv6_get_link_local (struct grub_net_card *card,
27a4da
     return NULL;
27a4da
 
27a4da
   addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6;
27a4da
-  addr.ipv6[0] = grub_cpu_to_be64 (0xfe80ULL << 48);
27a4da
+  addr.ipv6[0] = grub_cpu_to_be64_compile_time (0xfe80ULL << 48);
27a4da
   addr.ipv6[1] = grub_net_ipv6_get_id (hwaddr);
27a4da
 
27a4da
   FOR_NET_NETWORK_LEVEL_INTERFACES (inf)
27a4da
diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
28f7f8
index 8632339de97..3931884c6dd 100644
27a4da
--- a/grub-core/net/tftp.c
27a4da
+++ b/grub-core/net/tftp.c
27a4da
@@ -149,7 +149,7 @@ ack (tftp_data_t data, grub_uint64_t block)
27a4da
     return err;
27a4da
 
27a4da
   tftph_ack = (struct tftphdr *) nb_ack.data;
27a4da
-  tftph_ack->opcode = grub_cpu_to_be16 (TFTP_ACK);
27a4da
+  tftph_ack->opcode = grub_cpu_to_be16_compile_time (TFTP_ACK);
27a4da
   tftph_ack->u.ack.block = grub_cpu_to_be16 (block);
27a4da
 
27a4da
   err = grub_net_send_udp_packet (data->sock, &nb_ack);
27a4da
@@ -352,7 +352,7 @@ tftp_open (struct grub_file *file, const char *filename)
27a4da
   rrq = (char *) tftph->u.rrq;
27a4da
   rrqlen = 0;
27a4da
 
27a4da
-  tftph->opcode = grub_cpu_to_be16 (TFTP_RRQ);
27a4da
+  tftph->opcode = grub_cpu_to_be16_compile_time (TFTP_RRQ);
27a4da
 
27a4da
   /* Copy and normalize the filename to work-around issues on some tftp
27a4da
      servers when file names are being matched for remapping. */
27a4da
@@ -469,8 +469,8 @@ tftp_close (struct grub_file *file)
27a4da
       if (!err)
27a4da
 	{
27a4da
 	  tftph = (struct tftphdr *) nb_err.data;
27a4da
-	  tftph->opcode = grub_cpu_to_be16 (TFTP_ERROR);
27a4da
-	  tftph->u.err.errcode = grub_cpu_to_be16 (TFTP_EUNDEF);
27a4da
+	  tftph->opcode = grub_cpu_to_be16_compile_time (TFTP_ERROR);
27a4da
+	  tftph->u.err.errcode = grub_cpu_to_be16_compile_time (TFTP_EUNDEF);
27a4da
 	  grub_memcpy (tftph->u.err.errmsg, "closed", sizeof ("closed"));
27a4da
 
27a4da
 	  err = grub_net_send_udp_packet (data->sock, &nb_err);
27a4da
diff --git a/grub-core/partmap/acorn.c b/grub-core/partmap/acorn.c
28f7f8
index 7bb93d9bec9..c022c61ddfc 100644
27a4da
--- a/grub-core/partmap/acorn.c
27a4da
+++ b/grub-core/partmap/acorn.c
27a4da
@@ -25,8 +25,8 @@
27a4da
 
27a4da
 GRUB_MOD_LICENSE ("GPLv3+");
27a4da
 
27a4da
-#define LINUX_NATIVE_MAGIC grub_cpu_to_le32 (0xdeafa1de)
27a4da
-#define LINUX_SWAP_MAGIC   grub_cpu_to_le32 (0xdeafab1e)
27a4da
+#define LINUX_NATIVE_MAGIC grub_cpu_to_le32_compile_time (0xdeafa1de)
27a4da
+#define LINUX_SWAP_MAGIC   grub_cpu_to_le32_compile_time (0xdeafab1e)
27a4da
 #define LINUX_MAP_ENTRIES  (512 / 12)
27a4da
 
27a4da
 #define NONADFS_PARTITION_TYPE_LINUX 9
27a4da
diff --git a/grub-core/partmap/bsdlabel.c b/grub-core/partmap/bsdlabel.c
28f7f8
index cf0f967c1fa..1d785906b6a 100644
27a4da
--- a/grub-core/partmap/bsdlabel.c
27a4da
+++ b/grub-core/partmap/bsdlabel.c
27a4da
@@ -53,7 +53,7 @@ iterate_real (grub_disk_t disk, grub_disk_addr_t sector, int freebsd,
27a4da
     return grub_errno;
27a4da
 
27a4da
   /* Check if it is valid.  */
27a4da
-  if (label.magic != grub_cpu_to_le32 (GRUB_PC_PARTITION_BSD_LABEL_MAGIC))
27a4da
+  if (label.magic != grub_cpu_to_le32_compile_time (GRUB_PC_PARTITION_BSD_LABEL_MAGIC))
27a4da
     return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature");
27a4da
 
27a4da
   /* A kludge to determine a base of be.offset.  */
27a4da
diff --git a/grub-core/partmap/gpt.c b/grub-core/partmap/gpt.c
28f7f8
index 38df7b3c9b8..83bcba77914 100644
27a4da
--- a/grub-core/partmap/gpt.c
27a4da
+++ b/grub-core/partmap/gpt.c
27a4da
@@ -65,7 +65,7 @@ grub_gpt_partition_map_iterate (grub_disk_t disk,
27a4da
     return grub_errno;
27a4da
 
27a4da
   /* Check if it is valid.  */
27a4da
-  if (mbr.signature != grub_cpu_to_le16 (GRUB_PC_PARTITION_SIGNATURE))
27a4da
+  if (mbr.signature != grub_cpu_to_le16_compile_time (GRUB_PC_PARTITION_SIGNATURE))
27a4da
     return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature");
27a4da
 
27a4da
   /* Make sure the MBR is a protective MBR and not a normal MBR.  */
27a4da
diff --git a/grub-core/partmap/msdos.c b/grub-core/partmap/msdos.c
28f7f8
index 1d81a53573b..46c406bff1f 100644
27a4da
--- a/grub-core/partmap/msdos.c
27a4da
+++ b/grub-core/partmap/msdos.c
27a4da
@@ -162,7 +162,7 @@ grub_partition_msdos_iterate (grub_disk_t disk,
27a4da
 	lastaddr = p.offset;
27a4da
 
27a4da
       /* Check if it is valid.  */
27a4da
-      if (mbr.signature != grub_cpu_to_le16 (GRUB_PC_PARTITION_SIGNATURE))
27a4da
+      if (mbr.signature != grub_cpu_to_le16_compile_time (GRUB_PC_PARTITION_SIGNATURE))
27a4da
 	return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature");
27a4da
 
27a4da
       for (i = 0; i < 4; i++)
27a4da
@@ -280,7 +280,7 @@ pc_partition_map_embed (struct grub_disk *disk, unsigned int *nsectors,
27a4da
 	lastaddr = offset;
27a4da
 
27a4da
       /* Check if it is valid.  */
27a4da
-      if (mbr.signature != grub_cpu_to_le16 (GRUB_PC_PARTITION_SIGNATURE))
27a4da
+      if (mbr.signature != grub_cpu_to_le16_compile_time (GRUB_PC_PARTITION_SIGNATURE))
27a4da
 	return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature");
27a4da
 
27a4da
       for (i = 0; i < 4; i++)
27a4da
diff --git a/grub-core/tests/video_checksum.c b/grub-core/tests/video_checksum.c
28f7f8
index 491bc55731c..74d5b65e5c7 100644
27a4da
--- a/grub-core/tests/video_checksum.c
27a4da
+++ b/grub-core/tests/video_checksum.c
27a4da
@@ -288,16 +288,16 @@ grub_video_capture_write_bmp (const char *fname,
27a4da
   if (mode_info->mode_type & GRUB_VIDEO_MODE_TYPE_RGB)
27a4da
     {
27a4da
       head.filesize = grub_cpu_to_le32 (sizeof (head) + mode_info->width * mode_info->height * 3);
27a4da
-      head.bmp_off = grub_cpu_to_le32 (sizeof (head));
27a4da
+      head.bmp_off = grub_cpu_to_le32_compile_time (sizeof (head));
27a4da
       head.bpp = grub_cpu_to_le16_compile_time (24);
27a4da
     }
27a4da
   else
27a4da
     {
27a4da
       head.filesize = grub_cpu_to_le32 (sizeof (head) + 3 * 256 + mode_info->width * mode_info->height);
27a4da
-      head.bmp_off = grub_cpu_to_le32 (sizeof (head) + 3 * 256);
27a4da
+      head.bmp_off = grub_cpu_to_le32_compile_time (sizeof (head) + 3 * 256);
27a4da
       head.bpp = grub_cpu_to_le16_compile_time (8);
27a4da
     }
27a4da
-  head.head_size = grub_cpu_to_le32 (sizeof (head) - 14);
27a4da
+  head.head_size = grub_cpu_to_le32_compile_time (sizeof (head) - 14);
27a4da
   head.width = grub_cpu_to_le16 (mode_info->width);
27a4da
   head.height = grub_cpu_to_le16 (mode_info->height);
27a4da
   head.planes = grub_cpu_to_le16_compile_time (1);
27a4da
diff --git a/util/grub-mkfont.c b/util/grub-mkfont.c
28f7f8
index e6485b40f28..a0cab3a93f8 100644
27a4da
--- a/util/grub-mkfont.c
27a4da
+++ b/util/grub-mkfont.c
27a4da
@@ -704,7 +704,7 @@ write_be16_section (const char *name, grub_uint16_t data, int* offset,
27a4da
 {
27a4da
   grub_uint32_t leng;
27a4da
 
27a4da
-  leng = grub_cpu_to_be32 (2);
27a4da
+  leng = grub_cpu_to_be32_compile_time (2);
27a4da
   data = grub_cpu_to_be16 (data);
27a4da
   grub_util_write_image (name, 4, file, filename);
27a4da
   grub_util_write_image ((char *) &leng, 4, file, filename);
27a4da
@@ -801,7 +801,7 @@ write_font_pf2 (struct grub_font_info *font_info, char *output_file)
27a4da
 
27a4da
   offset = 0;
27a4da
 
27a4da
-  leng = grub_cpu_to_be32 (4);
27a4da
+  leng = grub_cpu_to_be32_compile_time (4);
27a4da
   grub_util_write_image (FONT_FORMAT_SECTION_NAMES_FILE,
27a4da
   			 sizeof(FONT_FORMAT_SECTION_NAMES_FILE) - 1, file,
27a4da
 			 output_file);
27a4da
diff --git a/util/grub-mklayout.c b/util/grub-mklayout.c
28f7f8
index 692f881900b..1a4f1b4c855 100644
27a4da
--- a/util/grub-mklayout.c
27a4da
+++ b/util/grub-mklayout.c
27a4da
@@ -329,7 +329,7 @@ write_file (FILE *out, const char *fname, struct grub_keyboard_layout *layout)
27a4da
   grub_uint32_t version;
27a4da
   unsigned i;
27a4da
 
27a4da
-  version = grub_cpu_to_le32 (GRUB_KEYBOARD_LAYOUTS_VERSION);
27a4da
+  version = grub_cpu_to_le32_compile_time (GRUB_KEYBOARD_LAYOUTS_VERSION);
27a4da
   
27a4da
   for (i = 0; i < ARRAY_SIZE (layout->keyboard_map); i++)
27a4da
     layout->keyboard_map[i] = grub_cpu_to_le32(layout->keyboard_map[i]);
27a4da
diff --git a/util/mkimage.c b/util/mkimage.c
28f7f8
index 26d9816e07e..e6b799fd73c 100644
27a4da
--- a/util/mkimage.c
27a4da
+++ b/util/mkimage.c
27a4da
@@ -1528,9 +1528,10 @@ grub_install_generate_image (const char *dir, const char *prefix,
27a4da
 	text_section->virtual_address = grub_cpu_to_le32 (header_size);
27a4da
 	text_section->raw_data_size = grub_cpu_to_le32 (exec_size);
27a4da
 	text_section->raw_data_offset = grub_cpu_to_le32 (header_size);
27a4da
-	text_section->characteristics = grub_cpu_to_le32 (GRUB_PE32_SCN_CNT_CODE
27a4da
-							  | GRUB_PE32_SCN_MEM_EXECUTE
27a4da
-							  | GRUB_PE32_SCN_MEM_READ);
27a4da
+	text_section->characteristics = grub_cpu_to_le32_compile_time (
27a4da
+						  GRUB_PE32_SCN_CNT_CODE
27a4da
+						| GRUB_PE32_SCN_MEM_EXECUTE
27a4da
+						| GRUB_PE32_SCN_MEM_READ);
27a4da
 
27a4da
 	data_section = text_section + 1;
27a4da
 	strcpy (data_section->name, ".data");
27a4da
@@ -1539,7 +1540,7 @@ grub_install_generate_image (const char *dir, const char *prefix,
27a4da
 	data_section->raw_data_size = grub_cpu_to_le32 (kernel_size - exec_size);
27a4da
 	data_section->raw_data_offset = grub_cpu_to_le32 (header_size + exec_size);
27a4da
 	data_section->characteristics
27a4da
-	  = grub_cpu_to_le32 (GRUB_PE32_SCN_CNT_INITIALIZED_DATA
27a4da
+	  = grub_cpu_to_le32_compile_time (GRUB_PE32_SCN_CNT_INITIALIZED_DATA
27a4da
 			      | GRUB_PE32_SCN_MEM_READ
27a4da
 			      | GRUB_PE32_SCN_MEM_WRITE);
27a4da
 
27a4da
@@ -1551,7 +1552,7 @@ grub_install_generate_image (const char *dir, const char *prefix,
27a4da
 	bss_section->raw_data_size = 0;
27a4da
 	bss_section->raw_data_offset = 0;
27a4da
 	bss_section->characteristics
27a4da
-	  = grub_cpu_to_le32 (GRUB_PE32_SCN_MEM_READ
27a4da
+	  = grub_cpu_to_le32_compile_time (GRUB_PE32_SCN_MEM_READ
27a4da
 			      | GRUB_PE32_SCN_MEM_WRITE
27a4da
 			      | GRUB_PE32_SCN_ALIGN_64BYTES
27a4da
 			      | GRUB_PE32_SCN_CNT_INITIALIZED_DATA
27a4da
@@ -1565,7 +1566,7 @@ grub_install_generate_image (const char *dir, const char *prefix,
27a4da
 	mods_section->raw_data_size = grub_cpu_to_le32 (reloc_addr - kernel_size - header_size);
27a4da
 	mods_section->raw_data_offset = grub_cpu_to_le32 (header_size + kernel_size);
27a4da
 	mods_section->characteristics
27a4da
-	  = grub_cpu_to_le32 (GRUB_PE32_SCN_CNT_INITIALIZED_DATA
27a4da
+	  = grub_cpu_to_le32_compile_time (GRUB_PE32_SCN_CNT_INITIALIZED_DATA
27a4da
 			      | GRUB_PE32_SCN_MEM_READ
27a4da
 			      | GRUB_PE32_SCN_MEM_WRITE);
27a4da
 
27a4da
@@ -1576,7 +1577,7 @@ grub_install_generate_image (const char *dir, const char *prefix,
27a4da
 	reloc_section->raw_data_size = grub_cpu_to_le32 (reloc_size);
27a4da
 	reloc_section->raw_data_offset = grub_cpu_to_le32 (reloc_addr);
27a4da
 	reloc_section->characteristics
27a4da
-	  = grub_cpu_to_le32 (GRUB_PE32_SCN_CNT_INITIALIZED_DATA
27a4da
+	  = grub_cpu_to_le32_compile_time (GRUB_PE32_SCN_CNT_INITIALIZED_DATA
27a4da
 			      | GRUB_PE32_SCN_MEM_DISCARDABLE
27a4da
 			      | GRUB_PE32_SCN_MEM_READ);
27a4da
 	free (core_img);