#define pr_fmt(fmt) …
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/device.h>
#include <linux/spinlock.h>
#include <linux/list.h>
#include <linux/skbuff.h>
#include <linux/netdevice.h>
#include <linux/wwan.h>
#include <linux/debugfs.h>
#include <linux/workqueue.h>
#include <net/arp.h>
static int wwan_hwsim_devsnum = …;
module_param_named(devices, wwan_hwsim_devsnum, int, 0444);
MODULE_PARM_DESC(…) …;
static const struct class wwan_hwsim_class = …;
static struct dentry *wwan_hwsim_debugfs_topdir;
static struct dentry *wwan_hwsim_debugfs_devcreate;
static DEFINE_SPINLOCK(wwan_hwsim_devs_lock);
static LIST_HEAD(wwan_hwsim_devs);
static unsigned int wwan_hwsim_dev_idx;
static struct workqueue_struct *wwan_wq;
struct wwan_hwsim_dev { … };
struct wwan_hwsim_port { … };
static const struct file_operations wwan_hwsim_debugfs_portdestroy_fops;
static const struct file_operations wwan_hwsim_debugfs_portcreate_fops;
static const struct file_operations wwan_hwsim_debugfs_devdestroy_fops;
static void wwan_hwsim_port_del_work(struct work_struct *work);
static void wwan_hwsim_dev_del_work(struct work_struct *work);
static netdev_tx_t wwan_hwsim_netdev_xmit(struct sk_buff *skb,
struct net_device *ndev)
{ … }
static const struct net_device_ops wwan_hwsim_netdev_ops = …;
static void wwan_hwsim_netdev_setup(struct net_device *ndev)
{ … }
static const struct wwan_ops wwan_hwsim_wwan_rtnl_ops = …;
static int wwan_hwsim_port_start(struct wwan_port *wport)
{ … }
static void wwan_hwsim_port_stop(struct wwan_port *wport)
{ … }
static int wwan_hwsim_port_tx(struct wwan_port *wport, struct sk_buff *in)
{ … }
static const struct wwan_port_ops wwan_hwsim_port_ops = …;
static struct wwan_hwsim_port *wwan_hwsim_port_new(struct wwan_hwsim_dev *dev)
{ … }
static void wwan_hwsim_port_del(struct wwan_hwsim_port *port)
{ … }
static void wwan_hwsim_port_del_work(struct work_struct *work)
{ … }
static void wwan_hwsim_dev_release(struct device *sysdev)
{ … }
static struct wwan_hwsim_dev *wwan_hwsim_dev_new(void)
{ … }
static void wwan_hwsim_dev_del(struct wwan_hwsim_dev *dev)
{ … }
static void wwan_hwsim_dev_del_work(struct work_struct *work)
{ … }
static ssize_t wwan_hwsim_debugfs_portdestroy_write(struct file *file,
const char __user *usrbuf,
size_t count, loff_t *ppos)
{ … }
static const struct file_operations wwan_hwsim_debugfs_portdestroy_fops = …;
static ssize_t wwan_hwsim_debugfs_portcreate_write(struct file *file,
const char __user *usrbuf,
size_t count, loff_t *ppos)
{ … }
static const struct file_operations wwan_hwsim_debugfs_portcreate_fops = …;
static ssize_t wwan_hwsim_debugfs_devdestroy_write(struct file *file,
const char __user *usrbuf,
size_t count, loff_t *ppos)
{ … }
static const struct file_operations wwan_hwsim_debugfs_devdestroy_fops = …;
static ssize_t wwan_hwsim_debugfs_devcreate_write(struct file *file,
const char __user *usrbuf,
size_t count, loff_t *ppos)
{ … }
static const struct file_operations wwan_hwsim_debugfs_devcreate_fops = …;
static int __init wwan_hwsim_init_devs(void)
{ … }
static void wwan_hwsim_free_devs(void)
{ … }
static int __init wwan_hwsim_init(void)
{ … }
static void __exit wwan_hwsim_exit(void)
{ … }
module_init(…) …;
module_exit(wwan_hwsim_exit);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;