public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Richard Purdie <rpurdie@rpsys.net>
To: Bob Rodgers <Robert_Rodgers@dell.com>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>,
	"lenb@kernel.org" <lenb@kernel.org>,
	Linux-kernel <linux-kernel@vger.kernel.org>,
	Louis Davis <Louis_Davis@dell.com>,
	Jim Dailey <Jim_Dailey@dell.com>,
	Michael Brown <Michael_E_Brown@dell.com>,
	Mario Limonciello <Mario_Limonciello@dell.com>,
	Matt Domsch <Matt_Domsch@dell.com>,
	Dan Carpenter <error27@gmail.com>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>
Subject: Re: [PATCH] Add Dell Business Class Netbook LED driver
Date: Thu, 11 Feb 2010 17:59:14 +0000	[thread overview]
Message-ID: <1265911154.4689.11.camel@rex> (raw)
In-Reply-To: <4B7078E2.50407@dell.com>

On Mon, 2010-02-08 at 14:49 -0600, Bob Rodgers wrote:
> This patch adds an LED driver to support the Dell Activity LED on the 
> Dell Latitude 2100 netbook and future products to come. The Activity LED 
> is visible externally in the lid so classroom instructors can observe it 
> from a distance. The driver uses the sysfs led_class and provides a 
> standard LED interface. This driver is ready for submission upstream.

A couple of comments:

> diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
> index 8a0e1ec..40dd693 100644
> --- a/drivers/leds/Kconfig
> +++ b/drivers/leds/Kconfig
> @@ -269,6 +269,13 @@ config LEDS_ADP5520
>  	  To compile this driver as a module, choose M here: the module will
>  	  be called leds-adp5520.
> 
> +config LEDS_DELL_NETBOOKS
> +	tristate "External LED on Dell Business Netbooks"
> +	depends on LEDS_CLASS
> +	help
> +	  This adds support for the Latitude 2100 and similar
> +	  notebooks that have an external LED.
> +
>  comment "LED Triggers"

I assume this driver applies to X86 only? Is there anything else this
config option should be depending on?

> +static int __devinit dell_led_probe(struct platform_device *pdev)
> +{
> +	return led_classdev_register(&pdev->dev, &dell_led);
> +}
> +
> +static int dell_led_remove(struct platform_device *pdev)
> +{
> +	led_classdev_unregister(&dell_led);
> +	return 0;
> +}
> +
> +static struct platform_driver dell_led_driver = {
> +	.probe		= dell_led_probe,
> +	.remove		= dell_led_remove,
> +	.driver		= {
> +		.name	= KBUILD_MODNAME,
> +		.owner	= THIS_MODULE,
> +	},
> +};
> +
> +static struct platform_device *pdev;
> +
> +static int __init dell_led_init(void)
> +{
> +	int error = 0;
> +
> +	if (!wmi_has_guid(DELL_LED_BIOS_GUID)) {
> +		printk(KERN_DEBUG KBUILD_MODNAME
> +			": could not find: DELL_LED_BIOS_GUID\n");
> +		return -ENODEV;
> +	}
> +
> +	error = led_off();
> +	if (error != 0) {
> +		printk(KERN_DEBUG KBUILD_MODNAME
> +			": could not communicate with LED"
> +			": error %d\n", error);
> +		return -ENODEV;
> +	}
> +
> +	error = platform_driver_register(&dell_led_driver);
> +	if (error < 0)
> +		return error;
> +
> +	pdev = platform_device_register_simple(KBUILD_MODNAME, -1, NULL, 0);
> +	if (IS_ERR(pdev)) {
> +		error = PTR_ERR(pdev);
> +		platform_driver_unregister(&dell_led_driver);
> +	}
> +
> +	return error;
> +}

Rather than add all this overhead of a platform device, why not just
pass NULL as the parent to led_classdev_register()?

Cheers,

Richard


  reply	other threads:[~2010-02-11 18:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-08 20:49 [PATCH] Add Dell Business Class Netbook LED driver Bob Rodgers
2010-02-11 17:59 ` Richard Purdie [this message]
2010-02-11 18:05   ` Dmitry Torokhov
2010-02-11 18:07     ` Matthew Garrett
2010-02-11 18:28       ` Dmitry Torokhov
2010-02-11 18:31         ` Matthew Garrett
2010-02-11 18:09   ` Matthew Garrett

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=1265911154.4689.11.camel@rex \
    --to=rpurdie@rpsys.net \
    --cc=Jim_Dailey@dell.com \
    --cc=Louis_Davis@dell.com \
    --cc=Mario_Limonciello@dell.com \
    --cc=Matt_Domsch@dell.com \
    --cc=Michael_E_Brown@dell.com \
    --cc=Robert_Rodgers@dell.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=error27@gmail.com \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjg59@srcf.ucam.org \
    /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