#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/ioctl.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/uaccess.h>
#include <linux/bitops.h>
#include <linux/poll.h>
#include <linux/skbuff.h>
#include <linux/usb.h>
#include <linux/usb/cdc.h>
#include <linux/wwan.h>
#include <asm/byteorder.h>
#include <asm/unaligned.h>
#include <linux/usb/cdc-wdm.h>
#define DRIVER_AUTHOR …
#define DRIVER_DESC …
static const struct usb_device_id wdm_ids[] = …;
MODULE_DEVICE_TABLE (usb, wdm_ids);
#define WDM_MINOR_BASE …
#define WDM_IN_USE …
#define WDM_DISCONNECTING …
#define WDM_RESULT …
#define WDM_READ …
#define WDM_INT_STALL …
#define WDM_POLL_RUNNING …
#define WDM_RESPONDING …
#define WDM_SUSPENDING …
#define WDM_RESETTING …
#define WDM_OVERFLOW …
#define WDM_WWAN_IN_USE …
#define WDM_MAX …
#define WDM_FLUSH_TIMEOUT …
#define WDM_DEFAULT_BUFSIZE …
static DEFINE_MUTEX(wdm_mutex);
static DEFINE_SPINLOCK(wdm_device_list_lock);
static LIST_HEAD(wdm_device_list);
struct wdm_device { … };
static struct usb_driver wdm_driver;
static struct wdm_device *wdm_find_device(struct usb_interface *intf)
{ … }
static struct wdm_device *wdm_find_device_by_minor(int minor)
{ … }
static void wdm_out_callback(struct urb *urb)
{ … }
static void wdm_wwan_rx(struct wdm_device *desc, int length);
static void wdm_in_callback(struct urb *urb)
{ … }
static void wdm_int_callback(struct urb *urb)
{ … }
static void poison_urbs(struct wdm_device *desc)
{ … }
static void unpoison_urbs(struct wdm_device *desc)
{ … }
static void free_urbs(struct wdm_device *desc)
{ … }
static void cleanup(struct wdm_device *desc)
{ … }
static ssize_t wdm_write
(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
{ … }
static int service_outstanding_interrupt(struct wdm_device *desc)
{ … }
static ssize_t wdm_read
(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
{ … }
static int wdm_wait_for_response(struct file *file, long timeout)
{ … }
static int wdm_fsync(struct file *file, loff_t start, loff_t end, int datasync)
{ … }
static int wdm_flush(struct file *file, fl_owner_t id)
{ … }
static __poll_t wdm_poll(struct file *file, struct poll_table_struct *wait)
{ … }
static int wdm_open(struct inode *inode, struct file *file)
{ … }
static int wdm_release(struct inode *inode, struct file *file)
{ … }
static long wdm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ … }
static const struct file_operations wdm_fops = …;
static struct usb_class_driver wdm_class = …;
#ifdef CONFIG_WWAN
static int wdm_wwan_port_start(struct wwan_port *port)
{ … }
static void wdm_wwan_port_stop(struct wwan_port *port)
{ … }
static void wdm_wwan_port_tx_complete(struct urb *urb)
{ … }
static int wdm_wwan_port_tx(struct wwan_port *port, struct sk_buff *skb)
{ … }
static const struct wwan_port_ops wdm_wwan_port_ops = …;
static void wdm_wwan_init(struct wdm_device *desc)
{ … }
static void wdm_wwan_deinit(struct wdm_device *desc)
{ … }
static void wdm_wwan_rx(struct wdm_device *desc, int length)
{ … }
#else
static void wdm_wwan_init(struct wdm_device *desc) {}
static void wdm_wwan_deinit(struct wdm_device *desc) {}
static void wdm_wwan_rx(struct wdm_device *desc, int length) {}
#endif
static void wdm_rxwork(struct work_struct *work)
{ … }
static void service_interrupt_work(struct work_struct *work)
{ … }
static int wdm_create(struct usb_interface *intf, struct usb_endpoint_descriptor *ep,
u16 bufsize, enum wwan_port_type type,
int (*manage_power)(struct usb_interface *, int))
{ … }
static int wdm_manage_power(struct usb_interface *intf, int on)
{ … }
static int wdm_probe(struct usb_interface *intf, const struct usb_device_id *id)
{ … }
struct usb_driver *usb_cdc_wdm_register(struct usb_interface *intf,
struct usb_endpoint_descriptor *ep,
int bufsize, enum wwan_port_type type,
int (*manage_power)(struct usb_interface *, int))
{ … }
EXPORT_SYMBOL(…);
static void wdm_disconnect(struct usb_interface *intf)
{ … }
#ifdef CONFIG_PM
static int wdm_suspend(struct usb_interface *intf, pm_message_t message)
{ … }
#endif
static int recover_from_urb_loss(struct wdm_device *desc)
{ … }
#ifdef CONFIG_PM
static int wdm_resume(struct usb_interface *intf)
{ … }
#endif
static int wdm_pre_reset(struct usb_interface *intf)
{ … }
static int wdm_post_reset(struct usb_interface *intf)
{ … }
static struct usb_driver wdm_driver = …;
module_usb_driver(…) …;
MODULE_AUTHOR(…);
MODULE_DESCRIPTION(…);
MODULE_LICENSE(…) …;