#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/string.h>
#include <linux/usb.h>
#define DRIVER_AUTHOR …
#define DRIVER_DESC …
#define VENDOR_ID …
#define PRODUCT_ID …
#define MAXLEN …
static const struct usb_device_id id_table[] = …;
MODULE_DEVICE_TABLE(usb, id_table);
static const char *display_textmodes[] = …;
struct usb_sevsegdev { … };
static inline size_t my_memlen(const char *buf, size_t count)
{ … }
static void update_display_powered(struct usb_sevsegdev *mydev)
{ … }
static void update_display_mode(struct usb_sevsegdev *mydev)
{ … }
static void update_display_visual(struct usb_sevsegdev *mydev, gfp_t mf)
{ … }
#define MYDEV_ATTR_SIMPLE_UNSIGNED(name, update_fcn) …
static ssize_t text_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t text_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{ … }
static DEVICE_ATTR_RW(text);
static ssize_t decimals_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t decimals_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{ … }
static DEVICE_ATTR_RW(decimals);
static ssize_t textmode_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t textmode_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{ … }
static DEVICE_ATTR_RW(textmode);
MYDEV_ATTR_SIMPLE_UNSIGNED(powered, update_display_powered);
MYDEV_ATTR_SIMPLE_UNSIGNED(mode_msb, update_display_mode);
MYDEV_ATTR_SIMPLE_UNSIGNED(mode_lsb, update_display_mode);
static struct attribute *sevseg_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static int sevseg_probe(struct usb_interface *interface,
const struct usb_device_id *id)
{ … }
static void sevseg_disconnect(struct usb_interface *interface)
{ … }
static int sevseg_suspend(struct usb_interface *intf, pm_message_t message)
{ … }
static int sevseg_resume(struct usb_interface *intf)
{ … }
static int sevseg_reset_resume(struct usb_interface *intf)
{ … }
static struct usb_driver sevseg_driver = …;
module_usb_driver(…) …;
MODULE_AUTHOR(…);
MODULE_DESCRIPTION(…);
MODULE_LICENSE(…) …;