File chrdev.h

FileList > dmabuf > chrdev.h

Go to the source code of this file

  • #include <linux/cdev.h>
  • #include <linux/fs.h>
  • #include <linux/slab.h>
  • #include "module.h"

Classes

Type Name
struct chrdev
struct chrdev_device

Public Static Functions

Type Name
struct chrdev * chrdev_alloc (const char * name, int count)
struct chrdev_device * chrdev_device_add (struct chrdev * chrdev, int minor, const struct file_operations * fops, struct device * parent, void * private_data)
void chrdev_device_del (struct chrdev_device * chrdev_device)
void chrdev_free (struct chrdev * chrdev)

Public Static Functions Documentation

function chrdev_alloc

static struct chrdev * chrdev_alloc (
    const char * name,
    int count
) 
chrdev = kzalloc()
chrdev->class = create_calss(name)
alloc_chrdev_region(&chrdev->dev, count, name)

Parameters:

  • name - name of class and associated device or driver
  • count - required number of minor numbers
  • fops - file_operations for this device

Returns:

pointer to struct chrdev

Return value:

  • -EINVAL - if name == NULL or count <= 0
  • -ENOMEM - out of memory
  • - errors from class_create and alloc_chrdev_region

function chrdev_device_add

static struct chrdev_device * chrdev_device_add (
    struct chrdev * chrdev,
    int minor,
    const struct file_operations * fops,
    struct device * parent,
    void * private_data
) 
chrdev_device = chrdev->devices[minor]
cdev_init(&chrdev_device->cdev)
cdev_add(&chrdev_device->cdev)
chrdev_device->device = device_create(parent, drvdata, "${name}${minor}")

Parameters:

  • chrdev - pointer to struct chrdev
  • minor - minor number for this device
  • parent - parent struct device

Returns:

Return value:

  • -EINVAL - invalid minor number
  • - errors from cdev_add and device_create

function chrdev_device_del

static void chrdev_device_del (
    struct chrdev_device * chrdev_device
) 

function chrdev_free

static void chrdev_free (
    struct chrdev * chrdev
) 


The documentation for this class was generated from the following file midas_fe/kerneldriver/dmabuf/chrdev.h