[RAMEN9610-12171] ion: attach prefix [Exynos][ION] to all error logs
authorhyesoo.yu <hyesoo.yu@samsung.com>
Mon, 6 Aug 2018 08:01:32 +0000 (17:01 +0900)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:23:16 +0000 (20:23 +0300)
Introducing four printk helper for ION driver
- perr: print logs in error level.
- perrfn: print logs with current function name.
- perrdev: print logs with devce name.
- perrfndev: print logs with current function name and device name.

All above macros attaches newline after the log.

Change-Id: Iabd441ff7b5b808baa832ec6ecf826b0e93e9a43
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
13 files changed:
drivers/staging/android/ion/ion-ioctl.c
drivers/staging/android/ion/ion.c
drivers/staging/android/ion/ion.h
drivers/staging/android/ion/ion_buffer_protect.c
drivers/staging/android/ion/ion_carveout_heap.c
drivers/staging/android/ion/ion_cma_heap.c
drivers/staging/android/ion/ion_debug.c
drivers/staging/android/ion/ion_exynos.c
drivers/staging/android/ion/ion_fdt_exynos.c
drivers/staging/android/ion/ion_heap.c
drivers/staging/android/ion/ion_page_pool.c
drivers/staging/android/ion/ion_system_heap.c
drivers/staging/android/ion/ion_test.c

index 52063f91df0572a98510da5cc7cbe79aa555d829..5c34a2be6891d0dec91c3f09dbf0d15bafea5c8f 100644 (file)
@@ -51,8 +51,7 @@ static int validate_ioctl_arg(unsigned int cmd, union ion_ioctl_arg *arg)
        }
 
        if (ret) {
-               pr_err("%s: reserved fields of query_data should be 0\n",
-                      __func__);
+               perrfn("reserved fields of query_data should be 0");
                return -EINVAL;
        }
 
@@ -77,7 +76,7 @@ long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
        dir = ion_ioctl_dir(cmd);
 
        if (_IOC_SIZE(cmd) > sizeof(data)) {
-               pr_err("%s: unknown ioctl %#x\n", __func__, cmd);
+               perrfn("unknown ioctl %#x", cmd);
                return -EINVAL;
        }
 
@@ -118,7 +117,7 @@ long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
                break;
        default:
                if (cmd != ION_IOC_FREE)
-                       pr_err("%s: unknown ioctl %#x\n", __func__, cmd);
+                       perrfn("unknown ioctl %#x", cmd);
                return -ENOTTY;
        }
 
index 000c999aea7ca1d31bddcfaa320cdff931e3595d..134932e202e0e4cfc332420771736e4619a6c3eb 100644 (file)
@@ -66,7 +66,7 @@ static void ion_buffer_add(struct ion_device *dev,
                } else if (buffer > entry) {
                        p = &(*p)->rb_right;
                } else {
-                       pr_err("%s: buffer already found.", __func__);
+                       perrfn("buffer already found.");
                        BUG();
                }
        }
@@ -127,8 +127,8 @@ err1:
        heap->ops->free(buffer);
 err2:
        kfree(buffer);
-       pr_err("%s: failed to alloc (len %zu, flag %#lx) buffer from %s heap\n",
-              __func__, len, flags, heap->name);
+       perrfn("failed to alloc (len %zu, flag %#lx) buffer from %s heap",
+              len, flags, heap->name);
        return ERR_PTR(ret);
 }
 
@@ -175,8 +175,8 @@ void *ion_buffer_kmap_get(struct ion_buffer *buffer)
                      "heap->ops->map_kernel should return ERR_PTR on error"))
                return ERR_PTR(-EINVAL);
        if (IS_ERR(vaddr)) {
-               pr_err("%s: failed to alloc kernel address of %zu buffer\n",
-                      __func__, buffer->size);
+               perrfn("failed to alloc kernel address of %zu buffer",
+                      buffer->size);
                return vaddr;
        }
        buffer->vaddr = vaddr;
