lkml.org 
[lkml]   [2008]   [Feb]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRe: [PATCH 1/6] regulator: consumer driver regulator control framework.
    Date
    On Saturday 23 February 2008, Andrew Morton wrote:
    > On Wed, 20 Feb 2008 17:08:53 +0000 Liam Girdwood <lg@opensource.wolfsonmicro.com> wrote:
    > > +#define mV_to_uV(mV) (mV * 1000)
    > > +#define uV_to_mV(uV) (uV / 1000)
    > > +#define V_to_uV(V) (mV_to_uV(V * 1000))
    > > +#define uV_to_V(uV) (uV_to_mV(uV) / 1000)
    > > +#define mA_to_uA(mA) (mA * 1000)
    > > +#define uA_to_mA(uA) (uA / 1000)
    > > +#define A_to_uA(A) (mA_to_uA(A * 1000))
    > > +#define uA_to_A(uA) (uA_to_mA(uA) / 1000)
    >
    > hm. It might be nicer to make these static inline functions. Especially
    > if the code is consistent about what C type is used to represent voltage
    > and current.

    And if not ... then be sure to use e.g. ((mV) * 1000), ((uV) / 1000) etc
    so that params like "x + 23" can't cause chaos.

    (FWIW oth these points -- use inlines, parenthesize params -- are also
    found in Documentation/CodingStyle.)


    \
     
     \ /
      Last update: 2008-02-23 19:39    [W:2.406 / U:0.756 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site