From: Brian King <brking@us.ibm.com>
To: Adam Belay <ambx1@neo.rr.com>
Cc: Greg KH <greg@kroah.com>,
linux-pci@atrey.karlin.mff.cuni.cz, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] PCI: Dynids - passing driver data
Date: Wed, 09 Feb 2005 09:14:34 -0600 [thread overview]
Message-ID: <420A28DA.40700@us.ibm.com> (raw)
In-Reply-To: <20050208182127.GA28367@neo.rr.com>
Adam Belay wrote:
> On Mon, Feb 07, 2005 at 02:18:20PM -0800, Greg KH wrote:
>
>>On Mon, Feb 07, 2005 at 04:00:27PM -0600, brking@us.ibm.com wrote:
>>
>>>Currently, code exists in the pci layer to allow userspace to specify
>>>driver data when adding a pci dynamic id from sysfs. However, this data
>>>is never used and there exists no way in the existing code to use it.
>>
>>Which is a good thing, right? "driver_data" is usually a pointer to
>>somewhere. Having userspace specify it would not be a good thing.
>
>
> Yeah, I don't think it's safe to use "driver_data". Although it can be a
> set of flags, it's also often used as an index in an array, or as a
> pointer. An invalid value could result in an oops.
>
> Most drivers don't use "driver_data". For those that do, it might be
> helpful to have the capability of setting a few static configuration values
> before probing the device. Currently "driver_data" fills this role.
> Perhaps we need a new mechanism that would be more useable with sysfs?
> The current code is limiting because the configuration options in
> "driver_data" are not well defined. Any ideas?
Unfortunately, from what I have gathered so far, driver_data is pretty
unique for different drivers, especially when comparing the usage in the
pci serial driver to a scsi hba driver like ipr.
Certainly, a driver that uses driver_data as a pointer cannot allow it
to be passed in from userspace. But a device driver that uses it as an
index into an array can easily allow it to be passed in and do some
simple range checking on it to verify it is a valid value before
indexing into the array.
--
Brian King
eServer Storage I/O
IBM Linux Technology Center
prev parent reply other threads:[~2005-02-09 15:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-07 22:00 [PATCH 1/1] PCI: Dynids - passing driver data brking
2005-02-07 22:18 ` Greg KH
2005-02-07 22:34 ` Brian King
2005-02-07 22:38 ` Martin Mares
2005-02-07 22:59 ` Brian King
2005-02-08 18:21 ` Adam Belay
2005-02-09 15:14 ` Brian King [this message]
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=420A28DA.40700@us.ibm.com \
--to=brking@us.ibm.com \
--cc=ambx1@neo.rr.com \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@atrey.karlin.mff.cuni.cz \
/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