Date: Mon, 18 Oct 2010 22:22:38 +0000 (UTC) From: Jeff Roberson <jeff@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r214038 - projects/ofed/head/sys/ofed/include/linux Message-ID: <201010182222.o9IMMcND087915@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jeff Date: Mon Oct 18 22:22:38 2010 New Revision: 214038 URL: http://svn.freebsd.org/changeset/base/214038 Log: - Add the cdev for misc devices. Sponsored by: Isilon Systems, iX Systems, and Panasas. Modified: projects/ofed/head/sys/ofed/include/linux/miscdevice.h Modified: projects/ofed/head/sys/ofed/include/linux/miscdevice.h ============================================================================== --- projects/ofed/head/sys/ofed/include/linux/miscdevice.h Mon Oct 18 22:21:57 2010 (r214037) +++ projects/ofed/head/sys/ofed/include/linux/miscdevice.h Mon Oct 18 22:22:38 2010 (r214038) @@ -32,24 +32,31 @@ #define MISC_DYNAMIC_MINOR -1 #include <linux/device.h> +#include <linux/cdev.h> struct miscdevice { const char *name; struct device *this_device; const struct file_operations *fops; + struct cdev *cdev; int minor; }; extern struct class miscclass; -/* - * XXX Missing cdev. - */ static inline int misc_register(struct miscdevice *misc) { misc->this_device = device_create(&miscclass, &linux_rootdev, 0, misc, misc->name); + misc->cdev = cdev_alloc(); + if (misc->cdev == NULL) + return -ENOMEM; + misc->cdev->owner = THIS_MODULE; + misc->cdev->ops = misc->fops; + kobject_set_name(&misc->cdev->kobj, misc->name); + if (cdev_add(misc->cdev, misc->this_device->devt, 1)) + return -EINVAL; return (0); } @@ -57,8 +64,9 @@ static inline int misc_deregister(struct miscdevice *misc) { device_destroy(&miscclass, misc->this_device->devt); + cdev_del(misc->cdev); + return (0); } - #endif /* _LINUX_MISCDEVICE_H_ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010182222.o9IMMcND087915>