i386/118739: [ PATCH ] Allow the cpufreq/p4tcc driver to detach
Dan Lukes
dan at obluda.cz
Sat Dec 15 18:40:03 PST 2007
>Number: 118739
>Category: i386
>Synopsis: [ PATCH ] Allow the cpufreq/p4tcc driver to detach
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-i386
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Sun Dec 16 02:40:02 UTC 2007
>Closed-Date:
>Last-Modified:
>Originator: Dan Lukes
>Release: FreeBSD 6.3-PRERELEASE i386
>Organization:
Obludarium
>Environment:
System: FreeBSD 6.3-PRERELEASE #18: Sun Dec 16 03:05:00 CET 2007 i386
src/sys/i386/cpufreq/p4tcc.c,v 1.11.2.1 2005/10/25 20:52:44 njl
As far as I know the problem apply to current as well
>Description:
The p4tcc driver has no detach method with no aparent reason
As p4tcc is not standalone driver but part of cpufreq suite it block
reloading of the other cpufreq subdrivers
>How-To-Repeat:
kldunload cpufreq on hardware where p4tcc supported
>Fix:
Add the detach method.
It mean:
1. set CPU to Automatic mode
2. deregister the driver
3. return NOERROR to upper layer
--- sys/i386/cpufreq/p4tcc.c.ORIG 2007-12-16 02:49:30.000000000 +0100
+++ sys/i386/cpufreq/p4tcc.c 2007-12-16 03:08:12.000000000 +0100
@@ -72,6 +72,7 @@
static void p4tcc_identify(driver_t *driver, device_t parent);
static int p4tcc_probe(device_t dev);
static int p4tcc_attach(device_t dev);
+static int p4tcc_detach(device_t dev);
static int p4tcc_settings(device_t dev, struct cf_setting *sets,
int *count);
static int p4tcc_set(device_t dev, const struct cf_setting *set);
@@ -83,6 +84,7 @@
DEVMETHOD(device_identify, p4tcc_identify),
DEVMETHOD(device_probe, p4tcc_probe),
DEVMETHOD(device_attach, p4tcc_attach),
+ DEVMETHOD(device_detach, p4tcc_detach),
/* cpufreq interface */
DEVMETHOD(cpufreq_drv_set, p4tcc_set),
@@ -201,6 +203,25 @@
}
static int
+p4tcc_detach(device_t dev)
+{
+ struct est_softc *sc;
+ struct cf_setting set;
+ int error;
+
+ sc = device_get_softc(dev);
+
+ /*
+ * Before we finish detach, switch to Automatic mode
+ */
+ set.freq = 10000;
+ p4tcc_set(dev, &set);
+
+ error = cpufreq_unregister(dev);
+ return (error);
+}
+
+static int
p4tcc_settings(device_t dev, struct cf_setting *sets, int *count)
{
struct p4tcc_softc *sc;
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-i386
mailing list