This reverts commit 640e77466e69d9c28de227bc76881f5501f532ca.
In commit 7967656ffbfa ("coding-style: Clarify the expectations around
bool") the check to dis-allow bool structure members was removed from
checkpatch.pl. It promotes bool structure members to store boolean
values. This enhances code readability.
Signed-off-by: Umang Jain <[email protected]>
---
.../staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 12 ++++++------
.../staging/vc04_services/vchiq-mmal/mmal-vchiq.h | 4 ++--
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
index cb921c94996a..4abb6178cb9f 100644
--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
@@ -863,9 +863,9 @@ static int port_info_get(struct vchiq_mmal_instance *instance,
goto release_msg;
if (rmsg->u.port_info_get_reply.port.is_enabled == 0)
- port->enabled = 0;
+ port->enabled = false;
else
- port->enabled = 1;
+ port->enabled = true;
/* copy the values out of the message */
port->handle = rmsg->u.port_info_get_reply.port_handle;
@@ -1304,7 +1304,7 @@ static int port_disable(struct vchiq_mmal_instance *instance,
if (!port->enabled)
return 0;
- port->enabled = 0;
+ port->enabled = false;
ret = port_action_port(instance, port,
MMAL_MSG_PORT_ACTION_TYPE_DISABLE);
@@ -1359,7 +1359,7 @@ static int port_enable(struct vchiq_mmal_instance *instance,
if (ret)
goto done;
- port->enabled = 1;
+ port->enabled = true;
if (port->buffer_cb) {
/* send buffer headers to videocore */
@@ -1531,7 +1531,7 @@ int vchiq_mmal_port_connect_tunnel(struct vchiq_mmal_instance *instance,
pr_err("failed disconnecting src port\n");
goto release_unlock;
}
- src->connected->enabled = 0;
+ src->connected->enabled = false;
src->connected = NULL;
}
@@ -1799,7 +1799,7 @@ int vchiq_mmal_component_disable(struct vchiq_mmal_instance *instance,
ret = disable_component(instance, component);
if (ret == 0)
- component->enabled = 0;
+ component->enabled = false;
mutex_unlock(&instance->vchiq_mutex);
diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h
index 6006e29232b3..6d984cf5a83a 100644
--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h
+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h
@@ -48,7 +48,7 @@ typedef void (*vchiq_mmal_buffer_cb)(
int status, struct mmal_buffer *buffer);
struct vchiq_mmal_port {
- u32 enabled:1;
+ bool enabled;
u32 handle;
u32 type; /* port type, cached to use on port info set */
u32 index; /* port index, cached to use on port info set */
@@ -83,7 +83,7 @@ struct vchiq_mmal_port {
struct vchiq_mmal_component {
u32 in_use:1;
- u32 enabled:1;
+ bool enabled;
u32 handle; /* VideoCore handle for component */
u32 inputs; /* Number of input ports */
u32 outputs; /* Number of output ports */
--
2.38.1
Quoting Umang Jain (2022-11-18 08:42:42)
> This reverts commit 640e77466e69d9c28de227bc76881f5501f532ca.
>
> In commit 7967656ffbfa ("coding-style: Clarify the expectations around
> bool") the check to dis-allow bool structure members was removed from
> checkpatch.pl. It promotes bool structure members to store boolean
> values. This enhances code readability.
>
> Signed-off-by: Umang Jain <[email protected]>
Thanks,
That's a more direct revert of 640e77466e69 ("staging: mmal-vchiq: Avoid
use of bool in structures") indeed.
I see Stefan was concerned about clarifying that this won't affect
firmware or userspace, it may still be good to hear from Dave to
confirm, but my understanding of 640e77466e69, means I believe this is
safe. I don't expect this structure to be used as any kind of ABI to
firmware or userspace.
Reviewed-by: Kieran Bingham <[email protected]>
> ---
> .../staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 12 ++++++------
> .../staging/vc04_services/vchiq-mmal/mmal-vchiq.h | 4 ++--
> 2 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
> index cb921c94996a..4abb6178cb9f 100644
> --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
> +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
> @@ -863,9 +863,9 @@ static int port_info_get(struct vchiq_mmal_instance *instance,
> goto release_msg;
>
> if (rmsg->u.port_info_get_reply.port.is_enabled == 0)
> - port->enabled = 0;
> + port->enabled = false;
> else
> - port->enabled = 1;
> + port->enabled = true;
>
> /* copy the values out of the message */
> port->handle = rmsg->u.port_info_get_reply.port_handle;
> @@ -1304,7 +1304,7 @@ static int port_disable(struct vchiq_mmal_instance *instance,
> if (!port->enabled)
> return 0;
>
> - port->enabled = 0;
> + port->enabled = false;
>
> ret = port_action_port(instance, port,
> MMAL_MSG_PORT_ACTION_TYPE_DISABLE);
> @@ -1359,7 +1359,7 @@ static int port_enable(struct vchiq_mmal_instance *instance,
> if (ret)
> goto done;
>
> - port->enabled = 1;
> + port->enabled = true;
>
> if (port->buffer_cb) {
> /* send buffer headers to videocore */
> @@ -1531,7 +1531,7 @@ int vchiq_mmal_port_connect_tunnel(struct vchiq_mmal_instance *instance,
> pr_err("failed disconnecting src port\n");
> goto release_unlock;
> }
> - src->connected->enabled = 0;
> + src->connected->enabled = false;
> src->connected = NULL;
> }
>
> @@ -1799,7 +1799,7 @@ int vchiq_mmal_component_disable(struct vchiq_mmal_instance *instance,
>
> ret = disable_component(instance, component);
> if (ret == 0)
> - component->enabled = 0;
> + component->enabled = false;
>
> mutex_unlock(&instance->vchiq_mutex);
>
> diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h
> index 6006e29232b3..6d984cf5a83a 100644
> --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h
> +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h
> @@ -48,7 +48,7 @@ typedef void (*vchiq_mmal_buffer_cb)(
> int status, struct mmal_buffer *buffer);
>
> struct vchiq_mmal_port {
> - u32 enabled:1;
> + bool enabled;
> u32 handle;
> u32 type; /* port type, cached to use on port info set */
> u32 index; /* port index, cached to use on port info set */
> @@ -83,7 +83,7 @@ struct vchiq_mmal_port {
>
> struct vchiq_mmal_component {
> u32 in_use:1;
> - u32 enabled:1;
> + bool enabled;
> u32 handle; /* VideoCore handle for component */
> u32 inputs; /* Number of input ports */
> u32 outputs; /* Number of output ports */
> --
> 2.38.1
>
Hi Umang & Kieran
On Fri, 18 Nov 2022 at 10:21, Kieran Bingham
<[email protected]> wrote:
>
> Quoting Umang Jain (2022-11-18 08:42:42)
> > This reverts commit 640e77466e69d9c28de227bc76881f5501f532ca.
> >
> > In commit 7967656ffbfa ("coding-style: Clarify the expectations around
> > bool") the check to dis-allow bool structure members was removed from
> > checkpatch.pl. It promotes bool structure members to store boolean
> > values. This enhances code readability.
> >
> > Signed-off-by: Umang Jain <[email protected]>
>
> Thanks,
>
> That's a more direct revert of 640e77466e69 ("staging: mmal-vchiq: Avoid
> use of bool in structures") indeed.
>
> I see Stefan was concerned about clarifying that this won't affect
> firmware or userspace, it may still be good to hear from Dave to
> confirm, but my understanding of 640e77466e69, means I believe this is
> safe. I don't expect this structure to be used as any kind of ABI to
> firmware or userspace.
If it were one of the structs in one of the mmal-msh*.h files, then
I'd worry about the firmware ABI. This is internal state solely on the
kernel side so it's fine.
> Reviewed-by: Kieran Bingham <[email protected]>
Reviewed-by: Dave Stevenson <[email protected]>
>
> > ---
> > .../staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 12 ++++++------
> > .../staging/vc04_services/vchiq-mmal/mmal-vchiq.h | 4 ++--
> > 2 files changed, 8 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
> > index cb921c94996a..4abb6178cb9f 100644
> > --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
> > +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
> > @@ -863,9 +863,9 @@ static int port_info_get(struct vchiq_mmal_instance *instance,
> > goto release_msg;
> >
> > if (rmsg->u.port_info_get_reply.port.is_enabled == 0)
> > - port->enabled = 0;
> > + port->enabled = false;
> > else
> > - port->enabled = 1;
> > + port->enabled = true;
> >
> > /* copy the values out of the message */
> > port->handle = rmsg->u.port_info_get_reply.port_handle;
> > @@ -1304,7 +1304,7 @@ static int port_disable(struct vchiq_mmal_instance *instance,
> > if (!port->enabled)
> > return 0;
> >
> > - port->enabled = 0;
> > + port->enabled = false;
> >
> > ret = port_action_port(instance, port,
> > MMAL_MSG_PORT_ACTION_TYPE_DISABLE);
> > @@ -1359,7 +1359,7 @@ static int port_enable(struct vchiq_mmal_instance *instance,
> > if (ret)
> > goto done;
> >
> > - port->enabled = 1;
> > + port->enabled = true;
> >
> > if (port->buffer_cb) {
> > /* send buffer headers to videocore */
> > @@ -1531,7 +1531,7 @@ int vchiq_mmal_port_connect_tunnel(struct vchiq_mmal_instance *instance,
> > pr_err("failed disconnecting src port\n");
> > goto release_unlock;
> > }
> > - src->connected->enabled = 0;
> > + src->connected->enabled = false;
> > src->connected = NULL;
> > }
> >
> > @@ -1799,7 +1799,7 @@ int vchiq_mmal_component_disable(struct vchiq_mmal_instance *instance,
> >
> > ret = disable_component(instance, component);
> > if (ret == 0)
> > - component->enabled = 0;
> > + component->enabled = false;
> >
> > mutex_unlock(&instance->vchiq_mutex);
> >
> > diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h
> > index 6006e29232b3..6d984cf5a83a 100644
> > --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h
> > +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h
> > @@ -48,7 +48,7 @@ typedef void (*vchiq_mmal_buffer_cb)(
> > int status, struct mmal_buffer *buffer);
> >
> > struct vchiq_mmal_port {
> > - u32 enabled:1;
> > + bool enabled;
> > u32 handle;
> > u32 type; /* port type, cached to use on port info set */
> > u32 index; /* port index, cached to use on port info set */
> > @@ -83,7 +83,7 @@ struct vchiq_mmal_port {
> >
> > struct vchiq_mmal_component {
> > u32 in_use:1;
> > - u32 enabled:1;
> > + bool enabled;
> > u32 handle; /* VideoCore handle for component */
> > u32 inputs; /* Number of input ports */
> > u32 outputs; /* Number of output ports */
> > --
> > 2.38.1
> >