public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <khali@linux-fr.org>
To: Stelian Pop <stelian@popies.net>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@osdl.org>,
	acpi-devel@lists.sourceforge.net
Subject: Re: [PATCH, new ACPI driver] new sony_acpi driver
Date: Fri, 11 Feb 2005 11:30:35 +0100	[thread overview]
Message-ID: <420C894B.1090700@linux-fr.org> (raw)
In-Reply-To: <20050210161809.GK3493@crusoe.alcove-fr>

Hi Stelian, all,

> This driver has been submitted (almost unchanged) on lkml and 
> on acpi-devel twice, first on July 21, 2004, then again on
> September 17, 2004. It has been quietly ignored.
> 
> Privately I've had many positive feedbacks from users of this driver
> (and no negative feedback), including Linux distributions who wish
> to include it into their kernels. The reports are increasing in number,
> it would seem that newer Sony Vaios are more and more incompatible
> with sonypi and require sony_acpi to control the screen brightness.

I'm sorry I missed the first two announcements. I'll give a try to your 
driver this evening, and report how it is working for me.

In the meantime, I'd have some comments on your patch:

> +static int debug = 0;

No need to initialize it to 0, the compiler does it for you (and more 
efficiently at that).

> +module_param(debug, int, 0);
> +MODULE_PARM_DESC(debug,"set this to 1 (and RTFM) if you want to help the development of this driver");

Lack of space after comma, and line too long, split it please.

> +static struct acpi_driver sony_acpi_driver = {
> +	name:	ACPI_SNC_DRIVER_NAME,
> +	class:	ACPI_SNC_CLASS,
> +	ids:	ACPI_SNC_HID,
> +	ops:	{
> +			add:	sony_acpi_add,
> +			remove:	sony_acpi_remove,
> +		},
> +};

As far as I know, you are supposed to use C99-style for structure 
initialization:
     .name = ACPI_SNC_DRIVER_NAME,
etc.

> +	printk(KERN_WARNING "acpi_callreadfunc failed\n");

Please prepend the driver name before such messages (everywhere in the 
driver). It's annoying when you see error messages in your logs and 
don't know which driver caused them.

> +static int parse_buffer(const char __user *buffer, unsigned long count, int *val) {
> +	char s[32];
> +	
> +	if (count > 31)
> +		return -EINVAL;
> +	if (copy_from_user(s, buffer, count))
> +		return -EFAULT;
> +	s[count] = 0;

= '\0' would look better IMHO.

> +	if (sscanf(s, "%i", val) != 1)

Can't you use simple_strtoul instead? This would be more efficient, or 
so I guess.

> --- /dev/null	2005-02-10 10:35:32.824183288 +0100
> +++ linux-2.6-stelian/Documentation/sony_acpi.txt	2005-01-31 17:00:09.000000000 +0100

Could be the time to create a Documentation/acpi directory and start 
populating it. It's odd that such a large subsystem has no documentation 
in the kernel tree.

> +You should start by trying the sonypi driver, which does
> +all this and many other things. But the sonypi driver does
> +not work on all sonypi laptops, whereas sony_acpi should 
> +work everywhere.

s/all sonypi laptops/all Sony laptops/?

> +Loading the sony_acpi.ko module will create a /proc/acpi/sony/
> +directory populated with a couple of files (only one for the
> +moment).

s/sony_acpi\.ko/sony_acpi/
.ko is an implementation detail the user-space should not have to care 
about.

> +For example:
> +	# echo "1" > /proc/acpi/sony/brt

BTW, why not naming the file "brightness" instead? Most acpi files have 
"long" names like that. At least people can easily figure out what the 
files are for.

> +config ACPI_SONY
> +	tristate "Sony Laptop Extras" 
> +	depends on X86
> +	depends on ACPI_INTERPRETER
> +	default m
> +	  ---help---
> +	  This mini-driver drives the ACPI SNC device present in the
> +	  ACPI BIOS of the Sony Vaio laptops.
> +
> +	  It gives access to some extra laptop functionalities. In
> +	  its current form, the only thing this driver does is letting 
> +	  the user set or query the screen brightness.
> +
> +	  Read <Documentation/sony_acpi.txt> for more information.

I think I remember this should be <file:Documentation...> or something 
similar.

Note that I have next to zero knowledge of the acpi internals so I 
couldn't comment on that part.

Thanks,
-- 
Jean Delvare

  reply	other threads:[~2005-02-11 10:30 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-10 16:18 [PATCH, new ACPI driver] new sony_acpi driver Stelian Pop
2005-02-11 10:30 ` Jean Delvare [this message]
2005-02-11 11:17   ` Stelian Pop
2005-02-14 10:53 ` Matthew Garrett
2005-02-14 10:58   ` Stelian Pop
     [not found]     ` <20050214105837.GE3233-KwDxFO93HejPHUqn3ntIkQ@public.gmane.org>
2005-02-14 20:32       ` Vojtech Pavlik
     [not found]         ` <20050214203211.GA8007-+ZI9xUNit7I@public.gmane.org>
2005-02-15 16:14           ` Romano Giannetti
     [not found]             ` <20050215161412.GC20951-NfIQswJzSEaq9fEpoSJUslHdEuJhDOxL@public.gmane.org>
2005-02-16 14:41               ` Stelian Pop
     [not found]                 ` <20050216144156.GA4372-KwDxFO93HejPHUqn3ntIkQ@public.gmane.org>
2005-02-16 15:40                   ` Romano Giannetti
2005-02-16 23:18         ` [ACPI] " Pavel Machek
     [not found] ` <20050210161809.GK3493-KwDxFO93HejPHUqn3ntIkQ@public.gmane.org>
2005-02-10 19:39   ` Bruno Ducrot
     [not found]     ` <20050210193937.GH1145-kk6yZipjEM5g9hUCZPvPmw@public.gmane.org>
2005-02-11  9:16       ` Stelian Pop
2005-02-11 11:05   ` Pekka Enberg
2005-02-11 11:36   ` Stelian Pop
2005-02-11 12:02     ` Pekka Enberg
2005-02-12 13:21     ` Jean Delvare
     [not found]       ` <20050212142103.5e1a79f9.khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
2005-02-14 10:07         ` Stelian Pop
2005-02-14 12:13           ` Jean Delvare
2005-02-14 12:38             ` Stelian Pop
     [not found]               ` <20050214123822.GF3233-KwDxFO93HejPHUqn3ntIkQ@public.gmane.org>
2005-02-14 18:42                 ` Jean Delvare
     [not found]                   ` <20050214194235.073f5850.khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
2005-02-16 15:39                     ` Stelian Pop
     [not found]                       ` <20050216153924.GC4372-KwDxFO93HejPHUqn3ntIkQ@public.gmane.org>
2005-02-18 18:38                         ` Jean Delvare
     [not found]     ` <20050211113636.GI3263-KwDxFO93HejPHUqn3ntIkQ@public.gmane.org>
2005-02-16 19:12       ` Emmanuel Fleury
2005-02-15 15:30   ` Len Brown
2005-02-15 15:39     ` [ACPI] " Stelian Pop
     [not found]       ` <20050215153912.GA3523-KwDxFO93HejPHUqn3ntIkQ@public.gmane.org>
2005-02-16 19:40         ` Bruno Ducrot
  -- strict thread matches above, loose matches on Subject: below --
2005-03-15  6:07 Yu, Luming

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=420C894B.1090700@linux-fr.org \
    --to=khali@linux-fr.org \
    --cc=acpi-devel@lists.sourceforge.net \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stelian@popies.net \
    /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