From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752152AbdKWHbu (ORCPT ); Thu, 23 Nov 2017 02:31:50 -0500 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:31264 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751305AbdKWHbs (ORCPT ); Thu, 23 Nov 2017 02:31:48 -0500 X-IronPort-AV: E=Sophos;i="5.44,440,1505772000"; d="scan'208";a="245709096" Date: Thu, 23 Nov 2017 08:31:43 +0100 (CET) From: Julia Lawall X-X-Sender: jll@hadrien To: Greg Kroah-Hartman cc: Joe Perches , netdev@vger.kernel.org, cocci , outreachy-kernel@googlegroups.com, "David S. Miller" , Andreas Kemnade , Johan Hovold , linux-kernel@vger.kernel.org, Philippe Ombredanne , linux-usb@vger.kernel.org Subject: Re: [Outreachy kernel] Re: [PATCH] net: usb: hso.c: remove unneeded DRIVER_LICENSE #define In-Reply-To: <20171123062228.GB25861@kroah.com> Message-ID: References: <20171117141939.GD17880@kroah.com> <1511370336.6989.100.camel@perches.com> <20171123062228.GB25861@kroah.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 23 Nov 2017, Greg Kroah-Hartman wrote: > 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_(MOD_) 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 > > > > #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. OK, that seems like a simple soluton. Thanks. julia