Commit be9c03e4 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

media: v4l2-fwnode: simplify v4l2_fwnode_reference_parse_int_props() call

The v4l2_fwnode_reference_parse_int_props() has a big name, causing
it to cause coding style warnings. Also, it depends on a const
struct embedded indide a function.

Rearrange the logic in order to move the struct declaration out
of such function and use it inside this function.

That cleans up some coding style issues.
Acked-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent c1e63055
...@@ -1006,6 +1006,12 @@ v4l2_fwnode_reference_get_int_prop(struct fwnode_handle *fwnode, ...@@ -1006,6 +1006,12 @@ v4l2_fwnode_reference_get_int_prop(struct fwnode_handle *fwnode,
return fwnode; return fwnode;
} }
struct v4l2_fwnode_int_props {
const char *name;
const char * const *props;
unsigned int nprops;
};
/* /*
* v4l2_fwnode_reference_parse_int_props - parse references for async * v4l2_fwnode_reference_parse_int_props - parse references for async
* sub-devices * sub-devices
...@@ -1032,13 +1038,14 @@ v4l2_fwnode_reference_get_int_prop(struct fwnode_handle *fwnode, ...@@ -1032,13 +1038,14 @@ v4l2_fwnode_reference_get_int_prop(struct fwnode_handle *fwnode,
static int static int
v4l2_fwnode_reference_parse_int_props(struct device *dev, v4l2_fwnode_reference_parse_int_props(struct device *dev,
struct v4l2_async_notifier *notifier, struct v4l2_async_notifier *notifier,
const char *prop, const struct v4l2_fwnode_int_props *p)
const char * const *props,
unsigned int nprops)
{ {
struct fwnode_handle *fwnode; struct fwnode_handle *fwnode;
unsigned int index; unsigned int index;
int ret; int ret;
const char *prop = p->name;
const char * const *props = p->props;
unsigned int nprops = p->nprops;
index = 0; index = 0;
do { do {
...@@ -1093,11 +1100,7 @@ int v4l2_async_notifier_parse_fwnode_sensor_common(struct device *dev, ...@@ -1093,11 +1100,7 @@ int v4l2_async_notifier_parse_fwnode_sensor_common(struct device *dev,
struct v4l2_async_notifier *notifier) struct v4l2_async_notifier *notifier)
{ {
static const char * const led_props[] = { "led" }; static const char * const led_props[] = { "led" };
static const struct { static const struct v4l2_fwnode_int_props props[] = {
const char *name;
const char * const *props;
unsigned int nprops;
} props[] = {
{ "flash-leds", led_props, ARRAY_SIZE(led_props) }, { "flash-leds", led_props, ARRAY_SIZE(led_props) },
{ "lens-focus", NULL, 0 }, { "lens-focus", NULL, 0 },
}; };
...@@ -1109,9 +1112,7 @@ int v4l2_async_notifier_parse_fwnode_sensor_common(struct device *dev, ...@@ -1109,9 +1112,7 @@ int v4l2_async_notifier_parse_fwnode_sensor_common(struct device *dev,
if (props[i].props && is_acpi_node(dev_fwnode(dev))) if (props[i].props && is_acpi_node(dev_fwnode(dev)))
ret = v4l2_fwnode_reference_parse_int_props(dev, ret = v4l2_fwnode_reference_parse_int_props(dev,
notifier, notifier,
props[i].name, &props[i]);
props[i].props,
props[i].nprops);
else else
ret = v4l2_fwnode_reference_parse(dev, notifier, ret = v4l2_fwnode_reference_parse(dev, notifier,
props[i].name); props[i].name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment