| Date | Mon, 4 Feb 2013 19:41:26 +0000 | From | Mark Brown <> | Subject | Re: [PATCH 12/73] regulator: core: Show consumers that hold a regulator in Sysfs |
| |
On Mon, Feb 04, 2013 at 11:53:27AM +0000, Lee Jones wrote:
> + int use;
Better to call it use_count like the other use_count.
> + list_for_each_entry(reg, &rdev->consumer_list, list) { > + if (!reg->use) > + continue; > + > + if (reg->dev != NULL) > + size += sprintf((buf + size), "%s (%d) ", > + dev_name(reg->dev), reg->use); > + else > + size += sprintf((buf + size), "unknown (%d) ", > + reg->use);
Should really check we don't go over PAGE_SIZE, and since this isn't a simple value it should go in debugfs (a simple count would be OK in sysfs, I'd suggest adding both).
> if (ret != 0 && rdev->supply) > regulator_disable(rdev->supply); > + else > + regulator->use++;
This will increase the usage count in the case where we get an error but don't have a parent supply. [unhandled content-type:application/pgp-signature] |