]> nv-tegra.nvidia Code Review - linux-3.10.git/commitdiff
[PATCH] ipmi iomem annotations and fixes
authorAl Viro <viro@www.linux.org.uk>
Wed, 4 May 2005 04:40:22 +0000 (05:40 +0100)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Wed, 4 May 2005 14:33:15 +0000 (07:33 -0700)
annotated, a bunch of direct dereferencing replaced with readb().

Signed-off-by: Al Viro <viro@parcelfarce.linux.theplanet.co.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/char/ipmi/ipmi_si_intf.c
drivers/char/ipmi/ipmi_si_sm.h

index 5419440087fd6844c923da80d790bd3ca91acbcc..298574e160613e67191472bf147e141546573957 100644 (file)
@@ -1617,15 +1617,15 @@ typedef struct dmi_header
        u16     handle;
 } dmi_header_t;
 
        u16     handle;
 } dmi_header_t;
 
-static int decode_dmi(dmi_header_t *dm, int intf_num)
+static int decode_dmi(dmi_header_t __iomem *dm, int intf_num)
 {
 {
-       u8              *data = (u8 *)dm;
+       u8              __iomem *data = (u8 __iomem *)dm;
        unsigned long   base_addr;
        u8              reg_spacing;
        unsigned long   base_addr;
        u8              reg_spacing;
-       u8              len = dm->length;
+       u8              len = readb(&dm->length);
        dmi_ipmi_data_t *ipmi_data = dmi_data+intf_num;
 
        dmi_ipmi_data_t *ipmi_data = dmi_data+intf_num;
 
-       ipmi_data->type = data[4];
+       ipmi_data->type = readb(&data[4]);
 
        memcpy(&base_addr, data+8, sizeof(unsigned long));
        if (len >= 0x11) {
 
        memcpy(&base_addr, data+8, sizeof(unsigned long));
        if (len >= 0x11) {
@@ -1640,12 +1640,12 @@ static int decode_dmi(dmi_header_t *dm, int intf_num)
                }
                /* If bit 4 of byte 0x10 is set, then the lsb for the address
                   is odd. */
                }
                /* If bit 4 of byte 0x10 is set, then the lsb for the address
                   is odd. */
-               ipmi_data->base_addr = base_addr | ((data[0x10] & 0x10) >> 4);
+               ipmi_data->base_addr = base_addr | ((readb(&data[0x10]) & 0x10) >> 4);
 
 
-               ipmi_data->irq = data[0x11];
+               ipmi_data->irq = readb(&data[0x11]);
 
                /* The top two bits of byte 0x10 hold the register spacing. */
 
                /* The top two bits of byte 0x10 hold the register spacing. */
-               reg_spacing = (data[0x10] & 0xC0) >> 6;
+               reg_spacing = (readb(&data[0x10]) & 0xC0) >> 6;
                switch(reg_spacing){
                case 0x00: /* Byte boundaries */
                    ipmi_data->offset = 1;
                switch(reg_spacing){
                case 0x00: /* Byte boundaries */
                    ipmi_data->offset = 1;
@@ -1673,7 +1673,7 @@ static int decode_dmi(dmi_header_t *dm, int intf_num)
                ipmi_data->offset = 1;
        }
 
                ipmi_data->offset = 1;
        }
 
-       ipmi_data->slave_addr = data[6];
+       ipmi_data->slave_addr = readb(&data[6]);
 
        if (is_new_interface(-1, ipmi_data->addr_space,ipmi_data->base_addr)) {
                dmi_data_entries++;
 
        if (is_new_interface(-1, ipmi_data->addr_space,ipmi_data->base_addr)) {
                dmi_data_entries++;
@@ -1687,9 +1687,9 @@ static int decode_dmi(dmi_header_t *dm, int intf_num)
 
 static int dmi_table(u32 base, int len, int num)
 {
 
 static int dmi_table(u32 base, int len, int num)
 {
-       u8                *buf;
-       struct dmi_header *dm;
-       u8                *data;
+       u8                __iomem *buf;
+       struct dmi_header __iomem *dm;
+       u8                __iomem *data;
        int               i=1;
        int               status=-1;
        int               intf_num = 0;
        int               i=1;
        int               status=-1;
        int               intf_num = 0;
@@ -1702,12 +1702,12 @@ static int dmi_table(u32 base, int len, int num)
 
        while(i<num && (data - buf) < len)
        {
 
        while(i<num && (data - buf) < len)
        {
-               dm=(dmi_header_t *)data;
+               dm=(dmi_header_t __iomem *)data;
 
 
-               if((data-buf+dm->length) >= len)
+               if((data-buf+readb(&dm->length)) >= len)
                        break;
 
                        break;
 
-               if (dm->type == 38) {
+               if (readb(&dm->type) == 38) {
                        if (decode_dmi(dm, intf_num) == 0) {
                                intf_num++;
                                if (intf_num >= SI_MAX_DRIVERS)
                        if (decode_dmi(dm, intf_num) == 0) {
                                intf_num++;
                                if (intf_num >= SI_MAX_DRIVERS)
@@ -1715,8 +1715,8 @@ static int dmi_table(u32 base, int len, int num)
                        }
                }
 
                        }
                }
 
-               data+=dm->length;
-               while((data-buf) < len && (*data || data[1]))
+               data+=readb(&dm->length);
+               while((data-buf) < len && (readb(data)||readb(data+1)))
                        data++;
                data+=2;
                i++;
                        data++;
                data+=2;
                i++;
index a0212b004016ab3547562f2bb7ec46a8dabed2e0..62791dd429856d3755fe4898e83791b25dabaca3 100644 (file)
@@ -51,7 +51,7 @@ struct si_sm_io
        /* Generic info used by the actual handling routines, the
            state machine shouldn't touch these. */
        void *info;
        /* Generic info used by the actual handling routines, the
            state machine shouldn't touch these. */
        void *info;
-       void *addr;
+       void __iomem *addr;
        int  regspacing;
        int  regsize;
        int  regshift;
        int  regspacing;
        int  regsize;
        int  regshift;