Re: git: a1181662d370 - main - LinuxKPI: Add devm_device_add_group to linux/device.h

From: Vladimir Kondratyev <vladimir_at_kondratyev.su>
Date: Tue, 23 Jul 2024 23:46:47 UTC
On 22.07.2024 21:55, Bjoern A. Zeeb wrote:
> On Sun, 21 Jul 2024, Vladimir Kondratyev wrote:
> 
>> The branch main has been updated by wulf:
>>
>> URL: 
>> https://cgit.FreeBSD.org/src/commit/?id=a1181662d3707d8165d7153a0aa5d76ea1ddc11a
>>
>> commit a1181662d3707d8165d7153a0aa5d76ea1ddc11a
>> Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
>> AuthorDate: 2024-07-21 13:09:12 +0000
>> Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
>> CommitDate: 2024-07-21 13:09:12 +0000
>>
>>    LinuxKPI: Add devm_device_add_group to linux/device.h
>>
>>    devm_device_add_group creates a managed attribute group for a device.
>>
>>    Sponsored by:   Serenity Cyber Security, LLC
>>    MFC after:      1 week
>>    Reviewed by:    manu
>>    Differential Revision:  https://reviews.freebsd.org/D45845
>> ---
>> sys/compat/linuxkpi/common/include/linux/device.h |  4 +++
>> sys/compat/linuxkpi/common/src/linux_compat.c     | 30 +++++++++++++++++++++++
>> 2 files changed, 34 insertions(+)
>>
>> diff --git a/sys/compat/linuxkpi/common/include/linux/device.h 
>> b/sys/compat/linuxkpi/common/include/linux/device.h
>> index 00c55b31b248..912be8fbae8b 100644
>> --- a/sys/compat/linuxkpi/common/include/linux/device.h
>> +++ b/sys/compat/linuxkpi/common/include/linux/device.h
>> @@ -701,4 +701,8 @@ int lkpi_devm_add_action_or_reset(struct device *dev, void 
>> (*action)(void *), vo
>> #define    devm_add_action_or_reset(dev, action, data)    \
>>     lkpi_devm_add_action_or_reset(dev, action, data)
>>
>> +int lkpi_devm_device_add_group(struct device *dev, const struct 
>> attribute_group *group);
>> +#define    devm_device_add_group(dev, group)    \
>> +    lkpi_devm_device_add_group(dev, group)
> 
> I thought we would use linuxkpi_ as prefix for publicly exposed LinuxKPI
> related functions and lkpi_ for "internal" FreeBSD specific code which
> does not follow Linux KPI?
> 

And I thought that we use lkpi_ as HPS told me that once.
And really if we take a look at sys/compat/linuxkpi/common/src

% grep ^linux_ * | wc -l
      247
% grep ^lkpi_ * | wc -l
      228
% grep ^linuxkpi_ * | wc -l
       99

lkpi_ is used twice more times.

I would prefer to use lkpi_ as prefix for publicly exposed functions and _lkpi_ 
or __lkpi_ for internal code as lkpi is four symbols shorter.


> Can this be fixed before MFC?
> 

Yes if you insist on that.

-- 
WBR
Vladimir Kondratyev