LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Richard Purdie <rpurdie@rpsys.net>
To: Ben Dooks <ben@trinity.fluff.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: LEDS: S3C24XX generate name if none given
Date: Tue, 16 Jan 2007 19:06:11 +0000	[thread overview]
Message-ID: <1168974371.5841.76.camel@localhost.localdomain> (raw)
In-Reply-To: <20070115154221.GH11889@trinity.fluff.org>

On Mon, 2007-01-15 at 15:42 +0000, Ben Dooks wrote:
> On Mon, Jan 15, 2007 at 01:44:28PM +0000, Richard Purdie wrote:
> > On Mon, 2007-01-15 at 12:26 +0000, Ben Dooks wrote:
> > > Generate a name if none is passed to the S3C24XX GPIO LED driver.
> > > 
> > > Signed-off-by: Ben Dooks <ben-linux@fluff.org>
> > > 
>
> Ok, how about using kstrdup() on the name, like this:

Much better, thanks.

Acked-by: Richard Purdie <rpurdie@rpsys.net>

Creating a git tree to handle the LED patches properly is on my todo
list...

> diff -urpN -X ../dontdiff linux-2.6.19/drivers/leds/leds-s3c24xx.c linux-2.6.19-simtec1p22/drivers/leds/leds-s3c24xx.c
> --- linux-2.6.19/drivers/leds/leds-s3c24xx.c	2006-11-29 21:57:37.000000000 +0000
> +++ linux-2.6.19-simtec1p22/drivers/leds/leds-s3c24xx.c	2007-01-15 15:26:05.000000000 +0000
> @@ -59,6 +59,9 @@ static int s3c24xx_led_remove(struct pla
>  {
>  	struct s3c24xx_gpio_led *led = pdev_to_gpio(dev);
>  
> +	if (led->cdev.name != led->pdata.name)
> +		kfree(led->cdev.name);
> +
>  	led_classdev_unregister(&led->cdev);
>  	kfree(led);
>  
> @@ -85,6 +88,15 @@ static int s3c24xx_led_probe(struct plat
>  
>  	led->pdata = pdata;
>  
> +	/* create name if we were not passed one */
> +
> +	if (led->cdev.name == NULL) {
> +		char name[64];
> +
> +		snprintf(name, sizeof(name), "%s.%d",  dev->name, dev->id);
> +		led->cdev.name = kstrdup(name);
> +	}
> +
>  	/* no point in having a pull-up if we are always driving */
>  
>  	if (pdata->flags & S3C24XX_LEDF_TRISTATE) {
> 
> 


  reply	other threads:[~2007-01-16 19:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-15 12:26 Ben Dooks
2007-01-15 12:32 ` Robert P. J. Day
2007-01-15 13:44 ` Richard Purdie
2007-01-15 15:42   ` Ben Dooks
2007-01-16 19:06     ` Richard Purdie [this message]
2007-01-22 19:56     ` Andrew Morton

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=1168974371.5841.76.camel@localhost.localdomain \
    --to=rpurdie@rpsys.net \
    --cc=ben@trinity.fluff.org \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: LEDS: S3C24XX generate name if none given' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).