Lines Matching full:pci
3 * EDAC PCI component
31 struct edac_pci_ctl_info *pci; in edac_pci_alloc_ctl_info() local
35 pci = kzalloc(sizeof(struct edac_pci_ctl_info), GFP_KERNEL); in edac_pci_alloc_ctl_info()
36 if (!pci) in edac_pci_alloc_ctl_info()
40 pci->pvt_info = kzalloc(sz_pvt, GFP_KERNEL); in edac_pci_alloc_ctl_info()
41 if (!pci->pvt_info) in edac_pci_alloc_ctl_info()
45 pci->op_state = OP_ALLOC; in edac_pci_alloc_ctl_info()
47 snprintf(pci->name, strlen(edac_pci_name) + 1, "%s", edac_pci_name); in edac_pci_alloc_ctl_info()
49 return pci; in edac_pci_alloc_ctl_info()
52 kfree(pci); in edac_pci_alloc_ctl_info()
57 void edac_pci_free_ctl_info(struct edac_pci_ctl_info *pci) in edac_pci_free_ctl_info() argument
61 edac_pci_remove_sysfs(pci); in edac_pci_free_ctl_info()
73 struct edac_pci_ctl_info *pci; in find_edac_pci_by_dev() local
79 pci = list_entry(item, struct edac_pci_ctl_info, link); in find_edac_pci_by_dev()
81 if (pci->dev == dev) in find_edac_pci_by_dev()
82 return pci; in find_edac_pci_by_dev()
96 static int add_edac_pci_to_global_list(struct edac_pci_ctl_info *pci) in add_edac_pci_to_global_list() argument
106 rover = find_edac_pci_by_dev(pci->dev); in add_edac_pci_to_global_list()
114 if (rover->pci_idx >= pci->pci_idx) { in add_edac_pci_to_global_list()
115 if (unlikely(rover->pci_idx == pci->pci_idx)) in add_edac_pci_to_global_list()
123 list_add_tail_rcu(&pci->link, insert_before); in add_edac_pci_to_global_list()
144 * remove the PCI control struct from the global list
146 static void del_edac_pci_from_global_list(struct edac_pci_ctl_info *pci) in del_edac_pci_from_global_list() argument
148 list_del_rcu(&pci->link); in del_edac_pci_from_global_list()
154 INIT_LIST_HEAD(&pci->link); in del_edac_pci_from_global_list()
161 * scheduled by a workq request, for a given PCI control struct
166 struct edac_pci_ctl_info *pci = to_edac_pci_ctl_work(d_work); in edac_pci_workq_function() local
174 if (pci->op_state != OP_RUNNING_POLL) { in edac_pci_workq_function()
180 pci->edac_check(pci); in edac_pci_workq_function()
189 edac_queue_work(&pci->work, delay); in edac_pci_workq_function()
200 int edac_pci_add_device(struct edac_pci_ctl_info *pci, int edac_idx) in edac_pci_add_device() argument
204 pci->pci_idx = edac_idx; in edac_pci_add_device()
205 pci->start_time = jiffies; in edac_pci_add_device()
209 if (add_edac_pci_to_global_list(pci)) in edac_pci_add_device()
212 if (edac_pci_create_sysfs(pci)) { in edac_pci_add_device()
213 edac_pci_printk(pci, KERN_WARNING, in edac_pci_add_device()
214 "failed to create sysfs pci\n"); in edac_pci_add_device()
218 if (pci->edac_check) { in edac_pci_add_device()
219 pci->op_state = OP_RUNNING_POLL; in edac_pci_add_device()
221 INIT_DELAYED_WORK(&pci->work, edac_pci_workq_function); in edac_pci_add_device()
222 edac_queue_work(&pci->work, msecs_to_jiffies(edac_pci_get_poll_msec())); in edac_pci_add_device()
225 pci->op_state = OP_RUNNING_INTERRUPT; in edac_pci_add_device()
228 edac_pci_printk(pci, KERN_INFO, in edac_pci_add_device()
230 pci->mod_name, pci->ctl_name, pci->dev_name, in edac_pci_add_device()
231 edac_op_state_to_string(pci->op_state)); in edac_pci_add_device()
238 del_edac_pci_from_global_list(pci); in edac_pci_add_device()
247 struct edac_pci_ctl_info *pci; in edac_pci_del_device() local
256 pci = find_edac_pci_by_dev(dev); in edac_pci_del_device()
257 if (pci == NULL) { in edac_pci_del_device()
262 pci->op_state = OP_OFFLINE; in edac_pci_del_device()
264 del_edac_pci_from_global_list(pci); in edac_pci_del_device()
268 if (pci->edac_check) in edac_pci_del_device()
269 edac_stop_work(&pci->work); in edac_pci_del_device()
273 pci->pci_idx, pci->mod_name, pci->ctl_name, edac_dev_name(pci)); in edac_pci_del_device()
275 return pci; in edac_pci_del_device()
284 static void edac_pci_generic_check(struct edac_pci_ctl_info *pci) in edac_pci_generic_check() argument
292 #define EDAC_PCI_GENCTL_NAME "EDAC PCI controller"
301 struct edac_pci_ctl_info *pci; in edac_pci_create_generic_ctl() local
304 pci = edac_pci_alloc_ctl_info(sizeof(*pdata), EDAC_PCI_GENCTL_NAME); in edac_pci_create_generic_ctl()
305 if (!pci) in edac_pci_create_generic_ctl()
308 pdata = pci->pvt_info; in edac_pci_create_generic_ctl()
309 pci->dev = dev; in edac_pci_create_generic_ctl()
310 dev_set_drvdata(pci->dev, pci); in edac_pci_create_generic_ctl()
311 pci->dev_name = pci_name(to_pci_dev(dev)); in edac_pci_create_generic_ctl()
313 pci->mod_name = mod_name; in edac_pci_create_generic_ctl()
314 pci->ctl_name = EDAC_PCI_GENCTL_NAME; in edac_pci_create_generic_ctl()
316 pci->edac_check = edac_pci_generic_check; in edac_pci_create_generic_ctl()
320 if (edac_pci_add_device(pci, pdata->edac_idx) > 0) { in edac_pci_create_generic_ctl()
322 edac_pci_free_ctl_info(pci); in edac_pci_create_generic_ctl()
326 return pci; in edac_pci_create_generic_ctl()
330 void edac_pci_release_generic_ctl(struct edac_pci_ctl_info *pci) in edac_pci_release_generic_ctl() argument
332 edac_dbg(0, "pci mod=%s\n", pci->mod_name); in edac_pci_release_generic_ctl()
334 edac_pci_del_device(pci->dev); in edac_pci_release_generic_ctl()
335 edac_pci_free_ctl_info(pci); in edac_pci_release_generic_ctl()