[PATCH v2 7/7] remoteproc: core: Consolidate bool flags into 1-bit bitfields

Peng Fan
2025-10-10T12:25:15Z

Per Documentation/process/coding-style.rst rule 17 regarding the use of
bool types:
If a structure has many true/false values, consider consolidating them into
a bitfield with 1-bit members, or using an appropriate fixed-width type
such as u8.

This commit replaces multiple bool members in struct rproc with 1-bit
bitfields and groups them together. This change reduces the overall size of
struct rproc from 0x4d8 to 0x4c8 on ARM64.

No functional changes.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
include/linux/remoteproc.h | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h
index b4795698d8c2a4e80ccafbe632436c4dfb636a1e..d8468a96edfbd82f4011881c10f59bf7c12e9c1a 100644
--- a/include/linux/remoteproc.h
+++ b/include/linux/remoteproc.h
@@ -528,21 +528,21 @@ enum rproc_features {
* @index: index of this rproc device
* @crash_handler: workqueue for handling a crash
* @crash_cnt: crash counter
- * @recovery_disabled: flag that state if recovery was disabled
* @max_notifyid: largest allocated notify id.
* @table_ptr: pointer to the resource table in effect
* @clean_table: copy of the resource table without modifications. Used
* when a remote processor is attached or detached from the core
* @cached_table: copy of the resource table
* @table_sz: size of @cached_table
- * @has_iommu: flag to indicate if remote processor is behind an MMU
- * @auto_boot: flag to indicate if remote processor should be auto-started
- * @sysfs_read_only: flag to make remoteproc sysfs files read only
* @dump_segments: list of segments in the firmware
* @nb_vdev: number of vdev currently handled by rproc
* @elf_class: firmware ELF class
* @elf_machine: firmware ELF machine
* @cdev: character device of the rproc
+ * @recovery_disabled: flag that state if recovery was disabled
+ * @has_iommu: flag to indicate if remote processor is behind an MMU
+ * @auto_boot: flag to indicate if remote processor should be auto-started
+ * @sysfs_read_only: flag to make remoteproc sysfs files read only
* @cdev_put_on_release: flag to indicate if remoteproc should be shutdown on @char_dev release
* @features: indicate remoteproc features
*/
@@ -570,21 +570,21 @@ struct rproc {
int index;
struct work_struct crash_handler;
unsigned int crash_cnt;
- bool recovery_disabled;
int max_notifyid;
struct resource_table *table_ptr;
struct resource_table *clean_table;
struct resource_table *cached_table;
size_t table_sz;
- bool has_iommu;
- bool auto_boot;
- bool sysfs_read_only;
struct list_head dump_segments;
int nb_vdev;
u8 elf_class;
u16 elf_machine;
struct cdev cdev;
- bool cdev_put_on_release;
+ bool recovery_disabled :1;
+ bool has_iommu :1;
+ bool auto_boot :1;
+ bool sysfs_read_only :1;
+ bool cdev_put_on_release :1;
DECLARE_BITMAP(features, RPROC_MAX_FEATURES);
};

--
2.37.1