155 .groups = ipath_driver_attr_groups,
156 },
157};
158
159static inline void read_bars(struct ipath_devdata *dd, struct pci_dev *dev,
160 u32 *bar0, u32 *bar1)
161{
162 int ret;
163
164 ret = pci_read_config_dword(dev, PCI_BASE_ADDRESS_0, bar0);
165 if (ret)
166 ipath_dev_err(dd, "failed to read bar0 before enable: "
167 "error %d\n", -ret);
168
169 ret = pci_read_config_dword(dev, PCI_BASE_ADDRESS_1, bar1);
170 if (ret)
171 ipath_dev_err(dd, "failed to read bar1 before enable: "
172 "error %d\n", -ret);
173
174 ipath_dbg("Read bar0 %x bar1 %x\n", *bar0, *bar1);
175}
176
177static void ipath_free_devdata(struct pci_dev *pdev,
178 struct ipath_devdata *dd)
179{
180 unsigned long flags;
181
182 pci_set_drvdata(pdev, NULL);
183
184 if (dd->ipath_unit != -1) {
185 spin_lock_irqsave(&ipath_devs_lock, flags);
186 idr_remove(&unit_table, dd->ipath_unit);
187 list_del(&dd->ipath_list);
188 spin_unlock_irqrestore(&ipath_devs_lock, flags);
189 }
190 vfree(dd);
191}
192
193static struct ipath_devdata *ipath_alloc_devdata(struct pci_dev *pdev)
194{
195 unsigned long flags;