linux/drivers/usb/gadget/legacy/g_ffs.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * g_ffs.c -- user mode file system API for USB composite function controllers
 *
 * Copyright (C) 2010 Samsung Electronics
 * Author: Michal Nazarewicz <[email protected]>
 */

#define pr_fmt(fmt)

#include <linux/module.h>

#if defined CONFIG_USB_FUNCTIONFS_ETH || defined CONFIG_USB_FUNCTIONFS_RNDIS
#include <linux/netdevice.h>

#  if defined USB_ETH_RNDIS
#    undef USB_ETH_RNDIS
#  endif
#  ifdef CONFIG_USB_FUNCTIONFS_RNDIS
#define USB_ETH_RNDIS
#  endif

#  include "u_ecm.h"
#  include "u_gether.h"
#  ifdef USB_ETH_RNDIS
#    include "u_rndis.h"
#    include "rndis.h"
#  endif
#  include "u_ether.h"

USB_ETHERNET_MODULE_PARAMETERS();

#  ifdef CONFIG_USB_FUNCTIONFS_ETH
static int eth_bind_config(struct usb_configuration *c);
static struct usb_function_instance *fi_ecm;
static struct usb_function *f_ecm;
static struct usb_function_instance *fi_geth;
static struct usb_function *f_geth;
#  endif
#  ifdef CONFIG_USB_FUNCTIONFS_RNDIS
static int bind_rndis_config(struct usb_configuration *c);
static struct usb_function_instance *fi_rndis;
static struct usb_function *f_rndis;
#  endif
#endif

#include "u_fs.h"

#define DRIVER_NAME
#define DRIVER_DESC
#define DRIVER_VERSION

MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();

#define GFS_VENDOR_ID
#define GFS_PRODUCT_ID

#define GFS_MAX_DEVS

USB_GADGET_COMPOSITE_OPTIONS();

static struct usb_device_descriptor gfs_dev_desc =;

static char *func_names[GFS_MAX_DEVS];
static unsigned int func_num;

module_param_named(bDeviceClass,    gfs_dev_desc.bDeviceClass,    byte,   0644);
MODULE_PARM_DESC();
module_param_named(bDeviceSubClass, gfs_dev_desc.bDeviceSubClass, byte,   0644);
MODULE_PARM_DESC();
module_param_named(bDeviceProtocol, gfs_dev_desc.bDeviceProtocol, byte,   0644);
MODULE_PARM_DESC();
module_param_array_named();
MODULE_PARM_DESC();

static const struct usb_descriptor_header *gfs_otg_desc[2];

/* String IDs are assigned dynamically */
static struct usb_string gfs_strings[] =;

static struct usb_gadget_strings *gfs_dev_strings[] =;

struct gfs_configuration {};

static struct gfs_configuration gfs_configurations[] =;

static void *functionfs_acquire_dev(struct ffs_dev *dev);
static void functionfs_release_dev(struct ffs_dev *dev);
static int functionfs_ready_callback(struct ffs_data *ffs);
static void functionfs_closed_callback(struct ffs_data *ffs);
static int gfs_bind(struct usb_composite_dev *cdev);
static int gfs_unbind(struct usb_composite_dev *cdev);
static int gfs_do_config(struct usb_configuration *c);


static struct usb_composite_driver gfs_driver =;

static unsigned int missing_funcs;
static bool gfs_registered;
static bool gfs_single_func;
static struct usb_function_instance **fi_ffs;
static struct usb_function **f_ffs[] =;

#define N_CONF

static int __init gfs_init(void)
{}
module_init();

static void __exit gfs_exit(void)
{}
module_exit(gfs_exit);

static void *functionfs_acquire_dev(struct ffs_dev *dev)
{}

static void functionfs_release_dev(struct ffs_dev *dev)
{}

/*
 * The caller of this function takes ffs_lock
 */
static int functionfs_ready_callback(struct ffs_data *ffs)
{}

/*
 * The caller of this function takes ffs_lock
 */
static void functionfs_closed_callback(struct ffs_data *ffs)
{}

/*
 * It is assumed that gfs_bind is called from a context where ffs_lock is held
 */
static int gfs_bind(struct usb_composite_dev *cdev)
{}

/*
 * It is assumed that gfs_unbind is called from a context where ffs_lock is held
 */
static int gfs_unbind(struct usb_composite_dev *cdev)
{}

/*
 * It is assumed that gfs_do_config is called from a context where
 * ffs_lock is held
 */
static int gfs_do_config(struct usb_configuration *c)
{}

#ifdef CONFIG_USB_FUNCTIONFS_ETH

static int eth_bind_config(struct usb_configuration *c)
{}

#endif

#ifdef CONFIG_USB_FUNCTIONFS_RNDIS

static int bind_rndis_config(struct usb_configuration *c)
{}

#endif