From: Pei Xiao <xiaopei01@kylinos.cn>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
rafael@kernel.org, dakr@kernel.org,
bartosz.golaszewski@linaro.org
Subject: Re: [PATCH] devres: Move remaining devm_alloc_percpu and devm_device_add_group to devres.h
Date: Tue, 27 May 2025 17:41:21 +0800 [thread overview]
Message-ID: <b71a4ff3-8013-47e0-b2ac-2c5b3d8f8afc@kylinos.cn> (raw)
In-Reply-To: <aC8en60QI0MwnXxM@smile.fi.intel.com>
在 2025/5/22 20:54, Andy Shevchenko 写道:
> On Thu, May 22, 2025 at 05:01:26PM +0800, Pei Xiao wrote:
>> Since commit f5e5631df596("devres: Move devm_*_action*() APIs to
>> devres.h"), But devm_alloc_percpu() and devm_device_add_group didn't be
>> moved.
>>
>> so move it.The changes improve header organization by keeping all
>> resource-managed device APIs in the dedicated devres.h header,
>> reducing cross-header dependencies and making the interfaces
>> easier to locate.
> Thanks for the patch, my comments below.
>
> ...
>
>> -/**
>> - * devm_alloc_percpu - Resource-managed alloc_percpu
>> - * @dev: Device to allocate per-cpu memory for
>> - * @type: Type to allocate per-cpu memory for
>> - *
>> - * Managed alloc_percpu. Per-cpu memory allocated with this function is
>> - * automatically freed on driver detach.
>> - *
>> - * RETURNS:
>> - * Pointer to allocated memory on success, NULL on failure.
>> - */
>> -#define devm_alloc_percpu(dev, type) \
>> - ((typeof(type) __percpu *)__devm_alloc_percpu((dev), sizeof(type), \
>> - __alignof__(type)))
>> -
>> -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.
> ...
>
>> -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
> ...
>
>> +#include <linux/sysfs.h>
it's redundant.
>> +#include <asm/percpu.h>
> What for are these new inclusions, please?
for percpu.
> ...
>
>> +/**
>> + * devm_alloc_percpu - Resource-managed alloc_percpu
>> + * @dev: Device to allocate per-cpu memory for
>> + * @type: Type to allocate per-cpu memory for
>> + *
>> + * Managed alloc_percpu. Per-cpu memory allocated with this function is
>> + * automatically freed on driver detach.
>> + *
>> + * RETURNS:
> Please, check that all of the kernel-doc are in align (using same style).
ok.
>> + * Pointer to allocated memory on success, NULL on failure.
>> + */
>> +#define devm_alloc_percpu(dev, type) \
>> + ((typeof(type) __percpu *)__devm_alloc_percpu((dev), sizeof(type), \
>> + __alignof__(type)))
> Just make it one line. it will be less than 100.
get it.
>> +void __percpu *__devm_alloc_percpu(struct device *dev, size_t size,
>> + size_t align);
> Ditto.
>
get it.
>> +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.
Which header file should I include?
I've found that including <asm/percpu.h> does resolve my compilation issue.
Thanks for you help.
Pei.
next prev parent reply other threads:[~2025-05-27 9:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-22 9:01 Pei Xiao
2025-05-22 12:54 ` Andy Shevchenko
2025-05-23 3:08 ` Pei Xiao
2025-05-23 16:18 ` Andy Shevchenko
2025-05-27 9:41 ` Pei Xiao [this message]
2025-05-27 11:09 ` Andy Shevchenko
2025-05-28 3:07 ` Pei Xiao
2025-05-28 9:31 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b71a4ff3-8013-47e0-b2ac-2c5b3d8f8afc@kylinos.cn \
--to=xiaopei01@kylinos.cn \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bartosz.golaszewski@linaro.org \
--cc=dakr@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®