Re: [PATCH 10/17] tty: remove MODULE_LICENSE in non-modules

From: Nick Alcock
Date: Mon Mar 27 2023 - 06:47:20 EST


On 24 Mar 2023, Luis Chamberlain spake thusly:

> On Fri, Mar 24, 2023 at 03:29:00PM +0100, Greg Kroah-Hartman wrote:
>> Please put back the license bits that you removed, as it is not a good
>> idea to remove that if the file does not have a SPDX entry at the very
>> least.
>
> Nick, I've just dropped your series.

Thanks, that's much easier than getting all those reverts in.
(Presumably the bits taken by other people can all stay.)

> Please only re-submit only for
> files where the license is clear. The effort of clarifying licenses
> on files where one doesn't have an SPDX tag is welcomed but can take
> time and we'll need this anyway in the future to help later strive to
> see if we can automatically generate the MODULE_LICENSE() from the
> SPDX tags.

For now, I have an alternative that might be acceptable. I did a bit of
an audit and it's all a right mess (see below), with wild divergence
even when SPDX is present, GPL versus -only or GPL-2.0+ apparently
applied almost at random and some things being completely different (in
some cases they were both committed simultaneously and were inconsistent
from the moment the module was written). So many things are inconsistent
that kallmodsyms would call a lot of things modules that really aren't:
there is enough error that there probably be noticeable mistakes in
quite a high percentage of kernels.

But... for our purposes, we don't actually *mind* if non-modules list
things like licenses inconsistently in two different places. Removing
MODULE_LICENSE was a means, not an end. What we're actually interested
in doing is removing .modinfo in things that can't possibly be modules,
and since a .modinfo in a guaranteed-non-module is at best entirely
useless I don't think anyone could reasonably be opposed to that end
goal (though they might reasonably be unhappy about all the churn
involved in getting there). They object to the removal of the visible
MODULE_LICENSE() argument text string, not to the useless compile-time
effect of a MODULE_LICENSE in a non-module.

So how about, for the first three groups below (the groups where
MODULE_LICENSE and SPDX are inconsistent, or where a SPDX simply doesn't
exist), instead of removing the MODULE_LICENSE we replace it with an
identical call to a new macro named perhaps NONMODULE_LICENSE(), which
is defined in module.h as simply expanding to nothing, except possibly
emitting a compile-time error if it's ever used in a module? This more
clearly denotes what's going on, keeps the license string in the source
file on a nearly identical line (for whatever purpose it serves), drops
the spurious .modinfo that's causing trouble, and probably makes fewer
people unhappy?