@@ -283,20 +283,17 @@ static int ion_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma)
        int ret = 0;
 
        if (!buffer->heap->ops->map_user) {
-               pr_err("%s: this heap does not define a method for mapping to userspace\n",
-                      __func__);
+               perrfn("this heap does not define a method for mapping to userspace");
                return -EINVAL;
        }
 
        if ((buffer->flags & ION_FLAG_NOZEROED) != 0) {
-               pr_err("%s: mmap() to nozeroed buffer is not allowed\n",
-                      __func__);
+               perrfn("mmap() to nozeroed buffer is not allowed");
                return -EACCES;
        }
 
        if ((buffer->flags & ION_FLAG_PROTECTED) != 0) {
-               pr_err("%s: mmap() to protected buffer is not allowed\n",
-                      __func__);
+               perrfn("mmap() to protected buffer is not allowed");
                return -EACCES;
        }
 
@@ -309,8 +306,7 @@ static int ion_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma)
        mutex_unlock(&buffer->lock);
 
        if (ret)
-               pr_err("%s: failure mapping buffer to userspace\n",
-                      __func__);
+               perrfn("failure mapping buffer to userspace");
 
        return ret;
 }
@@ -464,8 +460,8 @@ struct dma_buf *__ion_alloc(size_t len, unsigned int heap_id_mask,
        len = PAGE_ALIGN(len);
 
        if (!len) {
-               pr_err("%s: zero size allocation - heapmask %#x, flags %#x\n",
-                      __func__, heap_id_mask, flags);
+               perrfn("zero size allocation - heapmask %#x, flags %#x",
+                      heap_id_mask, flags);
                return ERR_PTR(-EINVAL);
        }
 
@@ -481,8 +477,7 @@ struct dma_buf *__ion_alloc(size_t len, unsigned int heap_id_mask,
        up_read(&dev->lock);
 
        if (!buffer) {
-               pr_err("%s: no matching heap found against heapmaks %#x\n",
-                      __func__, heap_id_mask);
+               perrfn("no matching heap found against heapmaks %#x", heap_id_mask);
                return ERR_PTR(-ENODEV);
        }
 
@@ -499,8 +494,7 @@ struct dma_buf *__ion_alloc(size_t len, unsigned int heap_id_mask,
 
        dmabuf = dma_buf_export(&exp_info);
        if (IS_ERR(dmabuf)) {
-               pr_err("%s: failed to export dmabuf (err %ld)\n", __func__,
-                      -PTR_ERR(dmabuf));
+               perrfn("failed to export dmabuf (err %ld)", -PTR_ERR(dmabuf));
                _ion_buffer_destroy(buffer);
        }
 
@@ -517,7 +511,7 @@ int ion_alloc(size_t len, unsigned int heap_id_mask, unsigned int flags)
 
        fd = dma_buf_fd(dmabuf, O_CLOEXEC);
        if (fd < 0) {
-               pr_err("%s: failed to get dmabuf fd (err %d)\n", __func__, -fd);
+               perrfn("failed to get dmabuf fd (err %d)",  -fd);
                dma_buf_put(dmabuf);
        }
 
@@ -540,7 +534,7 @@ int ion_query_heaps(struct ion_heap_query *query)
        }
 
        if (query->cnt <= 0) {
-               pr_err("%s: invalid heapdata count %u\n", __func__, query->cnt);
+               perrfn("invalid heapdata count %u",  query->cnt);
                goto out;
        }
 
@@ -641,8 +635,7 @@ void ion_device_add_heap(struct ion_heap *heap)
        struct ion_device *dev = internal_dev;
 
        if (!heap->ops->allocate || !heap->ops->free)
-               pr_err("%s: can not add heap with invalid ops struct.\n",
-                      __func__);
+               perrfn("can not add heap with invalid ops struct.");
 
        spin_lock_init(&heap->free_lock);
        heap->free_list_size = 0;
@@ -674,8 +667,8 @@ void ion_device_add_heap(struct ion_heap *heap)
                        char buf[256], *path;
 
                        path = dentry_path(dev->debug_root, buf, 256);
-                       pr_err("Failed to create heap shrinker debugfs at %s/%s\n",
-                              path, debug_name);
+                       perr("Failed to create heap shrinker debugfs at %s/%s",
+                            path, debug_name);
                }
        }
 
@@ -699,14 +692,14 @@ static int ion_device_create(void)
        idev->dev.parent = NULL;
        ret = misc_register(&idev->dev);
        if (ret) {
-               pr_err("ion: failed to register misc device.\n");
+               perr("ion: failed to register misc device.");
                kfree(idev);
                return ret;
        }
 
        idev->debug_root = debugfs_create_dir("ion", NULL);
        if (!idev->debug_root) {
-               pr_err("ion: failed to create debugfs root directory.\n");
+               perr("ion: failed to create debugfs root directory.");
                goto debugfs_done;
        }
 
