Message ID | 20221118084244.199909-3-umang.jain@ideasonboard.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp70021wrr; Fri, 18 Nov 2022 00:46:22 -0800 (PST) X-Google-Smtp-Source: AA0mqf7gmecsYlkP/wV9NZMbYdxgumqbEtMInN3yEGk9zq2V2SlNTr1J8HkG39yKtb8eWtQNU5hw X-Received: by 2002:a17:902:7e48:b0:187:3c62:582c with SMTP id a8-20020a1709027e4800b001873c62582cmr6545851pln.114.1668761181910; Fri, 18 Nov 2022 00:46:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668761181; cv=none; d=google.com; s=arc-20160816; b=EpvaFZagmMmA4FBzW+2b77qHNbZ3U307FIIKkf+wcDmZAinFfv3n/wrNCSBjlBeHVo pXQOMG7cOnBZJPWVTFro/IQzYEjn0wDLjQAW1yjDDLYyryVh4s0YbY6SQvGmmpxq+9xW bWUdaKu6CzTciRWGEFXdxcEWvXqKD1dTuOM138vH/0DcA1kyyAlyoiYjk+woiDrGt1qf BjM8IAiD+NiusEbHG3nRXGffPV/f4epYp8fgFxXtGdXT60yWxFEfxbt94btIOcpwZ0VI sZfa69Auap8lFGD0z8kLzwdTjoPIwvX6ReUdIouo0Kx+uT3CqI+ugkz/jDRLVc6lU0V/ ykgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wjmTCjZ4OPQDeC/EQQ+ebYa1WoM4aB7s/Y3boN5iZpU=; b=hBz2bRurvxaqIOXBIafGPIMig0k8llZWi1kwC92mudiqp8vjW9Z31gDhfDnVrVGJX4 xhAd41iBy4hc1Dn8f4llU35U145mCZjfP5An2N+cqhPOj1AXeOa3TTt/m4UnWJyLgHhZ M6jWqYj8Rw6JOKqHvjgeWILZIpOFgQ/P5o5GVuzKZn+hKAxPxKmRXHRB6X2MZPmEMLd8 VEmUn3M8ZI5Mjxh3QiNcZsdjt8f7vVEGH5pDOx2ZUpOaPC/to4NVEY2tF4RyS8+kpZmQ 70l77HxXQeDaiphZMSlU73t4FQD8ZFe5YtW1PbhRME/aUmChtj9Malv8Tqu60z2tu24N xixA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=SvuHBB6G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q16-20020a17090311d000b00186a6b63515si3708220plh.214.2022.11.18.00.46.07; Fri, 18 Nov 2022 00:46:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=SvuHBB6G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241539AbiKRInY (ORCPT <rfc822;a1648639935@gmail.com> + 99 others); Fri, 18 Nov 2022 03:43:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241489AbiKRInK (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 18 Nov 2022 03:43:10 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77E5673404 for <linux-kernel@vger.kernel.org>; Fri, 18 Nov 2022 00:43:07 -0800 (PST) Received: from ideasonboard.com (unknown [103.251.226.79]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id EBC9BCE1; Fri, 18 Nov 2022 09:43:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1668760986; bh=6Phtney9spbBUHdVRM2VGrePUW5l4G22Zp/hlcIOKcI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SvuHBB6Gb8xK4U/2WKK92L7uHV4jHTdlWpJ2AhFmEM0Dj3zfnH/eCHCOpODGSO/iD cMY9VLGjJXYs/umwSYu4nyEPfDlVoxu7inLCBG2kCn40/Fn1VpVRdt0w4Za9d7HaIa 89fIIkC5ZKp6sAdXQyw5TiWKVaz+DxV/7COIcOEM= From: Umang Jain <umang.jain@ideasonboard.com> To: Florian Fainelli <f.fainelli@gmail.com>, Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>, Ray Jui <rjui@broadcom.com>, Dan Carpenter <error27@gmail.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Hans Verkuil <hverkuil-cisco@xs4all.nl>, Dave Stevenson <dave.stevenson@raspberrypi.com>, Mauro Carvalho Chehab <mchehab+samsung@kernel.org>, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: kieran.bingham@ideasonboard.com, Umang Jain <umang.jain@ideasonboard.com> Subject: [PATCH v2 2/3] vc04_services: mmal-vchiq: Use bool for vchiq_mmal_component.in_use Date: Fri, 18 Nov 2022 14:12:43 +0530 Message-Id: <20221118084244.199909-3-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221118084244.199909-1-umang.jain@ideasonboard.com> References: <20221118084244.199909-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749822925045341110?= X-GMAIL-MSGID: =?utf-8?q?1749822925045341110?= |
Series |
staging: vc04_services: Promote bool usage
|
|
Commit Message
Umang Jain
Nov. 18, 2022, 8:42 a.m. UTC
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 <umang.jain@ideasonboard.com>
---
drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 6 +++---
drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
Comments
Quoting Umang Jain (2022-11-18 08:42:43) > 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. This only talks about 7967656ffbfa as I can interpret it. A sentence here describing what we're going to do about it in /this/ patch would be clearer as a second paragraph: """ Convert the remaining bit-field storage for 'in-use' to a bool and use it accordingly. """ But that's trivial and not worth a v3 specifically. (unless anyone applying this wants to add it). Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > > Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> > --- > drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 6 +++--- > drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h | 2 +- > 2 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c > index 4abb6178cb9f..294b184d4a49 100644 > --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c > +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c > @@ -1648,7 +1648,7 @@ int vchiq_mmal_component_init(struct vchiq_mmal_instance *instance, > for (idx = 0; idx < VCHIQ_MMAL_MAX_COMPONENTS; idx++) { > if (!instance->component[idx].in_use) { > component = &instance->component[idx]; > - component->in_use = 1; > + component->in_use = true; > break; > } > } > @@ -1724,7 +1724,7 @@ int vchiq_mmal_component_init(struct vchiq_mmal_instance *instance, > destroy_component(instance, component); > unlock: > if (component) > - component->in_use = 0; > + component->in_use = false; > mutex_unlock(&instance->vchiq_mutex); > > return ret; > @@ -1747,7 +1747,7 @@ int vchiq_mmal_component_finalise(struct vchiq_mmal_instance *instance, > > ret = destroy_component(instance, component); > > - component->in_use = 0; > + component->in_use = 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 6d984cf5a83a..09f030919d4e 100644 > --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h > +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h > @@ -82,7 +82,7 @@ struct vchiq_mmal_port { > }; > > struct vchiq_mmal_component { > - u32 in_use:1; > + bool in_use; > bool enabled; > u32 handle; /* VideoCore handle for component */ > u32 inputs; /* Number of input ports */ > -- > 2.38.1 >
Hi Umang & Kieran On Fri, 18 Nov 2022 at 10:30, Kieran Bingham <kieran.bingham@ideasonboard.com> wrote: > > Quoting Umang Jain (2022-11-18 08:42:43) > > 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. > > This only talks about 7967656ffbfa as I can interpret it. A sentence > here describing what we're going to do about it in /this/ patch would be > clearer as a second paragraph: > > """ > Convert the remaining bit-field storage for 'in-use' to a bool and use > it accordingly. > """ > > But that's trivial and not worth a v3 specifically. (unless anyone > applying this wants to add it). Totally agree. > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com> > > > > Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> > > --- > > drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 6 +++--- > > drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h | 2 +- > > 2 files changed, 4 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c > > index 4abb6178cb9f..294b184d4a49 100644 > > --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c > > +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c > > @@ -1648,7 +1648,7 @@ int vchiq_mmal_component_init(struct vchiq_mmal_instance *instance, > > for (idx = 0; idx < VCHIQ_MMAL_MAX_COMPONENTS; idx++) { > > if (!instance->component[idx].in_use) { > > component = &instance->component[idx]; > > - component->in_use = 1; > > + component->in_use = true; > > break; > > } > > } > > @@ -1724,7 +1724,7 @@ int vchiq_mmal_component_init(struct vchiq_mmal_instance *instance, > > destroy_component(instance, component); > > unlock: > > if (component) > > - component->in_use = 0; > > + component->in_use = false; > > mutex_unlock(&instance->vchiq_mutex); > > > > return ret; > > @@ -1747,7 +1747,7 @@ int vchiq_mmal_component_finalise(struct vchiq_mmal_instance *instance, > > > > ret = destroy_component(instance, component); > > > > - component->in_use = 0; > > + component->in_use = 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 6d984cf5a83a..09f030919d4e 100644 > > --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h > > +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h > > @@ -82,7 +82,7 @@ struct vchiq_mmal_port { > > }; > > > > struct vchiq_mmal_component { > > - u32 in_use:1; > > + bool in_use; > > bool enabled; > > u32 handle; /* VideoCore handle for component */ > > u32 inputs; /* Number of input ports */ > > -- > > 2.38.1 > >
diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index 4abb6178cb9f..294b184d4a49 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -1648,7 +1648,7 @@ int vchiq_mmal_component_init(struct vchiq_mmal_instance *instance, for (idx = 0; idx < VCHIQ_MMAL_MAX_COMPONENTS; idx++) { if (!instance->component[idx].in_use) { component = &instance->component[idx]; - component->in_use = 1; + component->in_use = true; break; } } @@ -1724,7 +1724,7 @@ int vchiq_mmal_component_init(struct vchiq_mmal_instance *instance, destroy_component(instance, component); unlock: if (component) - component->in_use = 0; + component->in_use = false; mutex_unlock(&instance->vchiq_mutex); return ret; @@ -1747,7 +1747,7 @@ int vchiq_mmal_component_finalise(struct vchiq_mmal_instance *instance, ret = destroy_component(instance, component); - component->in_use = 0; + component->in_use = 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 6d984cf5a83a..09f030919d4e 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h @@ -82,7 +82,7 @@ struct vchiq_mmal_port { }; struct vchiq_mmal_component { - u32 in_use:1; + bool in_use; bool enabled; u32 handle; /* VideoCore handle for component */ u32 inputs; /* Number of input ports */