[OpenBIOS] [PATCH 1/6] escc.c: rename offset to index

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Sat Feb 20 16:51:22 CET 2016


This better describes the variable since it contains a reference to the
channel rather than an offset.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
 openbios-devel/drivers/escc.c |   32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/openbios-devel/drivers/escc.c b/openbios-devel/drivers/escc.c
index afb97fa..9b87083 100644
--- a/openbios-devel/drivers/escc.c
+++ b/openbios-devel/drivers/escc.c
@@ -386,15 +386,15 @@ escc_add_channel(const char *path, const char *node, phys_addr_t addr,
     phandle_t dnode, aliases;
 
     cell props[10];
-    int offset;
+    int index;
     int legacy;
 
     switch (esnum) {
-    case 2: offset = 1; legacy = 0; break;
-    case 3: offset = 0; legacy = 0; break;
-    case 4: offset = 1; legacy = 1; break;
-    case 5: offset = 0; legacy = 1; break;
-    default: return;
+        case 2: index = 1; legacy = 0; break;
+        case 3: index = 0; legacy = 0; break;
+        case 4: index = 1; legacy = 1; break;
+        case 5: index = 0; legacy = 1; break;
+        default: return;
     }
 
     /* add device */
@@ -425,32 +425,32 @@ escc_add_channel(const char *path, const char *node, phys_addr_t addr,
     set_property(dnode, "compatible", buf, 9);
 
     if (legacy) {
-        props[0] = IO_ESCC_LEGACY_OFFSET + offset * 0x4;
+        props[0] = IO_ESCC_LEGACY_OFFSET + index * 0x4;
         props[1] = 0x00000001;
-        props[2] = IO_ESCC_LEGACY_OFFSET + offset * 0x4 + 2;
+        props[2] = IO_ESCC_LEGACY_OFFSET + index * 0x4 + 2;
         props[3] = 0x00000001;
-        props[4] = IO_ESCC_LEGACY_OFFSET + offset * 0x4 + 6;
+        props[4] = IO_ESCC_LEGACY_OFFSET + index * 0x4 + 6;
         props[5] = 0x00000001;
         set_property(dnode, "reg", (char *)&props, 6 * sizeof(cell));
     } else {
-        props[0] = IO_ESCC_OFFSET + offset * 0x20;
+        props[0] = IO_ESCC_OFFSET + index * 0x20;
         props[1] = 0x00000020;
         set_property(dnode, "reg", (char *)&props, 2 * sizeof(cell));
     }
 
     if (legacy) {
-        props[0] = addr + IO_ESCC_LEGACY_OFFSET + offset * 0x4;
+        props[0] = addr + IO_ESCC_LEGACY_OFFSET + index * 0x4;
     } else {
-        props[0] = addr + IO_ESCC_OFFSET + offset * 0x20;
+        props[0] = addr + IO_ESCC_OFFSET + index * 0x20;
     }
     OLDWORLD(set_property(dnode, "AAPL,address",
             (char *)&props, 1 * sizeof(cell)));
 
-    props[0] = 0x00000010 - offset;
+    props[0] = 0x00000010 - index;
     OLDWORLD(set_property(dnode, "AAPL,interrupts",
             (char *)&props, 1 * sizeof(cell)));
 
-    props[0] = (0x24) + offset;
+    props[0] = (0x24) + index;
     props[1] = 0;
     props[2] = 0;
     NEWWORLD(set_property(dnode, "interrupts",
@@ -460,11 +460,11 @@ escc_add_channel(const char *path, const char *node, phys_addr_t addr,
 
     if (legacy) {
         uart_init_line(
-                (unsigned char*)addr + IO_ESCC_LEGACY_OFFSET + offset * 0x4,
+                (unsigned char*)addr + IO_ESCC_LEGACY_OFFSET + index * 0x4,
                 CONFIG_SERIAL_SPEED);
     } else {
         uart_init_line(
-                (unsigned char*)addr + IO_ESCC_OFFSET + offset * 0x20,
+                (unsigned char*)addr + IO_ESCC_OFFSET + index * 0x20,
                 CONFIG_SERIAL_SPEED);
     }
 }
-- 
1.7.10.4




More information about the OpenBIOS mailing list