struct usb_function function;
};
+static inline struct printer_dev *func_to_printer(struct usb_function *f)
+{
+ return container_of(f, struct printer_dev, function);
+}
+
static struct printer_dev usb_printer_gadget;
/*-------------------------------------------------------------------------*/
static int printer_func_setup(struct usb_function *f,
const struct usb_ctrlrequest *ctrl)
{
- struct printer_dev *dev = container_of(f, struct printer_dev, function);
+ struct printer_dev *dev = func_to_printer(f);
struct usb_composite_dev *cdev = f->config->cdev;
struct usb_request *req = cdev->req;
int value = -EOPNOTSUPP;
struct usb_function *f)
{
struct usb_gadget *gadget = c->cdev->gadget;
- struct printer_dev *dev = container_of(f, struct printer_dev, function);
+ struct printer_dev *dev = func_to_printer(f);
struct device *pdev;
struct usb_composite_dev *cdev = c->cdev;
struct usb_ep *in_ep;
struct printer_dev *dev;
struct usb_request *req;
- dev = container_of(f, struct printer_dev, function);
+ dev = func_to_printer(f);
device_destroy(usb_gadget_class, g_printer_devno);
static int printer_func_set_alt(struct usb_function *f,
unsigned intf, unsigned alt)
{
- struct printer_dev *dev = container_of(f, struct printer_dev, function);
+ struct printer_dev *dev = func_to_printer(f);
int ret = -ENOTSUPP;
if (!alt)
static void printer_func_disable(struct usb_function *f)
{
- struct printer_dev *dev = container_of(f, struct printer_dev, function);
+ struct printer_dev *dev = func_to_printer(f);
unsigned long flags;
DBG(dev, "%s\n", __func__);