#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/netdevice.h>
#include <linux/if_ether.h>
#include <linux/if_phonet.h>
#include <linux/if_arp.h>
#include <linux/usb/ch9.h>
#include <linux/usb/cdc.h>
#include <linux/usb/composite.h>
#include "u_phonet.h"
#include "u_ether.h"
#define PN_MEDIA_USB …
#define MAXPACKET …
#if (PAGE_SIZE % MAXPACKET)
#error MAXPACKET must divide PAGE_SIZE!
#endif
struct phonet_port { … };
struct f_phonet { … };
static int phonet_rxq_size = …;
static inline struct f_phonet *func_to_pn(struct usb_function *f)
{ … }
#define USB_CDC_SUBCLASS_PHONET …
#define USB_CDC_PHONET_TYPE …
static struct usb_interface_descriptor
pn_control_intf_desc = …;
static const struct usb_cdc_header_desc
pn_header_desc = …;
static const struct usb_cdc_header_desc
pn_phonet_desc = …;
static struct usb_cdc_union_desc
pn_union_desc = …;
static struct usb_interface_descriptor
pn_data_nop_intf_desc = …;
static struct usb_interface_descriptor
pn_data_intf_desc = …;
static struct usb_endpoint_descriptor
pn_fs_sink_desc = …;
static struct usb_endpoint_descriptor
pn_hs_sink_desc = …;
static struct usb_endpoint_descriptor
pn_fs_source_desc = …;
static struct usb_endpoint_descriptor
pn_hs_source_desc = …;
static struct usb_descriptor_header *fs_pn_function[] = …;
static struct usb_descriptor_header *hs_pn_function[] = …;
static int pn_net_open(struct net_device *dev)
{ … }
static int pn_net_close(struct net_device *dev)
{ … }
static void pn_tx_complete(struct usb_ep *ep, struct usb_request *req)
{ … }
static netdev_tx_t pn_net_xmit(struct sk_buff *skb, struct net_device *dev)
{ … }
static const struct net_device_ops pn_netdev_ops = …;
static void pn_net_setup(struct net_device *dev)
{ … }
static int
pn_rx_submit(struct f_phonet *fp, struct usb_request *req, gfp_t gfp_flags)
{ … }
static void pn_rx_complete(struct usb_ep *ep, struct usb_request *req)
{ … }
static void __pn_reset(struct usb_function *f)
{ … }
static int pn_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
{ … }
static int pn_get_alt(struct usb_function *f, unsigned intf)
{ … }
static void pn_disconnect(struct usb_function *f)
{ … }
static int pn_bind(struct usb_configuration *c, struct usb_function *f)
{ … }
static inline struct f_phonet_opts *to_f_phonet_opts(struct config_item *item)
{ … }
static void phonet_attr_release(struct config_item *item)
{ … }
static struct configfs_item_operations phonet_item_ops = …;
static ssize_t f_phonet_ifname_show(struct config_item *item, char *page)
{ … }
CONFIGFS_ATTR_RO(…);
static struct configfs_attribute *phonet_attrs[] = …;
static const struct config_item_type phonet_func_type = …;
static void phonet_free_inst(struct usb_function_instance *f)
{ … }
static struct usb_function_instance *phonet_alloc_inst(void)
{ … }
static void phonet_free(struct usb_function *f)
{ … }
static void pn_unbind(struct usb_configuration *c, struct usb_function *f)
{ … }
static struct usb_function *phonet_alloc(struct usb_function_instance *fi)
{ … }
struct net_device *gphonet_setup_default(void)
{ … }
void gphonet_set_gadget(struct net_device *net, struct usb_gadget *g)
{ … }
int gphonet_register_netdev(struct net_device *net)
{ … }
void gphonet_cleanup(struct net_device *dev)
{ … }
DECLARE_USB_FUNCTION_INIT(phonet, phonet_alloc_inst, phonet_alloc);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;