lkml.org 
[lkml]   [2007]   [Jan]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    SubjectRe: LEDS: S3C24XX generate name if none given
    From
    Date
    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) {
    >
    >

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2007-01-16 20:39    [W:0.049 / U:0.064 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site