lkml.org 
[lkml]   [2017]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH RESEND] regulator: rn5t618: add RC5T619 PMIC support
From
Date
On Sun, 2017-08-27 at 15:58 +0200, Pierre-Hugues Husson wrote:
> Extend the driver to support Ricoh RC5T619.
> Support the additional regulators and slightly different voltage ranges.
>
> @@ -101,10 +131,7 @@ static int rn5t618_regulator_probe(struct platform_device *pdev)
>   config.dev = pdev->dev.parent;
>   config.regmap = rn5t618->regmap;
>  
> - for (i = 0; i < RN5T618_REG_NUM; i++) {
> - if (!regulators[i].name)
> - continue;
> -
> + for (i = 0; i < num_regulators; i++) {
>   rdev = devm_regulator_register(&pdev->dev,
>          ®ulators[i],
>          &config);

This is wrong. The rn5t*_regulators arrays are indexed by RN5T618_*
constants and can have gaps. If you remove the check for
regulators[i].name then older models get errors like this:

rn5t618-regulator rn5t618-regulator: failed to register (null) regulator
rn5t618-regulator: probe of rn5t618-regulator failed with error -22

Either the check needs to be kep or otherwise regulator_desc arrays
should be modified. Indexing by RN5T618_* does not appear to be used so
maybe just use a flat array? That would also save a few bytes of
memory.

I know it's a late comment and the patch was already accepted, I just
noticed that rn5t567 fails to probe while working on something else.

--
Regards,
Leonard

\
 
 \ /
  Last update: 2017-10-13 18:30    [W:0.058 / U:0.288 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site