All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/7] Fix checkpatch issues
@ 2017-10-01 21:34 Georgiana Chelu
  2017-10-01 21:34 ` [PATCH v3 1/7] Staging: media: atomisp: Remove useless 'out of memory' messages Georgiana Chelu
                   ` (7 more replies)
  0 siblings, 8 replies; 11+ messages in thread
From: Georgiana Chelu @ 2017-10-01 21:34 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman

This patchset was created to fix warnings introduced
by several patches from the previous patchset.
The number of the patches was reduced from 10 to 7
because 1 patch is already accepted, 2 patches were
combined into a single patch, and the changes from
the 10/10 patch were added in the patches where 
coding style fixes were required.

* [1/07] kmalloc generates a backtrace on failure and it will
show the same information as the removed messages.
* [2/07] the unlikely function is not necessary on NULL pointers
after a memory allocation.

Changes in v2:
* Nothing changed in 1/10
* New added 2/10 - 10/10

Changes in v3:
* added a different cover letter message
* removed an accepted patch
* removed the braces for single statement blocks in 1/7
* split the lines with over 80 characters where changes
were made 

Georgiana Chelu (7):
  Staging: media: atomisp: Remove useless 'out of memory' messages
  Staging: media: atomisp: Remove unlikely from NULL pointer check
  Staging: media: atomisp: Adjust checks for null pointers
  Staging: media: atomisp: Remove return statement from void function
  Staging: media: atomisp: Add spaces around bitwise OR
  Staging: media: atomisp: Merge quoted string split across lines
  Staging: media: atomisp: Align code with open parenthesis

 .../media/atomisp/pci/atomisp2/hmm/hmm_bo.c        | 156 ++++++++++-----------
 1 file changed, 72 insertions(+), 84 deletions(-)

-- 
2.11.0



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v3 1/7] Staging: media: atomisp: Remove useless 'out of memory' messages
  2017-10-01 21:34 [PATCH v3 0/7] Fix checkpatch issues Georgiana Chelu
@ 2017-10-01 21:34 ` Georgiana Chelu
  2017-10-01 21:34 ` [PATCH v3 2/7] Staging: media: atomisp: Remove unlikely from NULL pointer check Georgiana Chelu
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Georgiana Chelu @ 2017-10-01 21:34 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman

OOM (Out Of Memory Manager) reports memory allocation fails,
so there is no need for the error messages. Also, remove
the {} for single if statement blocks.

Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
---

Changes in v2:
* this is a new patch added to the patchset

Changes in v3:
* removed {} for single statement blocks
* changed the commit message

 drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
index 5232327f5d9c..ca90b22020cc 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
@@ -727,10 +727,8 @@ static int alloc_private_pages(struct hmm_buffer_object *bo,
 
 	bo->page_obj = kmalloc_array(pgnr, sizeof(struct hmm_page_object),
 				GFP_KERNEL);
-	if (unlikely(!bo->page_obj)) {
-		dev_err(atomisp_dev, "out of memory for bo->page_obj\n");
+	if (unlikely(!bo->page_obj))
 		return -ENOMEM;
-	}
 
 	i = 0;
 	alloc_pgnr = 0;
@@ -991,15 +989,12 @@ static int alloc_user_pages(struct hmm_buffer_object *bo,
 	struct page **pages;
 
 	pages = kmalloc_array(bo->pgnr, sizeof(struct page *), GFP_KERNEL);
-	if (unlikely(!pages)) {
-		dev_err(atomisp_dev, "out of memory for pages...\n");
+	if (unlikely(!pages))
 		return -ENOMEM;
-	}
 
 	bo->page_obj = kmalloc_array(bo->pgnr, sizeof(struct hmm_page_object),
 		GFP_KERNEL);
 	if (unlikely(!bo->page_obj)) {
-		dev_err(atomisp_dev, "out of memory for bo->page_obj...\n");
 		kfree(pages);
 		return -ENOMEM;
 	}
@@ -1366,7 +1361,6 @@ void *hmm_bo_vmap(struct hmm_buffer_object *bo, bool cached)
 	pages = kmalloc_array(bo->pgnr, sizeof(*pages), GFP_KERNEL);
 	if (unlikely(!pages)) {
 		mutex_unlock(&bo->mutex);
-		dev_err(atomisp_dev, "out of memory for pages...\n");
 		return NULL;
 	}
 
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v3 2/7] Staging: media: atomisp: Remove unlikely from NULL pointer check
  2017-10-01 21:34 [PATCH v3 0/7] Fix checkpatch issues Georgiana Chelu
  2017-10-01 21:34 ` [PATCH v3 1/7] Staging: media: atomisp: Remove useless 'out of memory' messages Georgiana Chelu
@ 2017-10-01 21:34 ` Georgiana Chelu
  2017-10-01 21:34 ` [PATCH v3 3/7] Staging: media: atomisp: Adjust checks for null pointers Georgiana Chelu
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Georgiana Chelu @ 2017-10-01 21:34 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman

Remove unlikely because kmalloc uses it inside the source code.

Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
---

Changes in v2:
* this is a new patch added to the patchset

Changes in v3:
* nothing changed

 drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
index ca90b22020cc..80952b7a9cc6 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
@@ -727,7 +727,7 @@ static int alloc_private_pages(struct hmm_buffer_object *bo,
 
 	bo->page_obj = kmalloc_array(pgnr, sizeof(struct hmm_page_object),
 				GFP_KERNEL);
-	if (unlikely(!bo->page_obj))
+	if (!bo->page_obj)
 		return -ENOMEM;
 
 	i = 0;
@@ -989,12 +989,12 @@ static int alloc_user_pages(struct hmm_buffer_object *bo,
 	struct page **pages;
 
 	pages = kmalloc_array(bo->pgnr, sizeof(struct page *), GFP_KERNEL);
-	if (unlikely(!pages))
+	if (!pages)
 		return -ENOMEM;
 
 	bo->page_obj = kmalloc_array(bo->pgnr, sizeof(struct hmm_page_object),
 		GFP_KERNEL);
-	if (unlikely(!bo->page_obj)) {
+	if (!bo->page_obj) {
 		kfree(pages);
 		return -ENOMEM;
 	}
@@ -1359,7 +1359,7 @@ void *hmm_bo_vmap(struct hmm_buffer_object *bo, bool cached)
 	}
 
 	pages = kmalloc_array(bo->pgnr, sizeof(*pages), GFP_KERNEL);
-	if (unlikely(!pages)) {
+	if (!pages) {
 		mutex_unlock(&bo->mutex);
 		return NULL;
 	}
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v3 3/7] Staging: media: atomisp: Adjust checks for null pointers
  2017-10-01 21:34 [PATCH v3 0/7] Fix checkpatch issues Georgiana Chelu
  2017-10-01 21:34 ` [PATCH v3 1/7] Staging: media: atomisp: Remove useless 'out of memory' messages Georgiana Chelu
  2017-10-01 21:34 ` [PATCH v3 2/7] Staging: media: atomisp: Remove unlikely from NULL pointer check Georgiana Chelu
@ 2017-10-01 21:34 ` Georgiana Chelu
  2017-10-01 21:34 ` [PATCH v3 4/7] Staging: media: atomisp: Remove return statement from void function Georgiana Chelu
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Georgiana Chelu @ 2017-10-01 21:34 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman

Rewrite the comparison to NULL for better coding style.

Fix issue reported by checkpatch.pl:
* CHECK: Comparison to NULL could be written

Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
---

Changes in v2:
* this is a new patch added to the patchset

Changes in v3:
* nothing changed

 .../staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c  | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
index 80952b7a9cc6..a180752e7c66 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
@@ -106,7 +106,7 @@ struct hmm_buffer_object *__bo_search_and_remove_from_free_rbtree(
 
 	this = rb_entry(node, struct hmm_buffer_object, node);
 	if (this->pgnr == pgnr ||
-		(this->pgnr > pgnr && this->node.rb_left == NULL)) {
+		(this->pgnr > pgnr && !this->node.rb_left)) {
 		goto remove_bo_and_return;
 	} else {
 		if (this->pgnr < pgnr) {
@@ -132,7 +132,7 @@ struct hmm_buffer_object *__bo_search_and_remove_from_free_rbtree(
 	 * 1. check if 'this->next' is NULL:
 	 *	yes: erase 'this' node and rebalance rbtree, return 'this'.
 	 */
-	if (this->next == NULL) {
+	if (!this->next) {
 		rb_erase(&this->node, &this->bdev->free_rbtree);
 		return this;
 	}
@@ -160,11 +160,11 @@ struct hmm_buffer_object *__bo_search_by_addr(struct rb_root *root,
 		bo = rb_entry(n, struct hmm_buffer_object, node);
 
 		if (bo->start > start) {
-			if (n->rb_left == NULL)
+			if (!n->rb_left)
 				return NULL;
 			n = n->rb_left;
 		} else if (bo->start < start) {
-			if (n->rb_right == NULL)
+			if (!n->rb_right)
 				return NULL;
 			n = n->rb_right;
 		} else {
@@ -185,13 +185,13 @@ struct hmm_buffer_object *__bo_search_by_addr_in_range(struct rb_root *root,
 		bo = rb_entry(n, struct hmm_buffer_object, node);
 
 		if (bo->start > start) {
-			if (n->rb_left == NULL)
+			if (!n->rb_left)
 				return NULL;
 			n = n->rb_left;
 		} else {
 			if (bo->end > start)
 				return bo;
-			if (n->rb_right == NULL)
+			if (!n->rb_right)
 				return NULL;
 			n = n->rb_right;
 		}
@@ -298,14 +298,14 @@ static void __bo_take_off_handling(struct hmm_buffer_object *bo)
 	 *	and does not have a linked list after bo, to take off this bo,
 	 *	we just need erase bo directly and rebalance the free rbtree
 	 */
-	if (bo->prev == NULL && bo->next == NULL) {
+	if (!bo->prev && !bo->next) {
 		rb_erase(&bo->node, &bdev->free_rbtree);
 	/* 2. when bo->next != NULL && bo->prev == NULL, bo is a rbtree node,
 	 *	and has a linked list,to take off this bo we need erase bo
 	 *	first, then, insert bo->next into free rbtree and rebalance
 	 *	the free rbtree
 	 */
-	} else if (bo->prev == NULL && bo->next != NULL) {
+	} else if (!bo->prev && bo->next) {
 		bo->next->prev = NULL;
 		rb_erase(&bo->node, &bdev->free_rbtree);
 		__bo_insert_to_free_rbtree(&bdev->free_rbtree, bo->next);
@@ -315,7 +315,7 @@ static void __bo_take_off_handling(struct hmm_buffer_object *bo)
 	 *	node, to take off this bo, we just need set the "prev/next"
 	 *	pointers to NULL, the free rbtree stays unchaged
 	 */
-	} else if (bo->prev != NULL && bo->next == NULL) {
+	} else if (bo->prev && !bo->next) {
 		bo->prev->next = NULL;
 		bo->prev = NULL;
 	/* 4. when bo->prev != NULL && bo->next != NULL ,bo is not a rbtree
@@ -1003,7 +1003,7 @@ static int alloc_user_pages(struct hmm_buffer_object *bo,
 	down_read(&current->mm->mmap_sem);
 	vma = find_vma(current->mm, (unsigned long)userptr);
 	up_read(&current->mm->mmap_sem);
-	if (vma == NULL) {
+	if (!vma) {
 		dev_err(atomisp_dev, "find_vma failed\n");
 		kfree(bo->page_obj);
 		kfree(pages);
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v3 4/7] Staging: media: atomisp: Remove return statement from void function
  2017-10-01 21:34 [PATCH v3 0/7] Fix checkpatch issues Georgiana Chelu
                   ` (2 preceding siblings ...)
  2017-10-01 21:34 ` [PATCH v3 3/7] Staging: media: atomisp: Adjust checks for null pointers Georgiana Chelu
@ 2017-10-01 21:34 ` Georgiana Chelu
  2017-10-01 21:34 ` [PATCH v3 5/7] Staging: media: atomisp: Add spaces around bitwise OR Georgiana Chelu
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Georgiana Chelu @ 2017-10-01 21:34 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman

The return statement is not useful when it ends a void function.

Issue found by checkpatch.pl:
WARNING: void function return statements are not generally useful

Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
---

Changes in v2:
* this is a new patch added to the patchset

Changes in v3:
* nothing changed

 drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
index a180752e7c66..cf6078b2195a 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
@@ -520,7 +520,6 @@ void hmm_bo_release(struct hmm_buffer_object *bo)
 	__bo_insert_to_free_rbtree(&bdev->free_rbtree, bo);
 
 	mutex_unlock(&bdev->rbtree_mutex);
-	return;
 }
 
 void hmm_bo_device_exit(struct hmm_bo_device *bdev)
@@ -700,8 +699,6 @@ static void free_private_bo_pages(struct hmm_buffer_object *bo,
 			break;
 		}
 	}
-
-	return;
 }
 
 /*Allocate pages which will be used only by ISP*/
@@ -1409,7 +1406,6 @@ void hmm_bo_vunmap(struct hmm_buffer_object *bo)
 	}
 
 	mutex_unlock(&bo->mutex);
-	return;
 }
 
 void hmm_bo_ref(struct hmm_buffer_object *bo)
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v3 5/7] Staging: media: atomisp: Add spaces around bitwise OR
  2017-10-01 21:34 [PATCH v3 0/7] Fix checkpatch issues Georgiana Chelu
                   ` (3 preceding siblings ...)
  2017-10-01 21:34 ` [PATCH v3 4/7] Staging: media: atomisp: Remove return statement from void function Georgiana Chelu
@ 2017-10-01 21:34 ` Georgiana Chelu
  2017-10-01 21:34 ` [PATCH v3 6/7] Staging: media: atomisp: Merge quoted string split across lines Georgiana Chelu
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Georgiana Chelu @ 2017-10-01 21:34 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman

Add spaces around operator to improve the code
readability.

Issue reported by checkpatch.pl script:
* CHECK: spaces preferred around that '|'

Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
---

Changes in v2:
* this is a new patch added to the patchset

Changes in v3:
* nothing changed

 drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
index cf6078b2195a..0dcdcdd16462 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
@@ -1519,7 +1519,7 @@ int hmm_bo_mmap(struct vm_area_struct *vma, struct hmm_buffer_object *bo)
 	vma->vm_private_data = bo;
 
 	vma->vm_ops = &hmm_bo_vm_ops;
-	vma->vm_flags |= VM_IO|VM_DONTEXPAND|VM_DONTDUMP;
+	vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP;
 
 	/*
 	 * call hmm_bo_vm_open explictly.
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v3 6/7] Staging: media: atomisp: Merge quoted string split across lines
  2017-10-01 21:34 [PATCH v3 0/7] Fix checkpatch issues Georgiana Chelu
                   ` (4 preceding siblings ...)
  2017-10-01 21:34 ` [PATCH v3 5/7] Staging: media: atomisp: Add spaces around bitwise OR Georgiana Chelu
@ 2017-10-01 21:34 ` Georgiana Chelu
  2017-10-03 16:15   ` Greg Kroah-Hartman
  2017-10-01 21:34 ` [PATCH v3 7/7] Staging: media: atomisp: Align code with open parenthesis Georgiana Chelu
  2017-10-03 16:09 ` [PATCH v3 0/7] Fix checkpatch issues Greg Kroah-Hartman
  7 siblings, 1 reply; 11+ messages in thread
From: Georgiana Chelu @ 2017-10-01 21:34 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman

Prefer merging quoted strings on one line than splitting them,
even if the line exceeds 80 characters. It is easier to
read and grep for strings that are not split. Also, split
one line with over 80 characters.

Warning found by the checkpatch.pl script:
* WARNING: quoted string split across lines

Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
---

Changes in v2:
* this is a new patch added to the patchset

Changes in v3:
* fixed the "line over 80 characters" warning
introduced in v2
* updated the commit message

 drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
index 0dcdcdd16462..d039e2607116 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
@@ -822,8 +822,7 @@ static int alloc_private_pages(struct hmm_buffer_object *bo,
 				ret = set_pages_uc(pages, blk_pgnr);
 				if (ret) {
 					dev_err(atomisp_dev,
-						     "set page uncacheable"
-							"failed.\n");
+						"set page uncacheable failed.\n");
 
 					__free_pages(pages, order);
 
@@ -1032,8 +1031,7 @@ static int alloc_user_pages(struct hmm_buffer_object *bo,
 	/* can be written by caller, not forced */
 	if (page_nr != bo->pgnr) {
 		dev_err(atomisp_dev,
-				"get_user_pages err: bo->pgnr = %d, "
-				"pgnr actually pinned = %d.\n",
+			"get_user_pages err: bo->pgnr = %d, pgnr actually pinned = %d.\n",
 				bo->pgnr, page_nr);
 		goto out_of_mem;
 	}
@@ -1498,8 +1496,7 @@ int hmm_bo_mmap(struct vm_area_struct *vma, struct hmm_buffer_object *bo)
 	 */
 	if ((start + pgnr_to_size(pgnr)) != end) {
 		dev_warn(atomisp_dev,
-			     "vma's address space size not equal"
-			     " to buffer object's size");
+			 "vma's address space size not equal to buffer object's size");
 		return -EINVAL;
 	}
 
@@ -1508,9 +1505,8 @@ int hmm_bo_mmap(struct vm_area_struct *vma, struct hmm_buffer_object *bo)
 		pfn = page_to_pfn(bo->page_obj[i].page);
 		if (remap_pfn_range(vma, virt, pfn, PAGE_SIZE, PAGE_SHARED)) {
 			dev_warn(atomisp_dev,
-					"remap_pfn_range failed:"
-					" virt = 0x%x, pfn = 0x%x,"
-					" mapped_pgnr = %d\n", virt, pfn, 1);
+				 "remap_pfn_range failed: virt = 0x%x, pfn = 0x%x, mapped_pgnr = %d\n",
+				 virt, pfn, 1);
 			return -EINVAL;
 		}
 		virt += PAGE_SIZE;
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v3 7/7] Staging: media: atomisp: Align code with open parenthesis
  2017-10-01 21:34 [PATCH v3 0/7] Fix checkpatch issues Georgiana Chelu
                   ` (5 preceding siblings ...)
  2017-10-01 21:34 ` [PATCH v3 6/7] Staging: media: atomisp: Merge quoted string split across lines Georgiana Chelu
@ 2017-10-01 21:34 ` Georgiana Chelu
  2017-10-03 16:09 ` [PATCH v3 0/7] Fix checkpatch issues Greg Kroah-Hartman
  7 siblings, 0 replies; 11+ messages in thread
From: Georgiana Chelu @ 2017-10-01 21:34 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman

Improve the code readability by aligning the code
with the open parenthesis. Also, split lines
with over 80 characters.

Fix issue reported by checkpatch.pl
* CHECK: Alignment should match open parenthesis

Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
---

Changes in v2:
* this is a new patch added to the patchset

Changes in v3:
* fixed the "line over 80 characters" warning
introduced in v2
* updated the commit message to reflect the changes

 .../media/atomisp/pci/atomisp2/hmm/hmm_bo.c        | 104 +++++++++++----------
 1 file changed, 53 insertions(+), 51 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
index d039e2607116..fbf10041a6d5 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
@@ -70,11 +70,11 @@ struct hmm_buffer_object *__bo_alloc(struct kmem_cache *bo_cache)
 }
 
 static int __bo_init(struct hmm_bo_device *bdev, struct hmm_buffer_object *bo,
-					unsigned int pgnr)
+		     unsigned int pgnr)
 {
 	check_bodev_null_return(bdev, -EINVAL);
 	var_equal_return(hmm_bo_device_inited(bdev), 0, -EINVAL,
-			"hmm_bo_device not inited yet.\n");
+			 "hmm_bo_device not inited yet.\n");
 	/* prevent zero size buffer object */
 	if (pgnr == 0) {
 		dev_err(atomisp_dev, "0 size buffer is not allowed.\n");
@@ -106,7 +106,7 @@ struct hmm_buffer_object *__bo_search_and_remove_from_free_rbtree(
 
 	this = rb_entry(node, struct hmm_buffer_object, node);
 	if (this->pgnr == pgnr ||
-		(this->pgnr > pgnr && !this->node.rb_left)) {
+	    (this->pgnr > pgnr && !this->node.rb_left)) {
 		goto remove_bo_and_return;
 	} else {
 		if (this->pgnr < pgnr) {
@@ -151,7 +151,7 @@ struct hmm_buffer_object *__bo_search_and_remove_from_free_rbtree(
 }
 
 struct hmm_buffer_object *__bo_search_by_addr(struct rb_root *root,
-							ia_css_ptr start)
+					      ia_css_ptr start)
 {
 	struct rb_node *n = root->rb_node;
 	struct hmm_buffer_object *bo;
@@ -176,7 +176,7 @@ struct hmm_buffer_object *__bo_search_by_addr(struct rb_root *root,
 }
 
 struct hmm_buffer_object *__bo_search_by_addr_in_range(struct rb_root *root,
-					unsigned int start)
+						       unsigned int start)
 {
 	struct rb_node *n = root->rb_node;
 	struct hmm_buffer_object *bo;
@@ -201,7 +201,7 @@ struct hmm_buffer_object *__bo_search_by_addr_in_range(struct rb_root *root,
 }
 
 static void __bo_insert_to_free_rbtree(struct rb_root *root,
-					struct hmm_buffer_object *bo)
+				       struct hmm_buffer_object *bo)
 {
 	struct rb_node **new = &(root->rb_node);
 	struct rb_node *parent = NULL;
@@ -332,7 +332,7 @@ static void __bo_take_off_handling(struct hmm_buffer_object *bo)
 }
 
 struct hmm_buffer_object *__bo_merge(struct hmm_buffer_object *bo,
-					struct hmm_buffer_object *next_bo)
+				     struct hmm_buffer_object *next_bo)
 {
 	struct hmm_bo_device *bdev;
 	unsigned long flags;
@@ -354,9 +354,9 @@ struct hmm_buffer_object *__bo_merge(struct hmm_buffer_object *bo,
  * hmm_bo_device functions.
  */
 int hmm_bo_device_init(struct hmm_bo_device *bdev,
-				struct isp_mmu_client *mmu_driver,
-				unsigned int vaddr_start,
-				unsigned int size)
+		       struct isp_mmu_client *mmu_driver,
+		       unsigned int vaddr_start,
+		       unsigned int size)
 {
 	struct hmm_buffer_object *bo;
 	unsigned long flags;
@@ -384,7 +384,8 @@ int hmm_bo_device_init(struct hmm_bo_device *bdev,
 	bdev->free_rbtree = RB_ROOT;
 
 	bdev->bo_cache = kmem_cache_create("bo_cache",
-				sizeof(struct hmm_buffer_object), 0, 0, NULL);
+					   sizeof(struct hmm_buffer_object),
+					   0, 0, NULL);
 	if (!bdev->bo_cache) {
 		dev_err(atomisp_dev, "%s: create cache failed!\n", __func__);
 		isp_mmu_exit(&bdev->mmu);
@@ -416,14 +417,14 @@ int hmm_bo_device_init(struct hmm_bo_device *bdev,
 }
 
 struct hmm_buffer_object *hmm_bo_alloc(struct hmm_bo_device *bdev,
-					unsigned int pgnr)
+				       unsigned int pgnr)
 {
 	struct hmm_buffer_object *bo, *new_bo;
 	struct rb_root *root = &bdev->free_rbtree;
 
 	check_bodev_null_return(bdev, NULL);
 	var_equal_return(hmm_bo_device_inited(bdev), 0, NULL,
-			"hmm_bo_device not inited yet.\n");
+			 "hmm_bo_device not inited yet.\n");
 
 	if (pgnr == 0) {
 		dev_err(atomisp_dev, "0 size buffer is not allowed.\n");
@@ -504,15 +505,15 @@ void hmm_bo_release(struct hmm_buffer_object *bo)
 	next_bo = list_entry(bo->list.next, struct hmm_buffer_object, list);
 
 	if (bo->list.prev != &bdev->entire_bo_list &&
-		prev_bo->end == bo->start &&
-		(prev_bo->status & HMM_BO_MASK) == HMM_BO_FREE) {
+	    prev_bo->end == bo->start &&
+	    (prev_bo->status & HMM_BO_MASK) == HMM_BO_FREE) {
 		__bo_take_off_handling(prev_bo);
 		bo = __bo_merge(prev_bo, bo);
 	}
 
 	if (bo->list.next != &bdev->entire_bo_list &&
-		next_bo->start == bo->end &&
-		(next_bo->status & HMM_BO_MASK) == HMM_BO_FREE) {
+	    next_bo->start == bo->end &&
+	    (next_bo->status & HMM_BO_MASK) == HMM_BO_FREE) {
 		__bo_take_off_handling(next_bo);
 		bo = __bo_merge(bo, next_bo);
 	}
@@ -642,9 +643,9 @@ struct hmm_buffer_object *hmm_bo_device_search_vmap_start(
 
 
 static void free_private_bo_pages(struct hmm_buffer_object *bo,
-				struct hmm_pool *dypool,
-				struct hmm_pool *repool,
-				int free_pgnr)
+				  struct hmm_pool *dypool,
+				  struct hmm_pool *repool,
+				  int free_pgnr)
 {
 	int i, ret;
 
@@ -683,8 +684,8 @@ static void free_private_bo_pages(struct hmm_buffer_object *bo,
 			ret = set_pages_wb(bo->page_obj[i].page, 1);
 			if (ret)
 				dev_err(atomisp_dev,
-						"set page to WB err ...ret = %d\n",
-							ret);
+					"set page to WB err ...ret = %d\n",
+					ret);
 			/*
 			W/A: set_pages_wb seldom return value = -EFAULT
 			indicate that address of page is not in valid
@@ -703,10 +704,10 @@ static void free_private_bo_pages(struct hmm_buffer_object *bo,
 
 /*Allocate pages which will be used only by ISP*/
 static int alloc_private_pages(struct hmm_buffer_object *bo,
-				int from_highmem,
-				bool cached,
-				struct hmm_pool *dypool,
-				struct hmm_pool *repool)
+			       int from_highmem,
+			       bool cached,
+			       struct hmm_pool *dypool,
+			       struct hmm_pool *repool)
 {
 	int ret;
 	unsigned int pgnr, order, blk_pgnr, alloc_pgnr;
@@ -723,7 +724,7 @@ static int alloc_private_pages(struct hmm_buffer_object *bo,
 	pgnr = bo->pgnr;
 
 	bo->page_obj = kmalloc_array(pgnr, sizeof(struct hmm_page_object),
-				GFP_KERNEL);
+				     GFP_KERNEL);
 	if (!bo->page_obj)
 		return -ENOMEM;
 
@@ -735,8 +736,8 @@ static int alloc_private_pages(struct hmm_buffer_object *bo,
 	 */
 	if (dypool->pops && dypool->pops->pool_alloc_pages) {
 		alloc_pgnr = dypool->pops->pool_alloc_pages(dypool->pool_info,
-							bo->page_obj, pgnr,
-							cached);
+							    bo->page_obj, pgnr,
+							    cached);
 		hmm_mem_stat.dyc_size -= alloc_pgnr;
 
 		if (alloc_pgnr == pgnr)
@@ -860,8 +861,8 @@ static int alloc_private_pages(struct hmm_buffer_object *bo,
 }
 
 static void free_private_pages(struct hmm_buffer_object *bo,
-				struct hmm_pool *dypool,
-				struct hmm_pool *repool)
+			       struct hmm_pool *dypool,
+			       struct hmm_pool *repool)
 {
 	free_private_bo_pages(bo, dypool, repool, bo->pgnr);
 
@@ -958,8 +959,9 @@ static int __get_pfnmap_pages(struct task_struct *tsk, struct mm_struct *mm,
 }
 
 static int get_pfnmap_pages(struct task_struct *tsk, struct mm_struct *mm,
-		     unsigned long start, int nr_pages, int write, int force,
-		     struct page **pages, struct vm_area_struct **vmas)
+			    unsigned long start, int nr_pages, int write,
+			    int force, struct page **pages,
+			    struct vm_area_struct **vmas)
 {
 	int flags = FOLL_TOUCH;
 
@@ -977,7 +979,7 @@ static int get_pfnmap_pages(struct task_struct *tsk, struct mm_struct *mm,
  * Convert user space virtual address into pages list
  */
 static int alloc_user_pages(struct hmm_buffer_object *bo,
-			      void *userptr, bool cached)
+			    void *userptr, bool cached)
 {
 	int page_nr;
 	int i;
@@ -989,7 +991,7 @@ static int alloc_user_pages(struct hmm_buffer_object *bo,
 		return -ENOMEM;
 
 	bo->page_obj = kmalloc_array(bo->pgnr, sizeof(struct hmm_page_object),
-		GFP_KERNEL);
+				     GFP_KERNEL);
 	if (!bo->page_obj) {
 		kfree(pages);
 		return -ENOMEM;
@@ -1032,7 +1034,7 @@ static int alloc_user_pages(struct hmm_buffer_object *bo,
 	if (page_nr != bo->pgnr) {
 		dev_err(atomisp_dev,
 			"get_user_pages err: bo->pgnr = %d, pgnr actually pinned = %d.\n",
-				bo->pgnr, page_nr);
+			bo->pgnr, page_nr);
 		goto out_of_mem;
 	}
 
@@ -1097,7 +1099,8 @@ int hmm_bo_alloc_pages(struct hmm_buffer_object *bo,
 	 */
 	if (type == HMM_BO_PRIVATE) {
 		ret = alloc_private_pages(bo, from_highmem,
-				cached, &dynamic_pool, &reserved_pool);
+					  cached, &dynamic_pool,
+					  &reserved_pool);
 	} else if (type == HMM_BO_USER) {
 		ret = alloc_user_pages(bo, userptr, cached);
 	} else {
@@ -1122,7 +1125,7 @@ int hmm_bo_alloc_pages(struct hmm_buffer_object *bo,
 status_err:
 	mutex_unlock(&bo->mutex);
 	dev_err(atomisp_dev,
-			"buffer object has already page allocated.\n");
+		"buffer object has already page allocated.\n");
 	return -EINVAL;
 }
 
@@ -1153,7 +1156,7 @@ void hmm_bo_free_pages(struct hmm_buffer_object *bo)
 status_err2:
 	mutex_unlock(&bo->mutex);
 	dev_err(atomisp_dev,
-			"buffer object not page allocated yet.\n");
+		"buffer object not page allocated yet.\n");
 }
 
 int hmm_bo_page_allocated(struct hmm_buffer_object *bo)
@@ -1188,7 +1191,7 @@ int hmm_bo_get_page_info(struct hmm_buffer_object *bo,
 
 status_err:
 	dev_err(atomisp_dev,
-			"buffer object not page allocated yet.\n");
+		"buffer object not page allocated yet.\n");
 	mutex_unlock(&bo->mutex);
 	return -EINVAL;
 }
@@ -1207,9 +1210,8 @@ int hmm_bo_bind(struct hmm_buffer_object *bo)
 
 	mutex_lock(&bo->mutex);
 
-	check_bo_status_yes_goto(bo,
-				   HMM_BO_PAGE_ALLOCED | HMM_BO_ALLOCED,
-				   status_err1);
+	check_bo_status_yes_goto(bo, HMM_BO_PAGE_ALLOCED | HMM_BO_ALLOCED,
+				 status_err1);
 
 	check_bo_status_no_goto(bo, HMM_BO_BINDED, status_err2);
 
@@ -1239,7 +1241,7 @@ int hmm_bo_bind(struct hmm_buffer_object *bo)
 	 */
 	if (bo->start != 0x0)
 		isp_mmu_flush_tlb_range(&bdev->mmu, bo->start,
-						(bo->pgnr << PAGE_SHIFT));
+					(bo->pgnr << PAGE_SHIFT));
 
 	bo->status |= HMM_BO_BINDED;
 
@@ -1257,7 +1259,7 @@ int hmm_bo_bind(struct hmm_buffer_object *bo)
 
 	mutex_unlock(&bo->mutex);
 	dev_err(atomisp_dev,
-			"setup MMU address mapping failed.\n");
+		"setup MMU address mapping failed.\n");
 	return ret;
 
 status_err2:
@@ -1267,7 +1269,7 @@ int hmm_bo_bind(struct hmm_buffer_object *bo)
 status_err1:
 	mutex_unlock(&bo->mutex);
 	dev_err(atomisp_dev,
-		     "buffer object vm_node or page not allocated.\n");
+		"buffer object vm_node or page not allocated.\n");
 	return -EINVAL;
 }
 
@@ -1285,9 +1287,9 @@ void hmm_bo_unbind(struct hmm_buffer_object *bo)
 	mutex_lock(&bo->mutex);
 
 	check_bo_status_yes_goto(bo,
-				   HMM_BO_PAGE_ALLOCED |
-				   HMM_BO_ALLOCED |
-				   HMM_BO_BINDED, status_err);
+				 HMM_BO_PAGE_ALLOCED |
+				 HMM_BO_ALLOCED |
+				 HMM_BO_BINDED, status_err);
 
 	bdev = bo->bdev;
 
@@ -1314,7 +1316,7 @@ void hmm_bo_unbind(struct hmm_buffer_object *bo)
 status_err:
 	mutex_unlock(&bo->mutex);
 	dev_err(atomisp_dev,
-		     "buffer vm or page not allocated or not binded yet.\n");
+		"buffer vm or page not allocated or not binded yet.\n");
 }
 
 int hmm_bo_binded(struct hmm_buffer_object *bo)
@@ -1363,7 +1365,7 @@ void *hmm_bo_vmap(struct hmm_buffer_object *bo, bool cached)
 		pages[i] = bo->page_obj[i].page;
 
 	bo->vmap_addr = vmap(pages, bo->pgnr, VM_MAP,
-		cached ? PAGE_KERNEL : PAGE_KERNEL_NOCACHE);
+			     cached ? PAGE_KERNEL : PAGE_KERNEL_NOCACHE);
 	if (unlikely(!bo->vmap_addr)) {
 		kfree(pages);
 		mutex_unlock(&bo->mutex);
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v3 0/7] Fix checkpatch issues
  2017-10-01 21:34 [PATCH v3 0/7] Fix checkpatch issues Georgiana Chelu
                   ` (6 preceding siblings ...)
  2017-10-01 21:34 ` [PATCH v3 7/7] Staging: media: atomisp: Align code with open parenthesis Georgiana Chelu
@ 2017-10-03 16:09 ` Greg Kroah-Hartman
  2017-10-07 21:31   ` Georgiana Chelu
  7 siblings, 1 reply; 11+ messages in thread
From: Greg Kroah-Hartman @ 2017-10-03 16:09 UTC (permalink / raw)
  To: Georgiana Chelu; +Cc: outreachy-kernel, Mauro Carvalho Chehab

On Mon, Oct 02, 2017 at 12:34:35AM +0300, Georgiana Chelu wrote:
> This patchset was created to fix warnings introduced
> by several patches from the previous patchset.
> The number of the patches was reduced from 10 to 7
> because 1 patch is already accepted, 2 patches were
> combined into a single patch, and the changes from
> the 10/10 patch were added in the patches where 
> coding style fixes were required.

In the future, please put the subsystem and driver name in the subject
of your 0/X email, otherwise it can get lost in my inbox.

Also, why wrap your lines so narrow here?

thanks,

greg k-h


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3 6/7] Staging: media: atomisp: Merge quoted string split across lines
  2017-10-01 21:34 ` [PATCH v3 6/7] Staging: media: atomisp: Merge quoted string split across lines Georgiana Chelu
@ 2017-10-03 16:15   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 11+ messages in thread
From: Greg Kroah-Hartman @ 2017-10-03 16:15 UTC (permalink / raw)
  To: Georgiana Chelu; +Cc: outreachy-kernel, Mauro Carvalho Chehab

On Mon, Oct 02, 2017 at 12:34:41AM +0300, Georgiana Chelu wrote:
> Prefer merging quoted strings on one line than splitting them,
> even if the line exceeds 80 characters. It is easier to
> read and grep for strings that are not split. Also, split
> one line with over 80 characters.

It's nice to wrap changelog lines, but please do so at 72 columns.

Mauro, are you going to be taking these types of changes for this
driver, or do you want me to?

thanks,

greg k-h


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3 0/7] Fix checkpatch issues
  2017-10-03 16:09 ` [PATCH v3 0/7] Fix checkpatch issues Greg Kroah-Hartman
@ 2017-10-07 21:31   ` Georgiana Chelu
  0 siblings, 0 replies; 11+ messages in thread
