summaryrefslogtreecommitdiffstats
path: root/drivers/fpga
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-06-08 15:50:36 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-06-08 15:50:36 -0400
commit1ce2c85137b1db5b0e4158d558cb93dcff7674df (patch)
tree37f62adbc031e12747ba71f14b304edb8445fa82 /drivers/fpga
parent902b2edfca34f88b04b86e605087e200e7e79880 (diff)
parente7bf2ce837475445bfd44ac1193ced0684a70d96 (diff)
Merge tag 'char-misc-5.2-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc driver fixes from Greg KH: "Here are some small char and misc driver fixes for 5.2-rc4 to resolve a number of reported issues. The most "notable" one here is the kernel headers in proc^Wsysfs fixes. Those changes move the header file info into sysfs and fixes the build issues that you reported. Other than that, a bunch of small habanalabs driver fixes, some fpga driver fixes, and a few other tiny driver fixes. All of these have been in linux-next for a while with no reported issues" * tag 'char-misc-5.2-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: habanalabs: Read upper bits of trace buffer from RWPHI habanalabs: Fix virtual address access via debugfs for 2MB pages fpga: zynqmp-fpga: Correctly handle error pointer habanalabs: fix bug in checking huge page optimization habanalabs: Avoid using a non-initialized MMU cache mutex habanalabs: fix debugfs code uapi/habanalabs: add opcode for enable/disable device debug mode habanalabs: halt debug engines on user process close test_firmware: Use correct snprintf() limit genwqe: Prevent an integer overflow in the ioctl parport: Fix mem leak in parport_register_dev_model fpga: dfl: expand minor range when registering chrdev region fpga: dfl: Add lockdep classes for pdata->lock fpga: dfl: afu: Pass the correct device to dma_mapping_error() fpga: stratix10-soc: fix use-after-free on s10_init() w1: ds2408: Fix typo after 49695ac46861 (reset on output_write retry with readback) kheaders: Do not regenerate archive if config is not changed kheaders: Move from proc to sysfs lkdtm/bugs: Adjust recursion test to avoid elision lkdtm/usercopy: Moves the KERNEL_DS test to non-canonical
Diffstat (limited to 'drivers/fpga')
-rw-r--r--drivers/fpga/dfl-afu-dma-region.c2
-rw-r--r--drivers/fpga/dfl.c22
-rw-r--r--drivers/fpga/stratix10-soc.c6
-rw-r--r--drivers/fpga/zynqmp-fpga.c4
4 files changed, 26 insertions, 8 deletions
diff --git a/drivers/fpga/dfl-afu-dma-region.c b/drivers/fpga/dfl-afu-dma-region.c
index c438722bf4e1..dcd80b088c7b 100644
--- a/drivers/fpga/dfl-afu-dma-region.c
+++ b/drivers/fpga/dfl-afu-dma-region.c
@@ -399,7 +399,7 @@ int afu_dma_map_region(struct dfl_feature_platform_data *pdata,
399 region->pages[0], 0, 399 region->pages[0], 0,
400 region->length, 400 region->length,
401 DMA_BIDIRECTIONAL); 401 DMA_BIDIRECTIONAL);
402 if (dma_mapping_error(&pdata->dev->dev, region->iova)) { 402 if (dma_mapping_error(dfl_fpga_pdata_to_parent(pdata), region->iova)) {
403 dev_err(&pdata->dev->dev, "failed to map for dma\n"); 403 dev_err(&pdata->dev->dev, "failed to map for dma\n");
404 ret = -EFAULT; 404 ret = -EFAULT;
405 goto unpin_pages; 405 goto unpin_pages;
diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c
index 2c09e502e721..4b66aaa32b5a 100644
--- a/drivers/fpga/dfl.c
+++ b/drivers/fpga/dfl.c
@@ -40,6 +40,13 @@ enum dfl_fpga_devt_type {
40 DFL_FPGA_DEVT_MAX, 40 DFL_FPGA_DEVT_MAX,
41}; 41};
42 42
43static struct lock_class_key dfl_pdata_keys[DFL_ID_MAX];
44
45static const char *dfl_pdata_key_strings[DFL_ID_MAX] = {
46 "dfl-fme-pdata",
47 "dfl-port-pdata",
48};
49
43/** 50/**
44 * dfl_dev_info - dfl feature device information. 51 * dfl_dev_info - dfl feature device information.
45 * @name: name string of the feature platform device. 52 * @name: name string of the feature platform device.
@@ -315,7 +322,7 @@ static void dfl_chardev_uinit(void)
315 for (i = 0; i < DFL_FPGA_DEVT_MAX; i++) 322 for (i = 0; i < DFL_FPGA_DEVT_MAX; i++)
316 if (MAJOR(dfl_chrdevs[i].devt)) { 323 if (MAJOR(dfl_chrdevs[i].devt)) {
317 unregister_chrdev_region(dfl_chrdevs[i].devt, 324 unregister_chrdev_region(dfl_chrdevs[i].devt,
318 MINORMASK); 325 MINORMASK + 1);
319 dfl_chrdevs[i].devt = MKDEV(0, 0); 326 dfl_chrdevs[i].devt = MKDEV(0, 0);
320 } 327 }
321} 328}
@@ -325,8 +332,8 @@ static int dfl_chardev_init(void)
325 int i, ret; 332 int i, ret;
326 333
327 for (i = 0; i < DFL_FPGA_DEVT_MAX; i++) { 334 for (i = 0; i < DFL_FPGA_DEVT_MAX; i++) {
328 ret = alloc_chrdev_region(&dfl_chrdevs[i].devt, 0, MINORMASK, 335 ret = alloc_chrdev_region(&dfl_chrdevs[i].devt, 0,
329 dfl_chrdevs[i].name); 336 MINORMASK + 1, dfl_chrdevs[i].name);
330 if (ret) 337 if (ret)
331 goto exit; 338 goto exit;
332 } 339 }
@@ -443,11 +450,16 @@ static int build_info_commit_dev(struct build_feature_devs_info *binfo)
443 struct platform_device *fdev = binfo->feature_dev; 450 struct platform_device *fdev = binfo->feature_dev;
444 struct dfl_feature_platform_data *pdata; 451 struct dfl_feature_platform_data *pdata;
445 struct dfl_feature_info *finfo, *p; 452 struct dfl_feature_info *finfo, *p;
453 enum dfl_id_type type;
446 int ret, index = 0; 454 int ret, index = 0;
447 455
448 if (!fdev) 456 if (!fdev)
449 return 0; 457 return 0;
450 458
459 type = feature_dev_id_type(fdev);
460 if (WARN_ON_ONCE(type >= DFL_ID_MAX))
461 return -EINVAL;
462
451 /* 463 /*
452 * we do not need to care for the memory which is associated with 464 * we do not need to care for the memory which is associated with
453 * the platform device. After calling platform_device_unregister(), 465 * the platform device. After calling platform_device_unregister(),
@@ -463,6 +475,8 @@ static int build_info_commit_dev(struct build_feature_devs_info *binfo)
463 pdata->num = binfo->feature_num; 475 pdata->num = binfo->feature_num;
464 pdata->dfl_cdev = binfo->cdev; 476 pdata->dfl_cdev = binfo->cdev;
465 mutex_init(&pdata->lock); 477 mutex_init(&pdata->lock);
478 lockdep_set_class_and_name(&pdata->lock, &dfl_pdata_keys[type],
479 dfl_pdata_key_strings[type]);
466 480
467 /* 481 /*
468 * the count should be initialized to 0 to make sure 482 * the count should be initialized to 0 to make sure
@@ -497,7 +511,7 @@ static int build_info_commit_dev(struct build_feature_devs_info *binfo)
497 511
498 ret = platform_device_add(binfo->feature_dev); 512 ret = platform_device_add(binfo->feature_dev);
499 if (!ret) { 513 if (!ret) {
500 if (feature_dev_id_type(binfo->feature_dev) == PORT_ID) 514 if (type == PORT_ID)
501 dfl_fpga_cdev_add_port_dev(binfo->cdev, 515 dfl_fpga_cdev_add_port_dev(binfo->cdev,
502 binfo->feature_dev); 516 binfo->feature_dev);
503 else 517 else
diff --git a/drivers/fpga/stratix10-soc.c b/drivers/fpga/stratix10-soc.c
index 13851b3d1c56..215d33789c74 100644
--- a/drivers/fpga/stratix10-soc.c
+++ b/drivers/fpga/stratix10-soc.c
@@ -507,12 +507,16 @@ static int __init s10_init(void)
507 if (!fw_np) 507 if (!fw_np)
508 return -ENODEV; 508 return -ENODEV;
509 509
510 of_node_get(fw_np);
510 np = of_find_matching_node(fw_np, s10_of_match); 511 np = of_find_matching_node(fw_np, s10_of_match);
511 if (!np) 512 if (!np) {
513 of_node_put(fw_np);
512 return -ENODEV; 514 return -ENODEV;
515 }
513 516
514 of_node_put(np); 517 of_node_put(np);
515 ret = of_platform_populate(fw_np, s10_of_match, NULL, NULL); 518 ret = of_platform_populate(fw_np, s10_of_match, NULL, NULL);
519 of_node_put(fw_np);
516 if (ret) 520 if (ret)
517 return ret; 521 return ret;
518 522
diff --git a/drivers/fpga/zynqmp-fpga.c b/drivers/fpga/zynqmp-fpga.c
index f7cbaadf49ab..b8a88d21d038 100644
--- a/drivers/fpga/zynqmp-fpga.c
+++ b/drivers/fpga/zynqmp-fpga.c
@@ -47,7 +47,7 @@ static int zynqmp_fpga_ops_write(struct fpga_manager *mgr,
47 char *kbuf; 47 char *kbuf;
48 int ret; 48 int ret;
49 49
50 if (!eemi_ops || !eemi_ops->fpga_load) 50 if (IS_ERR_OR_NULL(eemi_ops) || !eemi_ops->fpga_load)
51 return -ENXIO; 51 return -ENXIO;
52 52
53 priv = mgr->priv; 53 priv = mgr->priv;
@@ -81,7 +81,7 @@ static enum fpga_mgr_states zynqmp_fpga_ops_state(struct fpga_manager *mgr)
81 const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops(); 81 const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops();
82 u32 status; 82 u32 status;
83 83
84 if (!eemi_ops || !eemi_ops->fpga_get_status) 84 if (IS_ERR_OR_NULL(eemi_ops) || !eemi_ops->fpga_get_status)
85 return FPGA_MGR_STATE_UNKNOWN; 85 return FPGA_MGR_STATE_UNKNOWN;
86 86
87 eemi_ops->fpga_get_status(&status); 87 eemi_ops->fpga_get_status(&status);