From: gregkh@linuxfoundation.org (Greg Kroah-Hartman)
To: cocci@systeme.lip6.fr
Subject: [Cocci] [Outreachy kernel] Re: [PATCH] net: usb: hso.c: remove unneeded DRIVER_LICENSE #define
Date: Thu, 23 Nov 2017 07:22:28 +0100 [thread overview]
Message-ID: <20171123062228.GB25861@kroah.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1711222220100.19477@hadrien>
On Wed, Nov 22, 2017 at 10:20:49PM +0100, Julia Lawall wrote:
>
>
> On Wed, 22 Nov 2017, Joe Perches wrote:
>
> > On Fri, 2017-11-17 at 15:19 +0100, Greg Kroah-Hartman wrote:
> > > There is no need to #define the license of the driver, just put it in
> > > the MODULE_LICENSE() line directly as a text string.
> > >
> > > This allows tools that check that the module license matches the source
> > > code license to work properly, as there is no need to unwind the
> > > unneeded dereference.
> > []
> > > diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
> > []
> > > @@ -76,7 +76,6 @@
> > >
> > > #define MOD_AUTHOR "Option Wireless"
> > > #define MOD_DESCRIPTION "USB High Speed Option driver"
> > > -#define MOD_LICENSE "GPL"
> > >
> > > #define HSO_MAX_NET_DEVICES 10
> > > #define HSO__MAX_MTU 2048
> > > @@ -3288,7 +3287,7 @@ module_exit(hso_exit);
> > >
> > > MODULE_AUTHOR(MOD_AUTHOR);
> > > MODULE_DESCRIPTION(MOD_DESCRIPTION);
> > > -MODULE_LICENSE(MOD_LICENSE);
> > > +MODULE_LICENSE("GPL");
> >
> > Probably all of these MODULE_<FOO>(MOD_<BAR>) uses could be
> > simplified as well.
> >
> > Perhaps there's utility in a (cocci?) script that looks for
> > used-once
> > macro #defines in various types of macros.
>
> What about module_version, eg:
>
> diff -u -p a/drivers/ata/pata_pdc202xx_old.c
> b/drivers/ata/pata_pdc202xx_old.c
> --- a/drivers/ata/pata_pdc202xx_old.c
> +++ b/drivers/ata/pata_pdc202xx_old.c
> @@ -21,7 +21,6 @@
> #include <linux/libata.h>
>
> #define DRV_NAME "pata_pdc202xx_old"
> -#define DRV_VERSION "0.4.3"
>
> static int pdc2026x_cable_detect(struct ata_port *ap)
> {
> @@ -389,4 +388,4 @@ MODULE_AUTHOR("Alan Cox");
> MODULE_DESCRIPTION("low-level driver for Promise 2024x and 20262-20267");
> MODULE_LICENSE("GPL");
> MODULE_DEVICE_TABLE(pci, pdc202xx);
> -MODULE_VERSION(DRV_VERSION);
> +MODULE_VERSION("0.4.3");
I've just deleted MODULE_VERSION() entirely from some subsystems, as
once the driver is in the kernel source tree, the "version" makes almost
no sense at all.
But I know some companies love incrementing it (some network and scsi
drivers specifically), so those might want to keep it around for some
odd reason.
thanks
greg k-h
WARNING: multiple messages have this Message-ID (diff)
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: Joe Perches <joe@perches.com>,
netdev@vger.kernel.org, cocci <cocci@systeme.lip6.fr>,
outreachy-kernel@googlegroups.com,
"David S. Miller" <davem@davemloft.net>,
Andreas Kemnade <andreas@kemnade.info>,
Johan Hovold <johan@kernel.org>,
linux-kernel@vger.kernel.org,
Philippe Ombredanne <pombredanne@nexb.com>,
linux-usb@vger.kernel.org
Subject: Re: [Outreachy kernel] Re: [PATCH] net: usb: hso.c: remove unneeded DRIVER_LICENSE #define
Date: Thu, 23 Nov 2017 07:22:28 +0100 [thread overview]
Message-ID: <20171123062228.GB25861@kroah.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1711222220100.19477@hadrien>
On Wed, Nov 22, 2017 at 10:20:49PM +0100, Julia Lawall wrote:
>
>
> On Wed, 22 Nov 2017, Joe Perches wrote:
>
> > On Fri, 2017-11-17 at 15:19 +0100, Greg Kroah-Hartman wrote:
> > > There is no need to #define the license of the driver, just put it in
> > > the MODULE_LICENSE() line directly as a text string.
> > >
> > > This allows tools that check that the module license matches the source
> > > code license to work properly, as there is no need to unwind the
> > > unneeded dereference.
> > []
> > > diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
> > []
> > > @@ -76,7 +76,6 @@
> > >
> > > #define MOD_AUTHOR "Option Wireless"
> > > #define MOD_DESCRIPTION "USB High Speed Option driver"
> > > -#define MOD_LICENSE "GPL"
> > >
> > > #define HSO_MAX_NET_DEVICES 10
> > > #define HSO__MAX_MTU 2048
> > > @@ -3288,7 +3287,7 @@ module_exit(hso_exit);
> > >
> > > MODULE_AUTHOR(MOD_AUTHOR);
> > > MODULE_DESCRIPTION(MOD_DESCRIPTION);
> > > -MODULE_LICENSE(MOD_LICENSE);
> > > +MODULE_LICENSE("GPL");
> >
> > Probably all of these MODULE_<FOO>(MOD_<BAR>) uses could be
> > simplified as well.
> >
> > Perhaps there's utility in a (cocci?) script that looks for
> > used-once
> > macro #defines in various types of macros.
>
> What about module_version, eg:
>
> diff -u -p a/drivers/ata/pata_pdc202xx_old.c
> b/drivers/ata/pata_pdc202xx_old.c
> --- a/drivers/ata/pata_pdc202xx_old.c
> +++ b/drivers/ata/pata_pdc202xx_old.c
> @@ -21,7 +21,6 @@
> #include <linux/libata.h>
>
> #define DRV_NAME "pata_pdc202xx_old"
> -#define DRV_VERSION "0.4.3"
>
> static int pdc2026x_cable_detect(struct ata_port *ap)
> {
> @@ -389,4 +388,4 @@ MODULE_AUTHOR("Alan Cox");
> MODULE_DESCRIPTION("low-level driver for Promise 2024x and 20262-20267");
> MODULE_LICENSE("GPL");
> MODULE_DEVICE_TABLE(pci, pdc202xx);
> -MODULE_VERSION(DRV_VERSION);
> +MODULE_VERSION("0.4.3");
I've just deleted MODULE_VERSION() entirely from some subsystems, as
once the driver is in the kernel source tree, the "version" makes almost
no sense at all.
But I know some companies love incrementing it (some network and scsi
drivers specifically), so those might want to keep it around for some
odd reason.
thanks
greg k-h
WARNING: multiple messages have this Message-ID (diff)
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: netdev@vger.kernel.org, linux-usb@vger.kernel.org,
Johan Hovold <johan@kernel.org>, cocci <cocci@systeme.lip6.fr>,
outreachy-kernel@googlegroups.com,
Andreas Kemnade <andreas@kemnade.info>,
Philippe Ombredanne <pombredanne@nexb.com>,
Joe Perches <joe@perches.com>,
"David S. Miller" <davem@davemloft.net>,
linux-kernel@vger.kernel.org
Subject: Re: [Outreachy kernel] Re: [PATCH] net: usb: hso.c: remove unneeded DRIVER_LICENSE #define
Date: Thu, 23 Nov 2017 07:22:28 +0100 [thread overview]
Message-ID: <20171123062228.GB25861@kroah.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1711222220100.19477@hadrien>
On Wed, Nov 22, 2017 at 10:20:49PM +0100, Julia Lawall wrote:
>
>
> On Wed, 22 Nov 2017, Joe Perches wrote:
>
> > On Fri, 2017-11-17 at 15:19 +0100, Greg Kroah-Hartman wrote:
> > > There is no need to #define the license of the driver, just put it in
> > > the MODULE_LICENSE() line directly as a text string.
> > >
> > > This allows tools that check that the module license matches the source
> > > code license to work properly, as there is no need to unwind the
> > > unneeded dereference.
> > []
> > > diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
> > []
> > > @@ -76,7 +76,6 @@
> > >
> > > #define MOD_AUTHOR "Option Wireless"
> > > #define MOD_DESCRIPTION "USB High Speed Option driver"
> > > -#define MOD_LICENSE "GPL"
> > >
> > > #define HSO_MAX_NET_DEVICES 10
> > > #define HSO__MAX_MTU 2048
> > > @@ -3288,7 +3287,7 @@ module_exit(hso_exit);
> > >
> > > MODULE_AUTHOR(MOD_AUTHOR);
> > > MODULE_DESCRIPTION(MOD_DESCRIPTION);
> > > -MODULE_LICENSE(MOD_LICENSE);
> > > +MODULE_LICENSE("GPL");
> >
> > Probably all of these MODULE_<FOO>(MOD_<BAR>) uses could be
> > simplified as well.
> >
> > Perhaps there's utility in a (cocci?) script that looks for
> > used-once
> > macro #defines in various types of macros.
>
> What about module_version, eg:
>
> diff -u -p a/drivers/ata/pata_pdc202xx_old.c
> b/drivers/ata/pata_pdc202xx_old.c
> --- a/drivers/ata/pata_pdc202xx_old.c
> +++ b/drivers/ata/pata_pdc202xx_old.c
> @@ -21,7 +21,6 @@
> #include <linux/libata.h>
>
> #define DRV_NAME "pata_pdc202xx_old"
> -#define DRV_VERSION "0.4.3"
>
> static int pdc2026x_cable_detect(struct ata_port *ap)
> {
> @@ -389,4 +388,4 @@ MODULE_AUTHOR("Alan Cox");
> MODULE_DESCRIPTION("low-level driver for Promise 2024x and 20262-20267");
> MODULE_LICENSE("GPL");
> MODULE_DEVICE_TABLE(pci, pdc202xx);
> -MODULE_VERSION(DRV_VERSION);
> +MODULE_VERSION("0.4.3");
I've just deleted MODULE_VERSION() entirely from some subsystems, as
once the driver is in the kernel source tree, the "version" makes almost
no sense at all.
But I know some companies love incrementing it (some network and scsi
drivers specifically), so those might want to keep it around for some
odd reason.
thanks
greg k-h
next prev parent reply other threads:[~2017-11-23 6:22 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-17 14:19 [PATCH] net: usb: hso.c: remove unneeded DRIVER_LICENSE #define Greg Kroah-Hartman
2017-11-17 14:52 ` Philippe Ombredanne
2017-11-17 14:52 ` Philippe Ombredanne
2017-11-18 1:37 ` David Miller
2017-11-18 1:37 ` David Miller
2017-11-22 17:05 ` [Cocci] " Joe Perches
2017-11-22 17:05 ` Joe Perches
2017-11-22 17:12 ` [Cocci] " Greg Kroah-Hartman
2017-11-22 17:12 ` Greg Kroah-Hartman
2017-11-23 23:30 ` [Cocci] " Joe Perches
2017-11-23 23:30 ` Joe Perches
2017-11-24 0:25 ` [Cocci] " Joe Perches
2017-11-24 0:25 ` Joe Perches
2017-11-22 17:21 ` [Cocci] [Outreachy kernel] " Julia Lawall
2017-11-22 17:21 ` Julia Lawall
2017-11-22 17:21 ` Julia Lawall
2017-11-22 21:20 ` [Cocci] " Julia Lawall
2017-11-22 21:20 ` Julia Lawall
2017-11-22 21:20 ` Julia Lawall
2017-11-23 6:22 ` Greg Kroah-Hartman [this message]
2017-11-23 6:22 ` Greg Kroah-Hartman
2017-11-23 6:22 ` Greg Kroah-Hartman
2017-11-23 7:31 ` [Cocci] " Julia Lawall
2017-11-23 7:31 ` Julia Lawall
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=20171123062228.GB25861@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=cocci@systeme.lip6.fr \
/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.