From: Johannes Stezenbach <js@linuxtv.org>
To: Linus Torvalds <torvalds@osdl.org>
Cc: linux-kernel@vger.kernel.org, js@linuxtv.org
Subject: [PATCH 3/4] support up to six DVB cards
Date: Tue, 25 Jan 2005 01:31:40 +0100 [thread overview]
Message-ID: <11066131001936@linuxtv.org> (raw)
In-Reply-To: <11066130981300@linuxtv.org>
- [DVB] core: add support for up to six DVB cards by using
32bit dev_t capabilities
Signed-off-by: Johannes Stezenbach <js@linuxtv.org>
--- linux-2.6.11-rc2-bk2/drivers/media/dvb/dvb-core/dvbdev.c 2004-12-24 22:34:26.000000000 +0100
+++ linux-2.6.11-rc2-bk2-dvb/drivers/media/dvb/dvb-core/dvbdev.c 2005-01-25 00:35:45.000000000 +0100
@@ -31,6 +31,8 @@
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/device.h>
+#include <linux/fs.h>
+#include <linux/cdev.h>
#include "dvbdev.h"
@@ -50,8 +52,9 @@ static const char * const dnames[] = {
};
-#define DVB_MAX_IDS 4
+#define DVB_MAX_IDS 6
#define nums2minor(num,type,id) ((num << 6) | (id << 4) | type)
+#define MAX_DVB_MINORS (DVB_MAX_IDS*64)
struct class_simple *dvb_class;
EXPORT_SYMBOL(dvb_class);
@@ -109,6 +112,11 @@ static struct file_operations dvb_device
};
+static struct cdev dvb_device_cdev = {
+ .kobj = {.name = "dvb", },
+ .owner = THIS_MODULE,
+};
+
int dvb_generic_open(struct inode *inode, struct file *file)
{
struct dvb_device *dvbdev = file->private_data;
@@ -400,25 +408,41 @@ out:
static int __init init_dvbdev(void)
{
int retval;
+ dev_t dev = MKDEV(DVB_MAJOR, 0);
+
+ if ((retval = register_chrdev_region(dev, MAX_DVB_MINORS, "DVB")) != 0) {
+ printk("dvb-core: unable to get major %d\n", DVB_MAJOR);
+ return retval;
+ }
- if ((retval = register_chrdev(DVB_MAJOR,"DVB", &dvb_device_fops)))
+ cdev_init(&dvb_device_cdev, &dvb_device_fops);
+ if ((retval = cdev_add(&dvb_device_cdev, dev, MAX_DVB_MINORS)) != 0) {
printk("dvb-core: unable to get major %d\n", DVB_MAJOR);
+ goto error;
+ }
devfs_mk_dir("dvb");
dvb_class = class_simple_create(THIS_MODULE, "dvb");
- if (IS_ERR(dvb_class))
- return PTR_ERR(dvb_class);
+ if (IS_ERR(dvb_class)) {
+ retval = PTR_ERR(dvb_class);
+ goto error;
+ }
+ return 0;
+error:
+ cdev_del(&dvb_device_cdev);
+ unregister_chrdev_region(dev, MAX_DVB_MINORS);
return retval;
}
static void __exit exit_dvbdev(void)
{
- unregister_chrdev(DVB_MAJOR, "DVB");
devfs_remove("dvb");
class_simple_destroy(dvb_class);
+ cdev_del(&dvb_device_cdev);
+ unregister_chrdev_region(MKDEV(DVB_MAJOR, 0), MAX_DVB_MINORS);
}
module_init(init_dvbdev);
next prev parent reply other threads:[~2005-01-25 0:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-25 0:31 [PATCH 0/4] 2.6.11-rc2-bk2 DVB fixes Johannes Stezenbach
2005-01-25 0:31 ` [PATCH 1/4] follow USB __le16 changes Johannes Stezenbach
2005-01-25 0:31 ` [PATCH 2/4] fix access to freed memory Johannes Stezenbach
2005-01-25 0:31 ` Johannes Stezenbach [this message]
2005-01-25 0:31 ` [PATCH 4/4] cleanup firmware loading printks Johannes Stezenbach
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11066131001936@linuxtv.org \
--to=js@linuxtv.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox