diff options
Diffstat (limited to 'drivers/edac/edac_device.c')
-rw-r--r-- | drivers/edac/edac_device.c | 186 |
1 files changed, 92 insertions, 94 deletions
diff --git a/drivers/edac/edac_device.c b/drivers/edac/edac_device.c index 3db8effa1fd..4ce978b72d3 100644 --- a/drivers/edac/edac_device.c +++ b/drivers/edac/edac_device.c | |||
@@ -35,7 +35,6 @@ | |||
35 | static DECLARE_MUTEX(device_ctls_mutex); | 35 | static DECLARE_MUTEX(device_ctls_mutex); |
36 | static struct list_head edac_device_list = LIST_HEAD_INIT(edac_device_list); | 36 | static struct list_head edac_device_list = LIST_HEAD_INIT(edac_device_list); |
37 | 37 | ||
38 | |||
39 | static inline void lock_device_list(void) | 38 | static inline void lock_device_list(void) |
40 | { | 39 | { |
41 | down(&device_ctls_mutex); | 40 | down(&device_ctls_mutex); |
@@ -46,18 +45,17 @@ static inline void unlock_device_list(void) | |||
46 | up(&device_ctls_mutex); | 45 | up(&device_ctls_mutex); |
47 | } | 46 | } |
48 | 47 | ||
49 | |||
50 | #ifdef CONFIG_EDAC_DEBUG | 48 | #ifdef CONFIG_EDAC_DEBUG |
51 | static void edac_device_dump_device(struct edac_device_ctl_info *edac_dev) | 49 | static void edac_device_dump_device(struct edac_device_ctl_info *edac_dev) |
52 | { | 50 | { |
53 | debugf3("\tedac_dev = %p dev_idx=%d \n", edac_dev,edac_dev->dev_idx); | 51 | debugf3("\tedac_dev = %p dev_idx=%d \n", edac_dev, edac_dev->dev_idx); |
54 | debugf4("\tedac_dev->edac_check = %p\n", edac_dev->edac_check); | 52 | debugf4("\tedac_dev->edac_check = %p\n", edac_dev->edac_check); |
55 | debugf3("\tdev = %p\n", edac_dev->dev); | 53 | debugf3("\tdev = %p\n", edac_dev->dev); |
56 | debugf3("\tmod_name:ctl_name = %s:%s\n", | 54 | debugf3("\tmod_name:ctl_name = %s:%s\n", |
57 | edac_dev->mod_name, edac_dev->ctl_name); | 55 | edac_dev->mod_name, edac_dev->ctl_name); |
58 | debugf3("\tpvt_info = %p\n\n", edac_dev->pvt_info); | 56 | debugf3("\tpvt_info = %p\n\n", edac_dev->pvt_info); |
59 | } | 57 | } |
60 | #endif /* CONFIG_EDAC_DEBUG */ | 58 | #endif /* CONFIG_EDAC_DEBUG */ |
61 | 59 | ||
62 | /* | 60 | /* |
63 | * The alloc() and free() functions for the 'edac_device' control info | 61 | * The alloc() and free() functions for the 'edac_device' control info |
@@ -71,7 +69,8 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info( | |||
71 | char *edac_block_name, | 69 | char *edac_block_name, |
72 | unsigned nr_blocks, | 70 | unsigned nr_blocks, |
73 | unsigned offset_value, | 71 | unsigned offset_value, |
74 | struct edac_attrib_spec *attrib_spec, | 72 | struct edac_attrib_spec |
73 | *attrib_spec, | ||
75 | unsigned nr_attribs) | 74 | unsigned nr_attribs) |
76 | { | 75 | { |
77 | struct edac_device_ctl_info *dev_ctl; | 76 | struct edac_device_ctl_info *dev_ctl; |
@@ -84,35 +83,35 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info( | |||
84 | void *pvt; | 83 | void *pvt; |
85 | 84 | ||
86 | debugf1("%s() instances=%d blocks=%d\n", | 85 | debugf1("%s() instances=%d blocks=%d\n", |
87 | __func__,nr_instances,nr_blocks); | 86 | __func__, nr_instances, nr_blocks); |
88 | 87 | ||
89 | /* Figure out the offsets of the various items from the start of an | 88 | /* Figure out the offsets of the various items from the start of an |
90 | * ctl_info structure. We want the alignment of each item | 89 | * ctl_info structure. We want the alignment of each item |
91 | * to be at least as stringent as what the compiler would | 90 | * to be at least as stringent as what the compiler would |
92 | * provide if we could simply hardcode everything into a single struct. | 91 | * provide if we could simply hardcode everything into a single struct. |
93 | */ | 92 | */ |
94 | dev_ctl = (struct edac_device_ctl_info *) 0; | 93 | dev_ctl = (struct edac_device_ctl_info *)0; |
95 | 94 | ||
96 | /* Calc the 'end' offset past the ctl_info structure */ | 95 | /* Calc the 'end' offset past the ctl_info structure */ |
97 | dev_inst = (struct edac_device_instance *) | 96 | dev_inst = (struct edac_device_instance *) |
98 | edac_align_ptr(&dev_ctl[1],sizeof(*dev_inst)); | 97 | edac_align_ptr(&dev_ctl[1], sizeof(*dev_inst)); |
99 | 98 | ||
100 | /* Calc the 'end' offset past the instance array */ | 99 | /* Calc the 'end' offset past the instance array */ |
101 | dev_blk = (struct edac_device_block *) | 100 | dev_blk = (struct edac_device_block *) |
102 | edac_align_ptr(&dev_inst[nr_instances],sizeof(*dev_blk)); | 101 | edac_align_ptr(&dev_inst[nr_instances], sizeof(*dev_blk)); |
103 | 102 | ||
104 | /* Calc the 'end' offset past the dev_blk array */ | 103 | /* Calc the 'end' offset past the dev_blk array */ |
105 | count = nr_instances * nr_blocks; | 104 | count = nr_instances * nr_blocks; |
106 | dev_attrib = (struct edac_attrib *) | 105 | dev_attrib = (struct edac_attrib *) |
107 | edac_align_ptr(&dev_blk[count],sizeof(*dev_attrib)); | 106 | edac_align_ptr(&dev_blk[count], sizeof(*dev_attrib)); |
108 | 107 | ||
109 | /* Check for case of NO attributes specified */ | 108 | /* Check for case of NO attributes specified */ |
110 | if (nr_attribs > 0) | 109 | if (nr_attribs > 0) |
111 | count *= nr_attribs; | 110 | count *= nr_attribs; |
112 | 111 | ||
113 | /* Calc the 'end' offset past the attributes array */ | 112 | /* Calc the 'end' offset past the attributes array */ |
114 | pvt = edac_align_ptr(&dev_attrib[count],sz_private); | 113 | pvt = edac_align_ptr(&dev_attrib[count], sz_private); |
115 | total_size = ((unsigned long) pvt) + sz_private; | 114 | total_size = ((unsigned long)pvt) + sz_private; |
116 | 115 | ||
117 | /* Allocate the amount of memory for the set of control structures */ | 116 | /* Allocate the amount of memory for the set of control structures */ |
118 | if ((dev_ctl = kmalloc(total_size, GFP_KERNEL)) == NULL) | 117 | if ((dev_ctl = kmalloc(total_size, GFP_KERNEL)) == NULL) |
@@ -122,22 +121,21 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info( | |||
122 | * rather than an imaginary chunk of memory located at address 0. | 121 | * rather than an imaginary chunk of memory located at address 0. |
123 | */ | 122 | */ |
124 | dev_inst = (struct edac_device_instance *) | 123 | dev_inst = (struct edac_device_instance *) |
125 | (((char *) dev_ctl) + ((unsigned long) dev_inst)); | 124 | (((char *)dev_ctl) + ((unsigned long)dev_inst)); |
126 | dev_blk = (struct edac_device_block *) | 125 | dev_blk = (struct edac_device_block *) |
127 | (((char *) dev_ctl) + ((unsigned long) dev_blk)); | 126 | (((char *)dev_ctl) + ((unsigned long)dev_blk)); |
128 | dev_attrib = (struct edac_attrib *) | 127 | dev_attrib = (struct edac_attrib *) |
129 | (((char *) dev_ctl) + ((unsigned long) dev_attrib)); | 128 | (((char *)dev_ctl) + ((unsigned long)dev_attrib)); |
130 | pvt = sz_private ? | 129 | pvt = sz_private ? (((char *)dev_ctl) + ((unsigned long)pvt)) : NULL; |
131 | (((char *) dev_ctl) + ((unsigned long) pvt)) : NULL; | ||
132 | 130 | ||
133 | memset(dev_ctl, 0, total_size); /* clear all fields */ | 131 | memset(dev_ctl, 0, total_size); /* clear all fields */ |
134 | dev_ctl->nr_instances = nr_instances; | 132 | dev_ctl->nr_instances = nr_instances; |
135 | dev_ctl->instances = dev_inst; | 133 | dev_ctl->instances = dev_inst; |
136 | dev_ctl->pvt_info = pvt; | 134 | dev_ctl->pvt_info = pvt; |
137 | 135 | ||
138 | /* Name of this edac device, ensure null terminated */ | 136 | /* Name of this edac device, ensure null terminated */ |
139 | snprintf(dev_ctl->name,sizeof(dev_ctl->name),"%s", edac_device_name); | 137 | snprintf(dev_ctl->name, sizeof(dev_ctl->name), "%s", edac_device_name); |
140 | dev_ctl->name[sizeof(dev_ctl->name)-1] = '\0'; | 138 | dev_ctl->name[sizeof(dev_ctl->name) - 1] = '\0'; |
141 | 139 | ||
142 | /* Initialize every Instance */ | 140 | /* Initialize every Instance */ |
143 | for (instance = 0; instance < nr_instances; instance++) { | 141 | for (instance = 0; instance < nr_instances; instance++) { |
@@ -149,24 +147,22 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info( | |||
149 | 147 | ||
150 | /* name of this instance */ | 148 | /* name of this instance */ |
151 | snprintf(inst->name, sizeof(inst->name), | 149 | snprintf(inst->name, sizeof(inst->name), |
152 | "%s%u", edac_device_name, instance); | 150 | "%s%u", edac_device_name, instance); |
153 | inst->name[sizeof(inst->name)-1] = '\0'; | 151 | inst->name[sizeof(inst->name) - 1] = '\0'; |
154 | 152 | ||
155 | /* Initialize every block in each instance */ | 153 | /* Initialize every block in each instance */ |
156 | for ( block = 0; | 154 | for (block = 0; block < nr_blocks; block++) { |
157 | block < nr_blocks; | ||
158 | block++) { | ||
159 | blk = &blk_p[block]; | 155 | blk = &blk_p[block]; |
160 | blk->instance = inst; | 156 | blk->instance = inst; |
161 | blk->nr_attribs = nr_attribs; | 157 | blk->nr_attribs = nr_attribs; |
162 | attrib_p = &dev_attrib[block * nr_attribs]; | 158 | attrib_p = &dev_attrib[block * nr_attribs]; |
163 | blk->attribs = attrib_p; | 159 | blk->attribs = attrib_p; |
164 | snprintf(blk->name, sizeof(blk->name), | 160 | snprintf(blk->name, sizeof(blk->name), |
165 | "%s%d", edac_block_name,block+1); | 161 | "%s%d", edac_block_name, block + 1); |
166 | blk->name[sizeof(blk->name)-1] = '\0'; | 162 | blk->name[sizeof(blk->name) - 1] = '\0'; |
167 | 163 | ||
168 | debugf1("%s() instance=%d block=%d name=%s\n", | 164 | debugf1("%s() instance=%d block=%d name=%s\n", |
169 | __func__, instance,block,blk->name); | 165 | __func__, instance, block, blk->name); |
170 | 166 | ||
171 | if (attrib_spec != NULL) { | 167 | if (attrib_spec != NULL) { |
172 | /* when there is an attrib_spec passed int then | 168 | /* when there is an attrib_spec passed int then |
@@ -178,7 +174,7 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info( | |||
178 | 174 | ||
179 | /* Link each attribute to the caller's | 175 | /* Link each attribute to the caller's |
180 | * spec entry, for name and type | 176 | * spec entry, for name and type |
181 | */ | 177 | */ |
182 | attrib->spec = &attrib_spec[attr]; | 178 | attrib->spec = &attrib_spec[attr]; |
183 | } | 179 | } |
184 | } | 180 | } |
@@ -190,6 +186,7 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info( | |||
190 | 186 | ||
191 | return dev_ctl; | 187 | return dev_ctl; |
192 | } | 188 | } |
189 | |||
193 | EXPORT_SYMBOL_GPL(edac_device_alloc_ctl_info); | 190 | EXPORT_SYMBOL_GPL(edac_device_alloc_ctl_info); |
194 | 191 | ||
195 | /* | 192 | /* |
@@ -197,19 +194,18 @@ EXPORT_SYMBOL_GPL(edac_device_alloc_ctl_info); | |||
197 | * frees the memory allocated by the edac_device_alloc_ctl_info() | 194 | * frees the memory allocated by the edac_device_alloc_ctl_info() |
198 | * function | 195 | * function |
199 | */ | 196 | */ |
200 | void edac_device_free_ctl_info( struct edac_device_ctl_info *ctl_info) { | 197 | void edac_device_free_ctl_info(struct edac_device_ctl_info *ctl_info) |
198 | { | ||
201 | kfree(ctl_info); | 199 | kfree(ctl_info); |
202 | } | 200 | } |
203 | EXPORT_SYMBOL_GPL(edac_device_free_ctl_info); | ||
204 | |||
205 | 201 | ||
202 | EXPORT_SYMBOL_GPL(edac_device_free_ctl_info); | ||
206 | 203 | ||
207 | /* | 204 | /* |
208 | * find_edac_device_by_dev | 205 | * find_edac_device_by_dev |
209 | * scans the edac_device list for a specific 'struct device *' | 206 | * scans the edac_device list for a specific 'struct device *' |
210 | */ | 207 | */ |
211 | static struct edac_device_ctl_info * | 208 | static struct edac_device_ctl_info *find_edac_device_by_dev(struct device *dev) |
212 | find_edac_device_by_dev(struct device *dev) | ||
213 | { | 209 | { |
214 | struct edac_device_ctl_info *edac_dev; | 210 | struct edac_device_ctl_info *edac_dev; |
215 | struct list_head *item; | 211 | struct list_head *item; |
@@ -234,7 +230,7 @@ find_edac_device_by_dev(struct device *dev) | |||
234 | * 0 on success | 230 | * 0 on success |
235 | * 1 on failure. | 231 | * 1 on failure. |
236 | */ | 232 | */ |
237 | static int add_edac_dev_to_global_list (struct edac_device_ctl_info *edac_dev) | 233 | static int add_edac_dev_to_global_list(struct edac_device_ctl_info *edac_dev) |
238 | { | 234 | { |
239 | struct list_head *item, *insert_before; | 235 | struct list_head *item, *insert_before; |
240 | struct edac_device_ctl_info *rover; | 236 | struct edac_device_ctl_info *rover; |
@@ -261,17 +257,18 @@ static int add_edac_dev_to_global_list (struct edac_device_ctl_info *edac_dev) | |||
261 | list_add_tail_rcu(&edac_dev->link, insert_before); | 257 | list_add_tail_rcu(&edac_dev->link, insert_before); |
262 | return 0; | 258 | return 0; |
263 | 259 | ||
264 | fail0: | 260 | fail0: |
265 | edac_printk(KERN_WARNING, EDAC_MC, | 261 | edac_printk(KERN_WARNING, EDAC_MC, |
266 | "%s (%s) %s %s already assigned %d\n", | 262 | "%s (%s) %s %s already assigned %d\n", |
267 | rover->dev->bus_id, dev_name(rover), | 263 | rover->dev->bus_id, dev_name(rover), |
268 | rover->mod_name, rover->ctl_name, rover->dev_idx); | 264 | rover->mod_name, rover->ctl_name, rover->dev_idx); |
269 | return 1; | 265 | return 1; |
270 | 266 | ||
271 | fail1: | 267 | fail1: |
272 | edac_printk(KERN_WARNING, EDAC_MC, | 268 | edac_printk(KERN_WARNING, EDAC_MC, |
273 | "bug in low-level driver: attempt to assign\n" | 269 | "bug in low-level driver: attempt to assign\n" |
274 | " duplicate dev_idx %d in %s()\n", rover->dev_idx, __func__); | 270 | " duplicate dev_idx %d in %s()\n", rover->dev_idx, |
271 | __func__); | ||
275 | return 1; | 272 | return 1; |
276 | } | 273 | } |
277 | 274 | ||
@@ -290,8 +287,8 @@ static void complete_edac_device_list_del(struct rcu_head *head) | |||
290 | /* | 287 | /* |
291 | * del_edac_device_from_global_list | 288 | * del_edac_device_from_global_list |
292 | */ | 289 | */ |
293 | static void del_edac_device_from_global_list( | 290 | static void del_edac_device_from_global_list(struct edac_device_ctl_info |
294 | struct edac_device_ctl_info *edac_device) | 291 | *edac_device) |
295 | { | 292 | { |
296 | list_del_rcu(&edac_device->link); | 293 | list_del_rcu(&edac_device->link); |
297 | init_completion(&edac_device->complete); | 294 | init_completion(&edac_device->complete); |
@@ -308,7 +305,7 @@ static void del_edac_device_from_global_list( | |||
308 | * | 305 | * |
309 | * Caller must hold device_ctls_mutex. | 306 | * Caller must hold device_ctls_mutex. |
310 | */ | 307 | */ |
311 | struct edac_device_ctl_info * edac_device_find(int idx) | 308 | struct edac_device_ctl_info *edac_device_find(int idx) |
312 | { | 309 | { |
313 | struct list_head *item; | 310 | struct list_head *item; |
314 | struct edac_device_ctl_info *edac_dev; | 311 | struct edac_device_ctl_info *edac_dev; |
@@ -328,8 +325,8 @@ struct edac_device_ctl_info * edac_device_find(int idx) | |||
328 | 325 | ||
329 | return NULL; | 326 | return NULL; |
330 | } | 327 | } |
331 | EXPORT_SYMBOL(edac_device_find); | ||
332 | 328 | ||
329 | EXPORT_SYMBOL(edac_device_find); | ||
333 | 330 | ||
334 | /* | 331 | /* |
335 | * edac_device_workq_function | 332 | * edac_device_workq_function |
@@ -338,14 +335,13 @@ EXPORT_SYMBOL(edac_device_find); | |||
338 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) | 335 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) |
339 | static void edac_device_workq_function(struct work_struct *work_req) | 336 | static void edac_device_workq_function(struct work_struct *work_req) |
340 | { | 337 | { |
341 | struct delayed_work *d_work = (struct delayed_work*) work_req; | 338 | struct delayed_work *d_work = (struct delayed_work *)work_req; |
342 | struct edac_device_ctl_info *edac_dev = | 339 | struct edac_device_ctl_info *edac_dev = to_edac_device_ctl_work(d_work); |
343 | to_edac_device_ctl_work(d_work); | ||
344 | #else | 340 | #else |
345 | static void edac_device_workq_function(void *ptr) | 341 | static void edac_device_workq_function(void *ptr) |
346 | { | 342 | { |
347 | struct edac_device_ctl_info *edac_dev = | 343 | struct edac_device_ctl_info *edac_dev = |
348 | (struct edac_device_ctl_info *) ptr; | 344 | (struct edac_device_ctl_info *)ptr; |
349 | #endif | 345 | #endif |
350 | 346 | ||
351 | //debugf0("%s() here and running\n", __func__); | 347 | //debugf0("%s() here and running\n", __func__); |
@@ -353,14 +349,14 @@ static void edac_device_workq_function(void *ptr) | |||
353 | 349 | ||
354 | /* Only poll controllers that are running polled and have a check */ | 350 | /* Only poll controllers that are running polled and have a check */ |
355 | if ((edac_dev->op_state == OP_RUNNING_POLL) && | 351 | if ((edac_dev->op_state == OP_RUNNING_POLL) && |
356 | (edac_dev->edac_check != NULL)) { | 352 | (edac_dev->edac_check != NULL)) { |
357 | edac_dev->edac_check(edac_dev); | 353 | edac_dev->edac_check(edac_dev); |
358 | } | 354 | } |
359 | 355 | ||
360 | unlock_device_list(); | 356 | unlock_device_list(); |
361 | 357 | ||
362 | /* Reschedule */ | 358 | /* Reschedule */ |
363 | queue_delayed_work(edac_workqueue,&edac_dev->work, edac_dev->delay); | 359 | queue_delayed_work(edac_workqueue, &edac_dev->work, edac_dev->delay); |
364 | } | 360 | } |
365 | 361 | ||
366 | /* | 362 | /* |
@@ -369,7 +365,7 @@ static void edac_device_workq_function(void *ptr) | |||
369 | * passing in the new delay period in msec | 365 | * passing in the new delay period in msec |
370 | */ | 366 | */ |
371 | void edac_device_workq_setup(struct edac_device_ctl_info *edac_dev, | 367 | void edac_device_workq_setup(struct edac_device_ctl_info *edac_dev, |
372 | unsigned msec) | 368 | unsigned msec) |
373 | { | 369 | { |
374 | debugf0("%s()\n", __func__); | 370 | debugf0("%s()\n", __func__); |
375 | 371 | ||
@@ -403,9 +399,8 @@ void edac_device_workq_teardown(struct edac_device_ctl_info *edac_dev) | |||
403 | * edac_device_reset_delay_period | 399 | * edac_device_reset_delay_period |
404 | */ | 400 | */ |
405 | 401 | ||
406 | void edac_device_reset_delay_period( | 402 | void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev, |
407 | struct edac_device_ctl_info *edac_dev, | 403 | unsigned long value) |
408 | unsigned long value) | ||
409 | { | 404 | { |
410 | lock_device_list(); | 405 | lock_device_list(); |
411 | 406 | ||
@@ -450,7 +445,7 @@ int edac_device_add_device(struct edac_device_ctl_info *edac_dev, int edac_idx) | |||
450 | /* create this instance's sysfs entries */ | 445 | /* create this instance's sysfs entries */ |
451 | if (edac_device_create_sysfs(edac_dev)) { | 446 | if (edac_device_create_sysfs(edac_dev)) { |
452 | edac_device_printk(edac_dev, KERN_WARNING, | 447 | edac_device_printk(edac_dev, KERN_WARNING, |
453 | "failed to create sysfs device\n"); | 448 | "failed to create sysfs device\n"); |
454 | goto fail1; | 449 | goto fail1; |
455 | } | 450 | } |
456 | 451 | ||
@@ -468,27 +463,27 @@ int edac_device_add_device(struct edac_device_ctl_info *edac_dev, int edac_idx) | |||
468 | edac_dev->op_state = OP_RUNNING_INTERRUPT; | 463 | edac_dev->op_state = OP_RUNNING_INTERRUPT; |
469 | } | 464 | } |
470 | 465 | ||
471 | |||
472 | /* Report action taken */ | 466 | /* Report action taken */ |
473 | edac_device_printk(edac_dev, KERN_INFO, | 467 | edac_device_printk(edac_dev, KERN_INFO, |
474 | "Giving out device to module '%s' controller '%s': DEV '%s' (%s)\n", | 468 | "Giving out device to module '%s' controller '%s': DEV '%s' (%s)\n", |
475 | edac_dev->mod_name, | 469 | edac_dev->mod_name, |
476 | edac_dev->ctl_name, | 470 | edac_dev->ctl_name, |
477 | dev_name(edac_dev), | 471 | dev_name(edac_dev), |
478 | edac_op_state_toString(edac_dev->op_state) | 472 | edac_op_state_toString(edac_dev->op_state) |
479 | ); | 473 | ); |
480 | 474 | ||
481 | unlock_device_list(); | 475 | unlock_device_list(); |
482 | return 0; | 476 | return 0; |
483 | 477 | ||
484 | fail1: | 478 | fail1: |
485 | /* Some error, so remove the entry from the lsit */ | 479 | /* Some error, so remove the entry from the lsit */ |
486 | del_edac_device_from_global_list(edac_dev); | 480 | del_edac_device_from_global_list(edac_dev); |
487 | 481 | ||
488 | fail0: | 482 | fail0: |
489 | unlock_device_list(); | 483 | unlock_device_list(); |
490 | return 1; | 484 | return 1; |
491 | } | 485 | } |
486 | |||
492 | EXPORT_SYMBOL_GPL(edac_device_add_device); | 487 | EXPORT_SYMBOL_GPL(edac_device_add_device); |
493 | 488 | ||
494 | /** | 489 | /** |
@@ -504,7 +499,7 @@ EXPORT_SYMBOL_GPL(edac_device_add_device); | |||
504 | * Pointer to removed edac_device structure, | 499 | * Pointer to removed edac_device structure, |
505 | * OR NULL if device not found. | 500 | * OR NULL if device not found. |
506 | */ | 501 | */ |
507 | struct edac_device_ctl_info * edac_device_del_device(struct device *dev) | 502 | struct edac_device_ctl_info *edac_device_del_device(struct device *dev) |
508 | { | 503 | { |
509 | struct edac_device_ctl_info *edac_dev; | 504 | struct edac_device_ctl_info *edac_dev; |
510 | 505 | ||
@@ -532,16 +527,14 @@ struct edac_device_ctl_info * edac_device_del_device(struct device *dev) | |||
532 | unlock_device_list(); | 527 | unlock_device_list(); |
533 | 528 | ||
534 | edac_printk(KERN_INFO, EDAC_MC, | 529 | edac_printk(KERN_INFO, EDAC_MC, |
535 | "Removed device %d for %s %s: DEV %s\n", | 530 | "Removed device %d for %s %s: DEV %s\n", |
536 | edac_dev->dev_idx, | 531 | edac_dev->dev_idx, |
537 | edac_dev->mod_name, | 532 | edac_dev->mod_name, edac_dev->ctl_name, dev_name(edac_dev)); |
538 | edac_dev->ctl_name, | ||
539 | dev_name(edac_dev)); | ||
540 | 533 | ||
541 | return edac_dev; | 534 | return edac_dev; |
542 | } | 535 | } |
543 | EXPORT_SYMBOL_GPL(edac_device_del_device); | ||
544 | 536 | ||
537 | EXPORT_SYMBOL_GPL(edac_device_del_device); | ||
545 | 538 | ||
546 | static inline int edac_device_get_log_ce(struct edac_device_ctl_info *edac_dev) | 539 | static inline int edac_device_get_log_ce(struct edac_device_ctl_info *edac_dev) |
547 | { | 540 | { |
@@ -553,8 +546,8 @@ static inline int edac_device_get_log_ue(struct edac_device_ctl_info *edac_dev) | |||
553 | return edac_dev->log_ue; | 546 | return edac_dev->log_ue; |
554 | } | 547 | } |
555 | 548 | ||
556 | static inline int edac_device_get_panic_on_ue( | 549 | static inline int edac_device_get_panic_on_ue(struct edac_device_ctl_info |
557 | struct edac_device_ctl_info *edac_dev) | 550 | *edac_dev) |
558 | { | 551 | { |
559 | return edac_dev->panic_on_ue; | 552 | return edac_dev->panic_on_ue; |
560 | } | 553 | } |
@@ -564,15 +557,16 @@ static inline int edac_device_get_panic_on_ue( | |||
564 | * perform a common output and handling of an 'edac_dev' CE event | 557 | * perform a common output and handling of an 'edac_dev' CE event |
565 | */ | 558 | */ |
566 | void edac_device_handle_ce(struct edac_device_ctl_info *edac_dev, | 559 | void edac_device_handle_ce(struct edac_device_ctl_info *edac_dev, |
567 | int inst_nr, int block_nr, const char *msg) | 560 | int inst_nr, int block_nr, const char *msg) |
568 | { | 561 | { |
569 | struct edac_device_instance *instance; | 562 | struct edac_device_instance *instance; |
570 | struct edac_device_block *block = NULL; | 563 | struct edac_device_block *block = NULL; |
571 | 564 | ||
572 | if ((inst_nr >= edac_dev->nr_instances) || (inst_nr < 0)) { | 565 | if ((inst_nr >= edac_dev->nr_instances) || (inst_nr < 0)) { |
573 | edac_device_printk(edac_dev, KERN_ERR, | 566 | edac_device_printk(edac_dev, KERN_ERR, |
574 | "INTERNAL ERROR: 'instance' out of range " | 567 | "INTERNAL ERROR: 'instance' out of range " |
575 | "(%d >= %d)\n", inst_nr, edac_dev->nr_instances); | 568 | "(%d >= %d)\n", inst_nr, |
569 | edac_dev->nr_instances); | ||
576 | return; | 570 | return; |
577 | } | 571 | } |
578 | 572 | ||
@@ -580,8 +574,9 @@ void edac_device_handle_ce(struct edac_device_ctl_info *edac_dev, | |||
580 | 574 | ||
581 | if ((block_nr >= instance->nr_blocks) || (block_nr < 0)) { | 575 | if ((block_nr >= instance->nr_blocks) || (block_nr < 0)) { |
582 | edac_device_printk(edac_dev, KERN_ERR, | 576 | edac_device_printk(edac_dev, KERN_ERR, |
583 | "INTERNAL ERROR: instance %d 'block' out of range " | 577 | "INTERNAL ERROR: instance %d 'block' out of range " |
584 | "(%d >= %d)\n", inst_nr, block_nr, instance->nr_blocks); | 578 | "(%d >= %d)\n", inst_nr, block_nr, |
579 | instance->nr_blocks); | ||
585 | return; | 580 | return; |
586 | } | 581 | } |
587 | 582 | ||
@@ -596,10 +591,11 @@ void edac_device_handle_ce(struct edac_device_ctl_info *edac_dev, | |||
596 | 591 | ||
597 | if (edac_device_get_log_ce(edac_dev)) | 592 | if (edac_device_get_log_ce(edac_dev)) |
598 | edac_device_printk(edac_dev, KERN_WARNING, | 593 | edac_device_printk(edac_dev, KERN_WARNING, |
599 | "CE ctl: %s, instance: %s, block: %s: %s\n", | 594 | "CE ctl: %s, instance: %s, block: %s: %s\n", |
600 | edac_dev->ctl_name, instance->name, | 595 | edac_dev->ctl_name, instance->name, |
601 | block ? block->name : "N/A", msg); | 596 | block ? block->name : "N/A", msg); |
602 | } | 597 | } |
598 | |||
603 | EXPORT_SYMBOL_GPL(edac_device_handle_ce); | 599 | EXPORT_SYMBOL_GPL(edac_device_handle_ce); |
604 | 600 | ||
605 | /* | 601 | /* |
@@ -607,15 +603,16 @@ EXPORT_SYMBOL_GPL(edac_device_handle_ce); | |||
607 | * perform a common output and handling of an 'edac_dev' UE event | 603 | * perform a common output and handling of an 'edac_dev' UE event |
608 | */ | 604 | */ |
609 | void edac_device_handle_ue(struct edac_device_ctl_info *edac_dev, | 605 | void edac_device_handle_ue(struct edac_device_ctl_info *edac_dev, |
610 | int inst_nr, int block_nr, const char *msg) | 606 | int inst_nr, int block_nr, const char *msg) |
611 | { | 607 | { |
612 | struct edac_device_instance *instance; | 608 | struct edac_device_instance *instance; |
613 | struct edac_device_block *block = NULL; | 609 | struct edac_device_block *block = NULL; |
614 | 610 | ||
615 | if ((inst_nr >= edac_dev->nr_instances) || (inst_nr < 0)) { | 611 | if ((inst_nr >= edac_dev->nr_instances) || (inst_nr < 0)) { |
616 | edac_device_printk(edac_dev, KERN_ERR, | 612 | edac_device_printk(edac_dev, KERN_ERR, |
617 | "INTERNAL ERROR: 'instance' out of range " | 613 | "INTERNAL ERROR: 'instance' out of range " |
618 | "(%d >= %d)\n", inst_nr, edac_dev->nr_instances); | 614 | "(%d >= %d)\n", inst_nr, |
615 | edac_dev->nr_instances); | ||
619 | return; | 616 | return; |
620 | } | 617 | } |
621 | 618 | ||
@@ -623,8 +620,9 @@ void edac_device_handle_ue(struct edac_device_ctl_info *edac_dev, | |||
623 | 620 | ||
624 | if ((block_nr >= instance->nr_blocks) || (block_nr < 0)) { | 621 | if ((block_nr >= instance->nr_blocks) || (block_nr < 0)) { |
625 | edac_device_printk(edac_dev, KERN_ERR, | 622 | edac_device_printk(edac_dev, KERN_ERR, |
626 | "INTERNAL ERROR: instance %d 'block' out of range " | 623 | "INTERNAL ERROR: instance %d 'block' out of range " |
627 | "(%d >= %d)\n", inst_nr, block_nr, instance->nr_blocks); | 624 | "(%d >= %d)\n", inst_nr, block_nr, |
625 | instance->nr_blocks); | ||
628 | return; | 626 | return; |
629 | } | 627 | } |
630 | 628 | ||
@@ -639,14 +637,14 @@ void edac_device_handle_ue(struct edac_device_ctl_info *edac_dev, | |||
639 | 637 | ||
640 | if (edac_device_get_log_ue(edac_dev)) | 638 | if (edac_device_get_log_ue(edac_dev)) |
641 | edac_device_printk(edac_dev, KERN_EMERG, | 639 | edac_device_printk(edac_dev, KERN_EMERG, |
642 | "UE ctl: %s, instance: %s, block: %s: %s\n", | 640 | "UE ctl: %s, instance: %s, block: %s: %s\n", |
643 | edac_dev->ctl_name, instance->name, | 641 | edac_dev->ctl_name, instance->name, |
644 | block ? block->name : "N/A", msg); | 642 | block ? block->name : "N/A", msg); |
645 | 643 | ||
646 | if (edac_device_get_panic_on_ue(edac_dev)) | 644 | if (edac_device_get_panic_on_ue(edac_dev)) |
647 | panic("EDAC %s: UE instance: %s, block %s: %s\n", | 645 | panic("EDAC %s: UE instance: %s, block %s: %s\n", |
648 | edac_dev->ctl_name, instance->name, | 646 | edac_dev->ctl_name, instance->name, |
649 | block ? block->name : "N/A", msg); | 647 | block ? block->name : "N/A", msg); |
650 | } | 648 | } |
651 | EXPORT_SYMBOL_GPL(edac_device_handle_ue); | ||
652 | 649 | ||
650 | EXPORT_SYMBOL_GPL(edac_device_handle_ue); | ||