]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
drivers/edac: mod edac_align_ptr function
authorDouglas Thompson <dougthompson@xmission.com>
Thu, 19 Jul 2007 08:50:21 +0000 (01:50 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 19 Jul 2007 17:04:56 +0000 (10:04 -0700)
Refactor the edac_align_ptr() function to reduce the noise of casting the
aligned pointer to the various types of data objects and modified its callers
to its new signature

Signed-off-by: Douglas Thompson <dougthompson@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/edac/edac_core.h
drivers/edac/edac_device.c
drivers/edac/edac_mc.c
drivers/edac/edac_module.h

index fa3ff8c25b3618ee88e3ad677665baa88972ac37..d8435297df3d9b90b9635663479c915e37843aff 100644 (file)
@@ -211,8 +211,6 @@ enum scrub_type {
 #define OP_RUNNING_POLL_INTR   0x203
 #define OP_OFFLINE             0x300
 
-extern char *edac_align_ptr(void *ptr, unsigned size);
-
 /*
  * There are several things to be aware of that aren't at all obvious:
  *
index 3ccadda3e7233bcb8ab4cc4a781f170cec4dc9b9..d60f5df87af5f21729378d6a6861c4fef3210ee8 100644 (file)
@@ -89,17 +89,14 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info(
        dev_ctl = (struct edac_device_ctl_info *)NULL;
 
        /* Calc the 'end' offset past the ctl_info structure */
-       dev_inst = (struct edac_device_instance *)
-               edac_align_ptr(&dev_ctl[1], sizeof(*dev_inst));
+       dev_inst = edac_align_ptr(&dev_ctl[1], sizeof(*dev_inst));
 
        /* Calc the 'end' offset past the instance array */
-       dev_blk = (struct edac_device_block *)
-               edac_align_ptr(&dev_inst[nr_instances], sizeof(*dev_blk));
+       dev_blk = edac_align_ptr(&dev_inst[nr_instances], sizeof(*dev_blk));
 
        /* Calc the 'end' offset past the dev_blk array */
        count = nr_instances * nr_blocks;
-       dev_attrib = (struct edac_attrib *)
-               edac_align_ptr(&dev_blk[count], sizeof(*dev_attrib));
+       dev_attrib = edac_align_ptr(&dev_blk[count], sizeof(*dev_attrib));
 
        /* Check for case of NO attributes specified */
        if (nr_attribs > 0)
index 219e861eb3f9de503a7ddc2609fa6433d8aaf3a9..856860314789765a10f1c42b01f2dcf227acc8a2 100644 (file)
@@ -85,7 +85,7 @@ static void edac_mc_dump_mci(struct mem_ctl_info *mci)
  * If 'size' is a constant, the compiler will optimize this whole function
  * down to either a no-op or the addition of a constant to the value of 'ptr'.
  */
-char *edac_align_ptr(void *ptr, unsigned size)
+void *edac_align_ptr(void *ptr, unsigned size)
 {
        unsigned align, r;
 
@@ -109,7 +109,7 @@ char *edac_align_ptr(void *ptr, unsigned size)
        if (r == 0)
                return (char *)ptr;
 
-       return (char *)(((unsigned long)ptr) + align - r);
+       return (void *)(((unsigned long)ptr) + align - r);
 }
 
 /**
@@ -144,9 +144,8 @@ struct mem_ctl_info *edac_mc_alloc(unsigned sz_pvt, unsigned nr_csrows,
         * hardcode everything into a single struct.
         */
        mci = (struct mem_ctl_info *)0;
-       csi = (struct csrow_info *)edac_align_ptr(&mci[1], sizeof(*csi));
-       chi = (struct channel_info *)
-               edac_align_ptr(&csi[nr_csrows], sizeof(*chi));
+       csi = edac_align_ptr(&mci[1], sizeof(*csi));
+       chi = edac_align_ptr(&csi[nr_csrows], sizeof(*chi));
        pvt = edac_align_ptr(&chi[nr_chans * nr_csrows], sz_pvt);
        size = ((unsigned long)pvt) + sz_pvt;
 
index 0869fbaa733c67d162043c615668153f36be98ae..37a08aa87d3eb187d9f4d0dc6c3b7a1d250842be 100644 (file)
@@ -44,6 +44,7 @@ extern void edac_device_workq_setup(struct edac_device_ctl_info *edac_dev,
 extern void edac_device_workq_teardown(struct edac_device_ctl_info *edac_dev);
 extern void edac_device_reset_delay_period(struct edac_device_ctl_info
                                           *edac_dev, unsigned long value);
+extern void *edac_align_ptr(void *ptr, unsigned size);
 
 /*
  * EDAC PCI functions