regulator: adding constraints to regulator_desc?

From: Wolfram Sang
Date: Mon Sep 14 2009 - 06:41:08 EST


Hi,

I have a question regarding the constraints of the regulator-framework: If I
understood correctly, there is a struct in regulator_dev which is describing
the constraints on the power-domain-level. As we also have constraints on the
regulator-level, all the regulator drivers do sanity checks in their
set_voltage()-functions. These checks differ and it is not always clear to me
if additional checks other drivers have were forgotten or intentionally omitted
for a specific driver. I also wondered about code-duplication and if it was
maybe worthwhile to simply add 'min' and 'max' members to struct regulator_desc
and let the core do sanity checks (like it does for the constraints on the
power-domain-level). Has this been considered already?

One thing which also raised my attention was the beginning of
regulator_check_voltage(). It starts with

BUG_ON(*min_uV > *max_uV);

Is it really necessary to halt the kernel? Wouldn't a big warning and -EINVAL
do like at the end of the function?

Regards,

Wolfram

--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |

Attachment: signature.asc
Description: Digital signature