Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _LINUX_CDEV_H
0003 #define _LINUX_CDEV_H
0004 
0005 #include <linux/kobject.h>
0006 #include <linux/kdev_t.h>
0007 #include <linux/list.h>
0008 #include <linux/device.h>
0009 
0010 struct file_operations;
0011 struct inode;
0012 struct module;
0013 
0014 struct cdev {
0015     struct kobject kobj;
0016     struct module *owner;
0017     const struct file_operations *ops;
0018     struct list_head list;
0019     dev_t dev;
0020     unsigned int count;
0021 } __randomize_layout;
0022 
0023 void cdev_init(struct cdev *, const struct file_operations *);
0024 
0025 struct cdev *cdev_alloc(void);
0026 
0027 void cdev_put(struct cdev *p);
0028 
0029 int cdev_add(struct cdev *, dev_t, unsigned);
0030 
0031 void cdev_set_parent(struct cdev *p, struct kobject *kobj);
0032 int cdev_device_add(struct cdev *cdev, struct device *dev);
0033 void cdev_device_del(struct cdev *cdev, struct device *dev);
0034 
0035 void cdev_del(struct cdev *);
0036 
0037 void cd_forget(struct inode *);
0038 
0039 #endif