lkml.org 
[lkml]   [2025]   [May]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
SubjectRe: [PATCH] devres: Move remaining devm_alloc_percpu and devm_device_add_group to devres.h
From

在 2025/5/27 19:09, Andy Shevchenko 写道:
> On Tue, May 27, 2025 at 05:41:21PM +0800, Pei Xiao wrote:
>> 在 2025/5/22 20:54, Andy Shevchenko 写道:
>>> On Thu, May 22, 2025 at 05:01:26PM +0800, Pei Xiao wrote:
> ...
>
>>>> -void __percpu *__devm_alloc_percpu(struct device *dev, size_t size,
>>>> - size_t align);
>>>> -void devm_free_percpu(struct device *dev, void __percpu *pdata);
>>> Don't you need to cleanup the header inclusions as well?
>> no, I think we don't need to cleanup .
>>
>> #include <linux/lockdep.h> include #include <asm/percpu.h>
>>
>> only move #include <asm/percpu.h> to linux/device/devres.h for
>>
>> build error.
> It's not needed for the build error fixing as far as I understood it. __percpu
> is defined in another header.

compiler_types.h or compiler.h 

I tried before send patch, but it all resulted in compilation failures on my arm64 machine.


> ...
>
>>>> -int __must_check devm_device_add_group(struct device *dev,
>>>> - const struct attribute_group *grp);
>>> I'm not sure about this. The percpu seems standalone piece, but this has
>>> relations with the other group related definitions just above.
>> I'm also not sure if this devm_device_add_group needs to be moved, 
>>
>> which is why I haven't replied to you yet
> Fair enough.
>
> ...
>
>>>> +#include <linux/sysfs.h>
>> it's redundant.
>>>> +#include <asm/percpu.h>
>>> What for are these new inclusions, please?
>> for percpu.
> It does not define __percpu.
>
>>>> +void devm_free_percpu(struct device *dev, void __percpu *pdata);
>>> Please, take your time to understand what is behind the __percpu and
>>> why the asm/percpu.h is redundant here.
>> If this header file is missing, there will be a compilation error. 
> Right. But this is wrong header for the purpose.
>
>> Which header file should I include?
> The one that defines it, hint:
> https://elixir.bootlin.com/linux/v6.15/A/ident/__percpu

compiler_types.h or compiler.h 

I tried before send patch, but it all resulted in compilation failures on my arm64 machine.

 You can give it a try.

when i add a error in compiler_types.h

+++ b/include/linux/compiler_types.h
@@ -26,6 +26,7 @@
 
 /* sparse defines __CHECKER__; see Documentation/dev-tools/sparse.rst */
 #ifdef __CHECKER__
+sasasas
 /* address spaces */
 # define __kernel      __attribute__((address_space(0)))
 # define __user                __attribute__((noderef, address_space(__user)

it  still build success,have no build error.

#include <linux/lockdep.h> include <asm/percpu.h> ,so have no build error before modidy,I think.

>> I've found that including <asm/percpu.h> does resolve my compilation issue.
thanks!

\
 
 \ /
  Last update: 2025-05-28 05:08    [from the cache]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog