cdev.h 845 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _LINUX_CDEV_H
  3. #define _LINUX_CDEV_H
  4. #include <linux/kobject.h>
  5. #include <linux/kdev_t.h>
  6. #include <linux/list.h>
  7. #include <linux/device.h>
  8. struct file_operations;
  9. struct inode;
  10. struct module;
  11. struct cdev {
  12. struct kobject kobj;
  13. struct module *owner;
  14. const struct file_operations *ops;
  15. struct list_head list;
  16. dev_t dev;
  17. unsigned int count;
  18. } __randomize_layout;
  19. void cdev_init(struct cdev *, const struct file_operations *);
  20. struct cdev *cdev_alloc(void);
  21. void cdev_put(struct cdev *p);
  22. int cdev_add(struct cdev *, dev_t, unsigned);
  23. void cdev_set_parent(struct cdev *p, struct kobject *kobj);
  24. int cdev_device_add(struct cdev *cdev, struct device *dev);
  25. void cdev_device_del(struct cdev *cdev, struct device *dev);
  26. void cdev_del(struct cdev *);
  27. void cd_forget(struct inode *);
  28. #endif