Source
1310
1310
static void remove_sysfs_files(struct nozomi *dc)
1311
1311
{
1312
1312
device_remove_file(&dc->pdev->dev, &dev_attr_card_type);
1313
1313
device_remove_file(&dc->pdev->dev, &dev_attr_open_ttys);
1314
1314
}
1315
1315
1316
1316
/* Allocate memory for one device */
1317
1317
static int nozomi_card_init(struct pci_dev *pdev,
1318
1318
const struct pci_device_id *ent)
1319
1319
{
1320
-
resource_size_t start;
1321
1320
int ret;
1322
1321
struct nozomi *dc = NULL;
1323
1322
int ndev_idx;
1324
1323
int i;
1325
1324
1326
1325
dev_dbg(&pdev->dev, "Init, new card found\n");
1327
1326
1328
1327
for (ndev_idx = 0; ndev_idx < ARRAY_SIZE(ndevs); ndev_idx++)
1329
1328
if (!ndevs[ndev_idx])
1330
1329
break;
1350
1349
goto err_free;
1351
1350
}
1352
1351
1353
1352
ret = pci_request_regions(dc->pdev, NOZOMI_NAME);
1354
1353
if (ret) {
1355
1354
dev_err(&pdev->dev, "I/O address 0x%04x already in use\n",
1356
1355
(int) /* nozomi_private.io_addr */ 0);
1357
1356
goto err_disable_device;
1358
1357
}
1359
1358
1360
-
start = pci_resource_start(dc->pdev, 0);
1361
-
if (start == 0) {
1362
-
dev_err(&pdev->dev, "No I/O address for card detected\n");
1363
-
ret = -ENODEV;
1364
-
goto err_rel_regs;
1365
-
}
1366
-
1367
1359
/* Find out what card type it is */
1368
1360
nozomi_get_card_type(dc);
1369
1361
1370
-
dc->base_addr = ioremap_nocache(start, dc->card_type);
1362
+
dc->base_addr = pci_iomap(dc->pdev, 0, dc->card_type);
1371
1363
if (!dc->base_addr) {
1372
1364
dev_err(&pdev->dev, "Unable to map card MMIO\n");
1373
1365
ret = -ENODEV;
1374
1366
goto err_rel_regs;
1375
1367
}
1376
1368
1377
1369
dc->send_buf = kmalloc(SEND_BUF_MAX, GFP_KERNEL);
1378
1370
if (!dc->send_buf) {
1379
1371
dev_err(&pdev->dev, "Could not allocate send buffer?\n");
1380
1372
ret = -ENOMEM;