2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-27 14:43:58 +08:00
linux-next/net/ieee802154/trace.h
Greg Kroah-Hartman b24413180f License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.

By default all files without license information are under the default
license of the kernel, which is GPL version 2.

Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier.  The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.

This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.

How this work was done:

Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
 - file had no licensing information it it.
 - file was a */uapi/* one with no licensing information in it,
 - file was a */uapi/* one with existing licensing information,

Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.

The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne.  Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.

The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed.  Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.

Criteria used to select files for SPDX license identifier tagging was:
 - Files considered eligible had to be source code files.
 - Make and config files were included as candidates if they contained >5
   lines of source
 - File already had some variant of a license header in it (even if <5
   lines).

All documentation files were explicitly excluded.

The following heuristics were used to determine which SPDX license
identifiers to apply.

 - when both scanners couldn't find any license traces, file was
   considered to have no license information in it, and the top level
   COPYING file license applied.

   For non */uapi/* files that summary was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0                                              11139

   and resulted in the first patch in this series.

   If that file was a */uapi/* path one, it was "GPL-2.0 WITH
   Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0 WITH Linux-syscall-note                        930

   and resulted in the second patch in this series.

 - if a file had some form of licensing information in it, and was one
   of the */uapi/* ones, it was denoted with the Linux-syscall-note if
   any GPL family license was found in the file or had no licensing in
   it (per prior point).  Results summary:

   SPDX license identifier                            # files
   ---------------------------------------------------|------
   GPL-2.0 WITH Linux-syscall-note                       270
   GPL-2.0+ WITH Linux-syscall-note                      169
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
   LGPL-2.1+ WITH Linux-syscall-note                      15
   GPL-1.0+ WITH Linux-syscall-note                       14
   ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
   LGPL-2.0+ WITH Linux-syscall-note                       4
   LGPL-2.1 WITH Linux-syscall-note                        3
   ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
   ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1

   and that resulted in the third patch in this series.

 - when the two scanners agreed on the detected license(s), that became
   the concluded license(s).

 - when there was disagreement between the two scanners (one detected a
   license but the other didn't, or they both detected different
   licenses) a manual inspection of the file occurred.

 - In most cases a manual inspection of the information in the file
   resulted in a clear resolution of the license that should apply (and
   which scanner probably needed to revisit its heuristics).

 - When it was not immediately clear, the license identifier was
   confirmed with lawyers working with the Linux Foundation.

 - If there was any question as to the appropriate license identifier,
   the file was flagged for further research and to be revisited later
   in time.

In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.

Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights.  The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.

Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.

In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.

Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
 - a full scancode scan run, collecting the matched texts, detected
   license ids and scores
 - reviewing anything where there was a license detected (about 500+
   files) to ensure that the applied SPDX license was correct
 - reviewing anything where there was no detection but the patch license
   was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
   SPDX license was correct

This produced a worksheet with 20 files needing minor correction.  This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.

These .csv files were then reviewed by Greg.  Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected.  This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.)  Finally Greg ran the script using the .csv files to
generate the patches.

Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-02 11:10:55 +01:00

320 lines
8.2 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
/* Based on net/wireless/trace.h */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM cfg802154
#if !defined(__RDEV_CFG802154_OPS_TRACE) || defined(TRACE_HEADER_MULTI_READ)
#define __RDEV_CFG802154_OPS_TRACE
#include <linux/tracepoint.h>
#include <net/cfg802154.h>
#define MAXNAME 32
#define WPAN_PHY_ENTRY __array(char, wpan_phy_name, MAXNAME)
#define WPAN_PHY_ASSIGN strlcpy(__entry->wpan_phy_name, \
wpan_phy_name(wpan_phy), \
MAXNAME)
#define WPAN_PHY_PR_FMT "%s"
#define WPAN_PHY_PR_ARG __entry->wpan_phy_name
#define WPAN_DEV_ENTRY __field(u32, identifier)
#define WPAN_DEV_ASSIGN (__entry->identifier) = (!IS_ERR_OR_NULL(wpan_dev) \
? wpan_dev->identifier : 0)
#define WPAN_DEV_PR_FMT "wpan_dev(%u)"
#define WPAN_DEV_PR_ARG (__entry->identifier)
#define WPAN_CCA_ENTRY __field(enum nl802154_cca_modes, cca_mode) \
__field(enum nl802154_cca_opts, cca_opt)
#define WPAN_CCA_ASSIGN \
do { \
(__entry->cca_mode) = cca->mode; \
(__entry->cca_opt) = cca->opt; \
} while (0)
#define WPAN_CCA_PR_FMT "cca_mode: %d, cca_opt: %d"
#define WPAN_CCA_PR_ARG __entry->cca_mode, __entry->cca_opt
#define BOOL_TO_STR(bo) (bo) ? "true" : "false"
/*************************************************************
* rdev->ops traces *
*************************************************************/
DECLARE_EVENT_CLASS(wpan_phy_only_evt,
TP_PROTO(struct wpan_phy *wpan_phy),
TP_ARGS(wpan_phy),
TP_STRUCT__entry(
WPAN_PHY_ENTRY
),
TP_fast_assign(
WPAN_PHY_ASSIGN;
),
TP_printk(WPAN_PHY_PR_FMT, WPAN_PHY_PR_ARG)
);
DEFINE_EVENT(wpan_phy_only_evt, 802154_rdev_suspend,
TP_PROTO(struct wpan_phy *wpan_phy),
TP_ARGS(wpan_phy)
);
DEFINE_EVENT(wpan_phy_only_evt, 802154_rdev_resume,
TP_PROTO(struct wpan_phy *wpan_phy),
TP_ARGS(wpan_phy)
);
TRACE_EVENT(802154_rdev_add_virtual_intf,
TP_PROTO(struct wpan_phy *wpan_phy, char *name,
enum nl802154_iftype type, __le64 extended_addr),
TP_ARGS(wpan_phy, name, type, extended_addr),
TP_STRUCT__entry(
WPAN_PHY_ENTRY
__string(vir_intf_name, name ? name : "<noname>")
__field(enum nl802154_iftype, type)
__field(__le64, extended_addr)
),
TP_fast_assign(
WPAN_PHY_ASSIGN;
__assign_str(vir_intf_name, name ? name : "<noname>");
__entry->type = type;
__entry->extended_addr = extended_addr;
),
TP_printk(WPAN_PHY_PR_FMT ", virtual intf name: %s, type: %d, extended addr: 0x%llx",
WPAN_PHY_PR_ARG, __get_str(vir_intf_name), __entry->type,
__le64_to_cpu(__entry->extended_addr))
);
TRACE_EVENT(802154_rdev_del_virtual_intf,
TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev),
TP_ARGS(wpan_phy, wpan_dev),
TP_STRUCT__entry(
WPAN_PHY_ENTRY
WPAN_DEV_ENTRY
),
TP_fast_assign(
WPAN_PHY_ASSIGN;
WPAN_DEV_ASSIGN;
),
TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT, WPAN_PHY_PR_ARG,
WPAN_DEV_PR_ARG)
);
TRACE_EVENT(802154_rdev_set_channel,
TP_PROTO(struct wpan_phy *wpan_phy, u8 page, u8 channel),
TP_ARGS(wpan_phy, page, channel),
TP_STRUCT__entry(
WPAN_PHY_ENTRY
__field(u8, page)
__field(u8, channel)
),
TP_fast_assign(
WPAN_PHY_ASSIGN;
__entry->page = page;
__entry->channel = channel;
),
TP_printk(WPAN_PHY_PR_FMT ", page: %d, channel: %d", WPAN_PHY_PR_ARG,
__entry->page, __entry->channel)
);
TRACE_EVENT(802154_rdev_set_tx_power,
TP_PROTO(struct wpan_phy *wpan_phy, s32 power),
TP_ARGS(wpan_phy, power),
TP_STRUCT__entry(
WPAN_PHY_ENTRY
__field(s32, power)
),
TP_fast_assign(
WPAN_PHY_ASSIGN;
__entry->power = power;
),
TP_printk(WPAN_PHY_PR_FMT ", mbm: %d", WPAN_PHY_PR_ARG,
__entry->power)
);
TRACE_EVENT(802154_rdev_set_cca_mode,
TP_PROTO(struct wpan_phy *wpan_phy, const struct wpan_phy_cca *cca),
TP_ARGS(wpan_phy, cca),
TP_STRUCT__entry(
WPAN_PHY_ENTRY
WPAN_CCA_ENTRY
),
TP_fast_assign(
WPAN_PHY_ASSIGN;
WPAN_CCA_ASSIGN;
),
TP_printk(WPAN_PHY_PR_FMT ", " WPAN_CCA_PR_FMT, WPAN_PHY_PR_ARG,
WPAN_CCA_PR_ARG)
);
TRACE_EVENT(802154_rdev_set_cca_ed_level,
TP_PROTO(struct wpan_phy *wpan_phy, s32 ed_level),
TP_ARGS(wpan_phy, ed_level),
TP_STRUCT__entry(
WPAN_PHY_ENTRY
__field(s32, ed_level)
),
TP_fast_assign(
WPAN_PHY_ASSIGN;
__entry->ed_level = ed_level;
),
TP_printk(WPAN_PHY_PR_FMT ", ed level: %d", WPAN_PHY_PR_ARG,
__entry->ed_level)
);
DECLARE_EVENT_CLASS(802154_le16_template,
TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
__le16 le16arg),
TP_ARGS(wpan_phy, wpan_dev, le16arg),
TP_STRUCT__entry(
WPAN_PHY_ENTRY
WPAN_DEV_ENTRY
__field(__le16, le16arg)
),
TP_fast_assign(
WPAN_PHY_ASSIGN;
WPAN_DEV_ASSIGN;
__entry->le16arg = le16arg;
),
TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT ", pan id: 0x%04x",
WPAN_PHY_PR_ARG, WPAN_DEV_PR_ARG,
__le16_to_cpu(__entry->le16arg))
);
DEFINE_EVENT(802154_le16_template, 802154_rdev_set_pan_id,
TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
__le16 le16arg),
TP_ARGS(wpan_phy, wpan_dev, le16arg)
);
DEFINE_EVENT_PRINT(802154_le16_template, 802154_rdev_set_short_addr,
TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
__le16 le16arg),
TP_ARGS(wpan_phy, wpan_dev, le16arg),
TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT ", short addr: 0x%04x",
WPAN_PHY_PR_ARG, WPAN_DEV_PR_ARG,
__le16_to_cpu(__entry->le16arg))
);
TRACE_EVENT(802154_rdev_set_backoff_exponent,
TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
u8 min_be, u8 max_be),
TP_ARGS(wpan_phy, wpan_dev, min_be, max_be),
TP_STRUCT__entry(
WPAN_PHY_ENTRY
WPAN_DEV_ENTRY
__field(u8, min_be)
__field(u8, max_be)
),
TP_fast_assign(
WPAN_PHY_ASSIGN;
WPAN_DEV_ASSIGN;
__entry->min_be = min_be;
__entry->max_be = max_be;
),
TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT
", min be: %d, max be: %d", WPAN_PHY_PR_ARG,
WPAN_DEV_PR_ARG, __entry->min_be, __entry->max_be)
);
TRACE_EVENT(802154_rdev_set_csma_backoffs,
TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
u8 max_csma_backoffs),
TP_ARGS(wpan_phy, wpan_dev, max_csma_backoffs),
TP_STRUCT__entry(
WPAN_PHY_ENTRY
WPAN_DEV_ENTRY
__field(u8, max_csma_backoffs)
),
TP_fast_assign(
WPAN_PHY_ASSIGN;
WPAN_DEV_ASSIGN;
__entry->max_csma_backoffs = max_csma_backoffs;
),
TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT
", max csma backoffs: %d", WPAN_PHY_PR_ARG,
WPAN_DEV_PR_ARG, __entry->max_csma_backoffs)
);
TRACE_EVENT(802154_rdev_set_max_frame_retries,
TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
s8 max_frame_retries),
TP_ARGS(wpan_phy, wpan_dev, max_frame_retries),
TP_STRUCT__entry(
WPAN_PHY_ENTRY
WPAN_DEV_ENTRY
__field(s8, max_frame_retries)
),
TP_fast_assign(
WPAN_PHY_ASSIGN;
WPAN_DEV_ASSIGN;
__entry->max_frame_retries = max_frame_retries;
),
TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT
", max frame retries: %d", WPAN_PHY_PR_ARG,
WPAN_DEV_PR_ARG, __entry->max_frame_retries)
);
TRACE_EVENT(802154_rdev_set_lbt_mode,
TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
bool mode),
TP_ARGS(wpan_phy, wpan_dev, mode),
TP_STRUCT__entry(
WPAN_PHY_ENTRY
WPAN_DEV_ENTRY
__field(bool, mode)
),
TP_fast_assign(
WPAN_PHY_ASSIGN;
WPAN_DEV_ASSIGN;
__entry->mode = mode;
),
TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT
", lbt mode: %s", WPAN_PHY_PR_ARG,
WPAN_DEV_PR_ARG, BOOL_TO_STR(__entry->mode))
);
TRACE_EVENT(802154_rdev_set_ackreq_default,
TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
bool ackreq),
TP_ARGS(wpan_phy, wpan_dev, ackreq),
TP_STRUCT__entry(
WPAN_PHY_ENTRY
WPAN_DEV_ENTRY
__field(bool, ackreq)
),
TP_fast_assign(
WPAN_PHY_ASSIGN;
WPAN_DEV_ASSIGN;
__entry->ackreq = ackreq;
),
TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT
", ackreq default: %s", WPAN_PHY_PR_ARG,
WPAN_DEV_PR_ARG, BOOL_TO_STR(__entry->ackreq))
);
TRACE_EVENT(802154_rdev_return_int,
TP_PROTO(struct wpan_phy *wpan_phy, int ret),
TP_ARGS(wpan_phy, ret),
TP_STRUCT__entry(
WPAN_PHY_ENTRY
__field(int, ret)
),
TP_fast_assign(
WPAN_PHY_ASSIGN;
__entry->ret = ret;
),
TP_printk(WPAN_PHY_PR_FMT ", returned: %d", WPAN_PHY_PR_ARG,
__entry->ret)
);
#endif /* !__RDEV_CFG802154_OPS_TRACE || TRACE_HEADER_MULTI_READ */
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE trace
#include <trace/define_trace.h>