• Uwe Kleine-König's avatar
    pwm: lpc18xx-sct: Simplify driver by not using pwm_[gs]et_chip_data() · 9136a39e
    Uwe Kleine-König authored
    The per-channel data is available directly in the driver data struct. So
    use it without making use of pwm_[gs]et_chip_data().
    
    The relevant change introduced by this patch to lpc18xx_pwm_disable() at
    the assembler level (for an arm lpc18xx_defconfig build) is:
    
    	push    {r3, r4, r5, lr}
    	mov     r4, r0
    	mov     r0, r1
    	mov     r5, r1
    	bl      0 <pwm_get_chip_data>
    	ldr     r3, [r0, #0]
    
    changes to
    
    	ldr     r3, [r1, #8]
    	push    {r4, lr}
    	add.w   r3, r0, r3, lsl #2
    	ldr     r3, [r3, #92]   ; 0x5c
    
    So this reduces stack usage, has an improved runtime behavior because of
    better pipeline usage, doesn't branch to an external function and the
    generated code is a bit smaller occupying less memory.
    
    The codesize of lpc18xx_pwm_probe() is reduced by 32 bytes.
    Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
    Signed-off-by: default avatarThierry Reding <thierry.reding@gmail.com>
    9136a39e
pwm-lpc18xx-sct.c 12.9 KB