Skip to contentSkip to conversation

8390: Miscellaneous cleanups

PATCH Superseded Armin Wolf 3 participants 4 messages Aug 1, 2020 – Aug 2, 2020

Subsystems (3)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Armin Wolf

author
#0 lore raw

PATCH v2 1/2 8390: Miscellaneous cleanups

Replace version string with MODULE_* macros.

Include necessary libraries.

Fix two minor coding-style issues.

---
 drivers/net/ethernet/8390/8390.c | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)
drivers/net/ethernet/8390/8390.c +20 -5
index 0e0aa4016858..aabb637c1fbf 100644
@@ -1,11 +1,26 @@
 // SPDX-License-Identifier: GPL-2.0-only
-/* 8390 core for usual drivers */
 
-static const char version[] =
-    "8390.c:v1.10cvs 9/23/94 Donald Becker ([email protected])\n";
+#define DRV_NAME "8390"
+#define DRV_DESCRIPTION "8390 core for usual drivers"
+#define DRV_AUTHOR "Donald Becker ([email protected])"
+#define DRV_VERSION "1.10cvs"
+#define DRV_RELDATE "9/23/1994"
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/export.h>
+
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
 
 #include "lib8390.c"
 
+MODULE_AUTHOR(DRV_AUTHOR);
+MODULE_DESCRIPTION(DRV_DESCRIPTION);
+MODULE_VERSION(DRV_VERSION);
+MODULE_LICENSE("GPL");
+
 int ei_open(struct net_device *dev)
 {
 	return __ei_open(dev);
@@ -64,7 +79,7 @@ const struct net_device_ops ei_netdev_ops = {
 	.ndo_get_stats		= ei_get_stats,
 	.ndo_set_rx_mode	= ei_set_multicast_list,
 	.ndo_validate_addr	= eth_validate_addr,
-	.ndo_set_mac_address 	= eth_mac_addr,
+	.ndo_set_mac_address	= eth_mac_addr,
 #ifdef CONFIG_NET_POLL_CONTROLLER
 	.ndo_poll_controller	= ei_poll,
 #endif
@@ -74,6 +89,7 @@ EXPORT_SYMBOL(ei_netdev_ops);
 struct net_device *__alloc_ei_netdev(int size)
 {
 	struct net_device *dev = ____alloc_ei_netdev(size);
+
 	if (dev)
 		dev->netdev_ops = &ei_netdev_ops;
 	return dev;
@@ -100,4 +116,3 @@ static void __exit ns8390_module_exit(void)
 module_init(ns8390_module_init);
 module_exit(ns8390_module_exit);
 #endif /* MODULE */
-MODULE_LICENSE("GPL");

--
2.20.1

maintainer
#1 lore raw
Quoted 7 lines · On Sat, 1 Aug 2020 22:52:42 +0200 Armin Wolf wrote:

Replace version string with MODULE_* macros.

Include necessary libraries.

Fix two minor coding-style issues.

This doesn't build but also

../drivers/net/ethernet/8390/lib8390.c:973:17: error: undefined identifier 'version' In file included from ../include/linux/kernel.h:15,

                 from ../drivers/net/ethernet/8390/8390.c:9:
../drivers/net/ethernet/8390/lib8390.c: In function ‘ethdev_setup’:
../drivers/net/ethernet/8390/lib8390.c:973:17: error: ‘version’ undeclared (first use in this function)
  973 |   pr_info("%s", version);
      |                 ^~~~~~~
../include/linux/printk.h:368:34: note: in definition of macro ‘pr_info’
  368 |  printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
      |                                  ^~~~~~~~~~~
../drivers/net/ethernet/8390/lib8390.c:973:17: note: each undeclared identifier is reported only once for each function it appears in
  973 |   pr_info("%s", version);
      |                 ^~~~~~~
../include/linux/printk.h:368:34: note: in definition of macro ‘pr_info’
  368 |  printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
      |                                  ^~~~~~~~~~~

make[5]: *** [../scripts/Makefile.build:281: drivers/net/ethernet/8390/8390.o] Error 1 make[4]: *** [../scripts/Makefile.build:497: drivers/net/ethernet/8390] Error 2 make[4]: *** Waiting for unfinished jobs....
make[3]: *** [../scripts/Makefile.build:497: drivers/net/ethernet] Error 2 make[3]: *** Waiting for unfinished jobs....
make[2]: *** [../scripts/Makefile.build:497: drivers/net] Error 2 make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/netdev/net-next/Makefile:1771: drivers] Error 2
make: *** [Makefile:185: __sub-make] Error 2

Quoted 19 lines
drivers/net/ethernet/8390/8390.c +9 -3
index 0e0aa4016858..aabb637c1fbf 100644
@@ -1,11 +1,26 @@
 // SPDX-License-Identifier: GPL-2.0-only
-/* 8390 core for usual drivers */
 
-static const char version[] =
-    "8390.c:v1.10cvs 9/23/94 Donald Becker ([email protected])\n";
+#define DRV_NAME "8390"
+#define DRV_DESCRIPTION "8390 core for usual drivers"
+#define DRV_AUTHOR "Donald Becker ([email protected])"
+#define DRV_VERSION "1.10cvs"
+#define DRV_RELDATE "9/23/1994"
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>

drivers/net/ethernet/8390/8390.c line 21

Quoted 10 lines
drivers/net/ethernet/8390/8390.c +7 -0
+#include <linux/export.h>
+
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
 
 #include "lib8390.c"
 
+MODULE_AUTHOR(DRV_AUTHOR);
+MODULE_DESCRIPTION(DRV_DESCRIPTION);
+MODULE_VERSION(DRV_VERSION);

Please drop the driver version, it looks pretty meaningless and we are moving away from driver versions in general.

drivers/net/ethernet/8390/8390.c line 22

Quoted 1 line
drivers/net/ethernet/8390/8390.c +1 -0
+MODULE_LICENSE("GPL");

Why move this up? It's common to have these at the end.

Quoted 28 lines
drivers/net/ethernet/8390/8390.c +3 -3
+
 int ei_open(struct net_device *dev)
 {
 	return __ei_open(dev);
@@ -64,7 +79,7 @@ const struct net_device_ops ei_netdev_ops = {
 	.ndo_get_stats		= ei_get_stats,
 	.ndo_set_rx_mode	= ei_set_multicast_list,
 	.ndo_validate_addr	= eth_validate_addr,
-	.ndo_set_mac_address 	= eth_mac_addr,
+	.ndo_set_mac_address	= eth_mac_addr,
 #ifdef CONFIG_NET_POLL_CONTROLLER
 	.ndo_poll_controller	= ei_poll,
 #endif
@@ -74,6 +89,7 @@ EXPORT_SYMBOL(ei_netdev_ops);
 struct net_device *__alloc_ei_netdev(int size)
 {
 	struct net_device *dev = ____alloc_ei_netdev(size);
+
 	if (dev)
 		dev->netdev_ops = &ei_netdev_ops;
 	return dev;
@@ -100,4 +116,3 @@ static void __exit ns8390_module_exit(void)
 module_init(ns8390_module_init);
 module_exit(ns8390_module_exit);
 #endif /* MODULE */
-MODULE_LICENSE("GPL");
--

2.20.1

author
#2 lore raw
Quoted 27 lines · Jakub Kicinski
Quoted 7 lines · On Sat, 1 Aug 2020 22:52:42 +0200 Armin Wolf wrote:

Replace version string with MODULE_* macros.

Include necessary libraries.

Fix two minor coding-style issues.

This doesn't build but also

../drivers/net/ethernet/8390/lib8390.c:973:17: error: undefined identifier 'version' In file included from ../include/linux/kernel.h:15,

                 from ../drivers/net/ethernet/8390/8390.c:9:
../drivers/net/ethernet/8390/lib8390.c: In function ‘ethdev_setup’:
../drivers/net/ethernet/8390/lib8390.c:973:17: error: ‘version’ undeclared (first use in this function)
  973 |   pr_info("%s", version);
      |                 ^~~~~~~
../include/linux/printk.h:368:34: note: in definition of macro ‘pr_info’
  368 |  printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
      |                                  ^~~~~~~~~~~
../drivers/net/ethernet/8390/lib8390.c:973:17: note: each undeclared identifier is reported only once for each function it appears in
  973 |   pr_info("%s", version);
      |                 ^~~~~~~
../include/linux/printk.h:368:34: note: in definition of macro ‘pr_info’
  368 |  printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
      |                                  ^~~~~~~~~~~
Quoted 9 lines

make[5]: *** [../scripts/Makefile.build:281: drivers/net/ethernet/8390/8390.o] Error 1 make[4]: *** [../scripts/Makefile.build:497: drivers/net/ethernet/8390] Error 2 make[4]: *** Waiting for unfinished jobs....
make[3]: *** [../scripts/Makefile.build:497: drivers/net/ethernet] Error 2 make[3]: *** Waiting for unfinished jobs....
make[2]: *** [../scripts/Makefile.build:497: drivers/net] Error 2 make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/netdev/net-next/Makefile:1771: drivers] Error 2
make: *** [Makefile:185: __sub-make] Error 2

Did you apply patch 2/2 of the patchset?
Because version-printing (and the need for a version string) was removed from lib8390.c in patch 2/2 to allow the replacement of said version-string with MODULE_* macros in 8390.c, and failing to do so whould result in the exact same error.

#3 lore raw
Quoted 5 lines

Did you apply patch 2/2 of the patchset?
Because version-printing (and the need for a version string) was removed from lib8390.c in patch 2/2 to allow the replacement of said version-string with MODULE_* macros in 8390.c, and failing to do so whould result in the exact same error.

Hi Armin

We require that there be no break in buildability. The kernel must always build. Otherwise git bisect becomes much more difficult to use.

Andrew