From: "Michael Baumann" <baumann@optivus.com>
To: <linux-kernel@vger.kernel.org>
Subject: Problem with minor devices numbers in 2.4.4/68k
Date: Tue, 29 May 2001 08:25:49 -0700 [thread overview]
Message-ID: <000201c0e853$a4f4a540$bbc8c58f@mycroftpc.llumc.edu> (raw)
Hopefully, I don't offend anyone by asking this here, but
I assume (perhaps incorrectly) that this is the place to
go when trying to decipher writing device drivers.
My problem: A device driver for a custom board worked fine
under 2.2.10 - I used the minor number to identify various
channels on the board. In the open() call, I used
MINOR(inode->i_rdev) to decode that information. Now under
2.4.4, this *appears* to be broken - though I am certain it
is my misunderstanding. In checking, every minor device
returns exactly the same i_rdev code.
Anyway, attached are some snippets of code, if someone can point
out where I goofed, I would really appreciate it. I'm in the
process of trying to prove to the PHB that linux is a viable
embedded platform.
Note that at this time, I am not using the devfs, though I did
try and incorporate support. If someone can point me to a good
"how do deal with the changes in 2.4" I'd appreciate that as well.
Anyway in my init_module() routine I register the region, and major/minor
devices:
if((devfs_register_chrdev(42,"timer", &timer_fops)) < 0)
{
printk("Timer: bad doobie, device 42 missing?\n");
return -EIO;
}
else
{
int tmrs;
printk("Timer: Cool,chrdev is regsitered!\n");
for(tmrs=0;tmrs<8;tmrs++)
{
timer_handles[tmrs]=devfs_register(NULL,"timer",DEVFS_FL_DEFAULT,
42, tmrs, S_IFCHR |
S_IRUGO | S_IWUSR,&timer_fops,tmrs);
}
}
And in my open, I try to decode the minor number:
static
int timer_open(struct inode *inode, struct file *file)
{
printk("sysclk: open() f_mode=%d, minor = %1d, minor2 %0x\n",
file->f_mode, MINOR(inode->i_rdev),(inode->i_rdev));
// we're going to be sneaky here - the minor number
// stored in the file private data will be used to
// index the 'interrupt occurred' flag for the poll
// routine.
file->private_data = (void *)MINOR(inode->i_rdev);
usequeue[MINOR(inode->i_rdev)]++;
MOD_INC_USE_COUNT;
return 0;
}
But MINOR(inode->i_rdev) always returns 0, no matter which
minor devices I open.
If this doesn't belong here, please direct mail me, as this
has my stymied.
Thank you.
--
Michael Baumann Optivus Technology Inc.|Loma Linda University Medical
Center
San Bernardino, California. (909)799-8308 |Internet: baumann@llumc.edu
next reply other threads:[~2001-05-29 15:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-05-29 15:25 Michael Baumann [this message]
2001-05-29 16:56 ` Alan Cox
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='000201c0e853$a4f4a540$bbc8c58f@mycroftpc.llumc.edu' \
--to=baumann@optivus.com \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®