* [PATCH 1/2] staging: android: ion: Remove dead code in ion_page_pool_free
@ 2018-02-05 3:26 Yisheng Xie
2018-02-05 3:26 ` [PATCH 2/2] staging: android: ion: Return void instead of int Yisheng Xie
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Yisheng Xie @ 2018-02-05 3:26 UTC (permalink / raw)
To: gregkh, labbott; +Cc: devel, Yisheng Xie, linux-kernel
ion_page_pool_add will always return 0, however ion_page_pool_free will
call ion_page_pool_free_pages when ion_page_pool_add's return value is
not 0, so it is a dead code which can be removed.
Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
---
drivers/staging/android/ion/ion_page_pool.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/staging/android/ion/ion_page_pool.c b/drivers/staging/android/ion/ion_page_pool.c
index 4452e28..150626f 100644
--- a/drivers/staging/android/ion/ion_page_pool.c
+++ b/drivers/staging/android/ion/ion_page_pool.c
@@ -79,13 +79,9 @@ struct page *ion_page_pool_alloc(struct ion_page_pool *pool)
void ion_page_pool_free(struct ion_page_pool *pool, struct page *page)
{
- int ret;
-
BUG_ON(pool->order != compound_order(page));
- ret = ion_page_pool_add(pool, page);
- if (ret)
- ion_page_pool_free_pages(pool, page);
+ ion_page_pool_add(pool, page);
}
static int ion_page_pool_total(struct ion_page_pool *pool, bool high)
--
1.7.12.4
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] staging: android: ion: Return void instead of int
2018-02-05 3:26 [PATCH 1/2] staging: android: ion: Remove dead code in ion_page_pool_free Yisheng Xie
@ 2018-02-05 3:26 ` Yisheng Xie
2018-02-06 23:10 ` [PATCH 1/2] staging: android: ion: Remove dead code in ion_page_pool_free Laura Abbott
2018-02-12 11:40 ` Yisheng Xie
2 siblings, 0 replies; 6+ messages in thread
From: Yisheng Xie @ 2018-02-05 3:26 UTC (permalink / raw)
To: gregkh, labbott; +Cc: devel, Yisheng Xie, linux-kernel
Now, nobody care about the return value of ion_page_pool_add, therefore
we can just make it return void.
Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
---
drivers/staging/android/ion/ion_page_pool.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/staging/android/ion/ion_page_pool.c b/drivers/staging/android/ion/ion_page_pool.c
index 150626f..e3a6e32 100644
--- a/drivers/staging/android/ion/ion_page_pool.c
+++ b/drivers/staging/android/ion/ion_page_pool.c
@@ -26,7 +26,7 @@ static void ion_page_pool_free_pages(struct ion_page_pool *pool,
__free_pages(page, pool->order);
}
-static int ion_page_pool_add(struct ion_page_pool *pool, struct page *page)
+static void ion_page_pool_add(struct ion_page_pool *pool, struct page *page)
{
mutex_lock(&pool->mutex);
if (PageHighMem(page)) {
@@ -37,7 +37,6 @@ static int ion_page_pool_add(struct ion_page_pool *pool, struct page *page)
pool->low_count++;
}
mutex_unlock(&pool->mutex);
- return 0;
}
static struct page *ion_page_pool_remove(struct ion_page_pool *pool, bool high)
--
1.7.12.4
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] staging: android: ion: Remove dead code in ion_page_pool_free
2018-02-05 3:26 [PATCH 1/2] staging: android: ion: Remove dead code in ion_page_pool_free Yisheng Xie
2018-02-05 3:26 ` [PATCH 2/2] staging: android: ion: Return void instead of int Yisheng Xie
@ 2018-02-06 23:10 ` Laura Abbott
2018-02-06 23:11 ` Laura Abbott
2018-02-12 11:40 ` Yisheng Xie
2 siblings, 1 reply; 6+ messages in thread
From: Laura Abbott @ 2018-02-06 23:10 UTC (permalink / raw)
To: Yisheng Xie, gregkh; +Cc: devel, linux-kernel
On 02/04/2018 07:26 PM, Yisheng Xie wrote:
> ion_page_pool_add will always return 0, however ion_page_pool_free will
> call ion_page_pool_free_pages when ion_page_pool_add's return value is
> not 0, so it is a dead code which can be removed.
>
Can you clean up ion_page_pool_add to be a void return as well?
No sense in having it just always return 0.
> Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
> ---
> drivers/staging/android/ion/ion_page_pool.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/staging/android/ion/ion_page_pool.c b/drivers/staging/android/ion/ion_page_pool.c
> index 4452e28..150626f 100644
> --- a/drivers/staging/android/ion/ion_page_pool.c
> +++ b/drivers/staging/android/ion/ion_page_pool.c
> @@ -79,13 +79,9 @@ struct page *ion_page_pool_alloc(struct ion_page_pool *pool)
>
> void ion_page_pool_free(struct ion_page_pool *pool, struct page *page)
> {
> - int ret;
> -
> BUG_ON(pool->order != compound_order(page));
>
> - ret = ion_page_pool_add(pool, page);
> - if (ret)
> - ion_page_pool_free_pages(pool, page);
> + ion_page_pool_add(pool, page);
> }
>
> static int ion_page_pool_total(struct ion_page_pool *pool, bool high)
>
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] staging: android: ion: Remove dead code in ion_page_pool_free
2018-02-06 23:10 ` [PATCH 1/2] staging: android: ion: Remove dead code in ion_page_pool_free Laura Abbott
@ 2018-02-06 23:11 ` Laura Abbott
2018-02-07 0:57 ` Yisheng Xie
0 siblings, 1 reply; 6+ messages in thread
From: Laura Abbott @ 2018-02-06 23:11 UTC (permalink / raw)
To: Yisheng Xie, gregkh; +Cc: devel, linux-kernel
On 02/06/2018 03:10 PM, Laura Abbott wrote:
> On 02/04/2018 07:26 PM, Yisheng Xie wrote:
>> ion_page_pool_add will always return 0, however ion_page_pool_free will
>> call ion_page_pool_free_pages when ion_page_pool_add's return value is
>> not 0, so it is a dead code which can be removed.
>>
>
> Can you clean up ion_page_pool_add to be a void return as well?
> No sense in having it just always return 0.
>
Nevermind, just saw the follow up patch. Both of them:
Acked-by: Laura Abbott <labbott@redhat.com>
>> Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
>> ---
>> drivers/staging/android/ion/ion_page_pool.c | 6 +-----
>> 1 file changed, 1 insertion(+), 5 deletions(-)
>>
>> diff --git a/drivers/staging/android/ion/ion_page_pool.c b/drivers/staging/android/ion/ion_page_pool.c
>> index 4452e28..150626f 100644
>> --- a/drivers/staging/android/ion/ion_page_pool.c
>> +++ b/drivers/staging/android/ion/ion_page_pool.c
>> @@ -79,13 +79,9 @@ struct page *ion_page_pool_alloc(struct ion_page_pool *pool)
>> void ion_page_pool_free(struct ion_page_pool *pool, struct page *page)
>> {
>> - int ret;
>> -
>> BUG_ON(pool->order != compound_order(page));
>> - ret = ion_page_pool_add(pool, page);
>> - if (ret)
>> - ion_page_pool_free_pages(pool, page);
>> + ion_page_pool_add(pool, page);
>> }
>> static int ion_page_pool_total(struct ion_page_pool *pool, bool high)
>>
>
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] staging: android: ion: Remove dead code in ion_page_pool_free
2018-02-06 23:11 ` Laura Abbott
@ 2018-02-07 0:57 ` Yisheng Xie
0 siblings, 0 replies; 6+ messages in thread
From: Yisheng Xie @ 2018-02-07 0:57 UTC (permalink / raw)
To: Laura Abbott, gregkh; +Cc: devel, linux-kernel
Hi Laura,
On 2018/2/7 7:11, Laura Abbott wrote:
> On 02/06/2018 03:10 PM, Laura Abbott wrote:
>> On 02/04/2018 07:26 PM, Yisheng Xie wrote:
>>> ion_page_pool_add will always return 0, however ion_page_pool_free will
>>> call ion_page_pool_free_pages when ion_page_pool_add's return value is
>>> not 0, so it is a dead code which can be removed.
>>>
>>
>> Can you clean up ion_page_pool_add to be a void return as well?
>> No sense in having it just always return 0.
>>
>
> Nevermind, just saw the follow up patch. Both of them:
>
> Acked-by: Laura Abbott <labbott@redhat.com>
Thanks.
If you do not mind, I will send out another two cleanup patchs:
cleanup ion_page_pool_alloc_pages() and combine cache/uncache pools into one pools.
Thanks
>
>>> Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
>>> ---
>>> drivers/staging/android/ion/ion_page_pool.c | 6 +-----
>>> 1 file changed, 1 insertion(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/staging/android/ion/ion_page_pool.c b/drivers/staging/android/ion/ion_page_pool.c
>>> index 4452e28..150626f 100644
>>> --- a/drivers/staging/android/ion/ion_page_pool.c
>>> +++ b/drivers/staging/android/ion/ion_page_pool.c
>>> @@ -79,13 +79,9 @@ struct page *ion_page_pool_alloc(struct ion_page_pool *pool)
>>> void ion_page_pool_free(struct ion_page_pool *pool, struct page *page)
>>> {
>>> - int ret;
>>> -
>>> BUG_ON(pool->order != compound_order(page));
>>> - ret = ion_page_pool_add(pool, page);
>>> - if (ret)
>>> - ion_page_pool_free_pages(pool, page);
>>> + ion_page_pool_add(pool, page);
>>> }
>>> static int ion_page_pool_total(struct ion_page_pool *pool, bool high)
>>>
>>
>
>
>
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] staging: android: ion: Remove dead code in ion_page_pool_free
2018-02-05 3:26 [PATCH 1/2] staging: android: ion: Remove dead code in ion_page_pool_free Yisheng Xie
2018-02-05 3:26 ` [PATCH 2/2] staging: android: ion: Return void instead of int Yisheng Xie
2018-02-06 23:10 ` [PATCH 1/2] staging: android: ion: Remove dead code in ion_page_pool_free Laura Abbott
@ 2018-02-12 11:40 ` Yisheng Xie
2 siblings, 0 replies; 6+ messages in thread
From: Yisheng Xie @ 2018-02-12 11:40 UTC (permalink / raw)
To: gregkh, labbott; +Cc: devel, linux-kernel
Hi Greg,
JFYI, I have rebase this patchset to v4.15-rc1.[1]
[1] https://lkml.org/lkml/2018/2/12/204
Thanks
Yisheng
On 2018/2/5 11:26, Yisheng Xie wrote:
> ion_page_pool_add will always return 0, however ion_page_pool_free will
> call ion_page_pool_free_pages when ion_page_pool_add's return value is
> not 0, so it is a dead code which can be removed.
>
> Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
> ---
> drivers/staging/android/ion/ion_page_pool.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/staging/android/ion/ion_page_pool.c b/drivers/staging/android/ion/ion_page_pool.c
> index 4452e28..150626f 100644
> --- a/drivers/staging/android/ion/ion_page_pool.c
> +++ b/drivers/staging/android/ion/ion_page_pool.c
> @@ -79,13 +79,9 @@ struct page *ion_page_pool_alloc(struct ion_page_pool *pool)
>
> void ion_page_pool_free(struct ion_page_pool *pool, struct page *page)
> {
> - int ret;
> -
> BUG_ON(pool->order != compound_order(page));
>
> - ret = ion_page_pool_add(pool, page);
> - if (ret)
> - ion_page_pool_free_pages(pool, page);
> + ion_page_pool_add(pool, page);
> }
>
> static int ion_page_pool_total(struct ion_page_pool *pool, bool high)
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-02-12 11:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-05 3:26 [PATCH 1/2] staging: android: ion: Remove dead code in ion_page_pool_free Yisheng Xie
2018-02-05 3:26 ` [PATCH 2/2] staging: android: ion: Return void instead of int Yisheng Xie
2018-02-06 23:10 ` [PATCH 1/2] staging: android: ion: Remove dead code in ion_page_pool_free Laura Abbott
2018-02-06 23:11 ` Laura Abbott
2018-02-07 0:57 ` Yisheng Xie
2018-02-12 11:40 ` Yisheng Xie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®