* [PATCH 0/1] Input: inline macros for MODULE_LICENSE, etc
@ 2017-12-26 17:05 Julia Lawall
2017-12-26 17:05 ` [PATCH 1/1] " Julia Lawall
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Julia Lawall @ 2017-12-26 17:05 UTC (permalink / raw)
To: Dmitry Torokhov, linux-kernel
Cc: kernel-janitors, linux-input, Greg Kroah-Hartman
Inline macro for MODULE_LICENSE to make the license information easy to
find, eg with grep. Inline the other module-related macros at the same
time.
The complete semantic patch is as follows: (http://coccinelle.lip6.fr/)
// <smpl>
@q@
declarer name MODULE_LICENSE;
identifier i;
constant c;
position p;
@@
MODULE_LICENSE(c@i@p);
@r depends on q@
declarer name MODULE_AUTHOR, MODULE_DESCRIPTION, MODULE_VERSION;
identifier i;
constant c;
position p;
@@
(
MODULE_AUTHOR(c@i@p);
|
MODULE_DESCRIPTION(c@i@p);
|
MODULE_LICENSE(c@i@p);
|
MODULE_VERSION(c@i@p);
)
@other@
identifier r.i;
position p != r.p;
@@
i@p
@s depends on !other@
identifier r.i;
expression e;
@@
#define i e
@@
identifier r.i;
position r.p;
expression s.e;
@@
(
MODULE_AUTHOR(
- i@p
+ e
);
|
MODULE_DESCRIPTION(
- i@p
+ e
);
|
MODULE_LICENSE(
- i@p
+ e
);
|
MODULE_VERSION(
- i@p
+ e
);
)
@@
identifier r.i;
expression s.e;
@@
-#define i e
// </smpl>
---
drivers/input/misc/keyspan_remote.c | 9 +++------
drivers/input/tablet/acecad.c | 9 +++------
drivers/input/tablet/hanwang.c | 10 +++-------
drivers/input/tablet/kbtab.c | 9 +++------
4 files changed, 12 insertions(+), 25 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/1] Input: inline macros for MODULE_LICENSE, etc
2017-12-26 17:05 [PATCH 0/1] Input: inline macros for MODULE_LICENSE, etc Julia Lawall
@ 2017-12-26 17:05 ` Julia Lawall
2017-12-26 17:52 ` [PATCH 0/1] " Joe Perches
2017-12-26 18:04 ` Joe Perches
2 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2017-12-26 17:05 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: kernel-janitors, linux-input, linux-kernel, Greg Kroah-Hartman
Inline macro for MODULE_LICENSE to make the license information easy to
find, eg with grep. Inline the other module-related macros at the same
time.
A simplified version of the semantic patch for the MODULE_LICENSE
case is as follows: (http://coccinelle.lip6.fr/)
// <smpl>
@s@
identifier i; expression e;
@@
#define i e
@@
declarer name MODULE_LICENSE;
identifier s.i;
expression s.e;
@@
MODULE_LICENSE(
- i
+ e
);
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/input/misc/keyspan_remote.c | 9 +++------
drivers/input/tablet/acecad.c | 9 +++------
drivers/input/tablet/hanwang.c | 10 +++-------
drivers/input/tablet/kbtab.c | 9 +++------
4 files changed, 12 insertions(+), 25 deletions(-)
diff --git a/drivers/input/misc/keyspan_remote.c b/drivers/input/misc/keyspan_remote.c
index 77c47d6..594d2f84 100644
--- a/drivers/input/misc/keyspan_remote.c
+++ b/drivers/input/misc/keyspan_remote.c
@@ -18,9 +18,6 @@
#include <linux/usb/input.h>
#define DRIVER_VERSION "v0.1"
-#define DRIVER_AUTHOR "Michael Downey <downey@zymeta.com>"
-#define DRIVER_DESC "Driver for the USB Keyspan remote control."
-#define DRIVER_LICENSE "GPL"
/* Parameters that can be passed to the driver. */
static int debug;
@@ -590,6 +587,6 @@ static void keyspan_disconnect(struct usb_interface *interface)
module_usb_driver(keyspan_driver);
MODULE_DEVICE_TABLE(usb, keyspan_table);
-MODULE_AUTHOR(DRIVER_AUTHOR);
-MODULE_DESCRIPTION(DRIVER_DESC);
-MODULE_LICENSE(DRIVER_LICENSE);
+MODULE_AUTHOR("Michael Downey <downey@zymeta.com>");
+MODULE_DESCRIPTION("Driver for the USB Keyspan remote control.");
+MODULE_LICENSE("GPL");
diff --git a/drivers/input/tablet/acecad.c b/drivers/input/tablet/acecad.c
index aebb3f9..4b68549 100644
--- a/drivers/input/tablet/acecad.c
+++ b/drivers/input/tablet/acecad.c
@@ -34,13 +34,10 @@
* Version Information
*/
#define DRIVER_VERSION "v3.2"
-#define DRIVER_DESC "USB Acecad Flair tablet driver"
-#define DRIVER_LICENSE "GPL"
-#define DRIVER_AUTHOR "Edouard TISSERANT <edouard.tisserant@wanadoo.fr>"
-MODULE_AUTHOR(DRIVER_AUTHOR);
-MODULE_DESCRIPTION(DRIVER_DESC);
-MODULE_LICENSE(DRIVER_LICENSE);
+MODULE_AUTHOR("Edouard TISSERANT <edouard.tisserant@wanadoo.fr>");
+MODULE_DESCRIPTION("USB Acecad Flair tablet driver");
+MODULE_LICENSE("GPL");
#define USB_VENDOR_ID_ACECAD 0x0460
#define USB_DEVICE_ID_FLAIR 0x0004
diff --git a/drivers/input/tablet/hanwang.c b/drivers/input/tablet/hanwang.c
index df4bea9..4042c41 100644
--- a/drivers/input/tablet/hanwang.c
+++ b/drivers/input/tablet/hanwang.c
@@ -28,13 +28,9 @@
#include <linux/module.h>
#include <linux/usb/input.h>
-#define DRIVER_AUTHOR "Xing Wei <weixing@hanwang.com.cn>"
-#define DRIVER_DESC "USB Hanwang tablet driver"
-#define DRIVER_LICENSE "GPL"
-
-MODULE_AUTHOR(DRIVER_AUTHOR);
-MODULE_DESCRIPTION(DRIVER_DESC);
-MODULE_LICENSE(DRIVER_LICENSE);
+MODULE_AUTHOR("Xing Wei <weixing@hanwang.com.cn>");
+MODULE_DESCRIPTION("USB Hanwang tablet driver");
+MODULE_LICENSE("GPL");
#define USB_VENDOR_ID_HANWANG 0x0b57
#define HANWANG_TABLET_INT_CLASS 0x0003
diff --git a/drivers/input/tablet/kbtab.c b/drivers/input/tablet/kbtab.c
index a41c3ff..831fbec 100644
--- a/drivers/input/tablet/kbtab.c
+++ b/drivers/input/tablet/kbtab.c
@@ -13,13 +13,10 @@
*/
#define DRIVER_VERSION "v0.0.2"
-#define DRIVER_AUTHOR "Josh Myer <josh@joshisanerd.com>"
-#define DRIVER_DESC "USB KB Gear JamStudio Tablet driver"
-#define DRIVER_LICENSE "GPL"
-MODULE_AUTHOR(DRIVER_AUTHOR);
-MODULE_DESCRIPTION(DRIVER_DESC);
-MODULE_LICENSE(DRIVER_LICENSE);
+MODULE_AUTHOR("Josh Myer <josh@joshisanerd.com>");
+MODULE_DESCRIPTION("USB KB Gear JamStudio Tablet driver");
+MODULE_LICENSE("GPL");
#define USB_VENDOR_ID_KBGEAR 0x084e
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/1] Input: inline macros for MODULE_LICENSE, etc
2017-12-26 17:05 [PATCH 0/1] Input: inline macros for MODULE_LICENSE, etc Julia Lawall
2017-12-26 17:05 ` [PATCH 1/1] " Julia Lawall
@ 2017-12-26 17:52 ` Joe Perches
2017-12-26 17:56 ` Julia Lawall
2017-12-26 18:04 ` Joe Perches
2 siblings, 1 reply; 6+ messages in thread
From: Joe Perches @ 2017-12-26 17:52 UTC (permalink / raw)
To: Julia Lawall, Dmitry Torokhov, linux-kernel
Cc: kernel-janitors, linux-input, Greg Kroah-Hartman
On Tue, 2017-12-26 at 18:05 +0100, Julia Lawall wrote:
> Inline macro for MODULE_LICENSE to make the license information easy to
> find, eg with grep. Inline the other module-related macros at the same
> time.
>
> The complete semantic patch is as follows: (http://coccinelle.lip6.fr/)
>
> // <smpl>
> @q@
> declarer name MODULE_LICENSE;
> identifier i;
> constant c;
> position p;
> @@
>
> MODULE_LICENSE(c@i@p);
>
> @r depends on q@
> declarer name MODULE_AUTHOR, MODULE_DESCRIPTION, MODULE_VERSION;
> identifier i;
> constant c;
> position p;
> @@
>
> (
> MODULE_AUTHOR(c@i@p);
> >
>
> MODULE_DESCRIPTION(c@i@p);
> >
>
> MODULE_LICENSE(c@i@p);
> >
>
> MODULE_VERSION(c@i@p);
> )
>
> @other@
> identifier r.i;
> position p != r.p;
> @@
>
> i@p
>
> @s depends on !other@
> identifier r.i;
> expression e;
> @@
>
> #define i e
>
> @@
> identifier r.i;
> position r.p;
> expression s.e;
> @@
>
> (
> MODULE_AUTHOR(
> - i@p
> + e
> );
> >
>
> MODULE_DESCRIPTION(
> - i@p
> + e
> );
> >
>
> MODULE_LICENSE(
> - i@p
> + e
> );
> >
>
> MODULE_VERSION(
> - i@p
> + e
> );
> )
>
> @@
> identifier r.i;
> expression s.e;
> @@
>
> -#define i e
> // </smpl>
What assures that the #define is only used by
MODULE_<FOO> and is not used in any other way?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/1] Input: inline macros for MODULE_LICENSE, etc
2017-12-26 17:52 ` [PATCH 0/1] " Joe Perches
@ 2017-12-26 17:56 ` Julia Lawall
0 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2017-12-26 17:56 UTC (permalink / raw)
To: Joe Perches
Cc: Dmitry Torokhov, linux-kernel, kernel-janitors, linux-input,
Greg Kroah-Hartman
On Tue, 26 Dec 2017, Joe Perches wrote:
> On Tue, 2017-12-26 at 18:05 +0100, Julia Lawall wrote:
> > Inline macro for MODULE_LICENSE to make the license information easy to
> > find, eg with grep. Inline the other module-related macros at the same
> > time.
> >
> > The complete semantic patch is as follows: (http://coccinelle.lip6.fr/)
> >
> > // <smpl>
> > @q@
> > declarer name MODULE_LICENSE;
> > identifier i;
> > constant c;
> > position p;
> > @@
> >
> > MODULE_LICENSE(c@i@p);
> >
> > @r depends on q@
> > declarer name MODULE_AUTHOR, MODULE_DESCRIPTION, MODULE_VERSION;
> > identifier i;
> > constant c;
> > position p;
> > @@
> >
> > (
> > MODULE_AUTHOR(c@i@p);
> > >
> >
> > MODULE_DESCRIPTION(c@i@p);
> > >
> >
> > MODULE_LICENSE(c@i@p);
> > >
> >
> > MODULE_VERSION(c@i@p);
> > )
> >
> > @other@
> > identifier r.i;
> > position p != r.p;
> > @@
> >
> > i@p
> >
> > @s depends on !other@
> > identifier r.i;
> > expression e;
> > @@
> >
> > #define i e
> >
> > @@
> > identifier r.i;
> > position r.p;
> > expression s.e;
> > @@
> >
> > (
> > MODULE_AUTHOR(
> > - i@p
> > + e
> > );
> > >
> >
> > MODULE_DESCRIPTION(
> > - i@p
> > + e
> > );
> > >
> >
> > MODULE_LICENSE(
> > - i@p
> > + e
> > );
> > >
> >
> > MODULE_VERSION(
> > - i@p
> > + e
> > );
> > )
> >
> > @@
> > identifier r.i;
> > expression s.e;
> > @@
> >
> > -#define i e
> > // </smpl>
>
> What assures that the #define is only used by
> MODULE_<FOO> and is not used in any other way?
These two rules:
@other@
identifier r.i;
position p != r.p;
@@
i@p
@s depends on !other@
identifier r.i;
expression e;
@@
#define i e
The first rule checks for uses that are different than the one in the
MODULE_XXX call. The second rule only matches the #define if the first
rule fails, ie there are no other uses.
julia
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/1] Input: inline macros for MODULE_LICENSE, etc
2017-12-26 17:05 [PATCH 0/1] Input: inline macros for MODULE_LICENSE, etc Julia Lawall
2017-12-26 17:05 ` [PATCH 1/1] " Julia Lawall
2017-12-26 17:52 ` [PATCH 0/1] " Joe Perches
@ 2017-12-26 18:04 ` Joe Perches
2017-12-26 18:10 ` Julia Lawall
2 siblings, 1 reply; 6+ messages in thread
From: Joe Perches @ 2017-12-26 18:04 UTC (permalink / raw)
To: Julia Lawall, Dmitry Torokhov, linux-kernel
Cc: kernel-janitors, linux-input, Greg Kroah-Hartman
On Tue, 2017-12-26 at 18:05 +0100, Julia Lawall wrote:
> Inline macro for MODULE_LICENSE to make the license information easy to
> find, eg with grep. Inline the other module-related macros at the same
> time.
Perhaps it'd be better to not make this
dependent on a MODULE_LICENSE use, but allow
any #define foo/#define MODULE_<FOO> foo
where foo is used once to be converted.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/1] Input: inline macros for MODULE_LICENSE, etc
2017-12-26 18:04 ` Joe Perches
@ 2017-12-26 18:10 ` Julia Lawall
0 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2017-12-26 18:10 UTC (permalink / raw)
To: Joe Perches
Cc: Dmitry Torokhov, linux-kernel, kernel-janitors, linux-input,
Greg Kroah-Hartman
On Tue, 26 Dec 2017, Joe Perches wrote:
> On Tue, 2017-12-26 at 18:05 +0100, Julia Lawall wrote:
> > Inline macro for MODULE_LICENSE to make the license information easy to
> > find, eg with grep. Inline the other module-related macros at the same
> > time.
>
> Perhaps it'd be better to not make this
> dependent on a MODULE_LICENSE use, but allow
> any #define foo/#define MODULE_<FOO> foo
> where foo is used once to be converted.
Well, I wanted something that could be checked in a finite (small) amount
of time... There seemed to be a slightly more compelling argument for
inlining the license, so I decided to focus on that. What you suggested
resulted in around 5000 lines of patch code, mostly inlining authors and
descriptions.
But maybe you have already done the things done in my patch and it hasn't
been picked up yet?
julia
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-12-26 18:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-26 17:05 [PATCH 0/1] Input: inline macros for MODULE_LICENSE, etc Julia Lawall
2017-12-26 17:05 ` [PATCH 1/1] " Julia Lawall
2017-12-26 17:52 ` [PATCH 0/1] " Joe Perches
2017-12-26 17:56 ` Julia Lawall
2017-12-26 18:04 ` Joe Perches
2017-12-26 18:10 ` Julia Lawall
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox