From: Greg Kroah-Hartman <gregkh@suse.de>
To: linux-kernel@vger.kernel.org
Cc: David Brownell <david-b@pacbell.net>,
David Brownell <dbrownell@users.sourceforge.net>,
Andres Salomon <dilinger@debian.org>,
Dmitry Torokhov <dtor@mail.ru>,
Russell King <rmk@arm.linux.org.uk>,
Andrew Morton <akpm@linux-foundation.org>,
Greg Kroah-Hartman <gregkh@suse.de>
Subject: [PATCH 1/5] update Documentation/driver-model/platform.txt
Date: Fri, 8 Jun 2007 13:04:39 -0700 [thread overview]
Message-ID: <11813330832783-git-send-email-gregkh@suse.de> (raw)
In-Reply-To: <20070608200407.GA22825@kroah.com>
From: David Brownell <david-b@pacbell.net>
Make note of the legacy "probe-the-hardware" drivers, and some APIs that
are mostly unused except by such drivers. We probably can't escape having
legacy drivers for a while (e.g. old ISA drivers), but we can at least
discourage this style code for new drivers, and unless it's unavoidable.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Andres Salomon <dilinger@debian.org>
Cc: Dmitry Torokhov <dtor@mail.ru>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
Documentation/driver-model/platform.txt | 40 +++++++++++++++++++++++++++++++
1 files changed, 40 insertions(+), 0 deletions(-)
diff --git a/Documentation/driver-model/platform.txt b/Documentation/driver-model/platform.txt
index 19c4a6e..2a97320 100644
--- a/Documentation/driver-model/platform.txt
+++ b/Documentation/driver-model/platform.txt
@@ -96,6 +96,46 @@ System setup also associates those clocks with the device, so that that
calls to clk_get(&pdev->dev, clock_name) return them as needed.
+Legacy Drivers: Device Probing
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Some drivers are not fully converted to the driver model, because they take
+on a non-driver role: the driver registers its platform device, rather than
+leaving that for system infrastructure. Such drivers can't be hotplugged
+or coldplugged, since those mechanisms require device creation to be in a
+different system component than the driver.
+
+The only "good" reason for this is to handle older system designs which, like
+original IBM PCs, rely on error-prone "probe-the-hardware" models for hardware
+configuration. Newer systems have largely abandoned that model, in favor of
+bus-level support for dynamic configuration (PCI, USB), or device tables
+provided by the boot firmware (e.g. PNPACPI on x86). There are too many
+conflicting options about what might be where, and even educated guesses by
+an operating system will be wrong often enough to make trouble.
+
+This style of driver is discouraged. If you're updating such a driver,
+please try to move the device enumeration to a more appropriate location,
+outside the driver. This will usually be cleanup, since such drivers
+tend to already have "normal" modes, such as ones using device nodes that
+were created by PNP or by platform device setup.
+
+None the less, there are some APIs to support such legacy drivers. Avoid
+using these calls except with such hotplug-deficient drivers.
+
+ struct platform_device *platform_device_alloc(
+ char *name, unsigned id);
+
+You can use platform_device_alloc() to dynamically allocate a device, which
+you will then initialize with resources and platform_device_register().
+A better solution is usually:
+
+ struct platform_device *platform_device_register_simple(
+ char *name, unsigned id,
+ struct resource *res, unsigned nres);
+
+You can use platform_device_register_simple() as a one-step call to allocate
+and register a device.
+
+
Device Naming and Driver Binding
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The platform_device.dev.bus_id is the canonical name for the devices.
--
1.5.2.1
next prev parent reply other threads:[~2007-06-08 20:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-08 20:04 [GIT PATCH] Driver core fixes for 2.6.22-rc4 Greg KH
2007-06-08 20:04 ` Greg Kroah-Hartman [this message]
2007-06-08 20:04 ` [PATCH 2/5] Driver core: keep PHYSDEV for old struct class_device Greg Kroah-Hartman
2007-06-08 20:04 ` [PATCH 3/5] Driver core: kill unused code Greg Kroah-Hartman
2007-06-08 20:04 ` [PATCH 4/5] kobject: use the proper printk level for kobject error Greg Kroah-Hartman
2007-06-08 20:04 ` [PATCH 5/5] firmware: remove orphaned Email Greg Kroah-Hartman
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=11813330832783-git-send-email-gregkh@suse.de \
--to=gregkh@suse.de \
--cc=akpm@linux-foundation.org \
--cc=david-b@pacbell.net \
--cc=dbrownell@users.sourceforge.net \
--cc=dilinger@debian.org \
--cc=dtor@mail.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=rmk@arm.linux.org.uk \
/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