* [PATCH v2 0/1] RFC: media: v4l2-subdev: add subdev-wide config struct
@ 2021-04-23 10:29 Tomi Valkeinen
2021-04-23 10:29 ` [PATCH v2 1/1] RFC: media: v4l2-subdev: add subdev-wide state struct Tomi Valkeinen
0 siblings, 1 reply; 5+ messages in thread
From: Tomi Valkeinen @ 2021-04-23 10:29 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Hans Verkuil, linux-media,
Laurent Pinchart, Sakari Ailus
Cc: Tomi Valkeinen
Hi,
Second version of the RFC. The previous one is here:
https://lore.kernel.org/linux-media/20210409133659.389544-1-tomi.valkeinen@ideasonboard.com/
In v2:
- Rename v4l2_subdev_config -> v4l2_subdev_state
- Rename pad_configs -> pads
- Allocate the v4l2_subdev_state instead of embedding it
I didn't:
- Rename v4l2_subdev_pad_ops->init_cfg to init_state. There will be a
huge amount of changes to drivers, and I'd like to keep any extra
changes out of this series. For the same reason, I intend to keep
the v4l2_subdev_state variable names as 'cfg' instead of trying to
rename them to 'state'.
- Add number of pads or a pointer to subdev to v4l2_subdev_state. It can
be added easily if someone has a need for it.
I also dropped the few driver changes I made. They are obvious trivial
changes and don't really give anything to the discussion.
Tomi
Tomi Valkeinen (1):
RFC: media: v4l2-subdev: add subdev-wide state struct
drivers/media/v4l2-core/v4l2-subdev.c | 141 +++++++++++++++-----------
include/media/v4l2-subdev.h | 72 +++++++------
2 files changed, 120 insertions(+), 93 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/1] RFC: media: v4l2-subdev: add subdev-wide state struct
2021-04-23 10:29 [PATCH v2 0/1] RFC: media: v4l2-subdev: add subdev-wide config struct Tomi Valkeinen
@ 2021-04-23 10:29 ` Tomi Valkeinen
2021-04-23 21:01 ` kernel test robot
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Tomi Valkeinen @ 2021-04-23 10:29 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Hans Verkuil, linux-media,
Laurent Pinchart, Sakari Ailus
Cc: Tomi Valkeinen
We have 'struct v4l2_subdev_pad_config' which contains configuration for
a single pad used for the TRY functionality, and an array of those
structs is passed to various v4l2_subdev_pad_ops.
I was working on subdev internal routing between pads, and realized that
there's no way to add TRY functionality for routes, which is not pad
specific configuration. Adding a separate struct for try-route config
wouldn't work either, as e.g. set-fmt needs to know the try-route
configuration to propagate the settings.
This patch adds a new struct, 'struct v4l2_subdev_state' (which at the
moment only contains the v4l2_subdev_pad_config array) and the new
struct is used in most of the places where v4l2_subdev_pad_config was
used. All v4l2_subdev_pad_ops functions taking v4l2_subdev_pad_config
are changed to instead take v4l2_subdev_state.
Two drivers are changed to work with the above changes (drivers for HW
which I have) as an example.
I worked on a semantic patch (included below, my first spatch...) to do
this change to all drivers, but hit lots of problems with non-trivial
uses of v4l2_subdev_pad_config.
As it looks like substantial amount of manual work is needed, I'm
posting this RFC to get an ack on the changes before continuing that
work.
@ v4l2_subdev_pad_ops @
identifier pad_ops;
identifier func;
@@
(
static const struct v4l2_subdev_pad_ops pad_ops = {
...,
.enum_mbus_code = func,
...,
};
|
static const struct v4l2_subdev_pad_ops pad_ops = {
...,
.enum_frame_size = func,
...,
};
|
static const struct v4l2_subdev_pad_ops pad_ops = {
...,
.enum_frame_interval = func,
...,
};
|
static const struct v4l2_subdev_pad_ops pad_ops = {
...,
.get_fmt = func,
...,
};
|
static const struct v4l2_subdev_pad_ops pad_ops = {
...,
.set_fmt = func,
...,
};
|
static const struct v4l2_subdev_pad_ops pad_ops = {
...,
.get_selection = func,
...,
};
|
static const struct v4l2_subdev_pad_ops pad_ops = {
...,
.set_selection = func,
...,
};
|
static const struct v4l2_subdev_pad_ops pad_ops = {
...,
.init_cfg = func,
...,
};
)
@@
identifier v4l2_subdev_pad_ops.func;
identifier sd;
identifier cfg;
@@
func(struct v4l2_subdev *sd,
- struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_state *cfg,
...
)
{
...
}
@@
identifier v4l2_subdev_pad_ops.func;
identifier sd;
identifier cfg;
@@
func(struct v4l2_subdev *sd,
- struct v4l2_subdev_pad_config *cfg
+ struct v4l2_subdev_state *cfg
)
{
...
}
@@
struct v4l2_subdev_fh *fh;
@@
- fh->pad
+ &fh->cfg
@@
identifier func;
identifier cfg;
@@
func(...,
- struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_state *cfg,
...)
{
...
}
@@
struct v4l2_subdev_state *cfg;
@@
{
<...
(
- cfg->try_fmt
+ cfg->pad->try_fmt
|
- cfg->try_crop
+ cfg->pad->try_crop
|
- cfg->try_compose
+ cfg->pad->try_compose
)
...>
}
@@
identifier pad_cfg;
@@
{
...
struct v4l2_subdev_pad_config pad_cfg;
+ struct v4l2_subdev_state cfg = { .pad = &pad_cfg };
<...
- &pad_cfg
+ &cfg
...>
}
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
drivers/media/v4l2-core/v4l2-subdev.c | 141 +++++++++++++++-----------
include/media/v4l2-subdev.h | 72 +++++++------
2 files changed, 120 insertions(+), 93 deletions(-)
diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
index 956dafab43d4..bd996dcace3b 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -26,19 +26,21 @@
#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
static int subdev_fh_init(struct v4l2_subdev_fh *fh, struct v4l2_subdev *sd)
{
- if (sd->entity.num_pads) {
- fh->pad = v4l2_subdev_alloc_pad_config(sd);
- if (fh->pad == NULL)
- return -ENOMEM;
- }
+ struct v4l2_subdev_state *state;
+
+ state = v4l2_subdev_alloc_state(sd);
+ if (IS_ERR(state))
+ return PTR_ERR(state);
+
+ fh->state = state;
return 0;
}
static void subdev_fh_free(struct v4l2_subdev_fh *fh)
{
- v4l2_subdev_free_pad_config(fh->pad);
- fh->pad = NULL;
+ v4l2_subdev_free_state(fh->state);
+ fh->state = NULL;
}
static int subdev_open(struct file *file)
@@ -146,63 +148,63 @@ static inline int check_pad(struct v4l2_subdev *sd, u32 pad)
return 0;
}
-static int check_cfg(u32 which, struct v4l2_subdev_pad_config *cfg)
+static int check_cfg(u32 which, struct v4l2_subdev_state *state)
{
- if (which == V4L2_SUBDEV_FORMAT_TRY && !cfg)
+ if (which == V4L2_SUBDEV_FORMAT_TRY && !state)
return -EINVAL;
return 0;
}
static inline int check_format(struct v4l2_subdev *sd,
- struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_state *state,
struct v4l2_subdev_format *format)
{
if (!format)
return -EINVAL;
return check_which(format->which) ? : check_pad(sd, format->pad) ? :
- check_cfg(format->which, cfg);
+ check_cfg(format->which, state);
}
static int call_get_fmt(struct v4l2_subdev *sd,
- struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_state *state,
struct v4l2_subdev_format *format)
{
- return check_format(sd, cfg, format) ? :
- sd->ops->pad->get_fmt(sd, cfg, format);
+ return check_format(sd, state, format) ? :
+ sd->ops->pad->get_fmt(sd, state, format);
}
static int call_set_fmt(struct v4l2_subdev *sd,
- struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_state *state,
struct v4l2_subdev_format *format)
{
- return check_format(sd, cfg, format) ? :
- sd->ops->pad->set_fmt(sd, cfg, format);
+ return check_format(sd, state, format) ? :
+ sd->ops->pad->set_fmt(sd, state, format);
}
static int call_enum_mbus_code(struct v4l2_subdev *sd,
- struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_state *state,
struct v4l2_subdev_mbus_code_enum *code)
{
if (!code)
return -EINVAL;
return check_which(code->which) ? : check_pad(sd, code->pad) ? :
- check_cfg(code->which, cfg) ? :
- sd->ops->pad->enum_mbus_code(sd, cfg, code);
+ check_cfg(code->which, state) ? :
+ sd->ops->pad->enum_mbus_code(sd, state, code);
}
static int call_enum_frame_size(struct v4l2_subdev *sd,
- struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_state *state,
struct v4l2_subdev_frame_size_enum *fse)
{
if (!fse)
return -EINVAL;
return check_which(fse->which) ? : check_pad(sd, fse->pad) ? :
- check_cfg(fse->which, cfg) ? :
- sd->ops->pad->enum_frame_size(sd, cfg, fse);
+ check_cfg(fse->which, state) ? :
+ sd->ops->pad->enum_frame_size(sd, state, fse);
}
static inline int check_frame_interval(struct v4l2_subdev *sd,
@@ -229,42 +231,42 @@ static int call_s_frame_interval(struct v4l2_subdev *sd,
}
static int call_enum_frame_interval(struct v4l2_subdev *sd,
- struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_state *state,
struct v4l2_subdev_frame_interval_enum *fie)
{
if (!fie)
return -EINVAL;
return check_which(fie->which) ? : check_pad(sd, fie->pad) ? :
- check_cfg(fie->which, cfg) ? :
- sd->ops->pad->enum_frame_interval(sd, cfg, fie);
+ check_cfg(fie->which, state) ? :
+ sd->ops->pad->enum_frame_interval(sd, state, fie);
}
static inline int check_selection(struct v4l2_subdev *sd,
- struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_state *state,
struct v4l2_subdev_selection *sel)
{
if (!sel)
return -EINVAL;
return check_which(sel->which) ? : check_pad(sd, sel->pad) ? :
- check_cfg(sel->which, cfg);
+ check_cfg(sel->which, state);
}
static int call_get_selection(struct v4l2_subdev *sd,
- struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_state *state,
struct v4l2_subdev_selection *sel)
{
- return check_selection(sd, cfg, sel) ? :
- sd->ops->pad->get_selection(sd, cfg, sel);
+ return check_selection(sd, state, sel) ? :
+ sd->ops->pad->get_selection(sd, state, sel);
}
static int call_set_selection(struct v4l2_subdev *sd,
- struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_state *state,
struct v4l2_subdev_selection *sel)
{
- return check_selection(sd, cfg, sel) ? :
- sd->ops->pad->set_selection(sd, cfg, sel);
+ return check_selection(sd, state, sel) ? :
+ sd->ops->pad->set_selection(sd, state, sel);
}
static inline int check_edid(struct v4l2_subdev *sd,
@@ -506,7 +508,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
memset(format->reserved, 0, sizeof(format->reserved));
memset(format->format.reserved, 0, sizeof(format->format.reserved));
- return v4l2_subdev_call(sd, pad, get_fmt, subdev_fh->pad, format);
+ return v4l2_subdev_call(sd, pad, get_fmt, subdev_fh->state, format);
}
case VIDIOC_SUBDEV_S_FMT: {
@@ -517,7 +519,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
memset(format->reserved, 0, sizeof(format->reserved));
memset(format->format.reserved, 0, sizeof(format->format.reserved));
- return v4l2_subdev_call(sd, pad, set_fmt, subdev_fh->pad, format);
+ return v4l2_subdev_call(sd, pad, set_fmt, subdev_fh->state, format);
}
case VIDIOC_SUBDEV_G_CROP: {
@@ -531,7 +533,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
sel.target = V4L2_SEL_TGT_CROP;
rval = v4l2_subdev_call(
- sd, pad, get_selection, subdev_fh->pad, &sel);
+ sd, pad, get_selection, subdev_fh->state, &sel);
crop->rect = sel.r;
@@ -553,7 +555,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
sel.r = crop->rect;
rval = v4l2_subdev_call(
- sd, pad, set_selection, subdev_fh->pad, &sel);
+ sd, pad, set_selection, subdev_fh->state, &sel);
crop->rect = sel.r;
@@ -564,7 +566,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
struct v4l2_subdev_mbus_code_enum *code = arg;
memset(code->reserved, 0, sizeof(code->reserved));
- return v4l2_subdev_call(sd, pad, enum_mbus_code, subdev_fh->pad,
+ return v4l2_subdev_call(sd, pad, enum_mbus_code, subdev_fh->state,
code);
}
@@ -572,7 +574,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
struct v4l2_subdev_frame_size_enum *fse = arg;
memset(fse->reserved, 0, sizeof(fse->reserved));
- return v4l2_subdev_call(sd, pad, enum_frame_size, subdev_fh->pad,
+ return v4l2_subdev_call(sd, pad, enum_frame_size, subdev_fh->state,
fse);
}
@@ -597,7 +599,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
struct v4l2_subdev_frame_interval_enum *fie = arg;
memset(fie->reserved, 0, sizeof(fie->reserved));
- return v4l2_subdev_call(sd, pad, enum_frame_interval, subdev_fh->pad,
+ return v4l2_subdev_call(sd, pad, enum_frame_interval, subdev_fh->state,
fie);
}
@@ -606,7 +608,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
memset(sel->reserved, 0, sizeof(sel->reserved));
return v4l2_subdev_call(
- sd, pad, get_selection, subdev_fh->pad, sel);
+ sd, pad, get_selection, subdev_fh->state, sel);
}
case VIDIOC_SUBDEV_S_SELECTION: {
@@ -617,7 +619,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
memset(sel->reserved, 0, sizeof(sel->reserved));
return v4l2_subdev_call(
- sd, pad, set_selection, subdev_fh->pad, sel);
+ sd, pad, set_selection, subdev_fh->state, sel);
}
case VIDIOC_G_EDID: {
@@ -892,35 +894,50 @@ int v4l2_subdev_link_validate(struct media_link *link)
}
EXPORT_SYMBOL_GPL(v4l2_subdev_link_validate);
-struct v4l2_subdev_pad_config *
-v4l2_subdev_alloc_pad_config(struct v4l2_subdev *sd)
+struct v4l2_subdev_state *v4l2_subdev_alloc_state(struct v4l2_subdev *sd)
{
- struct v4l2_subdev_pad_config *cfg;
+ struct v4l2_subdev_state *state;
int ret;
- if (!sd->entity.num_pads)
- return NULL;
-
- cfg = kvmalloc_array(sd->entity.num_pads, sizeof(*cfg),
- GFP_KERNEL | __GFP_ZERO);
- if (!cfg)
- return NULL;
+ state = kzalloc(sizeof(*state), GFP_KERNEL);
+ if (!state) {
+ ret = -ENOMEM;
+ goto err;
+ }
- ret = v4l2_subdev_call(sd, pad, init_cfg, cfg);
- if (ret < 0 && ret != -ENOIOCTLCMD) {
- kvfree(cfg);
- return NULL;
+ if (sd->entity.num_pads) {
+ state->pads = kvmalloc_array(sd->entity.num_pads,
+ sizeof(*state->pads),
+ GFP_KERNEL | __GFP_ZERO);
+ if (!state->pads) {
+ ret = -ENOMEM;
+ goto err;
+ }
}
- return cfg;
+ ret = v4l2_subdev_call(sd, pad, init_cfg, state);
+ if (ret < 0 && ret != -ENOIOCTLCMD)
+ goto err;
+
+ return state;
+
+err:
+ if (state && state->pads)
+ kvfree(state->pads);
+
+ kfree(state);
+
+ return ERR_PTR(ret);
}
-EXPORT_SYMBOL_GPL(v4l2_subdev_alloc_pad_config);
+EXPORT_SYMBOL_GPL(v4l2_subdev_alloc_state);
-void v4l2_subdev_free_pad_config(struct v4l2_subdev_pad_config *cfg)
+void v4l2_subdev_free_state(struct v4l2_subdev_state *state)
{
- kvfree(cfg);
+ kvfree(state->pads);
+ kvfree(state);
}
-EXPORT_SYMBOL_GPL(v4l2_subdev_free_pad_config);
+EXPORT_SYMBOL_GPL(v4l2_subdev_free_state);
+
#endif /* CONFIG_MEDIA_CONTROLLER */
void v4l2_subdev_init(struct v4l2_subdev *sd, const struct v4l2_subdev_ops *ops)
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index d0e9a5bdb08b..79f9932d2b00 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -623,6 +623,19 @@ struct v4l2_subdev_pad_config {
struct v4l2_rect try_compose;
};
+/**
+ * struct v4l2_subdev_state - Used for storing subdev information.
+ *
+ * @pads: &struct v4l2_subdev_pad_config array
+ *
+ * This structure only needs to be passed to the pad op if the 'which' field
+ * of the main argument is set to %V4L2_SUBDEV_FORMAT_TRY. For
+ * %V4L2_SUBDEV_FORMAT_ACTIVE it is safe to pass %NULL.
+ */
+struct v4l2_subdev_state {
+ struct v4l2_subdev_pad_config *pads;
+};
+
/**
* struct v4l2_subdev_pad_ops - v4l2-subdev pad level operations
*
@@ -687,27 +700,27 @@ struct v4l2_subdev_pad_config {
*/
struct v4l2_subdev_pad_ops {
int (*init_cfg)(struct v4l2_subdev *sd,
- struct v4l2_subdev_pad_config *cfg);
+ struct v4l2_subdev_state *state);
int (*enum_mbus_code)(struct v4l2_subdev *sd,
- struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_state *state,
struct v4l2_subdev_mbus_code_enum *code);
int (*enum_frame_size)(struct v4l2_subdev *sd,
- struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_state *state,
struct v4l2_subdev_frame_size_enum *fse);
int (*enum_frame_interval)(struct v4l2_subdev *sd,
- struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_state *state,
struct v4l2_subdev_frame_interval_enum *fie);
int (*get_fmt)(struct v4l2_subdev *sd,
- struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_state *state,
struct v4l2_subdev_format *format);
int (*set_fmt)(struct v4l2_subdev *sd,
- struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_state *state,
struct v4l2_subdev_format *format);
int (*get_selection)(struct v4l2_subdev *sd,
- struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_state *state,
struct v4l2_subdev_selection *sel);
int (*set_selection)(struct v4l2_subdev *sd,
- struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_state *state,
struct v4l2_subdev_selection *sel);
int (*get_edid)(struct v4l2_subdev *sd, struct v4l2_edid *edid);
int (*set_edid)(struct v4l2_subdev *sd, struct v4l2_edid *edid);
@@ -918,14 +931,14 @@ struct v4l2_subdev {
* struct v4l2_subdev_fh - Used for storing subdev information per file handle
*
* @vfh: pointer to &struct v4l2_fh
- * @pad: pointer to &struct v4l2_subdev_pad_config
+ * @state: pointer to &struct v4l2_subdev_state
* @owner: module pointer to the owner of this file handle
*/
struct v4l2_subdev_fh {
struct v4l2_fh vfh;
struct module *owner;
#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
- struct v4l2_subdev_pad_config *pad;
+ struct v4l2_subdev_state *state;
#endif
};
@@ -945,17 +958,17 @@ struct v4l2_subdev_fh {
* &struct v4l2_subdev_pad_config->try_fmt
*
* @sd: pointer to &struct v4l2_subdev
- * @cfg: pointer to &struct v4l2_subdev_pad_config array.
- * @pad: index of the pad in the @cfg array.
+ * @state: pointer to &struct v4l2_subdev_state.
+ * @pad: index of the pad in the @state array.
*/
static inline struct v4l2_mbus_framefmt *
v4l2_subdev_get_try_format(struct v4l2_subdev *sd,
- struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_state *state,
unsigned int pad)
{
if (WARN_ON(pad >= sd->entity.num_pads))
pad = 0;
- return &cfg[pad].try_fmt;
+ return &state->pads[pad].try_fmt;
}
/**
@@ -963,17 +976,17 @@ v4l2_subdev_get_try_format(struct v4l2_subdev *sd,
* &struct v4l2_subdev_pad_config->try_crop
*
* @sd: pointer to &struct v4l2_subdev
- * @cfg: pointer to &struct v4l2_subdev_pad_config array.
- * @pad: index of the pad in the @cfg array.
+ * @state: pointer to &struct v4l2_subdev_state.
+ * @pad: index of the pad in the @state array.
*/
static inline struct v4l2_rect *
v4l2_subdev_get_try_crop(struct v4l2_subdev *sd,
- struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_state *state,
unsigned int pad)
{
if (WARN_ON(pad >= sd->entity.num_pads))
pad = 0;
- return &cfg[pad].try_crop;
+ return &state->pads[pad].try_crop;
}
/**
@@ -981,17 +994,17 @@ v4l2_subdev_get_try_crop(struct v4l2_subdev *sd,
* &struct v4l2_subdev_pad_config->try_compose
*
* @sd: pointer to &struct v4l2_subdev
- * @cfg: pointer to &struct v4l2_subdev_pad_config array.
- * @pad: index of the pad in the @cfg array.
+ * @state: pointer to &struct v4l2_subdev_state.
+ * @pad: index of the pad in the @state array.
*/
static inline struct v4l2_rect *
v4l2_subdev_get_try_compose(struct v4l2_subdev *sd,
- struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_state *state,
unsigned int pad)
{
if (WARN_ON(pad >= sd->entity.num_pads))
pad = 0;
- return &cfg[pad].try_compose;
+ return &state->pads[pad].try_compose;
}
#endif
@@ -1093,20 +1106,17 @@ int v4l2_subdev_link_validate_default(struct v4l2_subdev *sd,
int v4l2_subdev_link_validate(struct media_link *link);
/**
- * v4l2_subdev_alloc_pad_config - Allocates memory for pad config
+ * v4l2_subdev_alloc_state - allocate v4l2_subdev_state
*
- * @sd: pointer to struct v4l2_subdev
+ * Must call v4l2_subdev_free_state() when state is no longer needed.
*/
-struct
-v4l2_subdev_pad_config *v4l2_subdev_alloc_pad_config(struct v4l2_subdev *sd);
+struct v4l2_subdev_state *v4l2_subdev_alloc_state(struct v4l2_subdev *sd);
/**
- * v4l2_subdev_free_pad_config - Frees memory allocated by
- * v4l2_subdev_alloc_pad_config().
- *
- * @cfg: pointer to &struct v4l2_subdev_pad_config
+ * v4l2_subdev_free_state - uninitialize v4l2_subdev_state
*/
-void v4l2_subdev_free_pad_config(struct v4l2_subdev_pad_config *cfg);
+void v4l2_subdev_free_state(struct v4l2_subdev_state *state);
+
#endif /* CONFIG_MEDIA_CONTROLLER */
/**
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/1] RFC: media: v4l2-subdev: add subdev-wide state struct
2021-04-23 10:29 ` [PATCH v2 1/1] RFC: media: v4l2-subdev: add subdev-wide state struct Tomi Valkeinen
@ 2021-04-23 21:01 ` kernel test robot
2021-04-23 21:34 ` kernel test robot
2021-04-23 21:34 ` kernel test robot
2 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2021-04-23 21:01 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 16763 bytes --]
Hi Tomi,
[FYI, it's a private test report for your RFC patch.]
[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on v5.12-rc8 next-20210423]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Tomi-Valkeinen/RFC-media-v4l2-subdev-add-subdev-wide-config-struct/20210423-183133
base: git://linuxtv.org/media_tree.git master
config: openrisc-randconfig-r005-20210424 (attached as .config)
compiler: or1k-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/09a6489d3b108d037f87df5fcf5d2c1fa6f70248
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Tomi-Valkeinen/RFC-media-v4l2-subdev-add-subdev-wide-config-struct/20210423-183133
git checkout 09a6489d3b108d037f87df5fcf5d2c1fa6f70248
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=openrisc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/media/i2c/ov2659.c: In function 'ov2659_get_fmt':
drivers/media/i2c/ov2659.c:1036:39: error: passing argument 2 of 'v4l2_subdev_get_try_format' from incompatible pointer type [-Werror=incompatible-pointer-types]
1036 | mf = v4l2_subdev_get_try_format(sd, cfg, 0);
| ^~~
| |
| struct v4l2_subdev_pad_config *
In file included from drivers/media/i2c/ov2659.c:24:
include/media/v4l2-subdev.h:966:33: note: expected 'struct v4l2_subdev_state *' but argument is of type 'struct v4l2_subdev_pad_config *'
966 | struct v4l2_subdev_state *state,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
drivers/media/i2c/ov2659.c: In function 'ov2659_set_fmt':
drivers/media/i2c/ov2659.c:1116:39: error: passing argument 2 of 'v4l2_subdev_get_try_format' from incompatible pointer type [-Werror=incompatible-pointer-types]
1116 | mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad);
| ^~~
| |
| struct v4l2_subdev_pad_config *
In file included from drivers/media/i2c/ov2659.c:24:
include/media/v4l2-subdev.h:966:33: note: expected 'struct v4l2_subdev_state *' but argument is of type 'struct v4l2_subdev_pad_config *'
966 | struct v4l2_subdev_state *state,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
drivers/media/i2c/ov2659.c: In function 'ov2659_open':
drivers/media/i2c/ov2659.c:1305:38: error: 'struct v4l2_subdev_fh' has no member named 'pad'
1305 | v4l2_subdev_get_try_format(sd, fh->pad, 0);
| ^~
drivers/media/i2c/ov2659.c: At top level:
>> drivers/media/i2c/ov2659.c:1326:20: error: initialization of 'int (*)(struct v4l2_subdev *, struct v4l2_subdev_state *, struct v4l2_subdev_mbus_code_enum *)' from incompatible pointer type 'int (*)(struct v4l2_subdev *, struct v4l2_subdev_pad_config *, struct v4l2_subdev_mbus_code_enum *)' [-Werror=incompatible-pointer-types]
1326 | .enum_mbus_code = ov2659_enum_mbus_code,
| ^~~~~~~~~~~~~~~~~~~~~
drivers/media/i2c/ov2659.c:1326:20: note: (near initialization for 'ov2659_subdev_pad_ops.enum_mbus_code')
>> drivers/media/i2c/ov2659.c:1327:21: error: initialization of 'int (*)(struct v4l2_subdev *, struct v4l2_subdev_state *, struct v4l2_subdev_frame_size_enum *)' from incompatible pointer type 'int (*)(struct v4l2_subdev *, struct v4l2_subdev_pad_config *, struct v4l2_subdev_frame_size_enum *)' [-Werror=incompatible-pointer-types]
1327 | .enum_frame_size = ov2659_enum_frame_sizes,
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/media/i2c/ov2659.c:1327:21: note: (near initialization for 'ov2659_subdev_pad_ops.enum_frame_size')
>> drivers/media/i2c/ov2659.c:1328:13: error: initialization of 'int (*)(struct v4l2_subdev *, struct v4l2_subdev_state *, struct v4l2_subdev_format *)' from incompatible pointer type 'int (*)(struct v4l2_subdev *, struct v4l2_subdev_pad_config *, struct v4l2_subdev_format *)' [-Werror=incompatible-pointer-types]
1328 | .get_fmt = ov2659_get_fmt,
| ^~~~~~~~~~~~~~
drivers/media/i2c/ov2659.c:1328:13: note: (near initialization for 'ov2659_subdev_pad_ops.get_fmt')
drivers/media/i2c/ov2659.c:1329:13: error: initialization of 'int (*)(struct v4l2_subdev *, struct v4l2_subdev_state *, struct v4l2_subdev_format *)' from incompatible pointer type 'int (*)(struct v4l2_subdev *, struct v4l2_subdev_pad_config *, struct v4l2_subdev_format *)' [-Werror=incompatible-pointer-types]
1329 | .set_fmt = ov2659_set_fmt,
| ^~~~~~~~~~~~~~
drivers/media/i2c/ov2659.c:1329:13: note: (near initialization for 'ov2659_subdev_pad_ops.set_fmt')
cc1: some warnings being treated as errors
--
drivers/media/platform/video-mux.c: In function '__video_mux_get_pad_format':
>> drivers/media/platform/video-mux.c:150:41: error: passing argument 2 of 'v4l2_subdev_get_try_format' from incompatible pointer type [-Werror=incompatible-pointer-types]
150 | return v4l2_subdev_get_try_format(sd, cfg, pad);
| ^~~
| |
| struct v4l2_subdev_pad_config *
In file included from include/media/v4l2-device.h:13,
from drivers/media/platform/video-mux.c:18:
include/media/v4l2-subdev.h:966:33: note: expected 'struct v4l2_subdev_state *' but argument is of type 'struct v4l2_subdev_pad_config *'
966 | struct v4l2_subdev_state *state,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
drivers/media/platform/video-mux.c: In function 'video_mux_init_cfg':
drivers/media/platform/video-mux.c:322:47: error: passing argument 2 of 'v4l2_subdev_get_try_format' from incompatible pointer type [-Werror=incompatible-pointer-types]
322 | mbusformat = v4l2_subdev_get_try_format(sd, cfg, i);
| ^~~
| |
| struct v4l2_subdev_pad_config *
In file included from include/media/v4l2-device.h:13,
from drivers/media/platform/video-mux.c:18:
include/media/v4l2-subdev.h:966:33: note: expected 'struct v4l2_subdev_state *' but argument is of type 'struct v4l2_subdev_pad_config *'
966 | struct v4l2_subdev_state *state,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
drivers/media/platform/video-mux.c: At top level:
>> drivers/media/platform/video-mux.c:332:14: error: initialization of 'int (*)(struct v4l2_subdev *, struct v4l2_subdev_state *)' from incompatible pointer type 'int (*)(struct v4l2_subdev *, struct v4l2_subdev_pad_config *)' [-Werror=incompatible-pointer-types]
332 | .init_cfg = video_mux_init_cfg,
| ^~~~~~~~~~~~~~~~~~
drivers/media/platform/video-mux.c:332:14: note: (near initialization for 'video_mux_pad_ops.init_cfg')
>> drivers/media/platform/video-mux.c:333:13: error: initialization of 'int (*)(struct v4l2_subdev *, struct v4l2_subdev_state *, struct v4l2_subdev_format *)' from incompatible pointer type 'int (*)(struct v4l2_subdev *, struct v4l2_subdev_pad_config *, struct v4l2_subdev_format *)' [-Werror=incompatible-pointer-types]
333 | .get_fmt = video_mux_get_format,
| ^~~~~~~~~~~~~~~~~~~~
drivers/media/platform/video-mux.c:333:13: note: (near initialization for 'video_mux_pad_ops.get_fmt')
drivers/media/platform/video-mux.c:334:13: error: initialization of 'int (*)(struct v4l2_subdev *, struct v4l2_subdev_state *, struct v4l2_subdev_format *)' from incompatible pointer type 'int (*)(struct v4l2_subdev *, struct v4l2_subdev_pad_config *, struct v4l2_subdev_format *)' [-Werror=incompatible-pointer-types]
334 | .set_fmt = video_mux_set_format,
| ^~~~~~~~~~~~~~~~~~~~
drivers/media/platform/video-mux.c:334:13: note: (near initialization for 'video_mux_pad_ops.set_fmt')
cc1: some warnings being treated as errors
--
drivers/media/platform/xilinx/xilinx-tpg.c: In function '__xtpg_get_pad_format':
drivers/media/platform/xilinx/xilinx-tpg.c:259:57: error: passing argument 2 of 'v4l2_subdev_get_try_format' from incompatible pointer type [-Werror=incompatible-pointer-types]
259 | return v4l2_subdev_get_try_format(&xtpg->xvip.subdev, cfg, pad);
| ^~~
| |
| struct v4l2_subdev_pad_config *
In file included from drivers/media/platform/xilinx/xilinx-tpg.c:21:
include/media/v4l2-subdev.h:966:33: note: expected 'struct v4l2_subdev_state *' but argument is of type 'struct v4l2_subdev_pad_config *'
966 | struct v4l2_subdev_state *state,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
drivers/media/platform/xilinx/xilinx-tpg.c: In function 'xtpg_enum_frame_size':
drivers/media/platform/xilinx/xilinx-tpg.c:326:46: error: passing argument 2 of 'v4l2_subdev_get_try_format' from incompatible pointer type [-Werror=incompatible-pointer-types]
326 | format = v4l2_subdev_get_try_format(subdev, cfg, fse->pad);
| ^~~
| |
| struct v4l2_subdev_pad_config *
In file included from drivers/media/platform/xilinx/xilinx-tpg.c:21:
include/media/v4l2-subdev.h:966:33: note: expected 'struct v4l2_subdev_state *' but argument is of type 'struct v4l2_subdev_pad_config *'
966 | struct v4l2_subdev_state *state,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
drivers/media/platform/xilinx/xilinx-tpg.c: In function 'xtpg_open':
drivers/media/platform/xilinx/xilinx-tpg.c:354:48: error: 'struct v4l2_subdev_fh' has no member named 'pad'
354 | format = v4l2_subdev_get_try_format(subdev, fh->pad, 0);
| ^~
drivers/media/platform/xilinx/xilinx-tpg.c:358:49: error: 'struct v4l2_subdev_fh' has no member named 'pad'
358 | format = v4l2_subdev_get_try_format(subdev, fh->pad, 1);
| ^~
drivers/media/platform/xilinx/xilinx-tpg.c: At top level:
>> drivers/media/platform/xilinx/xilinx-tpg.c:468:21: error: initialization of 'int (*)(struct v4l2_subdev *, struct v4l2_subdev_state *, struct v4l2_subdev_mbus_code_enum *)' from incompatible pointer type 'int (*)(struct v4l2_subdev *, struct v4l2_subdev_pad_config *, struct v4l2_subdev_mbus_code_enum *)' [-Werror=incompatible-pointer-types]
468 | .enum_mbus_code = xvip_enum_mbus_code,
| ^~~~~~~~~~~~~~~~~~~
drivers/media/platform/xilinx/xilinx-tpg.c:468:21: note: (near initialization for 'xtpg_pad_ops.enum_mbus_code')
>> drivers/media/platform/xilinx/xilinx-tpg.c:469:21: error: initialization of 'int (*)(struct v4l2_subdev *, struct v4l2_subdev_state *, struct v4l2_subdev_frame_size_enum *)' from incompatible pointer type 'int (*)(struct v4l2_subdev *, struct v4l2_subdev_pad_config *, struct v4l2_subdev_frame_size_enum *)' [-Werror=incompatible-pointer-types]
469 | .enum_frame_size = xtpg_enum_frame_size,
| ^~~~~~~~~~~~~~~~~~~~
drivers/media/platform/xilinx/xilinx-tpg.c:469:21: note: (near initialization for 'xtpg_pad_ops.enum_frame_size')
>> drivers/media/platform/xilinx/xilinx-tpg.c:470:14: error: initialization of 'int (*)(struct v4l2_subdev *, struct v4l2_subdev_state *, struct v4l2_subdev_format *)' from incompatible pointer type 'int (*)(struct v4l2_subdev *, struct v4l2_subdev_pad_config *, struct v4l2_subdev_format *)' [-Werror=incompatible-pointer-types]
470 | .get_fmt = xtpg_get_format,
| ^~~~~~~~~~~~~~~
drivers/media/platform/xilinx/xilinx-tpg.c:470:14: note: (near initialization for 'xtpg_pad_ops.get_fmt')
drivers/media/platform/xilinx/xilinx-tpg.c:471:14: error: initialization of 'int (*)(struct v4l2_subdev *, struct v4l2_subdev_state *, struct v4l2_subdev_format *)' from incompatible pointer type 'int (*)(struct v4l2_subdev *, struct v4l2_subdev_pad_config *, struct v4l2_subdev_format *)' [-Werror=incompatible-pointer-types]
471 | .set_fmt = xtpg_set_format,
| ^~~~~~~~~~~~~~~
drivers/media/platform/xilinx/xilinx-tpg.c:471:14: note: (near initialization for 'xtpg_pad_ops.set_fmt')
cc1: some warnings being treated as errors
vim +1326 drivers/media/i2c/ov2659.c
2b4a07a0dd3364 Benoit Parrot 2019-09-30 1295
c4c0283ab3cd78 Benoit Parrot 2015-03-20 1296 /* -----------------------------------------------------------------------------
c4c0283ab3cd78 Benoit Parrot 2015-03-20 1297 * V4L2 subdev internal operations
c4c0283ab3cd78 Benoit Parrot 2015-03-20 1298 */
c4c0283ab3cd78 Benoit Parrot 2015-03-20 1299
fa8cb6444c3236 Mauro Carvalho Chehab 2015-05-14 1300 #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
c4c0283ab3cd78 Benoit Parrot 2015-03-20 1301 static int ov2659_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
c4c0283ab3cd78 Benoit Parrot 2015-03-20 1302 {
c4c0283ab3cd78 Benoit Parrot 2015-03-20 1303 struct i2c_client *client = v4l2_get_subdevdata(sd);
c4c0283ab3cd78 Benoit Parrot 2015-03-20 1304 struct v4l2_mbus_framefmt *format =
c4c0283ab3cd78 Benoit Parrot 2015-03-20 @1305 v4l2_subdev_get_try_format(sd, fh->pad, 0);
c4c0283ab3cd78 Benoit Parrot 2015-03-20 1306
c4c0283ab3cd78 Benoit Parrot 2015-03-20 1307 dev_dbg(&client->dev, "%s:\n", __func__);
c4c0283ab3cd78 Benoit Parrot 2015-03-20 1308
c4c0283ab3cd78 Benoit Parrot 2015-03-20 1309 ov2659_get_default_format(format);
c4c0283ab3cd78 Benoit Parrot 2015-03-20 1310
c4c0283ab3cd78 Benoit Parrot 2015-03-20 1311 return 0;
c4c0283ab3cd78 Benoit Parrot 2015-03-20 1312 }
fa8cb6444c3236 Mauro Carvalho Chehab 2015-05-14 1313 #endif
c4c0283ab3cd78 Benoit Parrot 2015-03-20 1314
c4c0283ab3cd78 Benoit Parrot 2015-03-20 1315 static const struct v4l2_subdev_core_ops ov2659_subdev_core_ops = {
c4c0283ab3cd78 Benoit Parrot 2015-03-20 1316 .log_status = v4l2_ctrl_subdev_log_status,
c4c0283ab3cd78 Benoit Parrot 2015-03-20 1317 .subscribe_event = v4l2_ctrl_subdev_subscribe_event,
c4c0283ab3cd78 Benoit Parrot 2015-03-20 1318 .unsubscribe_event = v4l2_event_subdev_unsubscribe,
c4c0283ab3cd78 Benoit Parrot 2015-03-20 1319 };
c4c0283ab3cd78 Benoit Parrot 2015-03-20 1320
c4c0283ab3cd78 Benoit Parrot 2015-03-20 1321 static const struct v4l2_subdev_video_ops ov2659_subdev_video_ops = {
c4c0283ab3cd78 Benoit Parrot 2015-03-20 1322 .s_stream = ov2659_s_stream,
c4c0283ab3cd78 Benoit Parrot 2015-03-20 1323 };
c4c0283ab3cd78 Benoit Parrot 2015-03-20 1324
c4c0283ab3cd78 Benoit Parrot 2015-03-20 1325 static const struct v4l2_subdev_pad_ops ov2659_subdev_pad_ops = {
c4c0283ab3cd78 Benoit Parrot 2015-03-20 @1326 .enum_mbus_code = ov2659_enum_mbus_code,
c4c0283ab3cd78 Benoit Parrot 2015-03-20 @1327 .enum_frame_size = ov2659_enum_frame_sizes,
c4c0283ab3cd78 Benoit Parrot 2015-03-20 @1328 .get_fmt = ov2659_get_fmt,
c4c0283ab3cd78 Benoit Parrot 2015-03-20 1329 .set_fmt = ov2659_set_fmt,
c4c0283ab3cd78 Benoit Parrot 2015-03-20 1330 };
c4c0283ab3cd78 Benoit Parrot 2015-03-20 1331
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 31639 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/1] RFC: media: v4l2-subdev: add subdev-wide state struct
2021-04-23 10:29 ` [PATCH v2 1/1] RFC: media: v4l2-subdev: add subdev-wide state struct Tomi Valkeinen
2021-04-23 21:01 ` kernel test robot
@ 2021-04-23 21:34 ` kernel test robot
2021-04-23 21:34 ` kernel test robot
2 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2021-04-23 21:34 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 26661 bytes --]
Hi Tomi,
[FYI, it's a private test report for your RFC patch.]
[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on v5.12-rc8 next-20210423]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Tomi-Valkeinen/RFC-media-v4l2-subdev-add-subdev-wide-config-struct/20210423-183133
base: git://linuxtv.org/media_tree.git master
config: riscv-randconfig-r003-20210424 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 06234f758e1945084582cf80450b396f75a9c06e)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/09a6489d3b108d037f87df5fcf5d2c1fa6f70248
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Tomi-Valkeinen/RFC-media-v4l2-subdev-add-subdev-wide-config-struct/20210423-183133
git checkout 09a6489d3b108d037f87df5fcf5d2c1fa6f70248
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=riscv
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
In file included from include/linux/hardirq.h:10:
In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/riscv/include/asm/io.h:149:
include/asm-generic/io.h:564:9: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
return inw(addr);
^~~~~~~~~
arch/riscv/include/asm/io.h:56:76: note: expanded from macro 'inw'
#define inw(c) ({ u16 __v; __io_pbr(); __v = readw_cpu((void*)(PCI_IOBASE + (c))); __io_par(__v); __v; })
~~~~~~~~~~ ^
arch/riscv/include/asm/mmio.h:88:76: note: expanded from macro 'readw_cpu'
#define readw_cpu(c) ({ u16 __r = le16_to_cpu((__force __le16)__raw_readw(c)); __r; })
^
include/uapi/linux/byteorder/little_endian.h:36:51: note: expanded from macro '__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
^
In file included from drivers/media/i2c/tda1997x.c:9:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:10:
In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/riscv/include/asm/io.h:149:
include/asm-generic/io.h:572:9: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
return inl(addr);
^~~~~~~~~
arch/riscv/include/asm/io.h:57:76: note: expanded from macro 'inl'
#define inl(c) ({ u32 __v; __io_pbr(); __v = readl_cpu((void*)(PCI_IOBASE + (c))); __io_par(__v); __v; })
~~~~~~~~~~ ^
arch/riscv/include/asm/mmio.h:89:76: note: expanded from macro 'readl_cpu'
#define readl_cpu(c) ({ u32 __r = le32_to_cpu((__force __le32)__raw_readl(c)); __r; })
^
include/uapi/linux/byteorder/little_endian.h:34:51: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
^
In file included from drivers/media/i2c/tda1997x.c:9:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:10:
In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/riscv/include/asm/io.h:149:
include/asm-generic/io.h:580:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
outb(value, addr);
^~~~~~~~~~~~~~~~~
arch/riscv/include/asm/io.h:59:68: note: expanded from macro 'outb'
#define outb(v,c) ({ __io_pbw(); writeb_cpu((v),(void*)(PCI_IOBASE + (c))); __io_paw(); })
~~~~~~~~~~ ^
arch/riscv/include/asm/mmio.h:91:52: note: expanded from macro 'writeb_cpu'
#define writeb_cpu(v, c) ((void)__raw_writeb((v), (c)))
^
In file included from drivers/media/i2c/tda1997x.c:9:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:10:
In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/riscv/include/asm/io.h:149:
include/asm-generic/io.h:588:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
outw(value, addr);
^~~~~~~~~~~~~~~~~
arch/riscv/include/asm/io.h:60:68: note: expanded from macro 'outw'
#define outw(v,c) ({ __io_pbw(); writew_cpu((v),(void*)(PCI_IOBASE + (c))); __io_paw(); })
~~~~~~~~~~ ^
arch/riscv/include/asm/mmio.h:92:76: note: expanded from macro 'writew_cpu'
#define writew_cpu(v, c) ((void)__raw_writew((__force u16)cpu_to_le16(v), (c)))
^
In file included from drivers/media/i2c/tda1997x.c:9:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:10:
In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/riscv/include/asm/io.h:149:
include/asm-generic/io.h:596:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
outl(value, addr);
^~~~~~~~~~~~~~~~~
arch/riscv/include/asm/io.h:61:68: note: expanded from macro 'outl'
#define outl(v,c) ({ __io_pbw(); writel_cpu((v),(void*)(PCI_IOBASE + (c))); __io_paw(); })
~~~~~~~~~~ ^
arch/riscv/include/asm/mmio.h:93:76: note: expanded from macro 'writel_cpu'
#define writel_cpu(v, c) ((void)__raw_writel((__force u32)cpu_to_le32(v), (c)))
^
In file included from drivers/media/i2c/tda1997x.c:9:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:10:
In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/riscv/include/asm/io.h:149:
include/asm-generic/io.h:1005:55: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
return (port > MMIO_UPPER_LIMIT) ? NULL : PCI_IOBASE + port;
~~~~~~~~~~ ^
>> drivers/media/i2c/tda1997x.c:1726:38: error: incompatible pointer types passing 'struct v4l2_subdev_pad_config *' to parameter of type 'struct v4l2_subdev_state *' [-Werror,-Wincompatible-pointer-types]
mf = v4l2_subdev_get_try_format(sd, cfg, 0);
^~~
include/media/v4l2-subdev.h:966:33: note: passing argument to parameter 'state' here
struct v4l2_subdev_state *state,
^
drivers/media/i2c/tda1997x.c:1778:40: error: incompatible pointer types passing 'struct v4l2_subdev_pad_config *' to parameter of type 'struct v4l2_subdev_state *' [-Werror,-Wincompatible-pointer-types]
fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad);
^~~
include/media/v4l2-subdev.h:966:33: note: passing argument to parameter 'state' here
struct v4l2_subdev_state *state,
^
drivers/media/i2c/tda1997x.c:1812:40: error: incompatible pointer types passing 'struct v4l2_subdev_pad_config *' to parameter of type 'struct v4l2_subdev_state *' [-Werror,-Wincompatible-pointer-types]
fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad);
^~~
include/media/v4l2-subdev.h:966:33: note: passing argument to parameter 'state' here
struct v4l2_subdev_state *state,
^
>> drivers/media/i2c/tda1997x.c:1911:14: error: incompatible function pointer types initializing 'int (*)(struct v4l2_subdev *, struct v4l2_subdev_state *)' with an expression of type 'int (struct v4l2_subdev *, struct v4l2_subdev_pad_config *)' [-Werror,-Wincompatible-function-pointer-types]
.init_cfg = tda1997x_init_cfg,
^~~~~~~~~~~~~~~~~
>> drivers/media/i2c/tda1997x.c:1912:20: error: incompatible function pointer types initializing 'int (*)(struct v4l2_subdev *, struct v4l2_subdev_state *, struct v4l2_subdev_mbus_code_enum *)' with an expression of type 'int (struct v4l2_subdev *, struct v4l2_subdev_pad_config *, struct v4l2_subdev_mbus_code_enum *)' [-Werror,-Wincompatible-function-pointer-types]
.enum_mbus_code = tda1997x_enum_mbus_code,
^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/media/i2c/tda1997x.c:1913:13: error: incompatible function pointer types initializing 'int (*)(struct v4l2_subdev *, struct v4l2_subdev_state *, struct v4l2_subdev_format *)' with an expression of type 'int (struct v4l2_subdev *, struct v4l2_subdev_pad_config *, struct v4l2_subdev_format *)' [-Werror,-Wincompatible-function-pointer-types]
.get_fmt = tda1997x_get_format,
^~~~~~~~~~~~~~~~~~~
drivers/media/i2c/tda1997x.c:1914:13: error: incompatible function pointer types initializing 'int (*)(struct v4l2_subdev *, struct v4l2_subdev_state *, struct v4l2_subdev_format *)' with an expression of type 'int (struct v4l2_subdev *, struct v4l2_subdev_pad_config *, struct v4l2_subdev_format *)' [-Werror,-Wincompatible-function-pointer-types]
.set_fmt = tda1997x_set_format,
^~~~~~~~~~~~~~~~~~~
7 warnings and 7 errors generated.
vim +1726 drivers/media/i2c/tda1997x.c
9ac0038db9a7e1 Tim Harvey 2018-02-15 1714
9ac0038db9a7e1 Tim Harvey 2018-02-15 1715
9ac0038db9a7e1 Tim Harvey 2018-02-15 1716 /* -----------------------------------------------------------------------------
9ac0038db9a7e1 Tim Harvey 2018-02-15 1717 * v4l2_subdev_pad_ops
9ac0038db9a7e1 Tim Harvey 2018-02-15 1718 */
9ac0038db9a7e1 Tim Harvey 2018-02-15 1719
9ac0038db9a7e1 Tim Harvey 2018-02-15 1720 static int tda1997x_init_cfg(struct v4l2_subdev *sd,
9ac0038db9a7e1 Tim Harvey 2018-02-15 1721 struct v4l2_subdev_pad_config *cfg)
9ac0038db9a7e1 Tim Harvey 2018-02-15 1722 {
9ac0038db9a7e1 Tim Harvey 2018-02-15 1723 struct tda1997x_state *state = to_state(sd);
9ac0038db9a7e1 Tim Harvey 2018-02-15 1724 struct v4l2_mbus_framefmt *mf;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1725
9ac0038db9a7e1 Tim Harvey 2018-02-15 @1726 mf = v4l2_subdev_get_try_format(sd, cfg, 0);
9ac0038db9a7e1 Tim Harvey 2018-02-15 1727 mf->code = state->mbus_codes[0];
9ac0038db9a7e1 Tim Harvey 2018-02-15 1728
9ac0038db9a7e1 Tim Harvey 2018-02-15 1729 return 0;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1730 }
9ac0038db9a7e1 Tim Harvey 2018-02-15 1731
9ac0038db9a7e1 Tim Harvey 2018-02-15 1732 static int tda1997x_enum_mbus_code(struct v4l2_subdev *sd,
9ac0038db9a7e1 Tim Harvey 2018-02-15 1733 struct v4l2_subdev_pad_config *cfg,
9ac0038db9a7e1 Tim Harvey 2018-02-15 1734 struct v4l2_subdev_mbus_code_enum *code)
9ac0038db9a7e1 Tim Harvey 2018-02-15 1735 {
9ac0038db9a7e1 Tim Harvey 2018-02-15 1736 struct tda1997x_state *state = to_state(sd);
9ac0038db9a7e1 Tim Harvey 2018-02-15 1737
9ac0038db9a7e1 Tim Harvey 2018-02-15 1738 v4l_dbg(1, debug, state->client, "%s %d\n", __func__, code->index);
9ac0038db9a7e1 Tim Harvey 2018-02-15 1739 if (code->index >= ARRAY_SIZE(state->mbus_codes))
9ac0038db9a7e1 Tim Harvey 2018-02-15 1740 return -EINVAL;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1741
9ac0038db9a7e1 Tim Harvey 2018-02-15 1742 if (!state->mbus_codes[code->index])
9ac0038db9a7e1 Tim Harvey 2018-02-15 1743 return -EINVAL;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1744
9ac0038db9a7e1 Tim Harvey 2018-02-15 1745 code->code = state->mbus_codes[code->index];
9ac0038db9a7e1 Tim Harvey 2018-02-15 1746
9ac0038db9a7e1 Tim Harvey 2018-02-15 1747 return 0;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1748 }
9ac0038db9a7e1 Tim Harvey 2018-02-15 1749
9ac0038db9a7e1 Tim Harvey 2018-02-15 1750 static void tda1997x_fill_format(struct tda1997x_state *state,
9ac0038db9a7e1 Tim Harvey 2018-02-15 1751 struct v4l2_mbus_framefmt *format)
9ac0038db9a7e1 Tim Harvey 2018-02-15 1752 {
9ac0038db9a7e1 Tim Harvey 2018-02-15 1753 const struct v4l2_bt_timings *bt;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1754
9ac0038db9a7e1 Tim Harvey 2018-02-15 1755 memset(format, 0, sizeof(*format));
9ac0038db9a7e1 Tim Harvey 2018-02-15 1756 bt = &state->timings.bt;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1757 format->width = bt->width;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1758 format->height = bt->height;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1759 format->colorspace = state->colorimetry.colorspace;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1760 format->field = (bt->interlaced) ?
9ac0038db9a7e1 Tim Harvey 2018-02-15 1761 V4L2_FIELD_SEQ_TB : V4L2_FIELD_NONE;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1762 }
9ac0038db9a7e1 Tim Harvey 2018-02-15 1763
9ac0038db9a7e1 Tim Harvey 2018-02-15 1764 static int tda1997x_get_format(struct v4l2_subdev *sd,
9ac0038db9a7e1 Tim Harvey 2018-02-15 1765 struct v4l2_subdev_pad_config *cfg,
9ac0038db9a7e1 Tim Harvey 2018-02-15 1766 struct v4l2_subdev_format *format)
9ac0038db9a7e1 Tim Harvey 2018-02-15 1767 {
9ac0038db9a7e1 Tim Harvey 2018-02-15 1768 struct tda1997x_state *state = to_state(sd);
9ac0038db9a7e1 Tim Harvey 2018-02-15 1769
9ac0038db9a7e1 Tim Harvey 2018-02-15 1770 v4l_dbg(1, debug, state->client, "%s pad=%d which=%d\n",
9ac0038db9a7e1 Tim Harvey 2018-02-15 1771 __func__, format->pad, format->which);
9ac0038db9a7e1 Tim Harvey 2018-02-15 1772
9ac0038db9a7e1 Tim Harvey 2018-02-15 1773 tda1997x_fill_format(state, &format->format);
9ac0038db9a7e1 Tim Harvey 2018-02-15 1774
9ac0038db9a7e1 Tim Harvey 2018-02-15 1775 if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
9ac0038db9a7e1 Tim Harvey 2018-02-15 1776 struct v4l2_mbus_framefmt *fmt;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1777
9ac0038db9a7e1 Tim Harvey 2018-02-15 1778 fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad);
9ac0038db9a7e1 Tim Harvey 2018-02-15 1779 format->format.code = fmt->code;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1780 } else
9ac0038db9a7e1 Tim Harvey 2018-02-15 1781 format->format.code = state->mbus_code;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1782
9ac0038db9a7e1 Tim Harvey 2018-02-15 1783 return 0;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1784 }
9ac0038db9a7e1 Tim Harvey 2018-02-15 1785
9ac0038db9a7e1 Tim Harvey 2018-02-15 1786 static int tda1997x_set_format(struct v4l2_subdev *sd,
9ac0038db9a7e1 Tim Harvey 2018-02-15 1787 struct v4l2_subdev_pad_config *cfg,
9ac0038db9a7e1 Tim Harvey 2018-02-15 1788 struct v4l2_subdev_format *format)
9ac0038db9a7e1 Tim Harvey 2018-02-15 1789 {
9ac0038db9a7e1 Tim Harvey 2018-02-15 1790 struct tda1997x_state *state = to_state(sd);
9ac0038db9a7e1 Tim Harvey 2018-02-15 1791 u32 code = 0;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1792 int i;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1793
9ac0038db9a7e1 Tim Harvey 2018-02-15 1794 v4l_dbg(1, debug, state->client, "%s pad=%d which=%d fmt=0x%x\n",
9ac0038db9a7e1 Tim Harvey 2018-02-15 1795 __func__, format->pad, format->which, format->format.code);
9ac0038db9a7e1 Tim Harvey 2018-02-15 1796
9ac0038db9a7e1 Tim Harvey 2018-02-15 1797 for (i = 0; i < ARRAY_SIZE(state->mbus_codes); i++) {
9ac0038db9a7e1 Tim Harvey 2018-02-15 1798 if (format->format.code == state->mbus_codes[i]) {
9ac0038db9a7e1 Tim Harvey 2018-02-15 1799 code = state->mbus_codes[i];
9ac0038db9a7e1 Tim Harvey 2018-02-15 1800 break;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1801 }
9ac0038db9a7e1 Tim Harvey 2018-02-15 1802 }
9ac0038db9a7e1 Tim Harvey 2018-02-15 1803 if (!code)
9ac0038db9a7e1 Tim Harvey 2018-02-15 1804 code = state->mbus_codes[0];
9ac0038db9a7e1 Tim Harvey 2018-02-15 1805
9ac0038db9a7e1 Tim Harvey 2018-02-15 1806 tda1997x_fill_format(state, &format->format);
9ac0038db9a7e1 Tim Harvey 2018-02-15 1807 format->format.code = code;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1808
9ac0038db9a7e1 Tim Harvey 2018-02-15 1809 if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
9ac0038db9a7e1 Tim Harvey 2018-02-15 1810 struct v4l2_mbus_framefmt *fmt;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1811
9ac0038db9a7e1 Tim Harvey 2018-02-15 1812 fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad);
9ac0038db9a7e1 Tim Harvey 2018-02-15 1813 *fmt = format->format;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1814 } else {
9ac0038db9a7e1 Tim Harvey 2018-02-15 1815 int ret = tda1997x_setup_format(state, format->format.code);
9ac0038db9a7e1 Tim Harvey 2018-02-15 1816
9ac0038db9a7e1 Tim Harvey 2018-02-15 1817 if (ret)
9ac0038db9a7e1 Tim Harvey 2018-02-15 1818 return ret;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1819 /* mbus_code has changed - re-configure csc/vidout */
9ac0038db9a7e1 Tim Harvey 2018-02-15 1820 tda1997x_configure_csc(sd);
9ac0038db9a7e1 Tim Harvey 2018-02-15 1821 tda1997x_configure_vidout(state);
9ac0038db9a7e1 Tim Harvey 2018-02-15 1822 }
9ac0038db9a7e1 Tim Harvey 2018-02-15 1823
9ac0038db9a7e1 Tim Harvey 2018-02-15 1824 return 0;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1825 }
9ac0038db9a7e1 Tim Harvey 2018-02-15 1826
9ac0038db9a7e1 Tim Harvey 2018-02-15 1827 static int tda1997x_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid)
9ac0038db9a7e1 Tim Harvey 2018-02-15 1828 {
9ac0038db9a7e1 Tim Harvey 2018-02-15 1829 struct tda1997x_state *state = to_state(sd);
9ac0038db9a7e1 Tim Harvey 2018-02-15 1830
9ac0038db9a7e1 Tim Harvey 2018-02-15 1831 v4l_dbg(1, debug, state->client, "%s pad=%d\n", __func__, edid->pad);
9ac0038db9a7e1 Tim Harvey 2018-02-15 1832 memset(edid->reserved, 0, sizeof(edid->reserved));
9ac0038db9a7e1 Tim Harvey 2018-02-15 1833
9ac0038db9a7e1 Tim Harvey 2018-02-15 1834 if (edid->start_block == 0 && edid->blocks == 0) {
9ac0038db9a7e1 Tim Harvey 2018-02-15 1835 edid->blocks = state->edid.blocks;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1836 return 0;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1837 }
9ac0038db9a7e1 Tim Harvey 2018-02-15 1838
9ac0038db9a7e1 Tim Harvey 2018-02-15 1839 if (!state->edid.present)
9ac0038db9a7e1 Tim Harvey 2018-02-15 1840 return -ENODATA;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1841
9ac0038db9a7e1 Tim Harvey 2018-02-15 1842 if (edid->start_block >= state->edid.blocks)
9ac0038db9a7e1 Tim Harvey 2018-02-15 1843 return -EINVAL;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1844
9ac0038db9a7e1 Tim Harvey 2018-02-15 1845 if (edid->start_block + edid->blocks > state->edid.blocks)
9ac0038db9a7e1 Tim Harvey 2018-02-15 1846 edid->blocks = state->edid.blocks - edid->start_block;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1847
9ac0038db9a7e1 Tim Harvey 2018-02-15 1848 memcpy(edid->edid, state->edid.edid + edid->start_block * 128,
9ac0038db9a7e1 Tim Harvey 2018-02-15 1849 edid->blocks * 128);
9ac0038db9a7e1 Tim Harvey 2018-02-15 1850
9ac0038db9a7e1 Tim Harvey 2018-02-15 1851 return 0;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1852 }
9ac0038db9a7e1 Tim Harvey 2018-02-15 1853
9ac0038db9a7e1 Tim Harvey 2018-02-15 1854 static int tda1997x_set_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid)
9ac0038db9a7e1 Tim Harvey 2018-02-15 1855 {
9ac0038db9a7e1 Tim Harvey 2018-02-15 1856 struct tda1997x_state *state = to_state(sd);
9ac0038db9a7e1 Tim Harvey 2018-02-15 1857 int i;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1858
9ac0038db9a7e1 Tim Harvey 2018-02-15 1859 v4l_dbg(1, debug, state->client, "%s pad=%d\n", __func__, edid->pad);
9ac0038db9a7e1 Tim Harvey 2018-02-15 1860 memset(edid->reserved, 0, sizeof(edid->reserved));
9ac0038db9a7e1 Tim Harvey 2018-02-15 1861
9ac0038db9a7e1 Tim Harvey 2018-02-15 1862 if (edid->start_block != 0)
9ac0038db9a7e1 Tim Harvey 2018-02-15 1863 return -EINVAL;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1864
9ac0038db9a7e1 Tim Harvey 2018-02-15 1865 if (edid->blocks == 0) {
9ac0038db9a7e1 Tim Harvey 2018-02-15 1866 state->edid.blocks = 0;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1867 state->edid.present = 0;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1868 tda1997x_disable_edid(sd);
9ac0038db9a7e1 Tim Harvey 2018-02-15 1869 return 0;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1870 }
9ac0038db9a7e1 Tim Harvey 2018-02-15 1871
9ac0038db9a7e1 Tim Harvey 2018-02-15 1872 if (edid->blocks > 2) {
9ac0038db9a7e1 Tim Harvey 2018-02-15 1873 edid->blocks = 2;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1874 return -E2BIG;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1875 }
9ac0038db9a7e1 Tim Harvey 2018-02-15 1876
9ac0038db9a7e1 Tim Harvey 2018-02-15 1877 tda1997x_disable_edid(sd);
9ac0038db9a7e1 Tim Harvey 2018-02-15 1878
9ac0038db9a7e1 Tim Harvey 2018-02-15 1879 /* write base EDID */
9ac0038db9a7e1 Tim Harvey 2018-02-15 1880 for (i = 0; i < 128; i++)
9ac0038db9a7e1 Tim Harvey 2018-02-15 1881 io_write(sd, REG_EDID_IN_BYTE0 + i, edid->edid[i]);
9ac0038db9a7e1 Tim Harvey 2018-02-15 1882
9ac0038db9a7e1 Tim Harvey 2018-02-15 1883 /* write CEA Extension */
9ac0038db9a7e1 Tim Harvey 2018-02-15 1884 for (i = 0; i < 128; i++)
9ac0038db9a7e1 Tim Harvey 2018-02-15 1885 io_write(sd, REG_EDID_IN_BYTE128 + i, edid->edid[i+128]);
9ac0038db9a7e1 Tim Harvey 2018-02-15 1886
0806bc0afbb415 Tim Harvey 2019-02-05 1887 /* store state */
0806bc0afbb415 Tim Harvey 2019-02-05 1888 memcpy(state->edid.edid, edid->edid, 256);
0806bc0afbb415 Tim Harvey 2019-02-05 1889 state->edid.blocks = edid->blocks;
0806bc0afbb415 Tim Harvey 2019-02-05 1890
9ac0038db9a7e1 Tim Harvey 2018-02-15 1891 tda1997x_enable_edid(sd);
9ac0038db9a7e1 Tim Harvey 2018-02-15 1892
9ac0038db9a7e1 Tim Harvey 2018-02-15 1893 return 0;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1894 }
9ac0038db9a7e1 Tim Harvey 2018-02-15 1895
9ac0038db9a7e1 Tim Harvey 2018-02-15 1896 static int tda1997x_get_dv_timings_cap(struct v4l2_subdev *sd,
9ac0038db9a7e1 Tim Harvey 2018-02-15 1897 struct v4l2_dv_timings_cap *cap)
9ac0038db9a7e1 Tim Harvey 2018-02-15 1898 {
9ac0038db9a7e1 Tim Harvey 2018-02-15 1899 *cap = tda1997x_dv_timings_cap;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1900 return 0;
9ac0038db9a7e1 Tim Harvey 2018-02-15 1901 }
9ac0038db9a7e1 Tim Harvey 2018-02-15 1902
9ac0038db9a7e1 Tim Harvey 2018-02-15 1903 static int tda1997x_enum_dv_timings(struct v4l2_subdev *sd,
9ac0038db9a7e1 Tim Harvey 2018-02-15 1904 struct v4l2_enum_dv_timings *timings)
9ac0038db9a7e1 Tim Harvey 2018-02-15 1905 {
9ac0038db9a7e1 Tim Harvey 2018-02-15 1906 return v4l2_enum_dv_timings_cap(timings, &tda1997x_dv_timings_cap,
9ac0038db9a7e1 Tim Harvey 2018-02-15 1907 NULL, NULL);
9ac0038db9a7e1 Tim Harvey 2018-02-15 1908 }
9ac0038db9a7e1 Tim Harvey 2018-02-15 1909
9ac0038db9a7e1 Tim Harvey 2018-02-15 1910 static const struct v4l2_subdev_pad_ops tda1997x_pad_ops = {
9ac0038db9a7e1 Tim Harvey 2018-02-15 @1911 .init_cfg = tda1997x_init_cfg,
9ac0038db9a7e1 Tim Harvey 2018-02-15 @1912 .enum_mbus_code = tda1997x_enum_mbus_code,
9ac0038db9a7e1 Tim Harvey 2018-02-15 @1913 .get_fmt = tda1997x_get_format,
9ac0038db9a7e1 Tim Harvey 2018-02-15 1914 .set_fmt = tda1997x_set_format,
9ac0038db9a7e1 Tim Harvey 2018-02-15 1915 .get_edid = tda1997x_get_edid,
9ac0038db9a7e1 Tim Harvey 2018-02-15 1916 .set_edid = tda1997x_set_edid,
9ac0038db9a7e1 Tim Harvey 2018-02-15 1917 .dv_timings_cap = tda1997x_get_dv_timings_cap,
9ac0038db9a7e1 Tim Harvey 2018-02-15 1918 .enum_dv_timings = tda1997x_enum_dv_timings,
9ac0038db9a7e1 Tim Harvey 2018-02-15 1919 };
9ac0038db9a7e1 Tim Harvey 2018-02-15 1920
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 35027 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/1] RFC: media: v4l2-subdev: add subdev-wide state struct
2021-04-23 10:29 ` [PATCH v2 1/1] RFC: media: v4l2-subdev: add subdev-wide state struct Tomi Valkeinen
2021-04-23 21:01 ` kernel test robot
2021-04-23 21:34 ` kernel test robot
@ 2021-04-23 21:34 ` kernel test robot
2 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2021-04-23 21:34 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 10335 bytes --]
Hi Tomi,
[FYI, it's a private test report for your RFC patch.]
[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on v5.12-rc8 next-20210423]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Tomi-Valkeinen/RFC-media-v4l2-subdev-add-subdev-wide-config-struct/20210423-183133
base: git://linuxtv.org/media_tree.git master
config: powerpc-randconfig-r002-20210424 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 06234f758e1945084582cf80450b396f75a9c06e)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install powerpc cross compiling tool for clang build
# apt-get install binutils-powerpc-linux-gnu
# https://github.com/0day-ci/linux/commit/09a6489d3b108d037f87df5fcf5d2c1fa6f70248
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Tomi-Valkeinen/RFC-media-v4l2-subdev-add-subdev-wide-config-struct/20210423-183133
git checkout 09a6489d3b108d037f87df5fcf5d2c1fa6f70248
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=powerpc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
In file included from drivers/media/i2c/max9286.c:17:
In file included from include/linux/gpio/driver.h:7:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:619:
arch/powerpc/include/asm/io-defs.h:45:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(insw, (unsigned long p, void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:60:1: note: expanded from here
__do_insw
^
arch/powerpc/include/asm/io.h:557:56: note: expanded from macro '__do_insw'
#define __do_insw(p, b, n) readsw((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from drivers/media/i2c/max9286.c:17:
In file included from include/linux/gpio/driver.h:7:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:619:
arch/powerpc/include/asm/io-defs.h:47:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(insl, (unsigned long p, void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:62:1: note: expanded from here
__do_insl
^
arch/powerpc/include/asm/io.h:558:56: note: expanded from macro '__do_insl'
#define __do_insl(p, b, n) readsl((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from drivers/media/i2c/max9286.c:17:
In file included from include/linux/gpio/driver.h:7:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:619:
arch/powerpc/include/asm/io-defs.h:49:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(outsb, (unsigned long p, const void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:64:1: note: expanded from here
__do_outsb
^
arch/powerpc/include/asm/io.h:559:58: note: expanded from macro '__do_outsb'
#define __do_outsb(p, b, n) writesb((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from drivers/media/i2c/max9286.c:17:
In file included from include/linux/gpio/driver.h:7:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:619:
arch/powerpc/include/asm/io-defs.h:51:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(outsw, (unsigned long p, const void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:66:1: note: expanded from here
__do_outsw
^
arch/powerpc/include/asm/io.h:560:58: note: expanded from macro '__do_outsw'
#define __do_outsw(p, b, n) writesw((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from drivers/media/i2c/max9286.c:17:
In file included from include/linux/gpio/driver.h:7:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:619:
arch/powerpc/include/asm/io-defs.h:53:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(outsl, (unsigned long p, const void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:68:1: note: expanded from here
__do_outsl
^
arch/powerpc/include/asm/io.h:561:58: note: expanded from macro '__do_outsl'
#define __do_outsl(p, b, n) writesl((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
~~~~~~~~~~~~~~~~~~~~~^
drivers/media/i2c/max9286.c:733:48: error: incompatible pointer types passing 'struct v4l2_subdev_pad_config *' to parameter of type 'struct v4l2_subdev_state *' [-Werror,-Wincompatible-pointer-types]
return v4l2_subdev_get_try_format(&priv->sd, cfg, pad);
^~~
include/media/v4l2-subdev.h:966:33: note: passing argument to parameter 'state' here
struct v4l2_subdev_state *state,
^
drivers/media/i2c/max9286.c:807:20: error: incompatible function pointer types initializing 'int (*)(struct v4l2_subdev *, struct v4l2_subdev_state *, struct v4l2_subdev_mbus_code_enum *)' with an expression of type 'int (struct v4l2_subdev *, struct v4l2_subdev_pad_config *, struct v4l2_subdev_mbus_code_enum *)' [-Werror,-Wincompatible-function-pointer-types]
.enum_mbus_code = max9286_enum_mbus_code,
^~~~~~~~~~~~~~~~~~~~~~
drivers/media/i2c/max9286.c:808:13: error: incompatible function pointer types initializing 'int (*)(struct v4l2_subdev *, struct v4l2_subdev_state *, struct v4l2_subdev_format *)' with an expression of type 'int (struct v4l2_subdev *, struct v4l2_subdev_pad_config *, struct v4l2_subdev_format *)' [-Werror,-Wincompatible-function-pointer-types]
.get_fmt = max9286_get_fmt,
^~~~~~~~~~~~~~~
drivers/media/i2c/max9286.c:809:13: error: incompatible function pointer types initializing 'int (*)(struct v4l2_subdev *, struct v4l2_subdev_state *, struct v4l2_subdev_format *)' with an expression of type 'int (struct v4l2_subdev *, struct v4l2_subdev_pad_config *, struct v4l2_subdev_format *)' [-Werror,-Wincompatible-function-pointer-types]
.set_fmt = max9286_set_fmt,
^~~~~~~~~~~~~~~
>> drivers/media/i2c/max9286.c:835:51: error: no member named 'pad' in 'struct v4l2_subdev_fh'
format = v4l2_subdev_get_try_format(subdev, fh->pad, i);
~~ ^
6 warnings and 5 errors generated.
vim +835 drivers/media/i2c/max9286.c
66d8c9d2422da2 Kieran Bingham 2020-06-12 828
66d8c9d2422da2 Kieran Bingham 2020-06-12 829 static int max9286_open(struct v4l2_subdev *subdev, struct v4l2_subdev_fh *fh)
66d8c9d2422da2 Kieran Bingham 2020-06-12 830 {
66d8c9d2422da2 Kieran Bingham 2020-06-12 831 struct v4l2_mbus_framefmt *format;
66d8c9d2422da2 Kieran Bingham 2020-06-12 832 unsigned int i;
66d8c9d2422da2 Kieran Bingham 2020-06-12 833
66d8c9d2422da2 Kieran Bingham 2020-06-12 834 for (i = 0; i < MAX9286_N_SINKS; i++) {
66d8c9d2422da2 Kieran Bingham 2020-06-12 @835 format = v4l2_subdev_get_try_format(subdev, fh->pad, i);
66d8c9d2422da2 Kieran Bingham 2020-06-12 836 max9286_init_format(format);
66d8c9d2422da2 Kieran Bingham 2020-06-12 837 }
66d8c9d2422da2 Kieran Bingham 2020-06-12 838
66d8c9d2422da2 Kieran Bingham 2020-06-12 839 return 0;
66d8c9d2422da2 Kieran Bingham 2020-06-12 840 }
66d8c9d2422da2 Kieran Bingham 2020-06-12 841
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 32930 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-04-23 21:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-23 10:29 [PATCH v2 0/1] RFC: media: v4l2-subdev: add subdev-wide config struct Tomi Valkeinen
2021-04-23 10:29 ` [PATCH v2 1/1] RFC: media: v4l2-subdev: add subdev-wide state struct Tomi Valkeinen
2021-04-23 21:01 ` kernel test robot
2021-04-23 21:34 ` kernel test robot
2021-04-23 21:34 ` kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.