diff options
Diffstat (limited to 'drivers/pci/switch/switchtec.c')
-rw-r--r-- | drivers/pci/switch/switchtec.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c index cc6e085008fb..f6a63406c76e 100644 --- a/drivers/pci/switch/switchtec.c +++ b/drivers/pci/switch/switchtec.c | |||
@@ -1291,7 +1291,6 @@ static struct switchtec_dev *stdev_create(struct pci_dev *pdev) | |||
1291 | cdev = &stdev->cdev; | 1291 | cdev = &stdev->cdev; |
1292 | cdev_init(cdev, &switchtec_fops); | 1292 | cdev_init(cdev, &switchtec_fops); |
1293 | cdev->owner = THIS_MODULE; | 1293 | cdev->owner = THIS_MODULE; |
1294 | cdev->kobj.parent = &dev->kobj; | ||
1295 | 1294 | ||
1296 | return stdev; | 1295 | return stdev; |
1297 | 1296 | ||
@@ -1442,12 +1441,15 @@ static int switchtec_init_pci(struct switchtec_dev *stdev, | |||
1442 | stdev->mmio_sys_info = stdev->mmio + SWITCHTEC_GAS_SYS_INFO_OFFSET; | 1441 | stdev->mmio_sys_info = stdev->mmio + SWITCHTEC_GAS_SYS_INFO_OFFSET; |
1443 | stdev->mmio_flash_info = stdev->mmio + SWITCHTEC_GAS_FLASH_INFO_OFFSET; | 1442 | stdev->mmio_flash_info = stdev->mmio + SWITCHTEC_GAS_FLASH_INFO_OFFSET; |
1444 | stdev->mmio_ntb = stdev->mmio + SWITCHTEC_GAS_NTB_OFFSET; | 1443 | stdev->mmio_ntb = stdev->mmio + SWITCHTEC_GAS_NTB_OFFSET; |
1445 | stdev->partition = ioread8(&stdev->mmio_ntb->partition_id); | 1444 | stdev->partition = ioread8(&stdev->mmio_sys_info->partition_id); |
1446 | stdev->partition_count = ioread8(&stdev->mmio_ntb->partition_count); | 1445 | stdev->partition_count = ioread8(&stdev->mmio_ntb->partition_count); |
1447 | stdev->mmio_part_cfg_all = stdev->mmio + SWITCHTEC_GAS_PART_CFG_OFFSET; | 1446 | stdev->mmio_part_cfg_all = stdev->mmio + SWITCHTEC_GAS_PART_CFG_OFFSET; |
1448 | stdev->mmio_part_cfg = &stdev->mmio_part_cfg_all[stdev->partition]; | 1447 | stdev->mmio_part_cfg = &stdev->mmio_part_cfg_all[stdev->partition]; |
1449 | stdev->mmio_pff_csr = stdev->mmio + SWITCHTEC_GAS_PFF_CSR_OFFSET; | 1448 | stdev->mmio_pff_csr = stdev->mmio + SWITCHTEC_GAS_PFF_CSR_OFFSET; |
1450 | 1449 | ||
1450 | if (stdev->partition_count < 1) | ||
1451 | stdev->partition_count = 1; | ||
1452 | |||
1451 | init_pff(stdev); | 1453 | init_pff(stdev); |
1452 | 1454 | ||
1453 | pci_set_drvdata(pdev, stdev); | 1455 | pci_set_drvdata(pdev, stdev); |
@@ -1479,11 +1481,7 @@ static int switchtec_pci_probe(struct pci_dev *pdev, | |||
1479 | SWITCHTEC_EVENT_EN_IRQ, | 1481 | SWITCHTEC_EVENT_EN_IRQ, |
1480 | &stdev->mmio_part_cfg->mrpc_comp_hdr); | 1482 | &stdev->mmio_part_cfg->mrpc_comp_hdr); |
1481 | 1483 | ||
1482 | rc = cdev_add(&stdev->cdev, stdev->dev.devt, 1); | 1484 | rc = cdev_device_add(&stdev->cdev, &stdev->dev); |
1483 | if (rc) | ||
1484 | goto err_put; | ||
1485 | |||
1486 | rc = device_add(&stdev->dev); | ||
1487 | if (rc) | 1485 | if (rc) |
1488 | goto err_devadd; | 1486 | goto err_devadd; |
1489 | 1487 | ||
@@ -1492,7 +1490,6 @@ static int switchtec_pci_probe(struct pci_dev *pdev, | |||
1492 | return 0; | 1490 | return 0; |
1493 | 1491 | ||
1494 | err_devadd: | 1492 | err_devadd: |
1495 | cdev_del(&stdev->cdev); | ||
1496 | stdev_kill(stdev); | 1493 | stdev_kill(stdev); |
1497 | err_put: | 1494 | err_put: |
1498 | ida_simple_remove(&switchtec_minor_ida, MINOR(stdev->dev.devt)); | 1495 | ida_simple_remove(&switchtec_minor_ida, MINOR(stdev->dev.devt)); |
@@ -1506,8 +1503,7 @@ static void switchtec_pci_remove(struct pci_dev *pdev) | |||
1506 | 1503 | ||
1507 | pci_set_drvdata(pdev, NULL); | 1504 | pci_set_drvdata(pdev, NULL); |
1508 | 1505 | ||
1509 | device_del(&stdev->dev); | 1506 | cdev_device_del(&stdev->cdev, &stdev->dev); |
1510 | cdev_del(&stdev->cdev); | ||
1511 | ida_simple_remove(&switchtec_minor_ida, MINOR(stdev->dev.devt)); | 1507 | ida_simple_remove(&switchtec_minor_ida, MINOR(stdev->dev.devt)); |
1512 | dev_info(&stdev->dev, "unregistered.\n"); | 1508 | dev_info(&stdev->dev, "unregistered.\n"); |
1513 | 1509 | ||