[lkml]   [2011]   [Jun]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH 1/2] Samsung SoC ADC: use regulator (VDD for ADC).
    On Thu, Jun 16, 2011 at 05:30:02PM +0900, MyungJoo Ham wrote:

    > + adc->vdd = regulator_get(dev, S3C_ADC_REGULATOR_NAME);

    I'm not convinced that the #define for the name is terribly good style
    here, especially given that you actually call it vdd in the code.

    > + if (IS_ERR_OR_NULL(adc->vdd)) {
    > + dev_dbg(dev, "operating without regulator %s.\n", S3C_ADC_REGULATOR_NAME);
    > + adc->vdd = NULL; /* Do not control regulator */
    > + }
    > +

    No, don't do this. Just unconditionally assume the regulator is present
    if power is essential for use of the device. The regulator API will
    stub out correctly if it's not in use to allow things to proceed and if
    vdd is genuinely not hooked up then the driver can't function.

    > + if (adc->vdd)
    > + regulator_enable(adc->vdd);

    You're not checking the return value here or anywhere else after the
    inital get().

     \ /
      Last update: 2011-06-18 17:09    [W:0.021 / U:2.152 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site