Re: [PATCH 14/14] regulator: 88pm8607: avoid to use constraint namein driver

From: Mark Brown
Date: Tue Apr 19 2011 - 04:13:01 EST


On Mon, Apr 18, 2011 at 07:45:06PM -0700, Haojian Zhuang wrote:

> >I assume that by "platform driver" you mean the machine driver for the
> >system? What I'm saying is that instead of using a string to match it'd
> >be more normal to use an enum in the driver header, that way if someone
> >typos the string or something then there will be a build failure whereas
> >with strings like this there will only be a runtime failure.

> It's nearly same whatever it's string or index number. In machine driver,
> it's more convenient on using string. Otherwise, I still need to create

You're saying it's more convenient but you're not saying why. I'd say
that the lack of build time checking I mentioned is actually unhelpful.

> a new integer array to store index since I transfer them into regulator data
> by driver_data parameter in regulator_init_data.

You already need to add a char * to store the name, adding an enum
instead isn't a substantial difference...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/