(I'm probably missing something, but the only reason I can see for being
unhappy with this change is if you think the actual text string
MODULE_LICENSE has some sort of legal force that NONMODULE_LICENSE would
not have. Speaking as a genuine non-lawyer, the only argument anyone
could have for that would be customary use, I'd think; and in *that*
case we can fix it without even changing the MODULE_LICENSE text string
by introducing a #define at the top of each affected file which
redefines MODULE_LICENSE() to nothing for that file. But that's ugly: I
think I'd prefer NONMODULE_LICENSE().)

... does that seem more reasonable?


Anyway, the audit of licenses in files touched by (the remainig files
in) this series. Here are the instances that don't fit what seems to be
the usual rule:

arch/x86/crypto/blake2s-glue.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0 OR MIT
arch/x86/mm/debug_pagetables.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0-only
drivers/bus/intel-ixp4xx-eb.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0-only
drivers/bus/qcom-ebi2.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0-only
drivers/clk/clk-bm1880.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0+
drivers/firmware/broadcom/bcm47xx_nvram.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0-or-later
drivers/firmware/imx/imx-scu.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0+
drivers/firmware/imx/scu-pd.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0+
drivers/irqchip/irq-mbigen.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0-only
drivers/irqchip/irq-renesas-rzg2l.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0
drivers/irqchip/irq-sl28cpld.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0-only
drivers/pinctrl/mediatek/pinctrl-mt8188.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0
drivers/pinctrl/mediatek/pinctrl-mt8365.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0
drivers/pinctrl/renesas/pinctrl-rzv2m.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0
drivers/power/reset/gpio-restart.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0-only
drivers/power/reset/ltc2952-poweroff.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0-or-later
drivers/power/supply/wm97xx_battery.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0-only
drivers/reset/reset-lantiq.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0-only
drivers/reset/reset-microchip-sparx5.c: ML: MODULE_LICENSE("Dual MIT/GPL"); SPDX: GPL-2.0+
drivers/reset/reset-mpfs.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0-only
drivers/soc/apple/apple-pmgr-pwrstate.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0-only OR MIT
drivers/soc/tegra/cbb/tegra194-cbb.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0
drivers/soc/tegra/cbb/tegra234-cbb.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0
drivers/tty/n_null.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0
drivers/video/fbdev/vesafb.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0-only
drivers/xen/grant-dma-ops.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0-only
fs/binfmt_elf.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0-only
fs/nfs_common/nfs_ssc.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0-only
kernel/dma/map_benchmark.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0-only
kernel/events/hw_breakpoint_test.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0
kernel/trace/rv/reactor_panic.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0
kernel/trace/rv/reactor_printk.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0
kernel/watch_queue.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0
lib/btree.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0-only
lib/crypto/blake2s-generic.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0 OR MIT
lib/crypto/blake2s.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0 OR MIT
mm/zpool.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0-only

Here's the subset of that that isn't just GPL-versus-v2 mismatches, all
MIT-versus-GPL in different directions:

arch/x86/crypto/blake2s-glue.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0 OR MIT
drivers/reset/reset-microchip-sparx5.c: ML: MODULE_LICENSE("Dual MIT/GPL"); SPDX: GPL-2.0+
drivers/soc/apple/apple-pmgr-pwrstate.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0-only OR MIT
lib/crypto/blake2s-generic.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0 OR MIT
lib/crypto/blake2s.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0 OR MIT

Here are the ones that don't have SPDX at all:

drivers/bus/arm-cci.c: ML: MODULE_LICENSE("GPL"); SPDX:
drivers/bus/imx-weim.c: ML: MODULE_LICENSE("GPL"); SPDX:
drivers/bus/simple-pm-bus.c: ML: MODULE_LICENSE("GPL v2"); SPDX:
drivers/gpu/drm/drm_mipi_dsi.c: ML: MODULE_LICENSE("GPL and additional rights"); SPDX:
drivers/reset/reset-axs10x.c: ML: MODULE_LICENSE("GPL v2"); SPDX:
drivers/reset/reset-hsdk.c: ML: MODULE_LICENSE("GPL v2"); SPDX:
drivers/video/console/vgacon.c: ML: MODULE_LICENSE("GPL"); SPDX:
drivers/video/fbdev/asiliantfb.c: ML: MODULE_LICENSE("GPL"); SPDX:
drivers/video/fbdev/gbefb.c: ML: MODULE_LICENSE("GPL"); SPDX:
drivers/video/fbdev/imsttfb.c: ML: MODULE_LICENSE("GPL"); SPDX:
drivers/xen/xenbus/xenbus_probe.c: ML: MODULE_LICENSE("GPL"); SPDX:
lib/glob.c: ML: MODULE_LICENSE("Dual MIT/GPL"); SPDX:

Here are all the others (verified largely by eye, so there might be a
few errors) -- the majority, but only just:

crypto/asymmetric_keys/asymmetric_type.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0-or-later
drivers/accessibility/braille/braille_console.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0-or-later
drivers/amba/tegra-ahb.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0-only
drivers/android/binder.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0-only
drivers/bus/arm-integrator-lm.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0-only
drivers/bus/bt1-apb.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0-only
drivers/bus/bt1-axi.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0-only
drivers/bus/qcom-ssc-block-bus.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0-only
drivers/clk/microchip/clk-mpfs.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0-only
drivers/clk/renesas/renesas-cpg-mssr.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/clk/renesas/rzg2l-cpg.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/clocksource/em_sti.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0-only
drivers/clocksource/sh_cmt.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/clocksource/sh_mtu2.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/clocksource/sh_tmu.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/clocksource/timer-stm32-lp.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/clocksource/timer-tegra186.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0-only
drivers/clocksource/timer-ti-dm.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0+
drivers/dma-buf/heaps/cma_heap.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/dma-buf/heaps/system_heap.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/dma-buf/udmabuf.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/dma/ep93xx_dma.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0-or-later
drivers/dma/ipu/ipu_idmac.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0-only
drivers/dma/mv_xor_v2.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0-or-later
drivers/dma/sh/shdma-base.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/dma/stm32-dmamux.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0-only
drivers/dma/stm32-mdma.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0-only
drivers/edac/altera_edac.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/hwspinlock/hwspinlock_core.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/interconnect/core.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/iommu/sun50i-iommu.c: ML: MODULE_LICENSE("Dual BSD/GPL"); SPDX: (GPL-2.0-only OR BSD-2-Clause)
drivers/irqchip/irq-al-fic.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/irqchip/irq-ls-scfg-msi.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0-only
drivers/irqchip/irq-mchp-eic.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0-only
drivers/irqchip/irq-mvebu-pic.c: ML: MODULE_LICENSE("GPL v2"); SPDX:
drivers/irqchip/irq-renesas-intc-irqpin.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/irqchip/irq-renesas-irqc.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/irqchip/irq-renesas-rza1.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/irqchip/irq-ti-sci-inta.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/irqchip/irq-ti-sci-intr.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/mailbox/rockchip-mailbox.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0-only
drivers/mfd/altera-sysmgr.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/nvmem/core.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/perf/apple_m1_cpu_pmu.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/phy/intel/phy-intel-lgm-combo.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/pinctrl/actions/pinctrl-s500.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0+
drivers/pinctrl/actions/pinctrl-s700.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0+
drivers/pinctrl/actions/pinctrl-s900.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0+
drivers/pinctrl/bcm/pinctrl-ns.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/pinctrl/mediatek/pinctrl-mt8192.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/pinctrl/pinctrl-amd.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0-only
drivers/pinctrl/renesas/pinctrl-rza1.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/pinctrl/renesas/pinctrl-rza2.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/pinctrl/renesas/pinctrl-rzg2l.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/pinctrl/renesas/pinctrl-rzn1.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/power/reset/as3722-poweroff.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0-only
drivers/power/reset/gpio-poweroff.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0-only
drivers/power/reset/keystone-reset.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0-only
drivers/power/reset/mt6323-poweroff.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/power/reset/regulator-poweroff.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0-only
drivers/power/reset/restart-poweroff.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0-only
drivers/power/reset/tps65086-restart.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/power/supply/power_supply_core.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0-only
drivers/regulator/stm32-pwr.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
drivers/remoteproc/remoteproc_core.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0-only
drivers/soc/fujitsu/a64fx-diag.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0-only
drivers/tty/serial/imx_earlycon.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0+
drivers/tty/serial/rda-uart.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0+
drivers/video/fbdev/mmp/hw/mmp_ctrl.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0-or-later
drivers/video/fbdev/mmp/panel/tpo_tj032md01bw.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0-or-later
drivers/video/fbdev/wm8505fb.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0-only
drivers/video/fbdev/wmt_ge_rops.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0-only
fs/unicode/utf8-core.c: ML: MODULE_LICENSE("GPL v2"); SPDX: SPDX-License-Identifier: GPL-2.0
lib/pldmfw/pldmfw.c: ML: MODULE_LICENSE("GPL v2"); SPDX: GPL-2.0
lib/test_fprobe.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0-or-later
mm/zswap.c: ML: MODULE_LICENSE("GPL"); SPDX: GPL-2.0-or-later