Skip to content

Commit

Permalink
Merge branch 'net-non-modular'
Browse files Browse the repository at this point in the history
Paul Gortmaker says:

====================
make non-modular code explicitly non-modular

[v2: drop m68k patches that Geert converted to modules; add one ARM
 driver patch ; update net-next baseline to today; switch to ARM
 for build testing.]

In a previous merge window, we made changes to allow better
delineation between modular and non-modular code in commit
0fd972a ("module: relocate module_init
from init.h to module.h").  This allows us to now ensure module code
looks modular and non-modular code does not accidentally look modular
just to avoid suffering build breakage.

Here we target code that is, by nature of their Makefile and/or
Kconfig settings, only available to be built-in, but implicitly
presenting itself as being possibly modular by way of using modular
headers, macros, and functions.

The goal here is to remove that illusion of modularity from these
files, but in a way that leaves the actual runtime unchanged.
In doing so, we remove code that has never been tested and adds
no value to the tree.  And we continue the process of expecting a
level of consistency between the Kconfig/Makefile of code and the
code in use itself.

Fortuntately the net subsystem has relatively few instances, given
the overall amount of code and drivers it contains.  For comparison
there are over 300 instances tree wide, resulting in a possible net
removal of on the order of 5000 lines of unused code.

Build tested on net-next from today, on ARM, since that is the arch
where the one ethernet driver changed here is available.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Oct 9, 2015
2 parents 4d886d6 + b3c8ec3 commit d49ae37
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 56 deletions.
10 changes: 4 additions & 6 deletions drivers/net/ethernet/ti/cpsw-phy-sel.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
*
* Copyright (C) 2013 Texas Instruments
*
* Module Author: Mugunthan V N <mugunthanvnm@ti.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
Expand All @@ -13,7 +15,7 @@
*/

#include <linux/platform_device.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/netdevice.h>
#include <linux/phy.h>
#include <linux/of.h>
Expand Down Expand Up @@ -173,7 +175,6 @@ static const struct of_device_id cpsw_phy_sel_id_table[] = {
},
{}
};
MODULE_DEVICE_TABLE(of, cpsw_phy_sel_id_table);

static int cpsw_phy_sel_probe(struct platform_device *pdev)
{
Expand Down Expand Up @@ -214,7 +215,4 @@ static struct platform_driver cpsw_phy_sel_driver = {
.of_match_table = cpsw_phy_sel_id_table,
},
};

module_platform_driver(cpsw_phy_sel_driver);
MODULE_AUTHOR("Mugunthan V N <mugunthanvnm@ti.com>");
MODULE_LICENSE("GPL v2");
builtin_platform_driver(cpsw_phy_sel_driver);
14 changes: 3 additions & 11 deletions net/core/sock_diag.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* License: GPL */

#include <linux/mutex.h>
#include <linux/socket.h>
#include <linux/skbuff.h>
Expand Down Expand Up @@ -323,14 +325,4 @@ static int __init sock_diag_init(void)
BUG_ON(!broadcast_wq);
return register_pernet_subsys(&diag_net_ops);
}

static void __exit sock_diag_exit(void)
{
unregister_pernet_subsys(&diag_net_ops);
destroy_workqueue(broadcast_wq);
}

module_init(sock_diag_init);
module_exit(sock_diag_exit);
MODULE_LICENSE("GPL");
MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_SOCK_DIAG);
device_initcall(sock_diag_init);
30 changes: 3 additions & 27 deletions net/dcb/dcbnl.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* You should have received a copy of the GNU General Public License along with
* this program; if not, see <http://www.gnu.org/licenses/>.
*
* Description: Data Center Bridging netlink interface
* Author: Lucy Liu <lucy.liu@intel.com>
*/

Expand All @@ -24,7 +25,7 @@
#include <linux/dcbnl.h>
#include <net/dcbevent.h>
#include <linux/rtnetlink.h>
#include <linux/module.h>
#include <linux/init.h>
#include <net/sock.h>

/* Data Center Bridging (DCB) is a collection of Ethernet enhancements
Expand All @@ -48,10 +49,6 @@
* features for capable devices.
*/

MODULE_AUTHOR("Lucy Liu, <lucy.liu@intel.com>");
MODULE_DESCRIPTION("Data Center Bridging netlink interface");
MODULE_LICENSE("GPL");

/**************** DCB attribute policies *************************************/

/* DCB netlink attributes policy */
Expand Down Expand Up @@ -1935,19 +1932,6 @@ int dcb_ieee_delapp(struct net_device *dev, struct dcb_app *del)
}
EXPORT_SYMBOL(dcb_ieee_delapp);

static void dcb_flushapp(void)
{
struct dcb_app_type *app;
struct dcb_app_type *tmp;

spin_lock_bh(&dcb_lock);
list_for_each_entry_safe(app, tmp, &dcb_app_list, list) {
list_del(&app->list);
kfree(app);
}
spin_unlock_bh(&dcb_lock);
}

static int __init dcbnl_init(void)
{
INIT_LIST_HEAD(&dcb_app_list);
Expand All @@ -1957,12 +1941,4 @@ static int __init dcbnl_init(void)

return 0;
}
module_init(dcbnl_init);

static void __exit dcbnl_exit(void)
{
rtnl_unregister(PF_UNSPEC, RTM_GETDCB);
rtnl_unregister(PF_UNSPEC, RTM_SETDCB);
dcb_flushapp();
}
module_exit(dcbnl_exit);
device_initcall(dcbnl_init);
15 changes: 3 additions & 12 deletions net/sched/sch_blackhole.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Note: Quantum tunneling is not supported.
*/

#include <linux/module.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/skbuff.h>
Expand All @@ -37,17 +37,8 @@ static struct Qdisc_ops blackhole_qdisc_ops __read_mostly = {
.owner = THIS_MODULE,
};

static int __init blackhole_module_init(void)
static int __init blackhole_init(void)
{
return register_qdisc(&blackhole_qdisc_ops);
}

static void __exit blackhole_module_exit(void)
{
unregister_qdisc(&blackhole_qdisc_ops);
}

module_init(blackhole_module_init)
module_exit(blackhole_module_exit)

MODULE_LICENSE("GPL");
device_initcall(blackhole_init)

0 comments on commit d49ae37

Please sign in to comment.