#include <linux/cdev.h>
#include <linux/counter.h>
#include <linux/device.h>
#include <linux/device/bus.h>
#include <linux/export.h>
#include <linux/fs.h>
#include <linux/gfp.h>
#include <linux/idr.h>
#include <linux/init.h>
#include <linux/kdev_t.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/wait.h>
#include "counter-chrdev.h"
#include "counter-sysfs.h"
#define COUNTER_NAME …
static DEFINE_IDA(counter_ida);
struct counter_device_allochelper { … };
static void counter_device_release(struct device *dev)
{ … }
static const struct device_type counter_device_type = …;
static const struct bus_type counter_bus_type = …;
static dev_t counter_devt;
void *counter_priv(const struct counter_device *const counter)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
struct counter_device *counter_alloc(size_t sizeof_priv)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
void counter_put(struct counter_device *counter)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
int counter_add(struct counter_device *counter)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
void counter_unregister(struct counter_device *const counter)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
static void devm_counter_release(void *counter)
{ … }
static void devm_counter_put(void *counter)
{ … }
struct counter_device *devm_counter_alloc(struct device *dev, size_t sizeof_priv)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
int devm_counter_add(struct device *dev,
struct counter_device *const counter)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
#define COUNTER_DEV_MAX …
static int __init counter_init(void)
{ … }
static void __exit counter_exit(void)
{ … }
subsys_initcall(counter_init);
module_exit(counter_exit);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;