All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antonio Quartulli <a@unstable.cc>
To: kuba@kernel.org
Cc: netdev@vger.kernel.org, donald.hunter@gmail.com,
	pabeni@redhat.com, davem@davemloft.net, edumazet@google.com,
	Antonio Quartulli <a@unstable.cc>
Subject: [PATCH] tools: ynl-gen: include auto-generated uAPI header only once
Date: Wed,  9 Oct 2024 14:12:35 +0200	[thread overview]
Message-ID: <20241009121235.4967-1-a@unstable.cc> (raw)

The auto-generated uAPI file is currently included in both the
.h and .c netlink stub files.
However, the .c file already includes its .h counterpart, thus
leading to a double inclusion of the uAPI header.

Prevent the double inclusion by including the uAPI header in the
.h stub file only.

Signed-off-by: Antonio Quartulli <a@unstable.cc>
---
 drivers/dpll/dpll_nl.c     | 2 --
 drivers/net/team/team_nl.c | 2 --
 fs/nfsd/netlink.c          | 2 --
 net/core/netdev-genl-gen.c | 1 -
 net/devlink/netlink_gen.c  | 2 --
 net/handshake/genl.c       | 2 --
 net/ipv4/fou_nl.c          | 2 --
 net/mptcp/mptcp_pm_gen.c   | 2 --
 tools/net/ynl/ynl-gen-c.py | 4 +++-
 9 files changed, 3 insertions(+), 16 deletions(-)

diff --git a/drivers/dpll/dpll_nl.c b/drivers/dpll/dpll_nl.c
index fe9b6893d261..9a739d9dcfbd 100644
--- a/drivers/dpll/dpll_nl.c
+++ b/drivers/dpll/dpll_nl.c
@@ -8,8 +8,6 @@
 
 #include "dpll_nl.h"
 
