* [PATCH -next] mm: Mark undo_dev_pagemap as __maybe_unused
@ 2019-07-02 13:02 Guenter Roeck
2019-07-02 20:54 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: Guenter Roeck @ 2019-07-02 13:02 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-mm, Stephen Rothwell, Robin Murphy, linux-kernel, Guenter Roeck
Several mips builds generate the following build warning.
mm/gup.c:1788:13: warning: 'undo_dev_pagemap' defined but not used
The function is declared unconditionally but only called from behind
various ifdefs. Mark it __maybe_unused.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
mm/gup.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mm/gup.c b/mm/gup.c
index 7dde2e3a1963..95a373bd8f21 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -1785,7 +1785,8 @@ static inline pte_t gup_get_pte(pte_t *ptep)
}
#endif /* CONFIG_GUP_GET_PTE_LOW_HIGH */
-static void undo_dev_pagemap(int *nr, int nr_start, struct page **pages)
+static void __maybe_unused undo_dev_pagemap(int *nr, int nr_start,
+ struct page **pages)
{
while ((*nr) - nr_start) {
struct page *page = pages[--(*nr)];
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH -next] mm: Mark undo_dev_pagemap as __maybe_unused
2019-07-02 13:02 [PATCH -next] mm: Mark undo_dev_pagemap as __maybe_unused Guenter Roeck
@ 2019-07-02 20:54 ` Andrew Morton
2019-07-02 23:27 ` Guenter Roeck
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2019-07-02 20:54 UTC (permalink / raw)
To: Guenter Roeck
Cc: linux-mm, Stephen Rothwell, Robin Murphy, linux-kernel,
Kirill A. Shutemov
On Tue, 2 Jul 2019 06:02:03 -0700 Guenter Roeck <linux@roeck-us.net> wrote:
> Several mips builds generate the following build warning.
>
> mm/gup.c:1788:13: warning: 'undo_dev_pagemap' defined but not used
>
> The function is declared unconditionally but only called from behind
> various ifdefs. Mark it __maybe_unused.
>
> ...
>
> --- a/mm/gup.c
> +++ b/mm/gup.c
> @@ -1785,7 +1785,8 @@ static inline pte_t gup_get_pte(pte_t *ptep)
> }
> #endif /* CONFIG_GUP_GET_PTE_LOW_HIGH */
>
> -static void undo_dev_pagemap(int *nr, int nr_start, struct page **pages)
> +static void __maybe_unused undo_dev_pagemap(int *nr, int nr_start,
> + struct page **pages)
> {
> while ((*nr) - nr_start) {
> struct page *page = pages[--(*nr)];
It's not our preferred way of doing it but yes, it would be a bit of a
mess and a bit of a maintenance burden to get the ifdefs correct.
And really, __maybe_unused isn't a bad way at all - it ensures that the
function always gets build-tested and the compiler will remove it so we
don't have to play the chase-the-ifdefs game.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -next] mm: Mark undo_dev_pagemap as __maybe_unused
2019-07-02 20:54 ` Andrew Morton
@ 2019-07-02 23:27 ` Guenter Roeck
0 siblings, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2019-07-02 23:27 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-mm, Stephen Rothwell, Robin Murphy, linux-kernel,
Kirill A. Shutemov
On 7/2/19 1:54 PM, Andrew Morton wrote:
> On Tue, 2 Jul 2019 06:02:03 -0700 Guenter Roeck <linux@roeck-us.net> wrote:
>
>> Several mips builds generate the following build warning.
>>
>> mm/gup.c:1788:13: warning: 'undo_dev_pagemap' defined but not used
>>
>> The function is declared unconditionally but only called from behind
>> various ifdefs. Mark it __maybe_unused.
>>
>> ...
>>
>> --- a/mm/gup.c
>> +++ b/mm/gup.c
>> @@ -1785,7 +1785,8 @@ static inline pte_t gup_get_pte(pte_t *ptep)
>> }
>> #endif /* CONFIG_GUP_GET_PTE_LOW_HIGH */
>>
>> -static void undo_dev_pagemap(int *nr, int nr_start, struct page **pages)
>> +static void __maybe_unused undo_dev_pagemap(int *nr, int nr_start,
>> + struct page **pages)
>> {
>> while ((*nr) - nr_start) {
>> struct page *page = pages[--(*nr)];
>
> It's not our preferred way of doing it but yes, it would be a bit of a
> mess and a bit of a maintenance burden to get the ifdefs correct.
>
That is why I did it here. I understand that some maintainers don't like it,
and I noticed that it wasn't used elsewhere in the file, but it seemed to be
to most straightforward solution.
> And really, __maybe_unused isn't a bad way at all - it ensures that the
> function always gets build-tested and the compiler will remove it so we
> don't have to play the chase-the-ifdefs game.
>
Yes, it does have its advantages. I like it myself, but usually I would not
impose my opinion on others. In this case, anything else would have been
quite awkward and be prone to never-ending adjustments.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-07-02 23:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-02 13:02 [PATCH -next] mm: Mark undo_dev_pagemap as __maybe_unused Guenter Roeck
2019-07-02 20:54 ` Andrew Morton
2019-07-02 23:27 ` Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).