#include <linux/bitmap.h>
#include <linux/err.h>
#include <linux/errno.h>
#include <linux/debugfs.h>
#include <linux/fs.h>
#include <linux/init.h>
#include <linux/idr.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/poll.h>
#include <linux/skbuff.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/uaccess.h>
#include <linux/termios.h>
#include <linux/wwan.h>
#include <net/rtnetlink.h>
#include <uapi/linux/wwan.h>
#define WWAN_MAX_MINORS …
static DEFINE_MUTEX(wwan_register_lock);
static DEFINE_IDA(minors);
static DEFINE_IDA(wwan_dev_ids);
static const struct class wwan_class = …;
static int wwan_major;
static struct dentry *wwan_debugfs_dir;
#define to_wwan_dev(d) …
#define to_wwan_port(d) …
#define WWAN_PORT_TX_OFF …
struct wwan_device { … };
struct wwan_port { … };
static ssize_t index_show(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(index);
static struct attribute *wwan_dev_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static void wwan_dev_destroy(struct device *dev)
{ … }
static const struct device_type wwan_dev_type = …;
static int wwan_dev_parent_match(struct device *dev, const void *parent)
{ … }
static struct wwan_device *wwan_dev_get_by_parent(struct device *parent)
{ … }
static int wwan_dev_name_match(struct device *dev, const void *name)
{ … }
static struct wwan_device *wwan_dev_get_by_name(const char *name)
{ … }
#ifdef CONFIG_WWAN_DEBUGFS
struct dentry *wwan_get_debugfs_dir(struct device *parent)
{ … }
EXPORT_SYMBOL_GPL(…);
static int wwan_dev_debugfs_match(struct device *dev, const void *dir)
{ … }
static struct wwan_device *wwan_dev_get_by_debugfs(struct dentry *dir)
{ … }
void wwan_put_debugfs_dir(struct dentry *dir)
{ … }
EXPORT_SYMBOL_GPL(…);
#endif
static struct wwan_device *wwan_create_dev(struct device *parent)
{ … }
static int is_wwan_child(struct device *dev, void *data)
{ … }
static void wwan_remove_dev(struct wwan_device *wwandev)
{ … }
static const struct { … } wwan_port_types[WWAN_PORT_MAX + 1] = …;
static ssize_t type_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static DEVICE_ATTR_RO(type);
static struct attribute *wwan_port_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static void wwan_port_destroy(struct device *dev)
{ … }
static const struct device_type wwan_port_dev_type = …;
static int wwan_port_minor_match(struct device *dev, const void *minor)
{ … }
static struct wwan_port *wwan_port_get_by_minor(unsigned int minor)
{ … }
static int __wwan_port_dev_assign_name(struct wwan_port *port, const char *fmt)
{ … }
struct wwan_port *wwan_create_port(struct device *parent,
enum wwan_port_type type,
const struct wwan_port_ops *ops,
struct wwan_port_caps *caps,
void *drvdata)
{ … }
EXPORT_SYMBOL_GPL(…);
void wwan_remove_port(struct wwan_port *port)
{ … }
EXPORT_SYMBOL_GPL(…);
void wwan_port_rx(struct wwan_port *port, struct sk_buff *skb)
{ … }
EXPORT_SYMBOL_GPL(…);
void wwan_port_txon(struct wwan_port *port)
{ … }
EXPORT_SYMBOL_GPL(…);
void wwan_port_txoff(struct wwan_port *port)
{ … }
EXPORT_SYMBOL_GPL(…);
void *wwan_port_get_drvdata(struct wwan_port *port)
{ … }
EXPORT_SYMBOL_GPL(…);
static int wwan_port_op_start(struct wwan_port *port)
{ … }
static void wwan_port_op_stop(struct wwan_port *port)
{ … }
static int wwan_port_op_tx(struct wwan_port *port, struct sk_buff *skb,
bool nonblock)
{ … }
static bool is_read_blocked(struct wwan_port *port)
{ … }
static bool is_write_blocked(struct wwan_port *port)
{ … }
static int wwan_wait_rx(struct wwan_port *port, bool nonblock)
{ … }
static int wwan_wait_tx(struct wwan_port *port, bool nonblock)
{ … }
static int wwan_port_fops_open(struct inode *inode, struct file *file)
{ … }
static int wwan_port_fops_release(struct inode *inode, struct file *filp)
{ … }
static ssize_t wwan_port_fops_read(struct file *filp, char __user *buf,
size_t count, loff_t *ppos)
{ … }
static ssize_t wwan_port_fops_write(struct file *filp, const char __user *buf,
size_t count, loff_t *offp)
{ … }
static __poll_t wwan_port_fops_poll(struct file *filp, poll_table *wait)
{ … }
static long wwan_port_fops_at_ioctl(struct wwan_port *port, unsigned int cmd,
unsigned long arg)
{ … }
static long wwan_port_fops_ioctl(struct file *filp, unsigned int cmd,
unsigned long arg)
{ … }
static const struct file_operations wwan_port_fops = …;
static int wwan_rtnl_validate(struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ … }
static const struct device_type wwan_type = …;
static struct net_device *wwan_rtnl_alloc(struct nlattr *tb[],
const char *ifname,
unsigned char name_assign_type,
unsigned int num_tx_queues,
unsigned int num_rx_queues)
{ … }
static int wwan_rtnl_newlink(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ … }
static void wwan_rtnl_dellink(struct net_device *dev, struct list_head *head)
{ … }
static size_t wwan_rtnl_get_size(const struct net_device *dev)
{ … }
static int wwan_rtnl_fill_info(struct sk_buff *skb,
const struct net_device *dev)
{ … }
static const struct nla_policy wwan_rtnl_policy[IFLA_WWAN_MAX + 1] = …;
static struct rtnl_link_ops wwan_rtnl_link_ops __read_mostly = …;
static void wwan_create_default_link(struct wwan_device *wwandev,
u32 def_link_id)
{ … }
int wwan_register_ops(struct device *parent, const struct wwan_ops *ops,
void *ctxt, u32 def_link_id)
{ … }
EXPORT_SYMBOL_GPL(…);
static int wwan_child_dellink(struct device *dev, void *data)
{ … }
void wwan_unregister_ops(struct device *parent)
{ … }
EXPORT_SYMBOL_GPL(…);
static int __init wwan_init(void)
{ … }
static void __exit wwan_exit(void)
{ … }
module_init(…) …;
module_exit(wwan_exit);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;