mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Samuel Thibault <Samuel.Thibault@ens-lyon.fr>
To: Dominik Brodowski <linux@brodo.de>, torvalds@transmeta.com
Cc: cpufreq@www.linux.org.uk, linux-kernel@vger.kernel.org,
	torvalds@transmeta.com
Subject: [2.5 PATCH] bug if cpufreq driver initialization fails
Date: Sun, 15 Jun 2003 14:04:36 -0400	[thread overview]
Message-ID: <20030615180435.GC686@bouh.unh.edu> (raw)
In-Reply-To: <20030615095044.GD2009@brodo.de>

Le dim 15 jun 2003 11:50:44 GMT, Dominik Brodowski a tapoté sur son clavier :
> > However, my 440BX chipset is still not supported, and I couldn't find
> > anything in Intel's documentation...
> 
> Do you know of Bruno Ducrot's work? 
> 
> http://www.poupinou.org/cpufreq/

I read the list archive yesterday, and tried this work. I got the results
http://youpibouh.thefreecat.org/speedstep/ac
http://youpibouh.thefreecat.org/speedstep/battery
and hence tried my gpo_hilo=11, and it works... Sometimes.

I seems like the hardware si sometimes slow to get to the low speed. My
PIII is a 800Mhz/650Mhz, but initialization sometimes shows 800 and 800,
as if the speed measure was done before the hardware actually achieved
the slow down.

As a result, speedstep_cpu_init() fails, hence cpufreq_add_dev() fails,
which is ignored by sysdev_driver_register(). In the end, the module is
kept loaded (since speedstep_init() successes, since
cpufreq_register_driver successes()), and I have to unload it by hand,
which entails kobject badness warning of course, since cpufreq then
tries to remove entries which were actually never added to /sys!

I hence modified drivers/base/sys.c to have sysdev_driver_register()
fail as well, and then I also had to modify kernel/cpufreq.c, because
this failure did not imply a setting cpufreq_driver to NULL (preventing
me from reinsmoding speedstep-ich: EBUSY)

I'd also suggest that the speedstep drivers printks something if
everything went ok (including the cpufreq_frequency_table_cpuinfo()
call), the low & high speed for instance, just to be sure everything
went ok

Regards,
Samuel Thibault

--- linux-2.5.71-orig/drivers/base/sys.c	2003-06-14 17:12:52.000000000 -0400
+++ linux-2.5.71-perso/drivers/base/sys.c	2003-06-15 13:47:45.000000000 -0400
@@ -116,6 +116,7 @@
 int sysdev_driver_register(struct sysdev_class * cls, 
 			   struct sysdev_driver * drv)
 {
+	int ret = 0;
 	down_write(&system_subsys.rwsem);
 	if (cls && kset_get(&cls->kset)) {
 		list_add_tail(&drv->entry,&cls->drivers);
@@ -123,13 +124,16 @@
 		/* If devices of this class already exist, tell the driver */
 		if (drv->add) {
 			struct sys_device *dev;
-			list_for_each_entry(dev, &cls->kset.list, kobj.entry)
-				drv->add(dev);
+			list_for_each_entry(dev, &cls->kset.list, kobj.entry) {
+				ret = drv->add(dev);
+				if (ret) goto out;
+			}
 		}
 	} else
 		list_add_tail(&drv->entry,&global_drivers);
+out:
 	up_write(&system_subsys.rwsem);
-	return 0;
+	return ret;
 }
 
 
--- linux-2.5.71-orig/kernel/cpufreq.c	2003-06-14 17:13:39.000000000 -0400
+++ linux-2.5.71-perso/kernel/cpufreq.c	2003-06-15 13:55:36.000000000 -0400
@@ -811,6 +811,8 @@
  */
 int cpufreq_register_driver(struct cpufreq_driver *driver_data)
 {
+	int ret;
+
 	if (!driver_data || !driver_data->verify || !driver_data->init ||
 	    ((!driver_data->setpolicy) && (!driver_data->target)))
 		return -EINVAL;
@@ -825,13 +827,17 @@
 
 	cpufreq_driver->policy = kmalloc(NR_CPUS * sizeof(struct cpufreq_policy), GFP_KERNEL);
 	if (!cpufreq_driver->policy) {
-		cpufreq_driver = NULL;
-		return -ENOMEM;
+		ret = -ENOMEM;
+		goto out;
 	}
 
 	memset(cpufreq_driver->policy, 0, NR_CPUS * sizeof(struct cpufreq_policy));
 
-	return sysdev_driver_register(&cpu_sysdev_class,&cpufreq_sysdev_driver);
+	ret = sysdev_driver_register(&cpu_sysdev_class,&cpufreq_sysdev_driver);
+out:
+	if (ret)
+		cpufreq_driver = NULL;
+	return ret;
 }
 EXPORT_SYMBOL_GPL(cpufreq_register_driver);
 

  parent reply	other threads:[~2003-06-15 17:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-08  8:22 [2.5. PATCH] cpufreq: correct initialization on Intel Coppermines Dominik Brodowski
2003-06-14  8:46 ` Samuel Thibault
     [not found]   ` <20030614095646.GA1702@brodo.de>
     [not found]     ` <20030614214943.GA4073@bouh.unh.edu>
     [not found]       ` <20030615095044.GD2009@brodo.de>
2003-06-15 18:04         ` Samuel Thibault [this message]
2003-06-15 18:16           ` [2.5 PATCH] bug if cpufreq driver initialization fails Russell King
2003-06-15 18:25             ` Samuel Thibault
2003-06-15 18:48               ` Russell King

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=20030615180435.GC686@bouh.unh.edu \
    --to=samuel.thibault@ens-lyon.fr \
    --cc=cpufreq@www.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@brodo.de \
    --cc=samuel.thibault@fnac.net \
    --cc=torvalds@transmeta.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 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®