Skip to contentSkip to conversation

tools: ynl: skip the explicit op array size when no needed

PATCH Applied Jakub Kicinski 2 participants 2 messages Mar 21, 2023 – Mar 22, 2023

Subsystems (3)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH 1/1 tools: ynl: skip the explicit op array size when no needed

Jiri suggests it reads more naturally to skip the explicit array size when possible. When we export the symbol we want to make sure that the size is right.

---
 net/core/netdev-genl-gen.c | 2 +-
 tools/net/ynl/ynl-gen-c.py | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)
net/core/netdev-genl-gen.c +1 -1
index 3abab70d66dd..de17ca2f7dbf 100644
@@ -16,7 +16,7 @@ static const struct nla_policy netdev_dev_get_nl_policy[NETDEV_A_DEV_IFINDEX + 1
 };
 
 /* Ops table for netdev */
-static const struct genl_split_ops netdev_nl_ops[2] = {
+static const struct genl_split_ops netdev_nl_ops[] = {
 	{
 		.cmd		= NETDEV_CMD_DEV_GET,
 		.doit		= netdev_nl_dev_get_doit,
tools/net/ynl/ynl-gen-c.py +3 -1
index c16671a02621..972b87c7aaaf 100755
@@ -1696,7 +1696,9 @@ _C_KW = {
                          'split': 'genl_split_ops'}
         struct_type = pol_to_struct[family.kernel_policy]
 
-        if family.kernel_policy == 'split':
+        if not exported:
+            cnt = ""
+        elif family.kernel_policy == 'split':
             cnt = 0
             for op in family.ops.values():
                 if 'do' in op:
Signature · 1 line
2.39.2
#1 lore raw
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Mon, 20 Mar 2023 21:41:59 -0700 you wrote:

Jiri suggests it reads more naturally to skip the explicit array size when possible. When we export the symbol we want to make sure that the size is right.

---
 net/core/netdev-genl-gen.c | 2 +-
 tools/net/ynl/ynl-gen-c.py | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

Here is the summary with links:
- [net-next] tools: ynl: skip the explicit op array size when no needed

    https://git.kernel.org/netdev/net-next/c/56c874f7dbca

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html