From owner-svn-src-projects@FreeBSD.ORG Mon Oct 18 22:22:38 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E133106564A; Mon, 18 Oct 2010 22:22:38 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6C7B18FC15; Mon, 18 Oct 2010 22:22:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9IMMcx0087917; Mon, 18 Oct 2010 22:22:38 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9IMMcND087915; Mon, 18 Oct 2010 22:22:38 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201010182222.o9IMMcND087915@svn.freebsd.org> From: Jeff Roberson Date: Mon, 18 Oct 2010 22:22:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214038 - projects/ofed/head/sys/ofed/include/linux X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Oct 2010 22:22:38 -0000 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 +#include 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_ */