Lines Matching refs:stdev

51 	struct switchtec_dev *stdev;  member
68 static struct switchtec_user *stuser_create(struct switchtec_dev *stdev) in stuser_create() argument
76 get_device(&stdev->dev); in stuser_create()
77 stuser->stdev = stdev; in stuser_create()
81 stuser->event_cnt = atomic_read(&stdev->event_cnt); in stuser_create()
83 dev_dbg(&stdev->dev, "%s: %p\n", __func__, stuser); in stuser_create()
94 dev_dbg(&stuser->stdev->dev, "%s: %p\n", __func__, stuser); in stuser_free()
96 put_device(&stuser->stdev->dev); in stuser_free()
119 dev_dbg(&stuser->stdev->dev, "stuser state %p -> %s", in stuser_set_state()
123 static void mrpc_complete_cmd(struct switchtec_dev *stdev);
125 static void flush_wc_buf(struct switchtec_dev *stdev) in flush_wc_buf() argument
133 mmio_dbmsg = (void __iomem *)stdev->mmio_ntb + in flush_wc_buf()
138 static void mrpc_cmd_submit(struct switchtec_dev *stdev) in mrpc_cmd_submit() argument
144 if (stdev->mrpc_busy) in mrpc_cmd_submit()
147 if (list_empty(&stdev->mrpc_queue)) in mrpc_cmd_submit()
150 stuser = list_entry(stdev->mrpc_queue.next, struct switchtec_user, in mrpc_cmd_submit()
153 if (stdev->dma_mrpc) { in mrpc_cmd_submit()
154 stdev->dma_mrpc->status = SWITCHTEC_MRPC_STATUS_INPROGRESS; in mrpc_cmd_submit()
155 memset(stdev->dma_mrpc->data, 0xFF, SWITCHTEC_MRPC_PAYLOAD_SIZE); in mrpc_cmd_submit()
159 stdev->mrpc_busy = 1; in mrpc_cmd_submit()
160 memcpy_toio(&stdev->mmio_mrpc->input_data, in mrpc_cmd_submit()
162 flush_wc_buf(stdev); in mrpc_cmd_submit()
163 iowrite32(stuser->cmd, &stdev->mmio_mrpc->cmd); in mrpc_cmd_submit()
165 schedule_delayed_work(&stdev->mrpc_timeout, in mrpc_cmd_submit()
173 struct switchtec_dev *stdev = stuser->stdev; in mrpc_queue_cmd() local
179 list_add_tail(&stuser->list, &stdev->mrpc_queue); in mrpc_queue_cmd()
181 mrpc_cmd_submit(stdev); in mrpc_queue_cmd()
186 static void mrpc_complete_cmd(struct switchtec_dev *stdev) in mrpc_complete_cmd() argument
191 if (list_empty(&stdev->mrpc_queue)) in mrpc_complete_cmd()
194 stuser = list_entry(stdev->mrpc_queue.next, struct switchtec_user, in mrpc_complete_cmd()
197 if (stdev->dma_mrpc) in mrpc_complete_cmd()
198 stuser->status = stdev->dma_mrpc->status; in mrpc_complete_cmd()
200 stuser->status = ioread32(&stdev->mmio_mrpc->status); in mrpc_complete_cmd()
211 if (stdev->dma_mrpc) in mrpc_complete_cmd()
212 stuser->return_code = stdev->dma_mrpc->rtn_code; in mrpc_complete_cmd()
214 stuser->return_code = ioread32(&stdev->mmio_mrpc->ret_value); in mrpc_complete_cmd()
218 if (stdev->dma_mrpc) in mrpc_complete_cmd()
219 memcpy(stuser->data, &stdev->dma_mrpc->data, in mrpc_complete_cmd()
222 memcpy_fromio(stuser->data, &stdev->mmio_mrpc->output_data, in mrpc_complete_cmd()
228 stdev->mrpc_busy = 0; in mrpc_complete_cmd()
230 mrpc_cmd_submit(stdev); in mrpc_complete_cmd()
235 struct switchtec_dev *stdev; in mrpc_event_work() local
237 stdev = container_of(work, struct switchtec_dev, mrpc_work); in mrpc_event_work()
239 dev_dbg(&stdev->dev, "%s\n", __func__); in mrpc_event_work()
241 mutex_lock(&stdev->mrpc_mutex); in mrpc_event_work()
242 cancel_delayed_work(&stdev->mrpc_timeout); in mrpc_event_work()
243 mrpc_complete_cmd(stdev); in mrpc_event_work()
244 mutex_unlock(&stdev->mrpc_mutex); in mrpc_event_work()
249 struct switchtec_dev *stdev; in mrpc_timeout_work() local
252 stdev = container_of(work, struct switchtec_dev, mrpc_timeout.work); in mrpc_timeout_work()
254 dev_dbg(&stdev->dev, "%s\n", __func__); in mrpc_timeout_work()
256 mutex_lock(&stdev->mrpc_mutex); in mrpc_timeout_work()
258 if (stdev->dma_mrpc) in mrpc_timeout_work()
259 status = stdev->dma_mrpc->status; in mrpc_timeout_work()
261 status = ioread32(&stdev->mmio_mrpc->status); in mrpc_timeout_work()
263 schedule_delayed_work(&stdev->mrpc_timeout, in mrpc_timeout_work()
268 mrpc_complete_cmd(stdev); in mrpc_timeout_work()
270 mutex_unlock(&stdev->mrpc_mutex); in mrpc_timeout_work()
276 struct switchtec_dev *stdev = to_stdev(dev); in device_version_show() local
279 ver = ioread32(&stdev->mmio_sys_info->device_version); in device_version_show()
288 struct switchtec_dev *stdev = to_stdev(dev); in fw_version_show() local
291 ver = ioread32(&stdev->mmio_sys_info->firmware_version); in fw_version_show()
319 struct switchtec_dev *stdev = to_stdev(dev); \
320 return io_string_show(buf, &stdev->mmio_sys_info->field, \
321 sizeof(stdev->mmio_sys_info->field)); \
334 struct switchtec_dev *stdev = to_stdev(dev); in component_id_show() local
335 int id = ioread16(&stdev->mmio_sys_info->component_id); in component_id_show()
344 struct switchtec_dev *stdev = to_stdev(dev); in component_revision_show() local
345 int rev = ioread8(&stdev->mmio_sys_info->component_revision); in component_revision_show()
354 struct switchtec_dev *stdev = to_stdev(dev); in partition_show() local
356 return sprintf(buf, "%d\n", stdev->partition); in partition_show()
363 struct switchtec_dev *stdev = to_stdev(dev); in partition_count_show() local
365 return sprintf(buf, "%d\n", stdev->partition_count); in partition_count_show()
387 struct switchtec_dev *stdev; in switchtec_dev_open() local
390 stdev = container_of(inode->i_cdev, struct switchtec_dev, cdev); in switchtec_dev_open()
392 stuser = stuser_create(stdev); in switchtec_dev_open()
399 dev_dbg(&stdev->dev, "%s: %p\n", __func__, stuser); in switchtec_dev_open()
413 static int lock_mutex_and_test_alive(struct switchtec_dev *stdev) in lock_mutex_and_test_alive() argument
415 if (mutex_lock_interruptible(&stdev->mrpc_mutex)) in lock_mutex_and_test_alive()
418 if (!stdev->alive) { in lock_mutex_and_test_alive()
419 mutex_unlock(&stdev->mrpc_mutex); in lock_mutex_and_test_alive()
430 struct switchtec_dev *stdev = stuser->stdev; in switchtec_dev_write() local
439 rc = lock_mutex_and_test_alive(stdev); in switchtec_dev_write()
464 mutex_unlock(&stdev->mrpc_mutex); in switchtec_dev_write()
476 struct switchtec_dev *stdev = stuser->stdev; in switchtec_dev_read() local
483 rc = lock_mutex_and_test_alive(stdev); in switchtec_dev_read()
488 mutex_unlock(&stdev->mrpc_mutex); in switchtec_dev_read()
494 mutex_unlock(&stdev->mrpc_mutex); in switchtec_dev_read()
505 rc = lock_mutex_and_test_alive(stdev); in switchtec_dev_read()
510 mutex_unlock(&stdev->mrpc_mutex); in switchtec_dev_read()
532 mutex_unlock(&stdev->mrpc_mutex); in switchtec_dev_read()
545 struct switchtec_dev *stdev = stuser->stdev; in switchtec_dev_poll() local
549 poll_wait(filp, &stdev->event_wq, wait); in switchtec_dev_poll()
551 if (lock_mutex_and_test_alive(stdev)) in switchtec_dev_poll()
554 mutex_unlock(&stdev->mrpc_mutex); in switchtec_dev_poll()
559 if (stuser->event_cnt != atomic_read(&stdev->event_cnt)) in switchtec_dev_poll()
565 static int ioctl_flash_info(struct switchtec_dev *stdev, in ioctl_flash_info() argument
569 struct flash_info_regs __iomem *fi = stdev->mmio_flash_info; in ioctl_flash_info()
587 static int ioctl_flash_part_info(struct switchtec_dev *stdev, in ioctl_flash_part_info() argument
591 struct flash_info_regs __iomem *fi = stdev->mmio_flash_info; in ioctl_flash_part_info()
592 struct sys_info_regs __iomem *si = stdev->mmio_sys_info; in ioctl_flash_part_info()
663 static int ioctl_event_summary(struct switchtec_dev *stdev, in ioctl_event_summary() argument
677 s->global = ioread32(&stdev->mmio_sw_event->global_summary); in ioctl_event_summary()
678 s->part_bitmap = ioread32(&stdev->mmio_sw_event->part_event_bitmap); in ioctl_event_summary()
679 s->local_part = ioread32(&stdev->mmio_part_cfg->part_event_summary); in ioctl_event_summary()
681 for (i = 0; i < stdev->partition_count; i++) { in ioctl_event_summary()
682 reg = ioread32(&stdev->mmio_part_cfg_all[i].part_event_summary); in ioctl_event_summary()
687 reg = ioread16(&stdev->mmio_pff_csr[i].vendor_id); in ioctl_event_summary()
691 reg = ioread32(&stdev->mmio_pff_csr[i].pff_event_summary); in ioctl_event_summary()
700 stuser->event_cnt = atomic_read(&stdev->event_cnt); in ioctl_event_summary()
707 static u32 __iomem *global_ev_reg(struct switchtec_dev *stdev, in global_ev_reg() argument
710 return (void __iomem *)stdev->mmio_sw_event + offset; in global_ev_reg()
713 static u32 __iomem *part_ev_reg(struct switchtec_dev *stdev, in part_ev_reg() argument
716 return (void __iomem *)&stdev->mmio_part_cfg_all[index] + offset; in part_ev_reg()
719 static u32 __iomem *pff_ev_reg(struct switchtec_dev *stdev, in pff_ev_reg() argument
722 return (void __iomem *)&stdev->mmio_pff_csr[index] + offset; in pff_ev_reg()
731 u32 __iomem *(*map_reg)(struct switchtec_dev *stdev,
768 static u32 __iomem *event_hdr_addr(struct switchtec_dev *stdev, in event_hdr_addr() argument
780 index = stdev->partition; in event_hdr_addr()
781 else if (index < 0 || index >= stdev->partition_count) in event_hdr_addr()
784 if (index < 0 || index >= stdev->pff_csr_count) in event_hdr_addr()
788 return event_regs[event_id].map_reg(stdev, off, index); in event_hdr_addr()
791 static int event_ctl(struct switchtec_dev *stdev, in event_ctl() argument
798 reg = event_hdr_addr(stdev, ctl->event_id, ctl->index); in event_ctl()
844 static int ioctl_event_ctl(struct switchtec_dev *stdev, in ioctl_event_ctl() argument
865 nr_idxs = stdev->partition_count; in ioctl_event_ctl()
867 nr_idxs = stdev->pff_csr_count; in ioctl_event_ctl()
874 ret = event_ctl(stdev, &ctl); in ioctl_event_ctl()
879 ret = event_ctl(stdev, &ctl); in ioctl_event_ctl()
890 static int ioctl_pff_to_port(struct switchtec_dev *stdev, in ioctl_pff_to_port() argument
902 for (part = 0; part < stdev->partition_count; part++) { in ioctl_pff_to_port()
903 pcfg = &stdev->mmio_part_cfg_all[part]; in ioctl_pff_to_port()
937 static int ioctl_port_to_pff(struct switchtec_dev *stdev, in ioctl_port_to_pff() argument
947 pcfg = stdev->mmio_part_cfg; in ioctl_port_to_pff()
948 else if (p.partition < stdev->partition_count) in ioctl_port_to_pff()
949 pcfg = &stdev->mmio_part_cfg_all[p.partition]; in ioctl_port_to_pff()
979 struct switchtec_dev *stdev = stuser->stdev; in switchtec_dev_ioctl() local
983 rc = lock_mutex_and_test_alive(stdev); in switchtec_dev_ioctl()
989 rc = ioctl_flash_info(stdev, argp); in switchtec_dev_ioctl()
992 rc = ioctl_flash_part_info(stdev, argp); in switchtec_dev_ioctl()
995 rc = ioctl_event_summary(stdev, stuser, argp, in switchtec_dev_ioctl()
999 rc = ioctl_event_ctl(stdev, argp); in switchtec_dev_ioctl()
1002 rc = ioctl_pff_to_port(stdev, argp); in switchtec_dev_ioctl()
1005 rc = ioctl_port_to_pff(stdev, argp); in switchtec_dev_ioctl()
1008 rc = ioctl_event_summary(stdev, stuser, argp, in switchtec_dev_ioctl()
1016 mutex_unlock(&stdev->mrpc_mutex); in switchtec_dev_ioctl()
1033 struct switchtec_dev *stdev; in link_event_work() local
1035 stdev = container_of(work, struct switchtec_dev, link_event_work); in link_event_work()
1037 if (stdev->link_notifier) in link_event_work()
1038 stdev->link_notifier(stdev); in link_event_work()
1041 static void check_link_state_events(struct switchtec_dev *stdev) in check_link_state_events() argument
1048 for (idx = 0; idx < stdev->pff_csr_count; idx++) { in check_link_state_events()
1049 reg = ioread32(&stdev->mmio_pff_csr[idx].link_state_hdr); in check_link_state_events()
1050 dev_dbg(&stdev->dev, "link_state: %d->%08x\n", idx, reg); in check_link_state_events()
1053 if (count != stdev->link_event_count[idx]) { in check_link_state_events()
1055 stdev->link_event_count[idx] = count; in check_link_state_events()
1060 schedule_work(&stdev->link_event_work); in check_link_state_events()
1063 static void enable_link_state_events(struct switchtec_dev *stdev) in enable_link_state_events() argument
1067 for (idx = 0; idx < stdev->pff_csr_count; idx++) { in enable_link_state_events()
1070 &stdev->mmio_pff_csr[idx].link_state_hdr); in enable_link_state_events()
1074 static void enable_dma_mrpc(struct switchtec_dev *stdev) in enable_dma_mrpc() argument
1076 writeq(stdev->dma_mrpc_dma_addr, &stdev->mmio_mrpc->dma_addr); in enable_dma_mrpc()
1077 flush_wc_buf(stdev); in enable_dma_mrpc()
1078 iowrite32(SWITCHTEC_DMA_MRPC_EN, &stdev->mmio_mrpc->dma_en); in enable_dma_mrpc()
1083 struct switchtec_dev *stdev = to_stdev(dev); in stdev_release() local
1085 if (stdev->dma_mrpc) { in stdev_release()
1086 iowrite32(0, &stdev->mmio_mrpc->dma_en); in stdev_release()
1087 flush_wc_buf(stdev); in stdev_release()
1088 writeq(0, &stdev->mmio_mrpc->dma_addr); in stdev_release()
1089 dma_free_coherent(&stdev->pdev->dev, sizeof(*stdev->dma_mrpc), in stdev_release()
1090 stdev->dma_mrpc, stdev->dma_mrpc_dma_addr); in stdev_release()
1092 kfree(stdev); in stdev_release()
1095 static void stdev_kill(struct switchtec_dev *stdev) in stdev_kill() argument
1099 pci_clear_master(stdev->pdev); in stdev_kill()
1101 cancel_delayed_work_sync(&stdev->mrpc_timeout); in stdev_kill()
1104 mutex_lock(&stdev->mrpc_mutex); in stdev_kill()
1105 stdev->alive = false; in stdev_kill()
1108 list_for_each_entry_safe(stuser, tmpuser, &stdev->mrpc_queue, list) { in stdev_kill()
1114 mutex_unlock(&stdev->mrpc_mutex); in stdev_kill()
1117 wake_up_interruptible(&stdev->event_wq); in stdev_kill()
1122 struct switchtec_dev *stdev; in stdev_create() local
1128 stdev = kzalloc_node(sizeof(*stdev), GFP_KERNEL, in stdev_create()
1130 if (!stdev) in stdev_create()
1133 stdev->alive = true; in stdev_create()
1134 stdev->pdev = pdev; in stdev_create()
1135 INIT_LIST_HEAD(&stdev->mrpc_queue); in stdev_create()
1136 mutex_init(&stdev->mrpc_mutex); in stdev_create()
1137 stdev->mrpc_busy = 0; in stdev_create()
1138 INIT_WORK(&stdev->mrpc_work, mrpc_event_work); in stdev_create()
1139 INIT_DELAYED_WORK(&stdev->mrpc_timeout, mrpc_timeout_work); in stdev_create()
1140 INIT_WORK(&stdev->link_event_work, link_event_work); in stdev_create()
1141 init_waitqueue_head(&stdev->event_wq); in stdev_create()
1142 atomic_set(&stdev->event_cnt, 0); in stdev_create()
1144 dev = &stdev->dev; in stdev_create()
1161 cdev = &stdev->cdev; in stdev_create()
1165 return stdev; in stdev_create()
1168 put_device(&stdev->dev); in stdev_create()
1172 static int mask_event(struct switchtec_dev *stdev, int eid, int idx) in mask_event() argument
1178 hdr_reg = event_regs[eid].map_reg(stdev, off, idx); in mask_event()
1188 dev_dbg(&stdev->dev, "%s: %d %d %x\n", __func__, eid, idx, hdr); in mask_event()
1195 static int mask_all_events(struct switchtec_dev *stdev, int eid) in mask_all_events() argument
1201 for (idx = 0; idx < stdev->partition_count; idx++) in mask_all_events()
1202 count += mask_event(stdev, eid, idx); in mask_all_events()
1204 for (idx = 0; idx < stdev->pff_csr_count; idx++) { in mask_all_events()
1205 if (!stdev->pff_local[idx]) in mask_all_events()
1208 count += mask_event(stdev, eid, idx); in mask_all_events()
1211 count += mask_event(stdev, eid, 0); in mask_all_events()
1219 struct switchtec_dev *stdev = dev; in switchtec_event_isr() local
1224 reg = ioread32(&stdev->mmio_part_cfg->mrpc_comp_hdr); in switchtec_event_isr()
1226 dev_dbg(&stdev->dev, "%s: mrpc comp\n", __func__); in switchtec_event_isr()
1228 schedule_work(&stdev->mrpc_work); in switchtec_event_isr()
1229 iowrite32(reg, &stdev->mmio_part_cfg->mrpc_comp_hdr); in switchtec_event_isr()
1232 check_link_state_events(stdev); in switchtec_event_isr()
1235 event_count += mask_all_events(stdev, eid); in switchtec_event_isr()
1238 atomic_inc(&stdev->event_cnt); in switchtec_event_isr()
1239 wake_up_interruptible(&stdev->event_wq); in switchtec_event_isr()
1240 dev_dbg(&stdev->dev, "%s: %d events\n", __func__, in switchtec_event_isr()
1251 struct switchtec_dev *stdev = dev; in switchtec_dma_mrpc_isr() local
1256 &stdev->mmio_part_cfg->mrpc_comp_hdr); in switchtec_dma_mrpc_isr()
1257 schedule_work(&stdev->mrpc_work); in switchtec_dma_mrpc_isr()
1263 static int switchtec_init_isr(struct switchtec_dev *stdev) in switchtec_init_isr() argument
1273 nvecs = pci_alloc_irq_vectors(stdev->pdev, 1, nirqs, in switchtec_init_isr()
1279 event_irq = ioread32(&stdev->mmio_part_cfg->vep_vector_number); in switchtec_init_isr()
1283 event_irq = pci_irq_vector(stdev->pdev, event_irq); in switchtec_init_isr()
1287 rc = devm_request_irq(&stdev->pdev->dev, event_irq, in switchtec_init_isr()
1289 KBUILD_MODNAME, stdev); in switchtec_init_isr()
1294 if (!stdev->dma_mrpc) in switchtec_init_isr()
1297 dma_mrpc_irq = ioread32(&stdev->mmio_mrpc->dma_vector); in switchtec_init_isr()
1301 dma_mrpc_irq = pci_irq_vector(stdev->pdev, dma_mrpc_irq); in switchtec_init_isr()
1305 rc = devm_request_irq(&stdev->pdev->dev, dma_mrpc_irq, in switchtec_init_isr()
1307 KBUILD_MODNAME, stdev); in switchtec_init_isr()
1312 static void init_pff(struct switchtec_dev *stdev) in init_pff() argument
1316 struct part_cfg_regs *pcfg = stdev->mmio_part_cfg; in init_pff()
1319 reg = ioread16(&stdev->mmio_pff_csr[i].vendor_id); in init_pff()
1324 stdev->pff_csr_count = i; in init_pff()
1328 stdev->pff_local[reg] = 1; in init_pff()
1332 stdev->pff_local[reg] = 1; in init_pff()
1337 stdev->pff_local[reg] = 1; in init_pff()
1341 static int switchtec_init_pci(struct switchtec_dev *stdev, in switchtec_init_pci() argument
1365 stdev->mmio_mrpc = devm_ioremap_wc(&pdev->dev, res_start, in switchtec_init_pci()
1367 if (!stdev->mmio_mrpc) in switchtec_init_pci()
1376 stdev->mmio = map - SWITCHTEC_GAS_TOP_CFG_OFFSET; in switchtec_init_pci()
1377 stdev->mmio_sw_event = stdev->mmio + SWITCHTEC_GAS_SW_EVENT_OFFSET; in switchtec_init_pci()
1378 stdev->mmio_sys_info = stdev->mmio + SWITCHTEC_GAS_SYS_INFO_OFFSET; in switchtec_init_pci()
1379 stdev->mmio_flash_info = stdev->mmio + SWITCHTEC_GAS_FLASH_INFO_OFFSET; in switchtec_init_pci()
1380 stdev->mmio_ntb = stdev->mmio + SWITCHTEC_GAS_NTB_OFFSET; in switchtec_init_pci()
1381 stdev->partition = ioread8(&stdev->mmio_sys_info->partition_id); in switchtec_init_pci()
1382 stdev->partition_count = ioread8(&stdev->mmio_ntb->partition_count); in switchtec_init_pci()
1383 stdev->mmio_part_cfg_all = stdev->mmio + SWITCHTEC_GAS_PART_CFG_OFFSET; in switchtec_init_pci()
1384 stdev->mmio_part_cfg = &stdev->mmio_part_cfg_all[stdev->partition]; in switchtec_init_pci()
1385 stdev->mmio_pff_csr = stdev->mmio + SWITCHTEC_GAS_PFF_CSR_OFFSET; in switchtec_init_pci()
1387 if (stdev->partition_count < 1) in switchtec_init_pci()
1388 stdev->partition_count = 1; in switchtec_init_pci()
1390 init_pff(stdev); in switchtec_init_pci()
1392 pci_set_drvdata(pdev, stdev); in switchtec_init_pci()
1397 if (ioread32(&stdev->mmio_mrpc->dma_ver) == 0) in switchtec_init_pci()
1400 stdev->dma_mrpc = dma_alloc_coherent(&stdev->pdev->dev, in switchtec_init_pci()
1401 sizeof(*stdev->dma_mrpc), in switchtec_init_pci()
1402 &stdev->dma_mrpc_dma_addr, in switchtec_init_pci()
1404 if (stdev->dma_mrpc == NULL) in switchtec_init_pci()
1413 struct switchtec_dev *stdev; in switchtec_pci_probe() local
1419 stdev = stdev_create(pdev); in switchtec_pci_probe()
1420 if (IS_ERR(stdev)) in switchtec_pci_probe()
1421 return PTR_ERR(stdev); in switchtec_pci_probe()
1423 rc = switchtec_init_pci(stdev, pdev); in switchtec_pci_probe()
1427 rc = switchtec_init_isr(stdev); in switchtec_pci_probe()
1429 dev_err(&stdev->dev, "failed to init isr.\n"); in switchtec_pci_probe()
1435 &stdev->mmio_part_cfg->mrpc_comp_hdr); in switchtec_pci_probe()
1436 enable_link_state_events(stdev); in switchtec_pci_probe()
1438 if (stdev->dma_mrpc) in switchtec_pci_probe()
1439 enable_dma_mrpc(stdev); in switchtec_pci_probe()
1441 rc = cdev_device_add(&stdev->cdev, &stdev->dev); in switchtec_pci_probe()
1445 dev_info(&stdev->dev, "Management device registered.\n"); in switchtec_pci_probe()
1450 stdev_kill(stdev); in switchtec_pci_probe()
1452 ida_simple_remove(&switchtec_minor_ida, MINOR(stdev->dev.devt)); in switchtec_pci_probe()
1453 put_device(&stdev->dev); in switchtec_pci_probe()
1459 struct switchtec_dev *stdev = pci_get_drvdata(pdev); in switchtec_pci_remove() local
1463 cdev_device_del(&stdev->cdev, &stdev->dev); in switchtec_pci_remove()
1464 ida_simple_remove(&switchtec_minor_ida, MINOR(stdev->dev.devt)); in switchtec_pci_remove()
1465 dev_info(&stdev->dev, "unregistered.\n"); in switchtec_pci_remove()
1466 stdev_kill(stdev); in switchtec_pci_remove()
1467 put_device(&stdev->dev); in switchtec_pci_remove()