-#include <uapi/linux/dpll.h>
-
 /* Common nested types */
 const struct nla_policy dpll_pin_parent_device_nl_policy[DPLL_A_PIN_PHASE_OFFSET + 1] = {
 	[DPLL_A_PIN_PARENT_ID] = { .type = NLA_U32, },
diff --git a/drivers/net/team/team_nl.c b/drivers/net/team/team_nl.c
index 208424ab78f5..b00fec07a8ca 100644
--- a/drivers/net/team/team_nl.c
+++ b/drivers/net/team/team_nl.c
@@ -8,8 +8,6 @@
 
 #include "team_nl.h"
 
-#include <uapi/linux/if_team.h>
-
 /* Common nested types */
 const struct nla_policy team_attr_option_nl_policy[TEAM_ATTR_OPTION_ARRAY_INDEX + 1] = {
 	[TEAM_ATTR_OPTION_NAME] = { .type = NLA_STRING, .len = TEAM_STRING_MAX_LEN, },
diff --git a/fs/nfsd/netlink.c b/fs/nfsd/netlink.c
index ca54aa583530..c59264f71ef6 100644
--- a/fs/nfsd/netlink.c
+++ b/fs/nfsd/netlink.c
@@ -8,8 +8,6 @@
 
 #include "netlink.h"
 
-#include <uapi/linux/nfsd_netlink.h>
-
 /* Common nested types */
 const struct nla_policy nfsd_sock_nl_policy[NFSD_A_SOCK_TRANSPORT_NAME + 1] = {
 	[NFSD_A_SOCK_ADDR] = { .type = NLA_BINARY, },
diff --git a/net/core/netdev-genl-gen.c b/net/core/netdev-genl-gen.c
index b28424ae06d5..a5c6ca79c7a4 100644
--- a/net/core/netdev-genl-gen.c
+++ b/net/core/netdev-genl-gen.c
@@ -8,7 +8,6 @@
 
 #include "netdev-genl-gen.h"
 
-#include <uapi/linux/netdev.h>
 #include <linux/list.h>
 
 /* Integer value ranges */
diff --git a/net/devlink/netlink_gen.c b/net/devlink/netlink_gen.c
index f9786d51f68f..c65a82593e76 100644
--- a/net/devlink/netlink_gen.c
+++ b/net/devlink/netlink_gen.c
@@ -8,8 +8,6 @@
 
 #include "netlink_gen.h"
 
-#include <uapi/linux/devlink.h>
-
 /* Common nested types */
 const struct nla_policy devlink_dl_port_function_nl_policy[DEVLINK_PORT_FN_ATTR_CAPS + 1] = {
 	[DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR] = { .type = NLA_BINARY, },
diff --git a/net/handshake/genl.c b/net/handshake/genl.c
index f55d14d7b726..8d18c0a0ca04 100644
--- a/net/handshake/genl.c
+++ b/net/handshake/genl.c
@@ -8,8 +8,6 @@
 
 #include "genl.h"
 
-#include <uapi/linux/handshake.h>
-
 /* HANDSHAKE_CMD_ACCEPT - do */
 static const struct nla_policy handshake_accept_nl_policy[HANDSHAKE_A_ACCEPT_HANDLER_CLASS + 1] = {
 	[HANDSHAKE_A_ACCEPT_HANDLER_CLASS] = NLA_POLICY_MAX(NLA_U32, 2),
diff --git a/net/ipv4/fou_nl.c b/net/ipv4/fou_nl.c
index 98b90107b5ab..7d3e107eacda 100644
--- a/net/ipv4/fou_nl.c
+++ b/net/ipv4/fou_nl.c
@@ -8,8 +8,6 @@
 
 #include "fou_nl.h"
 
-#include <uapi/linux/fou.h>
-
 /* Global operation policy for fou */
 const struct nla_policy fou_nl_policy[FOU_ATTR_IFINDEX + 1] = {
 	[FOU_ATTR_PORT] = { .type = NLA_U16, },
diff --git a/net/mptcp/mptcp_pm_gen.c b/net/mptcp/mptcp_pm_gen.c
index c30a2a90a192..d85c4540d6e8 100644
--- a/net/mptcp/mptcp_pm_gen.c
+++ b/net/mptcp/mptcp_pm_gen.c
@@ -8,8 +8,6 @@
 
 #include "mptcp_pm_gen.h"
 
-#include <uapi/linux/mptcp_pm.h>
-
 /* Common nested types */
 const struct nla_policy mptcp_pm_address_nl_policy[MPTCP_PM_ADDR_ATTR_IF_IDX + 1] = {
 	[MPTCP_PM_ADDR_ATTR_FAMILY] = { .type = NLA_U16, },
diff --git a/tools/net/ynl/ynl-gen-c.py b/tools/net/ynl/ynl-gen-c.py
index 9e8254aad578..341be0a4bcb7 100755
--- a/tools/net/ynl/ynl-gen-c.py
+++ b/tools/net/ynl/ynl-gen-c.py
@@ -2683,7 +2683,9 @@ def main():
             if args.out_file:
                 cw.p(f'#include "{hdr_file}"')
             cw.nl()
-        headers = ['uapi/' + parsed.uapi_header]
+            headers = []
+        else:
+            headers = ['uapi/' + parsed.uapi_header]
         headers += parsed.kernel_family.get('headers', [])
     else:
         cw.p('#include <stdlib.h>')
-- 
2.45.2


             reply	other threads:[~2024-10-09 12:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-09 12:12 Antonio Quartulli [this message]
2024-10-09 12:50 ` [PATCH] tools: ynl-gen: include auto-generated uAPI header only once Jiri Pirko
2024-10-09 13:00   ` Antonio Quartulli
2024-10-09 13:37     ` Jiri Pirko
2024-10-09 13:53       ` Antonio Quartulli
2024-10-10  2:19 ` Jakub Kicinski

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=20241009121235.4967-1-a@unstable.cc \
    --to=a@unstable.cc \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.