/* SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0-or-later) * (C) 2019-2021 AVM GmbH * * vim:set noexpandtab shiftwidth=8 softtabstop=8 fileencoding=utf-8: */ /** @file cchardevice.h * * Register a character device an let device files appear in /dev. * * Implementation via alloc_chrdev_region(), cdev_*(), class_init() * and device_create() ... * * Files in /proc: * /proc/cchardevice/devices - list registered devices * /proc/cchardevice/control - add/delete /dev/cchardevice_test* */ #ifndef CCHARDEVICE_H #define CCHARDEVICE_H struct cchardevice; /** * Register a character device an let device files appear in /dev * * @param name basename of device * @param minorcount number of minor devices to handle * 0 or 1: creates only /dev/NAME * else : /dev/NAME%d for every minor * @param module THIS_MODULE * @param fops struct file_operations * * @returns struct cchardevice or NULL on failure */ struct cchardevice *cchardevice_register(const char *name, unsigned int minorcount, struct module *module, const struct file_operations *fops); /** * Unregister character device previously registered with cchardevice_register. * * @param p struct cchardevice */ void cchardevice_unregister(struct cchardevice *p); #endif // CCHARDEVICE_H