[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 12 Dec 2023 15:14:17 +0000
From: Edward Cree <ecree.xilinx@...il.com>
To: Simon Horman <horms@...nel.org>, edward.cree@....com
Cc: linux-net-drivers@....com, davem@...emloft.net, kuba@...nel.org,
pabeni@...hat.com, edumazet@...gle.com, netdev@...r.kernel.org,
habetsm.xilinx@...il.com, Jonathan Cooper <jonathan.s.cooper@....com>
Subject: Re: [PATCH net-next 7/7] sfc: add debugfs node for filter table
contents
On 12/12/2023 13:58, Edward Cree wrote:
> On 11/12/2023 19:17, Simon Horman wrote:
>> On Mon, Dec 11, 2023 at 05:18:32PM +0000, edward.cree@....com wrote:
>>> @@ -63,6 +67,45 @@ void efx_fini_debugfs_nic(struct efx_nic *efx);
>>> int efx_init_debugfs(void);
>>> void efx_fini_debugfs(void);
>>>
>>> +void efx_debugfs_print_filter(char *s, size_t l, struct efx_filter_spec *spec);
>>> +
>>> +/* Generate operations for a debugfs node with a custom reader function.
>>> + * The reader should have signature int (*)(struct seq_file *s, void *data)
>>> + * where data is the pointer passed to EFX_DEBUGFS_CREATE_RAW.
>>> + */
>>> +#define EFX_DEBUGFS_RAW_PARAMETER(_reader) \
>>> + \
>>> +static int efx_debugfs_##_reader##_read(struct seq_file *s, void *d) \
>>> +{ \
>>> + return _reader(s, s->private); \
>>> +} \
>>> + \
>>> +static int efx_debugfs_##_reader##_open(struct inode *inode, struct file *f) \
>>> +{ \
>>> + return single_open(f, efx_debugfs_##_reader##_read, inode->i_private); \
>>> +} \
>>
>> Hi Edward,
>>
>> I think that probably the above should be static inline.
>
> Yep, in fact there are instances of this from patch 2 onwards (most
> of those aren't even static). Clearly I hadn't had enough sleep
> the day I wrote this :/
Or maybe it's *today* I haven't had enough sleep...
Unlike the functions in patches 2-4, which are stubs for the
CONFIG_DEBUG_FS=n build, these functions should *not* be "static
inline", because they are intended to be referenced from ops
structs or passed as callbacks.
The check on patchwork is actually a false positive here, because
this is not a function that's defined in the header file. It's
part of the body of a *macro*, EFX_DEBUGFS_RAW_PARAMETER.
Functions are only defined when some C file expands the macro.
I will update the commit message to call out and explain this; I
believe the code is actually fine.
-ed
Powered by blists - more mailing lists