Commit 6087b215 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

media: v4l2-core: cleanup coding style at V4L2 async/fwnode

There are several coding style issues at those definitions,
and the previous patchset added even more.

Address the trivial ones by first calling:

	./scripts/checkpatch.pl --strict --fix-inline include/media/v4l2-async.h include/media/v4l2-fwnode.h include/media/v4l2-mediabus.h drivers/media/v4l2-core/v4l2-async.c drivers/media/v4l2-core/v4l2-fwnode.c

and then manually adjusting the style where needed.
Acked-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent cac0223c
...@@ -57,6 +57,7 @@ static bool match_i2c(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd) ...@@ -57,6 +57,7 @@ static bool match_i2c(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
{ {
#if IS_ENABLED(CONFIG_I2C) #if IS_ENABLED(CONFIG_I2C)
struct i2c_client *client = i2c_verify_client(sd->dev); struct i2c_client *client = i2c_verify_client(sd->dev);
return client && return client &&
asd->match.i2c.adapter_id == client->adapter->nr && asd->match.i2c.adapter_id == client->adapter->nr &&
asd->match.i2c.address == client->addr; asd->match.i2c.address == client->addr;
...@@ -89,10 +90,11 @@ static LIST_HEAD(subdev_list); ...@@ -89,10 +90,11 @@ static LIST_HEAD(subdev_list);
static LIST_HEAD(notifier_list); static LIST_HEAD(notifier_list);
static DEFINE_MUTEX(list_lock); static DEFINE_MUTEX(list_lock);
static struct v4l2_async_subdev *v4l2_async_find_match( static struct v4l2_async_subdev *
struct v4l2_async_notifier *notifier, struct v4l2_subdev *sd) v4l2_async_find_match(struct v4l2_async_notifier *notifier,
struct v4l2_subdev *sd)
{ {
bool (*match)(struct v4l2_subdev *, struct v4l2_async_subdev *); bool (*match)(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd);
struct v4l2_async_subdev *asd; struct v4l2_async_subdev *asd;
list_for_each_entry(asd, &notifier->waiting, list) { list_for_each_entry(asd, &notifier->waiting, list) {
...@@ -150,8 +152,8 @@ static bool asd_equal(struct v4l2_async_subdev *asd_x, ...@@ -150,8 +152,8 @@ static bool asd_equal(struct v4l2_async_subdev *asd_x,
} }
/* Find the sub-device notifier registered by a sub-device driver. */ /* Find the sub-device notifier registered by a sub-device driver. */
static struct v4l2_async_notifier *v4l2_async_find_subdev_notifier( static struct v4l2_async_notifier *
struct v4l2_subdev *sd) v4l2_async_find_subdev_notifier(struct v4l2_subdev *sd)
{ {
struct v4l2_async_notifier *n; struct v4l2_async_notifier *n;
...@@ -163,8 +165,8 @@ static struct v4l2_async_notifier *v4l2_async_find_subdev_notifier( ...@@ -163,8 +165,8 @@ static struct v4l2_async_notifier *v4l2_async_find_subdev_notifier(
} }
/* Get v4l2_device related to the notifier if one can be found. */ /* Get v4l2_device related to the notifier if one can be found. */
static struct v4l2_device *v4l2_async_notifier_find_v4l2_dev( static struct v4l2_device *
struct v4l2_async_notifier *notifier) v4l2_async_notifier_find_v4l2_dev(struct v4l2_async_notifier *notifier)
{ {
while (notifier->parent) while (notifier->parent)
notifier = notifier->parent; notifier = notifier->parent;
...@@ -175,8 +177,8 @@ static struct v4l2_device *v4l2_async_notifier_find_v4l2_dev( ...@@ -175,8 +177,8 @@ static struct v4l2_device *v4l2_async_notifier_find_v4l2_dev(
/* /*
* Return true if all child sub-device notifiers are complete, false otherwise. * Return true if all child sub-device notifiers are complete, false otherwise.
*/ */
static bool v4l2_async_notifier_can_complete( static bool
struct v4l2_async_notifier *notifier) v4l2_async_notifier_can_complete(struct v4l2_async_notifier *notifier)
{ {
struct v4l2_subdev *sd; struct v4l2_subdev *sd;
...@@ -199,8 +201,8 @@ static bool v4l2_async_notifier_can_complete( ...@@ -199,8 +201,8 @@ static bool v4l2_async_notifier_can_complete(
* Complete the master notifier if possible. This is done when all async * Complete the master notifier if possible. This is done when all async
* sub-devices have been bound; v4l2_device is also available then. * sub-devices have been bound; v4l2_device is also available then.
*/ */
static int v4l2_async_notifier_try_complete( static int
struct v4l2_async_notifier *notifier) v4l2_async_notifier_try_complete(struct v4l2_async_notifier *notifier)
{ {
/* Quick check whether there are still more sub-devices here. */ /* Quick check whether there are still more sub-devices here. */
if (!list_empty(&notifier->waiting)) if (!list_empty(&notifier->waiting))
...@@ -221,8 +223,8 @@ static int v4l2_async_notifier_try_complete( ...@@ -221,8 +223,8 @@ static int v4l2_async_notifier_try_complete(
return v4l2_async_notifier_call_complete(notifier); return v4l2_async_notifier_call_complete(notifier);
} }
static int v4l2_async_notifier_try_all_subdevs( static int
struct v4l2_async_notifier *notifier); v4l2_async_notifier_try_all_subdevs(struct v4l2_async_notifier *notifier);
static int v4l2_async_match_notify(struct v4l2_async_notifier *notifier, static int v4l2_async_match_notify(struct v4l2_async_notifier *notifier,
struct v4l2_device *v4l2_dev, struct v4l2_device *v4l2_dev,
...@@ -268,8 +270,8 @@ static int v4l2_async_match_notify(struct v4l2_async_notifier *notifier, ...@@ -268,8 +270,8 @@ static int v4l2_async_match_notify(struct v4l2_async_notifier *notifier,
} }
/* Test all async sub-devices in a notifier for a match. */ /* Test all async sub-devices in a notifier for a match. */
static int v4l2_async_notifier_try_all_subdevs( static int
struct v4l2_async_notifier *notifier) v4l2_async_notifier_try_all_subdevs(struct v4l2_async_notifier *notifier)
{ {
struct v4l2_device *v4l2_dev = struct v4l2_device *v4l2_dev =
v4l2_async_notifier_find_v4l2_dev(notifier); v4l2_async_notifier_find_v4l2_dev(notifier);
...@@ -306,14 +308,17 @@ static int v4l2_async_notifier_try_all_subdevs( ...@@ -306,14 +308,17 @@ static int v4l2_async_notifier_try_all_subdevs(
static void v4l2_async_cleanup(struct v4l2_subdev *sd) static void v4l2_async_cleanup(struct v4l2_subdev *sd)
{ {
v4l2_device_unregister_subdev(sd); v4l2_device_unregister_subdev(sd);
/* Subdevice driver will reprobe and put the subdev back onto the list */ /*
* Subdevice driver will reprobe and put the subdev back
* onto the list
*/
list_del_init(&sd->async_list); list_del_init(&sd->async_list);
sd->asd = NULL; sd->asd = NULL;
} }
/* Unbind all sub-devices in the notifier tree. */ /* Unbind all sub-devices in the notifier tree. */
static void v4l2_async_notifier_unbind_all_subdevs( static void
struct v4l2_async_notifier *notifier) v4l2_async_notifier_unbind_all_subdevs(struct v4l2_async_notifier *notifier)
{ {
struct v4l2_subdev *sd, *tmp; struct v4l2_subdev *sd, *tmp;
...@@ -508,8 +513,8 @@ int v4l2_async_subdev_notifier_register(struct v4l2_subdev *sd, ...@@ -508,8 +513,8 @@ int v4l2_async_subdev_notifier_register(struct v4l2_subdev *sd,
} }
EXPORT_SYMBOL(v4l2_async_subdev_notifier_register); EXPORT_SYMBOL(v4l2_async_subdev_notifier_register);
static void __v4l2_async_notifier_unregister( static void
struct v4l2_async_notifier *notifier) __v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier)
{ {
if (!notifier || (!notifier->v4l2_dev && !notifier->sd)) if (!notifier || (!notifier->v4l2_dev && !notifier->sd))
return; return;
......
This diff is collapsed.
...@@ -89,8 +89,8 @@ struct v4l2_async_subdev { ...@@ -89,8 +89,8 @@ struct v4l2_async_subdev {
unsigned short address; unsigned short address;
} i2c; } i2c;
struct { struct {
bool (*match)(struct device *, bool (*match)(struct device *dev,
struct v4l2_async_subdev *); struct v4l2_async_subdev *sd);
void *priv; void *priv;
} custom; } custom;
} match; } match;
...@@ -222,7 +222,6 @@ v4l2_async_notifier_add_devname_subdev(struct v4l2_async_notifier *notifier, ...@@ -222,7 +222,6 @@ v4l2_async_notifier_add_devname_subdev(struct v4l2_async_notifier *notifier,
const char *device_name, const char *device_name,
unsigned int asd_struct_size); unsigned int asd_struct_size);
/** /**
* v4l2_async_notifier_register - registers a subdevice asynchronous notifier * v4l2_async_notifier_register - registers a subdevice asynchronous notifier
* *
...@@ -243,7 +242,8 @@ int v4l2_async_subdev_notifier_register(struct v4l2_subdev *sd, ...@@ -243,7 +242,8 @@ int v4l2_async_subdev_notifier_register(struct v4l2_subdev *sd,
struct v4l2_async_notifier *notifier); struct v4l2_async_notifier *notifier);
/** /**
* v4l2_async_notifier_unregister - unregisters a subdevice asynchronous notifier * v4l2_async_notifier_unregister - unregisters a subdevice
* asynchronous notifier
* *
* @notifier: pointer to &struct v4l2_async_notifier * @notifier: pointer to &struct v4l2_async_notifier
*/ */
...@@ -294,8 +294,8 @@ int v4l2_async_register_subdev(struct v4l2_subdev *sd); ...@@ -294,8 +294,8 @@ int v4l2_async_register_subdev(struct v4l2_subdev *sd);
* An error is returned if the module is no longer loaded on any attempts * An error is returned if the module is no longer loaded on any attempts
* to register it. * to register it.
*/ */
int __must_check v4l2_async_register_subdev_sensor_common( int __must_check
struct v4l2_subdev *sd); v4l2_async_register_subdev_sensor_common(struct v4l2_subdev *sd);
/** /**
* v4l2_async_unregister_subdev - unregisters a sub-device to the asynchronous * v4l2_async_unregister_subdev - unregisters a sub-device to the asynchronous
......
...@@ -71,8 +71,8 @@ struct v4l2_fwnode_bus_parallel { ...@@ -71,8 +71,8 @@ struct v4l2_fwnode_bus_parallel {
* @clock_lane: the number of the clock lane * @clock_lane: the number of the clock lane
*/ */
struct v4l2_fwnode_bus_mipi_csi1 { struct v4l2_fwnode_bus_mipi_csi1 {
bool clock_inv; unsigned char clock_inv:1;
bool strobe; unsigned char strobe:1;
bool lane_polarity[2]; bool lane_polarity[2];
unsigned char data_lane; unsigned char data_lane;
unsigned char clock_lane; unsigned char clock_lane;
...@@ -203,8 +203,8 @@ void v4l2_fwnode_endpoint_free(struct v4l2_fwnode_endpoint *vep); ...@@ -203,8 +203,8 @@ void v4l2_fwnode_endpoint_free(struct v4l2_fwnode_endpoint *vep);
* %-EINVAL on parsing failure * %-EINVAL on parsing failure
* %-ENXIO on mismatching bus types * %-ENXIO on mismatching bus types
*/ */
int v4l2_fwnode_endpoint_alloc_parse( int v4l2_fwnode_endpoint_alloc_parse(struct fwnode_handle *fwnode,
struct fwnode_handle *fwnode, struct v4l2_fwnode_endpoint *vep); struct v4l2_fwnode_endpoint *vep);
/** /**
* v4l2_fwnode_parse_link() - parse a link between two endpoints * v4l2_fwnode_parse_link() - parse a link between two endpoints
...@@ -236,7 +236,6 @@ int v4l2_fwnode_parse_link(struct fwnode_handle *fwnode, ...@@ -236,7 +236,6 @@ int v4l2_fwnode_parse_link(struct fwnode_handle *fwnode,
*/ */
void v4l2_fwnode_put_link(struct v4l2_fwnode_link *link); void v4l2_fwnode_put_link(struct v4l2_fwnode_link *link);
/** /**
* typedef parse_endpoint_func - Driver's callback function to be called on * typedef parse_endpoint_func - Driver's callback function to be called on
* each V4L2 fwnode endpoint. * each V4L2 fwnode endpoint.
...@@ -255,7 +254,6 @@ typedef int (*parse_endpoint_func)(struct device *dev, ...@@ -255,7 +254,6 @@ typedef int (*parse_endpoint_func)(struct device *dev,
struct v4l2_fwnode_endpoint *vep, struct v4l2_fwnode_endpoint *vep,
struct v4l2_async_subdev *asd); struct v4l2_async_subdev *asd);
/** /**
* v4l2_async_notifier_parse_fwnode_endpoints - Parse V4L2 fwnode endpoints in a * v4l2_async_notifier_parse_fwnode_endpoints - Parse V4L2 fwnode endpoints in a
* device node * device node
...@@ -294,8 +292,9 @@ typedef int (*parse_endpoint_func)(struct device *dev, ...@@ -294,8 +292,9 @@ typedef int (*parse_endpoint_func)(struct device *dev,
* %-EINVAL if graph or endpoint parsing failed * %-EINVAL if graph or endpoint parsing failed
* Other error codes as returned by @parse_endpoint * Other error codes as returned by @parse_endpoint
*/ */
int v4l2_async_notifier_parse_fwnode_endpoints( int
struct device *dev, struct v4l2_async_notifier *notifier, v4l2_async_notifier_parse_fwnode_endpoints(struct device *dev,
struct v4l2_async_notifier *notifier,
size_t asd_struct_size, size_t asd_struct_size,
parse_endpoint_func parse_endpoint); parse_endpoint_func parse_endpoint);
...@@ -345,8 +344,9 @@ int v4l2_async_notifier_parse_fwnode_endpoints( ...@@ -345,8 +344,9 @@ int v4l2_async_notifier_parse_fwnode_endpoints(
* %-EINVAL if graph or endpoint parsing failed * %-EINVAL if graph or endpoint parsing failed
* Other error codes as returned by @parse_endpoint * Other error codes as returned by @parse_endpoint
*/ */
int v4l2_async_notifier_parse_fwnode_endpoints_by_port( int
struct device *dev, struct v4l2_async_notifier *notifier, v4l2_async_notifier_parse_fwnode_endpoints_by_port(struct device *dev,
struct v4l2_async_notifier *notifier,
size_t asd_struct_size, unsigned int port, size_t asd_struct_size, unsigned int port,
parse_endpoint_func parse_endpoint); parse_endpoint_func parse_endpoint);
...@@ -368,8 +368,8 @@ int v4l2_async_notifier_parse_fwnode_endpoints_by_port( ...@@ -368,8 +368,8 @@ int v4l2_async_notifier_parse_fwnode_endpoints_by_port(
* -ENOMEM if memory allocation failed * -ENOMEM if memory allocation failed
* -EINVAL if property parsing failed * -EINVAL if property parsing failed
*/ */
int v4l2_async_notifier_parse_fwnode_sensor_common( int v4l2_async_notifier_parse_fwnode_sensor_common(struct device *dev,
struct device *dev, struct v4l2_async_notifier *notifier); struct v4l2_async_notifier *notifier);
/** /**
* v4l2_async_register_fwnode_subdev - registers a sub-device to the * v4l2_async_register_fwnode_subdev - registers a sub-device to the
...@@ -401,9 +401,11 @@ int v4l2_async_notifier_parse_fwnode_sensor_common( ...@@ -401,9 +401,11 @@ int v4l2_async_notifier_parse_fwnode_sensor_common(
* An error is returned if the module is no longer loaded on any attempts * An error is returned if the module is no longer loaded on any attempts
* to register it. * to register it.
*/ */
int v4l2_async_register_fwnode_subdev( int
struct v4l2_subdev *sd, size_t asd_struct_size, v4l2_async_register_fwnode_subdev(struct v4l2_subdev *sd,
unsigned int *ports, unsigned int num_ports, size_t asd_struct_size,
unsigned int *ports,
unsigned int num_ports,
int (*parse_endpoint)(struct device *dev, int (*parse_endpoint)(struct device *dev,
struct v4l2_fwnode_endpoint *vep, struct v4l2_fwnode_endpoint *vep,
struct v4l2_async_subdev *asd)); struct v4l2_async_subdev *asd));
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include <linux/v4l2-mediabus.h> #include <linux/v4l2-mediabus.h>
#include <linux/bitops.h> #include <linux/bitops.h>
/* Parallel flags */ /* Parallel flags */
/* /*
* Can the client run in master or in slave mode. By "Master mode" an operation * Can the client run in master or in slave mode. By "Master mode" an operation
...@@ -63,10 +62,14 @@ ...@@ -63,10 +62,14 @@
#define V4L2_MBUS_CSI2_CONTINUOUS_CLOCK BIT(8) #define V4L2_MBUS_CSI2_CONTINUOUS_CLOCK BIT(8)
#define V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK BIT(9) #define V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK BIT(9)
#define V4L2_MBUS_CSI2_LANES (V4L2_MBUS_CSI2_1_LANE | V4L2_MBUS_CSI2_2_LANE | \ #define V4L2_MBUS_CSI2_LANES (V4L2_MBUS_CSI2_1_LANE | \
V4L2_MBUS_CSI2_3_LANE | V4L2_MBUS_CSI2_4_LANE) V4L2_MBUS_CSI2_2_LANE | \
#define V4L2_MBUS_CSI2_CHANNELS (V4L2_MBUS_CSI2_CHANNEL_0 | V4L2_MBUS_CSI2_CHANNEL_1 | \ V4L2_MBUS_CSI2_3_LANE | \
V4L2_MBUS_CSI2_CHANNEL_2 | V4L2_MBUS_CSI2_CHANNEL_3) V4L2_MBUS_CSI2_4_LANE)
#define V4L2_MBUS_CSI2_CHANNELS (V4L2_MBUS_CSI2_CHANNEL_0 | \
V4L2_MBUS_CSI2_CHANNEL_1 | \
V4L2_MBUS_CSI2_CHANNEL_2 | \
V4L2_MBUS_CSI2_CHANNEL_3)
/** /**
* enum v4l2_mbus_type - media bus type * enum v4l2_mbus_type - media bus type
...@@ -106,7 +109,8 @@ struct v4l2_mbus_config { ...@@ -106,7 +109,8 @@ struct v4l2_mbus_config {
* @pix_fmt: pointer to &struct v4l2_pix_format to be filled * @pix_fmt: pointer to &struct v4l2_pix_format to be filled
* @mbus_fmt: pointer to &struct v4l2_mbus_framefmt to be used as model * @mbus_fmt: pointer to &struct v4l2_mbus_framefmt to be used as model
*/ */
static inline void v4l2_fill_pix_format(struct v4l2_pix_format *pix_fmt, static inline void
v4l2_fill_pix_format(struct v4l2_pix_format *pix_fmt,
const struct v4l2_mbus_framefmt *mbus_fmt) const struct v4l2_mbus_framefmt *mbus_fmt)
{ {
pix_fmt->width = mbus_fmt->width; pix_fmt->width = mbus_fmt->width;
...@@ -148,8 +152,8 @@ static inline void v4l2_fill_mbus_format(struct v4l2_mbus_framefmt *mbus_fmt, ...@@ -148,8 +152,8 @@ static inline void v4l2_fill_mbus_format(struct v4l2_mbus_framefmt *mbus_fmt,
* @pix_mp_fmt: pointer to &struct v4l2_pix_format_mplane to be filled * @pix_mp_fmt: pointer to &struct v4l2_pix_format_mplane to be filled
* @mbus_fmt: pointer to &struct v4l2_mbus_framefmt to be used as model * @mbus_fmt: pointer to &struct v4l2_mbus_framefmt to be used as model
*/ */
static inline void v4l2_fill_pix_format_mplane( static inline void
struct v4l2_pix_format_mplane *pix_mp_fmt, v4l2_fill_pix_format_mplane(struct v4l2_pix_format_mplane *pix_mp_fmt,
const struct v4l2_mbus_framefmt *mbus_fmt) const struct v4l2_mbus_framefmt *mbus_fmt)
{ {
pix_mp_fmt->width = mbus_fmt->width; pix_mp_fmt->width = mbus_fmt->width;
...@@ -168,8 +172,8 @@ static inline void v4l2_fill_pix_format_mplane( ...@@ -168,8 +172,8 @@ static inline void v4l2_fill_pix_format_mplane(
* @mbus_fmt: pointer to &struct v4l2_mbus_framefmt to be filled * @mbus_fmt: pointer to &struct v4l2_mbus_framefmt to be filled
* @pix_mp_fmt: pointer to &struct v4l2_pix_format_mplane to be used as model * @pix_mp_fmt: pointer to &struct v4l2_pix_format_mplane to be used as model
*/ */
static inline void v4l2_fill_mbus_format_mplane( static inline void
struct v4l2_mbus_framefmt *mbus_fmt, v4l2_fill_mbus_format_mplane(struct v4l2_mbus_framefmt *mbus_fmt,
const struct v4l2_pix_format_mplane *pix_mp_fmt) const struct v4l2_pix_format_mplane *pix_mp_fmt)
{ {
mbus_fmt->width = pix_mp_fmt->width; mbus_fmt->width = pix_mp_fmt->width;
......
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