driver inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I867RA CVE: NA
----------------------------------------------------------------------
1.Remove unmatched comments. 2.Remove unused struct uacce_err_isolate. 3.Remove unused ops 'dump_queue'. 4.Remove unused function dev_to uacce(). 5.Use jump labels in uacce_alloc_dma_buffers(), remove jump labels in uacce_init().
Signed-off-by: Weili Qian qianweili@huawei.com Signed-off-by: JiangShui Yang yangjiangshui@h-partners.com --- drivers/misc/uacce/uacce.c | 50 +++++++------------------------------- include/linux/uacce.h | 16 ------------ 2 files changed, 9 insertions(+), 57 deletions(-)
diff --git a/drivers/misc/uacce/uacce.c b/drivers/misc/uacce/uacce.c index d00a5d98980e..7bdccfe6f5f9 100644 --- a/drivers/misc/uacce/uacce.c +++ b/drivers/misc/uacce/uacce.c @@ -18,38 +18,6 @@ static struct uacce_qfile_region noiommu_ss_default_qfr = { .type = UACCE_QFRT_SS, };
-static int cdev_get(struct device *dev, void *data) -{ - struct uacce_device *uacce; - struct device **t_dev = data; - - uacce = container_of(dev, struct uacce_device, dev); - if (uacce->parent == *t_dev) { - *t_dev = dev; - return 1; - } - - return 0; -} - -/** - * dev_to_uacce - Get structure uacce device from its parent device - * @dev: the device - */ -struct uacce_device *dev_to_uacce(struct device *dev) -{ - struct device **tdev = &dev; - int ret; - - ret = class_for_each_device(uacce_class, NULL, tdev, cdev_get); - if (ret) { - dev = *tdev; - return container_of(dev, struct uacce_device, dev); - } - return NULL; -} -EXPORT_SYMBOL_GPL(dev_to_uacce); - /* * If the parent driver or the device disappears, the queue state is invalid and * ops are not usable anymore. @@ -544,8 +512,8 @@ static int uacce_alloc_dma_buffers(struct uacce_queue *q, dev_err(pdev, "get dma slice(sz = %lu,slice num = %d) fail!\n", size, i); slice[0].total_num = i; - uacce_free_dma_buffers(q); - return -ENOMEM; + ret = -ENOMEM; + goto free_buffer; } slice[i].size = (size + PAGE_SIZE - 1) & PAGE_MASK; slice[i].total_num = ss_num; @@ -556,11 +524,15 @@ static int uacce_alloc_dma_buffers(struct uacce_queue *q, &slice[ss_num]); if (ret) { dev_err(pdev, "failed to sort dma buffers.\n"); - uacce_free_dma_buffers(q); - return ret; + goto free_buffer; }
return 0; + +free_buffer: + uacce_free_dma_buffers(q); + + return ret; }
static int uacce_mmap_dma_buffers(struct uacce_queue *q, @@ -1099,12 +1071,8 @@ static int __init uacce_init(void)
ret = alloc_chrdev_region(&uacce_devt, 0, MINORMASK, UACCE_NAME); if (ret) - goto destroy_class; + class_destroy(uacce_class);
- return 0; - -destroy_class: - class_destroy(uacce_class); return ret; }
diff --git a/include/linux/uacce.h b/include/linux/uacce.h index 8a4bb77b1bc8..07a96a771da9 100644 --- a/include/linux/uacce.h +++ b/include/linux/uacce.h @@ -17,11 +17,6 @@ struct uacce_queue; struct uacce_device;
-struct uacce_err_isolate { - u32 hw_err_isolate_hz; /* user cfg freq which triggers isolation */ - atomic_t is_isolate; -}; - struct uacce_dma_slice { void *kaddr; /* kernel address for ss */ dma_addr_t dma; /* dma address, if created by dma api */ @@ -52,14 +47,11 @@ struct uacce_qfile_region { * @start_queue: make the queue start work after get_queue * @stop_queue: make the queue stop work before put_queue * @is_q_updated: check whether the task is finished - * @mask_notify: mask the task irq of queue * @mmap: mmap addresses of queue to user space * @ioctl: ioctl for user space users of the queue * @get_isolate_state: get the device state after set the isolate strategy * @isolate_err_threshold_write: stored the isolate error threshold to the device * @isolate_err_threshold_read: read the isolate error threshold value from the device - * @reset: reset the WD device - * @reset_queue: reset the queue */ struct uacce_ops { int (*get_available_instances)(struct uacce_device *uacce); @@ -68,7 +60,6 @@ struct uacce_ops { void (*put_queue)(struct uacce_queue *q); int (*start_queue)(struct uacce_queue *q); void (*stop_queue)(struct uacce_queue *q); - void (*dump_queue)(const struct uacce_queue *q); int (*is_q_updated)(struct uacce_queue *q); int (*mmap)(struct uacce_queue *q, struct vm_area_struct *vma, struct uacce_qfile_region *qfr); @@ -163,7 +154,6 @@ struct uacce_device { struct device dev; struct mutex mutex; void *priv; - struct uacce_err_isolate *isolate; struct list_head queues; };
@@ -173,7 +163,6 @@ struct uacce_device *uacce_alloc(struct device *parent, struct uacce_interface *interface); int uacce_register(struct uacce_device *uacce); void uacce_remove(struct uacce_device *uacce); -struct uacce_device *dev_to_uacce(struct device *dev); void uacce_wake_up(struct uacce_queue *q); #else /* CONFIG_UACCE */
@@ -190,11 +179,6 @@ static inline int uacce_register(struct uacce_device *uacce) }
static inline void uacce_remove(struct uacce_device *uacce) {} - -static inline struct uacce_device *dev_to_uacce(struct device *dev) -{ - return NULL; -} static inline void uacce_wake_up(struct uacce_queue *q) {} #endif /* CONFIG_UACCE */