[U-Boot] [Resend PATCH V2 (forgot generic.c)] mx31: provide readable WEIM CS accessor

Stefano Babic sbabic at denx.de
Thu Sep 29 16:16:09 CEST 2011


On 09/29/2011 04:01 PM, Helmut Raiger wrote:
> On 09/29/2011 03:21 PM, Stefano Babic wrote:
>>
>>>
>>>   static u32 mx31_decode_pll(u32 reg, u32 infreq)
>>>   {
>>> @@ -126,6 +128,13 @@ void mx31_set_pad(enum iomux_pins pin, u32 config)
>>>
>>>   }
>>>
>>> +void mxc_setup_weimcs(int cs, const struct mxc_weimcs *weimcs)
>>> +{
>>> +    writel(weimcs->upper, WEIM_CSCR_U(cs));
>>> +    writel(weimcs->lower, WEIM_CSCR_L(cs));
>>> +    writel(weimcs->additional, WEIM_CSCR_A(cs));
>>> +}
>> Even if more hidden, the access is always made with base + offset,
>> instead of defining a structure.
>>
> 
> Do you really thing this is more readable:
> 
> ------------ in imx_regs.h -----------
> 
> struct mx31_weim_cscr {
>     u32 upper;
>     u32 lower;
>     u32 additional;
>     u32 reserved;
> };
> 
> struct mx31_weim {
>     struct mx31_weim_cscr cscr[6];
> };
> 
> -------------- in generic.c --------------
> 
> void mxc_setup_weimcs(int cs, const struct mxc_weimcs *weimcs)
> {
>     struct mx31_weim *weim = (struct mx31_weim *) WEIM_BASE;
>     struct mx31_weim_cscr *cscr = &weim->cscr[cs];
> 
>     writel(weimcs->upper, &cscr->upper);
>     writel(weimcs->lower, &cscr->lower);
>     writel(weimcs->additional, &cscr->additional);
> }
> 
> 
> It seems pretty clumsy to me, but for sure a matter of taste.
> Helmut

Check in the ML and also in code - more as a question of taste, this is
a coding style rule in u-boot.

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================


More information about the U-Boot mailing list