mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Feuerer <peter@piie.net>
To: petkovbb@gmail.com
Cc: LKML <linux-kernel@vger.kernel.org>,
	lenb@kernel.org, Matthew Garrett <mjg59@srcf.ucam.org>,
	Maxim Levitsky <maximlevitsky@gmail.com>
Subject: Re: [PATCH] Acer Aspire One Fan Control
Date: Mon, 11 May 2009 20:05:07 +0200	[thread overview]
Message-ID: <cone.1242065107.695268.13534.1000@onepiie> (raw)
In-Reply-To: <20090509171432.GA31126@liondog.tnic>

Hello,

Borislav Petkov writes:
> 
> the more I'm looking at the driver, the more I get annoyed by that
> user/kernel mode operation split. Remind me again why the driver should
> be loaded and not started automatically but the user should be required
> to activate it explicitly?

The idea of not starting the module in kernel mode was from Matthew. And he 
stated that it could harm the hardware when software controls the fan 
instead of the BIOS. It may also be possible, that the warranty gets invalid 
when you do that. Not sure about how acer would handle a defect which could 
be caused by overheating and when they detect that software was controlling 
the fan. That's why I think Matthew is right. 

> That's not so optimal, I'd say. The kernel module should _replace_
> the userspace program, not work alongside it, since the last is flaky
> and unreliable, and this was the main reason the kernel module was
> introduced in the first place - to control the fan from kernel space,
> which is the more sane choice.

The main reason to do this in kernel was the availabilty of atomic ec- read 
and write functions. But I agree with you that either kernel or BIOS 
should control the fan and not a userspace tool. I added the user mode just 
because it wasn't really much more code than just an implementation of the 
enable/disable functionality.

> What is more, if the userspace program would fail, there's no way for
> the module to get activated again and jump in instead of the userspace
> program to the rescue. Which goes more to show that you don't need
> userspace control _at_ _all_ and the only two agents controlling the fan
> should be the BIOS or the kernel module.

After reading and thinking about all this a while, I agree with you. In the 
next patch I won't allow the user to switch on/off the fan anymore.

> 
> So I think that the kernel module should take over fan control upon
> load. This way you'll be able to get rid of all that needless complexity
> around kernelmode/disable_kernelmode and have a simple clean design.

I would really like to do that, but what do you think about the hardware damage / warranty things written above?

>> +
>> +	if (!force_bios[0]) {
>> +		/* check if product is a AO - Aspire One */
>> +		if (strncmp(product, "AO", 2)) {
> 
> I suppose this check will have to be updated if Acer release newer
> Aspire One versions which product names are not AOXXXX anymore, right?
> But who knows, they might fix the fan in their A1 versions :)

This may really be updated if they release newer AO version. But the time 
being all supported Aspire One versions begin with AO.

>> +	/* search BIOS version and BIOS vendor in BIOS settings table */
>> +	for (i = 0; bios_settings[i].version[0]; ++i) {
>> +		if (!strcmp(bios_settings[i].vendor, vendor) &&
>> +				!strcmp(bios_settings[i].version, version)) {
>> +			bios_version = i;
>> +			break;
>> +		}
>> +	}
>> +	if (bios_version == -1) {
>> +		acerhdf_error("cannot find BIOS version\n");
>> +		ret_val = -ENODEV;
>> +		goto EXIT;
>> +	}
> 
> you could split this function since logically you do basic checking of hardware
> and below this line you register with the thermal core so the rest of that
> function could go into another one, something like:
> 
> static int acerhdf_register(int mode) {
> 
> 	...
> }
> 
> and then call it in the acerhdf_init() like that:
> 
> 	return acerhdf_register(kernelmode);

Good idea.

kind regards,
--peter

  reply	other threads:[~2009-05-11 19:34 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-25  1:45 Peter Feuerer
2009-04-25  8:42 ` Peter Feuerer
2009-04-26 15:31   ` Matthew Garrett
2009-04-27 18:25     ` Peter Feuerer
2009-04-26 17:29   ` Borislav Petkov
2009-04-27 18:57     ` Peter Feuerer
2009-04-28  7:25       ` Borislav Petkov
2009-04-28 10:04         ` Maxim Levitsky
2009-04-28 20:17           ` Peter Feuerer
2009-04-28 20:31             ` Maxim Levitsky
2009-05-02 21:21               ` Peter Feuerer
2009-05-03 18:46                 ` Borislav Petkov
2009-05-06 19:41                   ` Peter Feuerer
2009-05-06 22:17                   ` Peter Feuerer
2009-05-09 17:14                     ` Borislav Petkov
2009-05-11 18:05                       ` Peter Feuerer [this message]
2009-05-12  6:02                         ` Borislav Petkov
2009-05-18 18:04                           ` Peter Feuerer
2009-05-18 20:20                             ` Joe Perches
2009-05-19  6:47                               ` Peter Feuerer
2009-05-19  7:06                                 ` Joe Perches
2009-05-24 19:22                             ` Borislav Petkov
2009-06-01 14:12                               ` Peter Feuerer
2009-06-03  7:35                                 ` Borislav Petkov
2009-06-03  8:10                                   ` Peter Feuerer
2009-06-03 10:52                                     ` Borislav Petkov
2009-06-03 11:29                                       ` Peter Feuerer
2009-06-03 13:07                                       ` Peter Feuerer
2009-06-03 14:49                                         ` Borislav Petkov
2009-06-01 14:18                               ` Peter Feuerer
2009-06-03  7:39                                 ` Borislav Petkov
2009-06-03  7:52                                   ` Peter Feuerer
2009-06-03  8:00                                     ` Borislav Petkov
2009-05-19 20:30                         ` Pavel Machek
2009-05-22 11:50                           ` Borislav Petkov
2009-05-22 14:09                             ` Pavel Machek
2009-05-22 14:53                               ` Borislav Petkov
2009-05-24 11:13                                 ` Peter Feuerer
2009-05-22 16:10                               ` [PATCH] Acer Aspire One Fan Contro Andreas Mohr
2009-05-22 18:24                                 ` Borislav Petkov
2009-05-22 19:35                                   ` Andreas Mohr
2009-04-26 22:20   ` [PATCH] Acer Aspire One Fan Control Joe Perches
2009-04-27 19:03     ` Peter Feuerer

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=cone.1242065107.695268.13534.1000@onepiie \
    --to=peter@piie.net \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maximlevitsky@gmail.com \
    --cc=mjg59@srcf.ucam.org \
    --cc=petkovbb@gmail.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®