#define pr_fmt(fmt) …
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/uaccess.h>
#include <linux/kref.h>
#include <linux/slab.h>
#include <linux/poll.h>
#include <linux/mutex.h>
#include <linux/usb.h>
#include <linux/compat.h>
#include <linux/usb/tmc.h>
#define USBTMC_API_VERSION …
#define USBTMC_HEADER_SIZE …
#define USBTMC_MINOR_BASE …
#define USBTMC_MIN_TIMEOUT …
#define USBTMC_TIMEOUT …
#define MAX_URBS_IN_FLIGHT …
#define USBTMC_BUFSIZE …
#define USBTMC_MAX_READS_TO_CLEAR_BULK_IN …
static const struct usb_device_id usbtmc_devices[] = …;
MODULE_DEVICE_TABLE(usb, usbtmc_devices);
struct usbtmc_dev_capabilities { … };
struct usbtmc_device_data { … };
#define to_usbtmc_data(d) …
struct usbtmc_file_data { … };
static struct usb_driver usbtmc_driver;
static void usbtmc_draw_down(struct usbtmc_file_data *file_data);
static void usbtmc_delete(struct kref *kref)
{ … }
static int usbtmc_open(struct inode *inode, struct file *filp)
{ … }
static int usbtmc_flush(struct file *file, fl_owner_t id)
{ … }
static int usbtmc_release(struct inode *inode, struct file *file)
{ … }
static int usbtmc_ioctl_abort_bulk_in_tag(struct usbtmc_device_data *data,
u8 tag)
{ … }
static int usbtmc_ioctl_abort_bulk_in(struct usbtmc_device_data *data)
{ … }
static int usbtmc_ioctl_abort_bulk_out_tag(struct usbtmc_device_data *data,
u8 tag)
{ … }
static int usbtmc_ioctl_abort_bulk_out(struct usbtmc_device_data *data)
{ … }
static int usbtmc_get_stb(struct usbtmc_file_data *file_data, __u8 *stb)
{ … }
static int usbtmc488_ioctl_read_stb(struct usbtmc_file_data *file_data,
void __user *arg)
{ … }
static int usbtmc_ioctl_get_srq_stb(struct usbtmc_file_data *file_data,
void __user *arg)
{ … }
static int usbtmc488_ioctl_wait_srq(struct usbtmc_file_data *file_data,
__u32 __user *arg)
{ … }
static int usbtmc488_ioctl_simple(struct usbtmc_device_data *data,
void __user *arg, unsigned int cmd)
{ … }
static int usbtmc488_ioctl_trigger(struct usbtmc_file_data *file_data)
{ … }
static struct urb *usbtmc_create_urb(void)
{ … }
static void usbtmc_read_bulk_cb(struct urb *urb)
{ … }
static inline bool usbtmc_do_transfer(struct usbtmc_file_data *file_data)
{ … }
static ssize_t usbtmc_generic_read(struct usbtmc_file_data *file_data,
void __user *user_buffer,
u32 transfer_size,
u32 *transferred,
u32 flags)
{ … }
static ssize_t usbtmc_ioctl_generic_read(struct usbtmc_file_data *file_data,
void __user *arg)
{ … }
static void usbtmc_write_bulk_cb(struct urb *urb)
{ … }
static ssize_t usbtmc_generic_write(struct usbtmc_file_data *file_data,
const void __user *user_buffer,
u32 transfer_size,
u32 *transferred,
u32 flags)
{ … }
static ssize_t usbtmc_ioctl_generic_write(struct usbtmc_file_data *file_data,
void __user *arg)
{ … }
static ssize_t usbtmc_ioctl_write_result(struct usbtmc_file_data *file_data,
void __user *arg)
{ … }
static int send_request_dev_dep_msg_in(struct usbtmc_file_data *file_data,
u32 transfer_size)
{ … }
static ssize_t usbtmc_read(struct file *filp, char __user *buf,
size_t count, loff_t *f_pos)
{ … }
static ssize_t usbtmc_write(struct file *filp, const char __user *buf,
size_t count, loff_t *f_pos)
{ … }
static int usbtmc_ioctl_clear(struct usbtmc_device_data *data)
{ … }
static int usbtmc_ioctl_clear_out_halt(struct usbtmc_device_data *data)
{ … }
static int usbtmc_ioctl_clear_in_halt(struct usbtmc_device_data *data)
{ … }
static int usbtmc_ioctl_cancel_io(struct usbtmc_file_data *file_data)
{ … }
static int usbtmc_ioctl_cleanup_io(struct usbtmc_file_data *file_data)
{ … }
static int get_capabilities(struct usbtmc_device_data *data)
{ … }
#define capability_attribute(name) …
capability_attribute(…);
capability_attribute(…);
capability_attribute(…);
capability_attribute(…);
static struct attribute *usbtmc_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static int usbtmc_ioctl_indicator_pulse(struct usbtmc_device_data *data)
{ … }
static int usbtmc_ioctl_request(struct usbtmc_device_data *data,
void __user *arg)
{ … }
static int usbtmc_ioctl_get_timeout(struct usbtmc_file_data *file_data,
void __user *arg)
{ … }
static int usbtmc_ioctl_set_timeout(struct usbtmc_file_data *file_data,
void __user *arg)
{ … }
static int usbtmc_ioctl_eom_enable(struct usbtmc_file_data *file_data,
void __user *arg)
{ … }
static int usbtmc_ioctl_config_termc(struct usbtmc_file_data *file_data,
void __user *arg)
{ … }
static long usbtmc_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ … }
static int usbtmc_fasync(int fd, struct file *file, int on)
{ … }
static __poll_t usbtmc_poll(struct file *file, poll_table *wait)
{ … }
static const struct file_operations fops = …;
static struct usb_class_driver usbtmc_class = …;
static void usbtmc_interrupt(struct urb *urb)
{ … }
static void usbtmc_free_int(struct usbtmc_device_data *data)
{ … }
static int usbtmc_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{ … }
static void usbtmc_disconnect(struct usb_interface *intf)
{ … }
static void usbtmc_draw_down(struct usbtmc_file_data *file_data)
{ … }
static int usbtmc_suspend(struct usb_interface *intf, pm_message_t message)
{ … }
static int usbtmc_resume(struct usb_interface *intf)
{ … }
static int usbtmc_pre_reset(struct usb_interface *intf)
{ … }
static int usbtmc_post_reset(struct usb_interface *intf)
{ … }
static struct usb_driver usbtmc_driver = …;
module_usb_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;