From: Georgiana Chelu @ 2017-10-07 21:31 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: outreachy-kernel, Mauro Carvalho Chehab

On 3 October 2017 at 19:09, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> On Mon, Oct 02, 2017 at 12:34:35AM +0300, Georgiana Chelu wrote:
>> This patchset was created to fix warnings introduced
>> by several patches from the previous patchset.
>> The number of the patches was reduced from 10 to 7
>> because 1 patch is already accepted, 2 patches were
>> combined into a single patch, and the changes from
>> the 10/10 patch were added in the patches where
>> coding style fixes were required.
>
> In the future, please put the subsystem and driver name in the subject
> of your 0/X email, otherwise it can get lost in my inbox.

I will keep it in mind.

>
> Also, why wrap your lines so narrow here?

I wanted to be a compact message, but now I see that is quite
difficult to read it. I will take into consideration to increase the
number of columns. Thank you for the review!

Georgiana

>
> thanks,
>
> greg k-h


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-10-07 21:31 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-01 21:34 [PATCH v3 0/7] Fix checkpatch issues Georgiana Chelu
2017-10-01 21:34 ` [PATCH v3 1/7] Staging: media: atomisp: Remove useless 'out of memory' messages Georgiana Chelu
2017-10-01 21:34 ` [PATCH v3 2/7] Staging: media: atomisp: Remove unlikely from NULL pointer check Georgiana Chelu
2017-10-01 21:34 ` [PATCH v3 3/7] Staging: media: atomisp: Adjust checks for null pointers Georgiana Chelu
2017-10-01 21:34 ` [PATCH v3 4/7] Staging: media: atomisp: Remove return statement from void function Georgiana Chelu
2017-10-01 21:34 ` [PATCH v3 5/7] Staging: media: atomisp: Add spaces around bitwise OR Georgiana Chelu
2017-10-01 21:34 ` [PATCH v3 6/7] Staging: media: atomisp: Merge quoted string split across lines Georgiana Chelu
2017-10-03 16:15   ` Greg Kroah-Hartman
2017-10-01 21:34 ` [PATCH v3 7/7] Staging: media: atomisp: Align code with open parenthesis Georgiana Chelu
2017-10-03 16:09 ` [PATCH v3 0/7] Fix checkpatch issues Greg Kroah-Hartman
2017-10-07 21:31   ` Georgiana Chelu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.