Re: [PATCH 12/73] regulator: core: Show consumers that hold aregulator in Sysfs

From: Mark Brown
Date: Mon Feb 04 2013 - 14:41:31 EST


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.

Attachment: signature.asc
Description: Digital signature