aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDouglas Thompson <dougthompson@xmission.com>2007-07-19 04:50:21 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-19 13:04:56 -0400
commit7391c6dcab3094610cb99bbd559beaa282582eac (patch)
tree29ec05cc8abdb9be8311ea797b29c9c5b9a99aea /drivers
parent52490c8d07680a7ecc3c1a70a16841455d37e96a (diff)
drivers/edac: mod edac_align_ptr function
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/edac/edac_core.h2
-rw-r--r--drivers/edac/edac_device.c9
-rw-r--r--drivers/edac/edac_mc.c9
-rw-r--r--drivers/edac/edac_module.h1
4 files changed, 8 insertions, 13 deletions
diff --git a/drivers/edac/edac_core.h b/drivers/edac/edac_core.h
index fa3ff8c25b36..d8435297df3d 100644
--- a/drivers/edac/edac_core.h
+++ b/drivers/edac/edac_core.h
@@ -211,8 +211,6 @@ enum scrub_type {
211#define OP_RUNNING_POLL_INTR 0x203 211#define OP_RUNNING_POLL_INTR 0x203
212#define OP_OFFLINE 0x300 212#define OP_OFFLINE 0x300
213 213
214extern char *edac_align_ptr(void *ptr, unsigned size);
215
216/* 214/*
217 * There are several things to be aware of that aren't at all obvious: 215 * There are several things to be aware of that aren't at all obvious:
218 * 216 *
diff --git a/drivers/edac/edac_device.c b/drivers/edac/edac_device.c
index 3ccadda3e723..d60f5df87af5 100644
--- a/drivers/edac/edac_device.c
+++ b/drivers/edac/edac_device.c
@@ -89,17 +89,14 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info(
89 dev_ctl = (struct edac_device_ctl_info *)NULL; 89 dev_ctl = (struct edac_device_ctl_info *)NULL;
90 90
91 /* Calc the 'end' offset past the ctl_info structure */ 91 /* Calc the 'end' offset past the ctl_info structure */
92 dev_inst = (struct edac_device_instance *) 92 dev_inst = edac_align_ptr(&dev_ctl[1], sizeof(*dev_inst));
93 edac_align_ptr(&dev_ctl[1], sizeof(*dev_inst));
94 93
95 /* Calc the 'end' offset past the instance array */ 94 /* Calc the 'end' offset past the instance array */
96 dev_blk = (struct edac_device_block *) 95 dev_blk = edac_align_ptr(&dev_inst[nr_instances], sizeof(*dev_blk));
97 edac_align_ptr(&dev_inst[nr_instances], sizeof(*dev_blk));
98 96
99 /* Calc the 'end' offset past the dev_blk array */ 97 /* Calc the 'end' offset past the dev_blk array */
100 count = nr_instances * nr_blocks; 98 count = nr_instances * nr_blocks;
101 dev_attrib = (struct edac_attrib *) 99 dev_attrib = edac_align_ptr(&dev_blk[count], sizeof(*dev_attrib));
102 edac_align_ptr(&dev_blk[count], sizeof(*dev_attrib));
103 100
104 /* Check for case of NO attributes specified */ 101 /* Check for case of NO attributes specified */
105 if (nr_attribs > 0) 102 if (nr_attribs > 0)
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
index 219e861eb3f9..856860314789 100644
--- a/drivers/edac/edac_mc.c
+++ b/drivers/edac/edac_mc.c
@@ -85,7 +85,7 @@ static void edac_mc_dump_mci(struct mem_ctl_info *mci)
85 * If 'size' is a constant, the compiler will optimize this whole function 85 * If 'size' is a constant, the compiler will optimize this whole function
86 * down to either a no-op or the addition of a constant to the value of 'ptr'. 86 * down to either a no-op or the addition of a constant to the value of 'ptr'.
87 */ 87 */
88char *edac_align_ptr(void *ptr, unsigned size) 88void *edac_align_ptr(void *ptr, unsigned size)
89{ 89{
90 unsigned align, r; 90 unsigned align, r;
91 91
@@ -109,7 +109,7 @@ char *edac_align_ptr(void *ptr, unsigned size)
109 if (r == 0) 109 if (r == 0)
110 return (char *)ptr; 110 return (char *)ptr;
111 111
112 return (char *)(((unsigned long)ptr) + align - r); 112 return (void *)(((unsigned long)ptr) + align - r);
113} 113}
114 114
115/** 115/**
@@ -144,9 +144,8 @@ struct mem_ctl_info *edac_mc_alloc(unsigned sz_pvt, unsigned nr_csrows,
144 * hardcode everything into a single struct. 144 * hardcode everything into a single struct.
145 */ 145 */
146 mci = (struct mem_ctl_info *)0; 146 mci = (struct mem_ctl_info *)0;
147 csi = (struct csrow_info *)edac_align_ptr(&mci[1], sizeof(*csi)); 147 csi = edac_align_ptr(&mci[1], sizeof(*csi));
148 chi = (struct channel_info *) 148 chi = edac_align_ptr(&csi[nr_csrows], sizeof(*chi));
149 edac_align_ptr(&csi[nr_csrows], sizeof(*chi));
150 pvt = edac_align_ptr(&chi[nr_chans * nr_csrows], sz_pvt); 149 pvt = edac_align_ptr(&chi[nr_chans * nr_csrows], sz_pvt);
151 size = ((unsigned long)pvt) + sz_pvt; 150 size = ((unsigned long)pvt) + sz_pvt;
152 151
diff --git a/drivers/edac/edac_module.h b/drivers/edac/edac_module.h
index 0869fbaa733c..37a08aa87d3e 100644
--- a/drivers/edac/edac_module.h
+++ b/drivers/edac/edac_module.h
@@ -44,6 +44,7 @@ extern void edac_device_workq_setup(struct edac_device_ctl_info *edac_dev,
44extern void edac_device_workq_teardown(struct edac_device_ctl_info *edac_dev); 44extern void edac_device_workq_teardown(struct edac_device_ctl_info *edac_dev);
45extern void edac_device_reset_delay_period(struct edac_device_ctl_info 45extern void edac_device_reset_delay_period(struct edac_device_ctl_info
46 *edac_dev, unsigned long value); 46 *edac_dev, unsigned long value);
47extern void *edac_align_ptr(void *ptr, unsigned size);
47 48
48/* 49/*
49 * EDAC PCI functions 50 * EDAC PCI functions