summaryrefslogtreecommitdiffstats
path: root/drivers/fpga/altera-cvp.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-12-28 23:54:57 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-12-28 23:54:57 -0500
commit457fa3469a65a524be04412f5cd497fa3b11c9fd (patch)
treee826786d7838668595dfac115ced53b32e5c97b9 /drivers/fpga/altera-cvp.c
parentb07039b79c9ea64c1eacda1e01d645082e4a0d5d (diff)
parentfbc4904c287778ddb74bf6060ac9dec51992fc53 (diff)
Merge tag 'char-misc-4.21-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc driver updates from Greg KH: "Here is the big set of char and misc driver patches for 4.21-rc1. Lots of different types of driver things in here, as this tree seems to be the "collection of various driver subsystems not big enough to have their own git tree" lately. Anyway, some highlights of the changes in here: - binderfs: is it a rule that all driver subsystems will eventually grow to have their own filesystem? Binder now has one to handle the use of it in containerized systems. This was discussed at the Plumbers conference a few months ago and knocked into mergable shape very fast by Christian Brauner. Who also has signed up to be another binder maintainer, showing a distinct lack of good judgement :) - binder updates and fixes - mei driver updates - fpga driver updates and additions - thunderbolt driver updates - soundwire driver updates - extcon driver updates - nvmem driver updates - hyper-v driver updates - coresight driver updates - pvpanic driver additions and reworking for more device support - lp driver updates. Yes really, it's _finally_ moved to the proper parallal port driver model, something I never thought I would see happen. Good stuff. - other tiny driver updates and fixes. All of these have been in linux-next for a while with no reported issues" * tag 'char-misc-4.21-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (116 commits) MAINTAINERS: add another Android binder maintainer intel_th: msu: Fix an off-by-one in attribute store stm class: Add a reference to the SyS-T document stm class: Fix a module refcount leak in policy creation error path char: lp: use new parport device model char: lp: properly count the lp devices char: lp: use first unused lp number while registering char: lp: detach the device when parallel port is removed char: lp: introduce list to save port number bus: qcom: remove duplicated include from qcom-ebi2.c VMCI: Use memdup_user() rather than duplicating its implementation char/rtc: Use of_node_name_eq for node name comparisons misc: mic: fix a DMA pool free failure ptp: fix an IS_ERR() vs NULL check genwqe: Fix size check binder: implement binderfs binder: fix use-after-free due to ksys_close() during fdget() bus: fsl-mc: remove duplicated include files bus: fsl-mc: explicitly define the fsl_mc_command endianness misc: ti-st: make array read_ver_cmd static, shrinks object size ...
Diffstat (limited to 'drivers/fpga/altera-cvp.c')
-rw-r--r--drivers/fpga/altera-cvp.c49
1 files changed, 37 insertions, 12 deletions
diff --git a/drivers/fpga/altera-cvp.c b/drivers/fpga/altera-cvp.c
index 610a1558e0ed..35c3aa5792e2 100644
--- a/drivers/fpga/altera-cvp.c
+++ b/drivers/fpga/altera-cvp.c
@@ -403,6 +403,7 @@ static int altera_cvp_probe(struct pci_dev *pdev,
403 struct altera_cvp_conf *conf; 403 struct altera_cvp_conf *conf;
404 struct fpga_manager *mgr; 404 struct fpga_manager *mgr;
405 u16 cmd, val; 405 u16 cmd, val;
406 u32 regval;
406 int ret; 407 int ret;
407 408
408 /* 409 /*
@@ -416,6 +417,14 @@ static int altera_cvp_probe(struct pci_dev *pdev,
416 return -ENODEV; 417 return -ENODEV;
417 } 418 }
418 419
420 pci_read_config_dword(pdev, VSE_CVP_STATUS, &regval);
421 if (!(regval & VSE_CVP_STATUS_CVP_EN)) {
422 dev_err(&pdev->dev,
423 "CVP is disabled for this device: CVP_STATUS Reg 0x%x\n",
424 regval);
425 return -ENODEV;
426 }
427
419 conf = devm_kzalloc(&pdev->dev, sizeof(*conf), GFP_KERNEL); 428 conf = devm_kzalloc(&pdev->dev, sizeof(*conf), GFP_KERNEL);
420 if (!conf) 429 if (!conf)
421 return -ENOMEM; 430 return -ENOMEM;
@@ -466,18 +475,11 @@ static int altera_cvp_probe(struct pci_dev *pdev,
466 if (ret) 475 if (ret)
467 goto err_unmap; 476 goto err_unmap;
468 477
469 ret = driver_create_file(&altera_cvp_driver.driver,
470 &driver_attr_chkcfg);
471 if (ret) {
472 dev_err(&pdev->dev, "Can't create sysfs chkcfg file\n");
473 fpga_mgr_unregister(mgr);
474 goto err_unmap;
475 }
476
477 return 0; 478 return 0;
478 479
479err_unmap: 480err_unmap:
480 pci_iounmap(pdev, conf->map); 481 if (conf->map)
482 pci_iounmap(pdev, conf->map);
481 pci_release_region(pdev, CVP_BAR); 483 pci_release_region(pdev, CVP_BAR);
482err_disable: 484err_disable:
483 cmd &= ~PCI_COMMAND_MEMORY; 485 cmd &= ~PCI_COMMAND_MEMORY;
@@ -491,16 +493,39 @@ static void altera_cvp_remove(struct pci_dev *pdev)
491 struct altera_cvp_conf *conf = mgr->priv; 493 struct altera_cvp_conf *conf = mgr->priv;
492 u16 cmd; 494 u16 cmd;
493 495
494 driver_remove_file(&altera_cvp_driver.driver, &driver_attr_chkcfg);
495 fpga_mgr_unregister(mgr); 496 fpga_mgr_unregister(mgr);
496 pci_iounmap(pdev, conf->map); 497 if (conf->map)
498 pci_iounmap(pdev, conf->map);
497 pci_release_region(pdev, CVP_BAR); 499 pci_release_region(pdev, CVP_BAR);
498 pci_read_config_word(pdev, PCI_COMMAND, &cmd); 500 pci_read_config_word(pdev, PCI_COMMAND, &cmd);
499 cmd &= ~PCI_COMMAND_MEMORY; 501 cmd &= ~PCI_COMMAND_MEMORY;
500 pci_write_config_word(pdev, PCI_COMMAND, cmd); 502 pci_write_config_word(pdev, PCI_COMMAND, cmd);
501} 503}
502 504
503module_pci_driver(altera_cvp_driver); 505static int __init altera_cvp_init(void)
506{
507 int ret;
508
509 ret = pci_register_driver(&altera_cvp_driver);
510 if (ret)
511 return ret;
512
513 ret = driver_create_file(&altera_cvp_driver.driver,
514 &driver_attr_chkcfg);
515 if (ret)
516 pr_warn("Can't create sysfs chkcfg file\n");
517
518 return 0;
519}
520
521static void __exit altera_cvp_exit(void)
522{
523 driver_remove_file(&altera_cvp_driver.driver, &driver_attr_chkcfg);
524 pci_unregister_driver(&altera_cvp_driver);
525}
526
527module_init(altera_cvp_init);
528module_exit(altera_cvp_exit);
504 529
505MODULE_LICENSE("GPL v2"); 530MODULE_LICENSE("GPL v2");
506MODULE_AUTHOR("Anatolij Gustschin <agust@denx.de>"); 531MODULE_AUTHOR("Anatolij Gustschin <agust@denx.de>");