From: Greg KH <greg@kroah.com>
To: "Richard B. Johnson" <root@chaos.analogic.com>
Cc: odain2@mindspring.com, Linux kernel <linux-kernel@vger.kernel.org>
Subject: Re: proper place for devfs_register_chrdev with pci_module_init
Date: Wed, 4 Feb 2004 15:34:00 -0800 [thread overview]
Message-ID: <20040204233400.GA5274@kroah.com> (raw)
In-Reply-To: <Pine.LNX.4.53.0402041723340.3515@chaos>
On Wed, Feb 04, 2004 at 05:29:31PM -0500, Richard B. Johnson wrote:
>
> I would call pci_find_class() and continue until a NULL is returned
> or my vendor and device are returned in the structure.
NOOOOO!!!!!
Do NOT do this. Use pci_register_driver() instead. Using pci_find_*()
is just broken and wrong for 99% of all pci drivers.
If you do this you do not hook up into sysfs properly. You do not get
modules automatically loaded for your driver. You do not get notified
if the device is removed from the system. And, most importantly, you do
not get exclusive access to the pci device.
As for the original poster, look at one of the many existing char
drivers for examples of what you need to do to register a char driver
properly. It really has nothing to do with the pci interface at all
(with the exception of when to register it...)
thanks,
greg k-h
next prev parent reply other threads:[~2004-02-04 23:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-04 20:23 proper place for devfs_register_chrdev with pci_module_init Oliver Dain
2004-02-04 21:30 ` Richard B. Johnson
2004-02-04 21:48 ` odain2
2004-02-04 22:29 ` Richard B. Johnson
2004-02-04 23:34 ` Greg KH [this message]
2004-02-05 12:42 ` Richard B. Johnson
2004-02-05 15:27 ` Greg KH
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=20040204233400.GA5274@kroah.com \
--to=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=odain2@mindspring.com \
--cc=root@chaos.analogic.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.