diff options
author | Logan Gunthorpe <logang@deltatee.com> | 2017-05-22 17:52:24 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2017-05-22 17:52:24 -0400 |
commit | e40cf640b8f632091a30ef0b030c83546f07c902 (patch) | |
tree | fdad52aeb6845c646f1824c2e2ba859be9557afc /drivers/pci/switch/switchtec.c | |
parent | c849e55178f559c4bbed43efb113cb7602aade89 (diff) |
switchtec: Use new cdev_device_add() helper function
Convert from "cdev_add() + device_add()" to cdev_device_add(), and from
"device_del() + cdev_del()" to cdev_device_del().
[bhelgaas: changelog]
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/switch/switchtec.c')
-rw-r--r-- | drivers/pci/switch/switchtec.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c index cc6e085008fb..abaa227a5f34 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 | ||
@@ -1479,11 +1478,7 @@ static int switchtec_pci_probe(struct pci_dev *pdev, | |||
1479 | SWITCHTEC_EVENT_EN_IRQ, | 1478 | SWITCHTEC_EVENT_EN_IRQ, |
1480 | &stdev->mmio_part_cfg->mrpc_comp_hdr); | 1479 | &stdev->mmio_part_cfg->mrpc_comp_hdr); |
1481 | 1480 | ||
1482 | rc = cdev_add(&stdev->cdev, stdev->dev.devt, 1); | 1481 | 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) | 1482 | if (rc) |
1488 | goto err_devadd; | 1483 | goto err_devadd; |
1489 | 1484 | ||
@@ -1492,7 +1487,6 @@ static int switchtec_pci_probe(struct pci_dev *pdev, | |||
1492 | return 0; | 1487 | return 0; |
1493 | 1488 | ||
1494 | err_devadd: | 1489 | err_devadd: |
1495 | cdev_del(&stdev->cdev); | ||
1496 | stdev_kill(stdev); | 1490 | stdev_kill(stdev); |
1497 | err_put: | 1491 | err_put: |
1498 | ida_simple_remove(&switchtec_minor_ida, MINOR(stdev->dev.devt)); | 1492 | ida_simple_remove(&switchtec_minor_ida, MINOR(stdev->dev.devt)); |
@@ -1506,8 +1500,7 @@ static void switchtec_pci_remove(struct pci_dev *pdev) | |||
1506 | 1500 | ||
1507 | pci_set_drvdata(pdev, NULL); | 1501 | pci_set_drvdata(pdev, NULL); |
1508 | 1502 | ||
1509 | device_del(&stdev->dev); | 1503 | cdev_device_del(&stdev->cdev, &stdev->dev); |
1510 | cdev_del(&stdev->cdev); | ||
1511 | ida_simple_remove(&switchtec_minor_ida, MINOR(stdev->dev.devt)); | 1504 | ida_simple_remove(&switchtec_minor_ida, MINOR(stdev->dev.devt)); |
1512 | dev_info(&stdev->dev, "unregistered.\n"); | 1505 | dev_info(&stdev->dev, "unregistered.\n"); |
1513 | 1506 | ||