index f439413a80ec5d7e9ffbc67ed0c1b48139afea8d..aa5440cefd716647b14c3f8ea18341a8e7546d51 100644 (file)
@@ -370,4 +370,17 @@ void ion_contig_heap_show_buffers(struct ion_heap *heap,
 void *ion_buffer_kmap_get(struct ion_buffer *buffer);
 void ion_buffer_kmap_put(struct ion_buffer *buffer);
 
+#define IONPREFIX "[Exynos][ION] "
+#define perr(format, arg...) \
+       pr_err(IONPREFIX format "\n", ##arg)
+
+#define perrfn(format, arg...) \
+       pr_err(IONPREFIX "%s: " format "\n", __func__, ##arg)
+
+#define perrdev(dev, format, arg...) \
+       dev_err(dev, IONPREFIX format "\n", ##arg)
+
+#define perrfndev(dev, format, arg...) \
+       dev_err(dev, IONPREFIX "%s: " format "\n", __func__, ##arg)
+
 #endif /* _ION_H */
index 22c0d46ab301af483e2b337dede23051619ca7ef..c7787faaac3bc95d567c36028f5af8c5fbeea22a 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <asm/cacheflush.h>
 
+#include "ion.h"
 #include "ion_exynos.h"
 
 #ifdef CONFIG_EXYNOS_CONTENT_PATH_PROTECTION
@@ -52,7 +53,7 @@ static int ion_secure_iova_alloc(unsigned long *addr, unsigned long size,
        unsigned long out_addr;
 
        if (!secure_iova_pool) {
-               pr_err("%s: Secure IOVA pool is not created\n", __func__);
+               perrfn("Secure IOVA pool is not created");
                return -ENODEV;
        }
 
@@ -68,8 +69,8 @@ static int ion_secure_iova_alloc(unsigned long *addr, unsigned long size,
        spin_unlock(&siova_pool_lock);
 
        if (out_addr == 0) {
-               pr_err("%s: failed alloc secure iova. %zu/%zu bytes used\n",
-                      __func__, gen_pool_avail(secure_iova_pool),
+               perrfn("failed alloc secure iova. %zu/%zu bytes used",
+                      gen_pool_avail(secure_iova_pool),
                       gen_pool_size(secure_iova_pool));
                return -ENOMEM;
        }
@@ -82,7 +83,7 @@ static int ion_secure_iova_alloc(unsigned long *addr, unsigned long size,
 void ion_secure_iova_free(unsigned long addr, unsigned long size)
 {
        if (!secure_iova_pool) {
-               pr_err("%s: Secure IOVA pool is not created\n", __func__);
+               perrfn("Secure IOVA pool is not created");
                return;
        }
 
@@ -95,14 +96,13 @@ int __init ion_secure_iova_pool_create(void)
 {
        secure_iova_pool = gen_pool_create(PAGE_SHIFT, -1);
        if (!secure_iova_pool) {
-               pr_err("%s: failed to create Secure IOVA pool\n", __func__);
+               perrfn("failed to create Secure IOVA pool");
                return -ENOMEM;
        }
 
        if (gen_pool_add(secure_iova_pool, ION_SECURE_DMA_BASE,
                         ION_SECURE_DMA_END - ION_SECURE_DMA_BASE, -1)) {
-               pr_err("%s: failed to set address range of Secure IOVA pool\n",
-                      __func__);
+               perrfn("failed to set address range of Secure IOVA pool");
                return -ENOMEM;
        }
 
@@ -139,8 +139,8 @@ static int ion_secure_protect(struct ion_buffer_prot_info *protdesc,
 err_smc:
        ion_secure_iova_free(dma_addr, size);
 err_iova:
-       pr_err("%s: PROT:%#x (err=%d,va=%#lx,len=%#lx,cnt=%u,flg=%u)\n",
-              __func__, SMC_DRM_PPMP_PROT, drmret, dma_addr, size,
+       perrfn("PROT:%#x (err=%d,va=%#lx,len=%#lx,cnt=%u,flg=%u)",
+              SMC_DRM_PPMP_PROT, drmret, dma_addr, size,
               protdesc->chunk_count, protdesc->flags);
 
        return ret;
@@ -159,8 +159,8 @@ static int ion_secure_unprotect(struct ion_buffer_prot_info *protdesc)
        ion_secure_iova_free(protdesc->dma_addr, size);
 
        if (ret != DRMDRV_OK) {
-               pr_err("%s: UNPROT:%d(err=%d,va=%#x,len=%#lx,cnt=%u,flg=%u)\n",
-                      __func__, SMC_DRM_PPMP_UNPROT, ret, protdesc->dma_addr,
+               perrfn("UNPROT:%d(err=%d,va=%#x,len=%#lx,cnt=%u,flg=%u)",
+                      SMC_DRM_PPMP_UNPROT, ret, protdesc->dma_addr,
                       size, protdesc->chunk_count, protdesc->flags);
                return -EACCES;
        }
@@ -203,8 +203,8 @@ void *ion_buffer_protect_single(unsigned int protection_id, unsigned int size,
 
        ret = ion_secure_protect(protdesc, protalign);
        if (ret) {
-               pr_err("%s: protection failure (id%u,len%u,base%#lx,align%#x\n",
-                      __func__, protection_id, size, phys, protalign);
+               perrfn("protection failure (id%u,len%u,base%#lx,align%#x",
+                      protection_id, size, phys, protalign);
                kfree(protdesc);
                return ERR_PTR(ret);
        }
@@ -243,8 +243,8 @@ void *ion_buffer_protect_multi(unsigned int protection_id, unsigned int count,
 
        ret = ion_secure_protect(protdesc, protalign);
        if (ret) {
-               pr_err("%s: protection failure (id%u,chk%u,count%u,align%#x\n",
-                      __func__, protection_id, chunk_size, count, protalign);
+               perrfn("protection failure (id%u,chk%u,count%u,align%#x",
+                      protection_id, chunk_size, count, protalign);
                kfree(protdesc);
                return ERR_PTR(ret);
        }
index 0785d2db9720522feb184eebbfdf9873f9926835..90e4988eec1a1c744ca3209995d6be5893b07582 100644 (file)
@@ -74,8 +74,8 @@ static int ion_carveout_heap_allocate(struct ion_heap *heap,
        int ret;
 
        if (carveout_heap->untouchable && !(flags & ION_FLAG_PROTECTED)) {
-               pr_err("%s: ION_FLAG_PROTECTED needed by untouchable heap %s\n",
-                      __func__, heap->name);
+               perrfn("ION_FLAG_PROTECTED needed by untouchable heap %s",
+                      heap->name);
                return -EACCES;
        }
 
@@ -84,15 +84,14 @@ static int ion_carveout_heap_allocate(struct ion_heap *heap,
                return -ENOMEM;
        ret = sg_alloc_table(table, 1, GFP_KERNEL);
        if (ret) {
-               pr_err("%s: failed to allocate scatterlist (err %d)\n",
-                      __func__, ret);
+               perrfn("failed to allocate scatterlist (err %d)", ret);
                goto err_free;
        }
 
        paddr = ion_carveout_allocate(carveout_heap, aligned_size);
        if (paddr == ION_CARVEOUT_ALLOCATE_FAIL) {
-               pr_err("%s: failed to allocate from %s(id %d), size %lu\n",
-                      __func__, heap->name, heap->id, size);
+               perrfn("failed to allocate from %s(id %d), size %lu",
+                      heap->name, heap->id, size);
                ret = -ENOMEM;
                goto err_free_table;
        }
@@ -154,7 +153,7 @@ static int carveout_heap_map_user(struct ion_heap *heap,
                container_of(heap, struct ion_carveout_heap, heap);
 
        if (carveout_heap->untouchable) {
-               pr_err("%s: mmap of %s heap unallowed\n", __func__, heap->name);
+               perrfn("mmap of %s heap unallowed", heap->name);
                return -EACCES;
        }
 
@@ -168,7 +167,7 @@ static void *carveout_heap_map_kernel(struct ion_heap *heap,
                container_of(heap, struct ion_carveout_heap, heap);
 
        if (carveout_heap->untouchable) {
-               pr_err("%s: mapping %s heap unallowed\n", __func__, heap->name);
+               perrfn("mapping %s heap unallowed", heap->name);
                return ERR_PTR(-EACCES);
        }
 
index 699194bf30a3bcda0255240cbc537122b48a1404..96020b97cfb052f9f05aadbcc25cdf26650f89bd 100644 (file)
@@ -56,8 +56,8 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
 
        pages = cma_alloc(cma_heap->cma, nr_pages, align, GFP_KERNEL);
        if (!pages) {
-               pr_err("%s: failed to allocate from %s(id %d), size %lu\n",
-                      __func__, cma_heap->heap.name, cma_heap->heap.id, len);
+               perrfn("failed to allocate from %s(id %d), size %lu",
+                      cma_heap->heap.name, cma_heap->heap.id, len);
                goto err;
        }
 
@@ -85,7 +85,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
 
        ret = sg_alloc_table(table, 1, GFP_KERNEL);
        if (ret) {
-               pr_err("%s: failed to alloc sgtable(err %d)\n", __func__, -ret);
+               perrfn("failed to alloc sgtable(err %d)", -ret);
                goto free_mem;
        }
 
index 7141c54bd7b5cc17e16668e6b880ce5927507e30..71562ba956987ac3b39815172184186738bc9977 100644 (file)
@@ -196,7 +196,7 @@ void ion_debug_initialize(struct ion_device *idev)
        buffer_file = debugfs_create_file("buffers", 0444, idev->debug_root,
                                          idev, &debug_buffers_fops);
        if (!buffer_file)
-               pr_err("%s: failed to create debugfs/ion/buffers\n", __func__);
+               perrfn("failed to create debugfs/ion/buffers");
 
        ion_oom_notifier.idev = idev;
        register_oom_notifier(&ion_oom_notifier.nb);
index bd58dd202ea55a0c5ead775262a1b99e988b0313..4bab048f03181dcc5865809035bcf4299b48bac7 100644 (file)
@@ -28,7 +28,7 @@ struct dma_buf *ion_alloc_dmabuf(const char *heap_name,
        struct ion_heap *heap = ion_get_heap_by_name(heap_name);
 
        if (!heap) {
-               pr_err("%s: heap '%s' is not found\n", __func__, heap_name);
+               perrfn("heap '%s' is not found", heap_name);
                return ERR_PTR(-EINVAL);
        }
 
@@ -64,8 +64,7 @@ static struct ion_iovm_map *ion_buffer_iova_create(struct ion_buffer *buffer,
                int ret = (int)iovm_map->iova;
 
                kfree(iovm_map);
-               dev_err(dev, "%s: failed to allocate iova (err %d)\n",
-                       __func__, ret);
+               perrfndev(dev, "failed to allocate iova (err %d)", ret);
                return ERR_PTR(ret);
        }
 
@@ -97,7 +96,7 @@ dma_addr_t ion_iovmm_map(struct dma_buf_attachment *attachment,
 
        domain = get_domain_from_dev(attachment->dev);
        if (!domain) {
-               dev_err(attachment->dev, "%s: no iommu domain\n", __func__);
+               perrfndev(attachment->dev, "no iommu domain");
                return -EINVAL;
        }
 
@@ -150,7 +149,7 @@ void ion_iovmm_unmap(struct dma_buf_attachment *attachment, dma_addr_t iova)
 
        domain = get_domain_from_dev(attachment->dev);
        if (!domain) {
-               dev_err(attachment->dev, "%s: no iommu domain\n", __func__);
+               perrfndev(attachment->dev, "no iommu domain");
                return;
        }
 
@@ -216,8 +215,8 @@ int exynos_ion_alloc_fixup(struct ion_device *idev, struct ion_buffer *buffer)
                                 table->orig_nents, DMA_TO_DEVICE,
                                 DMA_ATTR_SKIP_CPU_SYNC);
        if (nents < table->orig_nents) {
-               pr_err("%s: failed dma_map_sg(nents %d)=nents %d\n",
-                      __func__, table->orig_nents, nents);
+               perrfn("failed dma_map_sg(nents %d)=nents %d",
+                      table->orig_nents, nents);
                if (id < MAX_BUFFER_IDS)
                        ida_simple_remove(&ion_buffer_ida, id);
                return -ENOMEM;
index 949705df119b3edea2a4d6d203b42f20c0dea40e..5ae79fa2aab1dcb284b927335c2b6298e7f1680b 100644 (file)
@@ -61,21 +61,18 @@ static int __init exynos_ion_reserved_mem_setup(struct reserved_mem *rmem)
 
        prop = of_get_flat_dt_prop(rmem->fdt_node, "ion,heapname", &len);
        if (!prop) {
-               pr_err("%s: 'ion,heapname' is missing in '%s' node\n",
-                      __func__, rmem->name);
+               perrfn("'ion,heapname' is missing in '%s' node", rmem->name);
                return -EINVAL;
        }
        heapname = (char *)prop;
 
        if (reserved_mem_count == ARRAY_SIZE(ion_reserved_mem)) {
-               pr_err("%s: Not enough reserved_mem slot for %s\n",
-                      __func__, rmem->name);
+               perrfn("Not enough reserved_mem slot for %s", rmem->name);
                return -ENOMEM;
        }
 
        if (untch && reusable) {
-               pr_err("%s: 'reusable', 'untouchable' should not be together\n",
-                      __func__);
+               perrfn("'reusable', 'untouchable' should not be together");
                return -EINVAL;
        }
 
@@ -86,8 +83,7 @@ static int __init exynos_ion_reserved_mem_setup(struct reserved_mem *rmem)
                ret = cma_init_reserved_mem(rmem->base, rmem->size, 0,
                                            heapname, &cma);
                if (ret < 0) {
-                       pr_err("%s: failed to init cma for '%s'\n",
-                              __func__, heapname);
+                       perrfn("failed to init cma for '%s'", heapname);
                        return ret;
                }
 
@@ -123,8 +119,7 @@ static bool __init register_hpa_heap(struct device_node *np,
        u32 align;
 
        if (of_property_read_string(np, "ion,heapname", &pheap.name)) {
-               pr_err("%s: failed to read ion,heapname in '%s'\n",
-                      __func__, np->name);
+               perrfn("failed to read ion,heapname in '%s'", np->name);
                return false;
        }
 
@@ -132,20 +127,19 @@ static bool __init register_hpa_heap(struct device_node *np,
 
        if (pheap.secure) {
                if (of_property_read_u32(np, "ion,protection_id", &pheap.id)) {
-                       pr_err("%s: failed to read ion,protection_id in '%s'\n",
-                              __func__, np->name);
+                       perrfn("failed to read ion,protection_id in '%s'", np->name);
                        return false;
                }
 
                if (pheap.id > 32) {
-                       pr_err("%s: too large protection id %d of '%s'\n",
-                              __func__, pheap.id, pheap.name);
+                       perrfn("too large protection id %d of '%s'",
+                              pheap.id, pheap.name);
                        return false;
                }
 
                if ((1 << pheap.id) & prot_id_map) {
-                       pr_err("%s: protection_id %d in '%s' already exists\n",
-                              __func__, pheap.id, np->name);
+                       perrfn("protection_id %d in '%s' already exists",
+                              pheap.id, np->name);
                        return false;
                }
        }
@@ -159,8 +153,8 @@ static bool __init register_hpa_heap(struct device_node *np,
        heap = ion_hpa_heap_create(&pheap, hpa_alloc_exceptions,
                                   hpa_num_exception_areas);
        if (IS_ERR(heap)) {
-               pr_err("%s: failed to register '%s' heap\n",
-                      __func__, pheap.name);
+               perrfn("failed to register '%s' heap",
+                      pheap.name);
                return false;
        }
 
@@ -242,14 +236,14 @@ static int __init exynos_ion_register_heaps(void)
                pheap.untouchable = ion_reserved_mem[i].untouchable;
 
                if (pheap.id > 32) {
-                       pr_err("%s: too large protection id %d of '%s'\n",
-                              __func__, pheap.id, pheap.name);
+                       perrfn("too large protection id %d of '%s'",
+                              pheap.id, pheap.name);
                        continue;
                }
 
                if (pheap.secure && ((1 << pheap.id) & prot_id_map)) {
-                       pr_err("%s: protection id %d of '%s' already exists\n",
-                              __func__, pheap.id, pheap.name);
+                       perrfn("protection id %d of '%s' already exists",
+                              pheap.id, pheap.name);
                        continue;
                }
 
@@ -263,8 +257,7 @@ static int __init exynos_ion_register_heaps(void)
                }
 
                if (IS_ERR(heap)) {
-                       pr_err("%s: failed to register '%s' heap\n",
-                              __func__, pheap.name);
+                       perrfn("failed to register '%s' heap", pheap.name);
                        continue;
                }
 
index 6ea13e9210e71449655fd1b7e4066cca0b1ab8e9..d37bebe3c4c3f30481d074961ebd507986a05f7e 100644 (file)
@@ -57,7 +57,7 @@ void *ion_heap_map_kernel(struct ion_heap *heap,
        vfree(pages);
 
        if (!vaddr) {
-               pr_err("%s: failed vmap %d pages\n", __func__, npages);
+               perrfn("failed vmap %d pages", npages);
                return ERR_PTR(-ENOMEM);
        }
 
@@ -259,8 +259,7 @@ int ion_heap_init_deferred_free(struct ion_heap *heap)
        heap->task = kthread_run(ion_heap_deferred_free, heap,
                                 "%s", heap->name);
        if (IS_ERR(heap->task)) {
-               pr_err("%s: creating thread for deferred free failed\n",
-                      __func__);
+               perrfn("creating thread for deferred free failed");
                return PTR_ERR_OR_ZERO(heap->task);
        }
        sched_setscheduler(heap->task, SCHED_IDLE, &param);
index 68e7efd3717d0bceba7edb6eda4e48741d015bec..311f9d0b38d459703d98009dc23c8ecdcad4772f 100644 (file)
@@ -38,8 +38,7 @@ static void *ion_page_pool_alloc_pages(struct ion_page_pool *pool, bool nozero)
        page = alloc_pages(gfpmask, pool->order);
        if (!page) {
                if (pool->order == 0)
-                       pr_err("%s: failed to alloc order-0 page (gfp %pGg)\n",
-                              __func__, &gfpmask);
+                       perrfn("failed to alloc order-0 page (gfp %pGg)", &gfpmask);
                return NULL;
        }
        return page;
index 79bd8d5294348ec5d3ff2bfa86ce3fee93070196..44e11f4d687c732df6b86eefe37d007912d334a7 100644 (file)
@@ -142,7 +142,7 @@ static int ion_system_heap_allocate(struct ion_heap *heap,
        unsigned int max_order = orders[0];
 
        if (size / PAGE_SIZE > totalram_pages / 2) {
-               pr_err("%s: too large allocation, %zu bytes\n", __func__, size);
+               perrfn("too large allocation, %zu bytes", size);
                return -ENOMEM;
        }
 
@@ -162,7 +162,7 @@ static int ion_system_heap_allocate(struct ion_heap *heap,
                goto free_pages;
 
        if (sg_alloc_table(table, i, GFP_KERNEL)) {
-               pr_err("%s: failed to alloc sgtable of %d nent\n", __func__, i);
+               perrfn("failed to alloc sgtable of %d nent", i);
                goto free_table;
        }
 
index 14201300dbd0980429ee64a05fb1621ceb06c525..17af8b4a591742e799a6913c5292ea1ec9e19546 100644 (file)
@@ -55,15 +55,15 @@ static int ion_handle_test_dma(struct device *dev, struct dma_buf *dma_buf,
 
        attach = dma_buf_attach(dma_buf, dev);
        if (IS_ERR(attach)) {
-               dev_err(dev, "%s: failed to attach dmabuf (err %ld)\n",
-                       __func__, PTR_ERR(attach));
+               perrfndev(dev, "failed to attach dmabuf (err %ld)",
+                         PTR_ERR(attach));
                return PTR_ERR(attach);
        }
 
        table = dma_buf_map_attachment(attach, dir);
        if (IS_ERR(table)) {
-               dev_err(dev, "%s: failed to map dmabuf (err %ld)\n",
-                       __func__, PTR_ERR(table));
+               perrfndev(dev, "failed to map dmabuf (err %ld)",
+                         PTR_ERR(table));
                return PTR_ERR(table);
        }
 
@@ -160,19 +160,19 @@ static int ion_handle_test_phys(struct ion_test_data *test_data,
        int i;
 
        if (!test_data->dma_buf) {
-               pr_err("%s: no dmabuf is attached\n", __func__);
+               perrfn("no dmabuf is attached");
                return -EINVAL;
        }
 
        att = dma_buf_attach(test_data->dma_buf, test_data->dev);
        if (IS_ERR(att)) {
-               pr_err("%s: Failed to attach dmabuf\n", __func__);
+               perrfn("Failed to attach dmabuf");
                return PTR_ERR(att);
        }
 
        sgt = dma_buf_map_attachment(att, DMA_TO_DEVICE);
        if (IS_ERR(sgt)) {
-               pr_err("%s: Failed to map to attachment\n", __func__);
+               perrfn("Failed to map to attachment");
                ret = PTR_ERR(sgt);
                goto err_map;
        }
@@ -184,9 +184,8 @@ static int ion_handle_test_phys(struct ion_test_data *test_data,
 
                for_each_sg(sgt->sgl, sg, sgt->orig_nents, i) {
                        if (len != sg->length) {
-                               pr_err(
-                               "%s: expected size %zu but found %u at %d\n",
-                               __func__, len, sg->length, i);
+                               perrfn("expected size %zu but found %u at %d",
+                                      len, sg->length, i);
                                ret = -EINVAL;
                                break;
                        }
@@ -199,8 +198,7 @@ static int ion_handle_test_phys(struct ion_test_data *test_data,
 
                for_each_sg(sgt->sgl, sg, sgt->orig_nents, i) {
                        if (addr >= sg_phys(sg)) {
-                               pr_err("%s: pages are not in address order\n",
-                                      __func__);
+                               perrfn("pages are not in address order");
                                ret = -EINVAL;
                                break;
                        }
@@ -211,15 +209,13 @@ static int ion_handle_test_phys(struct ion_test_data *test_data,
        case PHYS_IS_RESERVED:
        {
                if (sgt->orig_nents != 1) {
-                       pr_err("%s: buffer should be physically contiguous\n",
-                              __func__);
+                       perrfn("buffer should be physically contiguous");
                        ret = -EINVAL;
                        break;
                }
 
                if (!PageReserved(sg_page(sgt->sgl))) {
-                       pr_err("%s: page of the buffer is not reserved\n",
-                              __func__);
+                       perrfn("page of the buffer is not reserved");
                        ret = -EINVAL;
                        break;
                }
@@ -229,15 +225,13 @@ static int ion_handle_test_phys(struct ion_test_data *test_data,
        case PHYS_IS_CMA:
        {
                if (sgt->orig_nents != 1) {
-                       pr_err("%s: buffer should be physically contiguous\n",
-                              __func__);
+                       perrfn("buffer should be physically contiguous");
                        ret = -EINVAL;
                        break;
                }
 
                if (!is_migrate_cma_page(sg_page(sgt->sgl))) {
-                       pr_err("%s: page of the buffer is not cma page\n",
-                              __func__);
+                       perrfn("page of the buffer is not cma page");
                        ret = -EINVAL;
                        break;
                }
@@ -247,31 +241,26 @@ static int ion_handle_test_phys(struct ion_test_data *test_data,
        case PHYS_IS_ALIGNED:
        {
                if (sgt->orig_nents != 1) {
-                       pr_err("%s: buffer should be physically contiguous\n",
-                              __func__);
+                       perrfn("buffer should be physically contiguous");
                        ret = -EINVAL;
                        break;
                }
 
                if ((arg & ~arg) != 0) {
-                       pr_err(
-                       "%s: arg %u of PHYS_IS_ALIGNED is not power of 2\n",
-                       __func__, arg);
+                       perrfn("arg %u of PHYS_IS_ALIGNED is not power of 2", arg);
                        ret = -EINVAL;
                        break;
                }
 
                if (!IS_ALIGNED(sg_phys(sgt->sgl), arg)) {
-                       pr_err("%s: buffer is not aligned by %u\n",
-                              __func__, arg);
+                       perrfn("buffer is not aligned by %u", arg);
                        ret = -EINVAL;
                        break;
                }
                break;
        }
        default:
-               pr_err("%s: unknown command %u to ION_IOC_TEST_PHYS\n",
-                      __func__, cmd);
+               perrfn("unknown command %u to ION_IOC_TEST_PHYS", cmd);
                ret = -EINVAL;
                break;
        }
@@ -403,7 +392,7 @@ static int __init ion_test_probe(struct platform_device *pdev)
        testdev->misc.parent = &pdev->dev;
        ret = misc_register(&testdev->misc);
        if (ret) {
-               pr_err("failed to register misc device.\n");
+               perr("failed to register misc device.");
                return ret;
        }