[U-Boot] [PATCH 2/4] cmd: adc: add info on channel mask

Fabrice Gasnier fabrice.gasnier at st.com
Fri Oct 19 07:40:00 UTC 2018


On 10/19/2018 05:25 AM, Simon Glass wrote:
> Hi Fabrice,
> 
> On 11 October 2018 at 10:00, Fabrice Gasnier <fabrice.gasnier at st.com> wrote:
>> Enhance adc info command to report also the channel mask.
>>
>> Signed-off-by: Fabrice Gasnier <fabrice.gasnier at st.com>
>> ---
>>
>>  cmd/adc.c | 6 +++++-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/cmd/adc.c b/cmd/adc.c
>> index c8857ed..39f61c1 100644
>> --- a/cmd/adc.c
>> +++ b/cmd/adc.c
>> @@ -35,7 +35,7 @@ static int do_adc_info(cmd_tbl_t *cmdtp, int flag, int argc,
>>                        char *const argv[])
>>  {
>>         struct udevice *dev;
>> -       unsigned int data_mask;
>> +       unsigned int data_mask, ch_mask;
>>         int ret, vss, vdd;
>>
>>         if (argc < 2)
>> @@ -49,6 +49,10 @@ static int do_adc_info(cmd_tbl_t *cmdtp, int flag, int argc,
>>
>>         printf("ADC Device '%s' :\n", argv[1]);
>>
>> +       ret = adc_channel_mask(dev, &ch_mask);
> 
> Could this just return the channel mask in the return value (or -ve on error)?

Hi Simon,

Channel mask is unsigned, so I would prefer to rely on (signed) ret to
return -ve on error, or success. And use pointer for the unsigned mask.

Do you agree to keep this approach ?

Thanks for reviewing,
Best Regards,
Fabrice

> 
>> +       if (!ret)
>> +               printf("channel mask: %x\n", ch_mask);
>> +
>>         ret = adc_data_mask(dev, &data_mask);
>>         if (!ret)
>>                 printf("data mask: %x\n", data_mask);
>> --
>> 1.9.1
>>
> 
> Regards,
> Simon
> 


More information about the U-Boot mailing list