uio_netx.c (3eb66e91a25497065c5322b1268cbc3953642227) | uio_netx.c (c3a747791138062b81b7ba24547c2b58485d3718) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * UIO driver for Hilscher NetX based fieldbus cards (cifX, comX). 4 * See http://www.hilscher.com for details. 5 * 6 * (C) 2007 Hans J. Koch <hjk@hansjkoch.de> 7 * (C) 2008 Manuel Traut <manut@linutronix.de> 8 * --- 39 unchanged lines hidden (view full) --- 48} 49 50static int netx_pci_probe(struct pci_dev *dev, 51 const struct pci_device_id *id) 52{ 53 struct uio_info *info; 54 int bar; 55 | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * UIO driver for Hilscher NetX based fieldbus cards (cifX, comX). 4 * See http://www.hilscher.com for details. 5 * 6 * (C) 2007 Hans J. Koch <hjk@hansjkoch.de> 7 * (C) 2008 Manuel Traut <manut@linutronix.de> 8 * --- 39 unchanged lines hidden (view full) --- 48} 49 50static int netx_pci_probe(struct pci_dev *dev, 51 const struct pci_device_id *id) 52{ 53 struct uio_info *info; 54 int bar; 55 |
56 info = kzalloc(sizeof(struct uio_info), GFP_KERNEL); | 56 info = devm_kzalloc(&dev->dev, sizeof(struct uio_info), GFP_KERNEL); |
57 if (!info) 58 return -ENOMEM; 59 60 if (pci_enable_device(dev)) | 57 if (!info) 58 return -ENOMEM; 59 60 if (pci_enable_device(dev)) |
61 goto out_free; | 61 return -ENODEV; |
62 63 if (pci_request_regions(dev, "netx")) 64 goto out_disable; 65 66 switch (id->device) { 67 case PCI_DEVICE_ID_HILSCHER_NETX: 68 bar = 0; 69 info->name = "netx"; --- 37 unchanged lines hidden (view full) --- 107 return 0; 108 109out_unmap: 110 iounmap(info->mem[0].internal_addr); 111out_release: 112 pci_release_regions(dev); 113out_disable: 114 pci_disable_device(dev); | 62 63 if (pci_request_regions(dev, "netx")) 64 goto out_disable; 65 66 switch (id->device) { 67 case PCI_DEVICE_ID_HILSCHER_NETX: 68 bar = 0; 69 info->name = "netx"; --- 37 unchanged lines hidden (view full) --- 107 return 0; 108 109out_unmap: 110 iounmap(info->mem[0].internal_addr); 111out_release: 112 pci_release_regions(dev); 113out_disable: 114 pci_disable_device(dev); |
115out_free: 116 kfree(info); | |
117 return -ENODEV; 118} 119 120static void netx_pci_remove(struct pci_dev *dev) 121{ 122 struct uio_info *info = pci_get_drvdata(dev); 123 124 /* Disable all interrupts */ 125 iowrite32(0, info->mem[0].internal_addr + DPM_HOST_INT_EN0); 126 uio_unregister_device(info); 127 pci_release_regions(dev); 128 pci_disable_device(dev); 129 iounmap(info->mem[0].internal_addr); | 115 return -ENODEV; 116} 117 118static void netx_pci_remove(struct pci_dev *dev) 119{ 120 struct uio_info *info = pci_get_drvdata(dev); 121 122 /* Disable all interrupts */ 123 iowrite32(0, info->mem[0].internal_addr + DPM_HOST_INT_EN0); 124 uio_unregister_device(info); 125 pci_release_regions(dev); 126 pci_disable_device(dev); 127 iounmap(info->mem[0].internal_addr); |
130 131 kfree(info); | |
132} 133 134static struct pci_device_id netx_pci_ids[] = { 135 { 136 .vendor = PCI_VENDOR_ID_HILSCHER, 137 .device = PCI_DEVICE_ID_HILSCHER_NETX, 138 .subvendor = 0, 139 .subdevice = 0, --- 39 unchanged lines hidden --- | 128} 129 130static struct pci_device_id netx_pci_ids[] = { 131 { 132 .vendor = PCI_VENDOR_ID_HILSCHER, 133 .device = PCI_DEVICE_ID_HILSCHER_NETX, 134 .subvendor = 0, 135 .subdevice = 0, --- 39 unchanged lines hidden --- |