Embedded Linux development
 help / color / mirror / Atom feed
  • [parent not found: <88de40673cc33e014928c2ee3a86bdac566021c8.1223482372.git.bgat@billgatliff.com>]
  • * Re: [RFC 1/6] [PWM] Generic PWM API implementation
           [not found] <4b5c3aa2b1bc2b7efad834da49c2dec8c0a8726b.1223482372.git.bgat@billgatliff.com>
           [not found] ` <cover.1223482372.git.bgat@billgatliff.com>
           [not found] ` <88de40673cc33e014928c2ee3a86bdac566021c8.1223482372.git.bgat@billgatliff.com>
    @ 2008-10-09  8:17 ` Marc Pignat
      2 siblings, 0 replies; 33+ messages in thread
    From: Marc Pignat @ 2008-10-09  8:17 UTC (permalink / raw)
      To: Bill Gatliff; +Cc: linux-embedded
    
    Cleanup implementation for __pwm_create_sysfs.
    
    Signed-off-by: Marc Pignat <marc.pignat@hevs.ch>
    ---
    
    Hi all!
    
    Here is a missing piece in the generic pwm implementation.
    
    Bill, the code is simpler that you was thinking ;)
    
    In facts, attributes are deleted by device_unregister -> there is nothing to
    worry about attributes (un-)successful creation.
    
    Finding which device was created is also trivial (thanks to class_find_device).
    
    Best regards
    
    Marc
    
    diff --git a/drivers/pwm/pwm.c b/drivers/pwm/pwm.c
    index 2f28c20..391f820 100644
    --- a/drivers/pwm/pwm.c
    +++ b/drivers/pwm/pwm.c
    @@ -626,15 +626,23 @@ static int __pwm_create_sysfs(struct pwm_device *pwm)
     			goto err_dev_create;
     		ret = sysfs_create_group(&dev->kobj, &pwm_device_attr_group);
     		if (ret)
    -			goto err_dev_group_create;
    +			goto err_dev_create;
     	}
     
     	return ret;
     
    -err_dev_group_create:
     err_dev_create:
    -	/* TODO: undo all the successful device_create calls */
    -	return -ENODEV;
    +	for (wchan = 0; wchan < pwm->nchan; wchan++) {
    +		dev = class_find_device(&pwm_class, NULL,
    +					&pwm->channels[wchan],
    +					__match_device);
    +		if (dev) {
    +			put_device(dev);
    +			device_unregister(dev);
    +		}
    +	}
    +
    +	return ret;
     }
     
     
    
    ^ permalink raw reply related	[flat|nested] 33+ messages in thread

  • end of thread, other threads:[~2008-10-13  7:40 UTC | newest]
    
    Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
    -- links below jump to the message on this page --
         [not found] <4b5c3aa2b1bc2b7efad834da49c2dec8c0a8726b.1223482372.git.bgat@billgatliff.com>
         [not found] ` <cover.1223482372.git.bgat@billgatliff.com>
    2008-10-08 16:43   ` [RFC 1/6] [PWM] Generic PWM API implementation Bill Gatliff
    2008-10-08 16:43   ` [RFC 2/6] [PWM] Changes to existing include/linux/pwm.h to adapt to generic PWM API Bill Gatliff
    2008-10-08 16:43   ` [RFC 3/6] [PWM] Documentation Bill Gatliff
    2008-10-08 16:43   ` [RFC 4/6] [PWM] Driver for Atmel PWMC peripheral Bill Gatliff
    2008-10-08 16:43   ` [RFC 5/6] [PWM] Install new Atmel PWMC driver in Kconfig, expunge old one Bill Gatliff
    2008-10-08 16:43   ` [RFC 6/6] [PWM] New LED driver and trigger that use PWM API Bill Gatliff
    2008-10-08 19:27   ` [RFC 0/6] Proposal for a Generic PWM Device API Mike Frysinger
    2008-10-09  2:23     ` Bill Gatliff
    2008-10-09  2:29       ` Bill Gatliff
    2008-10-09  2:32       ` Mike Frysinger
    2008-10-09  3:46         ` Bill Gatliff
    2008-10-09  4:05           ` Mike Frysinger
    2008-10-09  4:18             ` Bill Gatliff
    2008-10-09  4:33               ` Mike Frysinger
         [not found]   ` <1223608819.8157.127.camel@pasglop>
         [not found]     ` <48EED4D1.2040506@billgatliff.com>
    2008-10-10  9:00       ` Geert Uytterhoeven
    2008-10-10  9:36         ` Paul Mundt
    2008-10-10  9:46           ` David Woodhouse
    2008-10-10 13:59             ` Bill Gatliff
    2008-10-10 14:03           ` Bill Gatliff
    2008-10-10 14:32             ` Haavard Skinnemoen
    2008-10-10 17:28             ` Paul Mundt
    2008-10-10 19:15               ` Bill Gatliff
    2008-10-10 13:59         ` Bill Gatliff
    2008-10-10 17:40           ` Paul Mundt
    2008-10-10 19:42             ` Bill Gatliff
    2008-10-13  7:40               ` Geert Uytterhoeven
         [not found] ` <88de40673cc33e014928c2ee3a86bdac566021c8.1223482372.git.bgat@billgatliff.com>
         [not found]   ` <7b16004ca5f8030184c2de96cbcee38657d56252.1223482372.git.bgat@billgatliff.com>
         [not found]     ` <5640f37b779f953c83e79c16b2a0466c0f5da702.1223482372.git.bgat@billgatliff.com>
         [not found]       ` <475b4a5985463015fdfa943b9835ab8136dbc06a.1223482372.git.bgat@billgatliff.com>
    2008-10-09  5:21         ` [RFC 5/6] [PWM] Install new Atmel PWMC driver in Kconfig, expunge old one Hans-Christian Egtvedt
    2008-10-09 12:16           ` Haavard Skinnemoen
    2008-10-09 12:17             ` Hans-Christian Egtvedt
    2008-10-09 14:04               ` Bill Gatliff
    2008-10-09 13:40           ` Bill Gatliff
    2008-10-09 13:44             ` Hans-Christian Egtvedt
    2008-10-09  8:17 ` [RFC 1/6] [PWM] Generic PWM API implementation Marc Pignat
    

    This is a public inbox, see mirroring instructions
    for how to clone and mirror all data and code used for this inbox