Skip to contentSkip to conversation

staging: ks7010: avoid bool structure members

PATCH In review Payal Kshirsagar 2 participants 2 messages Mar 17, 2019 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: ks7010: avoid bool structure members

To avoid bool structure members (because they tend to waste of space ), change type to int and they will work as flags that is 1 if true and 0 if false

---
 drivers/staging/ks7010/ks_wlan.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/ks7010/ks_wlan.h +3 -3
index 7aaf8d7..fe2ab72 100644
@@ -337,7 +337,7 @@ struct mic_failure {
 
 struct wpa_status {
 	int wpa_enabled;
-	bool rsn_enabled;
+	int rsn_enabled;
 	int version;
 	int pairwise_suite;	/* unicast cipher */
 	int group_suite;	/* multicast cipher */
@@ -475,7 +475,7 @@ struct ks_wlan_private {
 	unsigned int need_commit;	/* for ioctl */
 
 	/* DeviceIoControl */
-	bool is_device_open;
+	int is_device_open;
 	atomic_t event_count;
 	atomic_t rec_count;
 	int dev_count;
@@ -487,7 +487,7 @@ struct ks_wlan_private {
 	unsigned char firmware_version[128 + 1];
 	int version_size;
 
-	bool mac_address_valid;
+	int mac_address_valid;
 
 	int dev_state;
 
Signature · 1 line
2.7.4
#1 lore raw
Quoted 3 lines · Payal Kshirsagar

To avoid bool structure members (because they tend to waste of space ), change type to int and they will work as flags that is 1 if true and 0 if false

Hello,

In messages before you joined the group, Greg has pushed back on these. In this cas, with an int before and an int after (or something similar) there is not going to be any space savings, due to alignment constraints. It would be better to stick with bool, as that makes clear how the value is being used.

julia

Quoted 47 lines
---
 drivers/staging/ks7010/ks_wlan.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/ks7010/ks_wlan.h +3 -4
index 7aaf8d7..fe2ab72 100644
@@ -337,7 +337,7 @@ struct mic_failure {
 
 struct wpa_status {
 	int wpa_enabled;
-	bool rsn_enabled;
+	int rsn_enabled;
 	int version;
 	int pairwise_suite;	/* unicast cipher */
 	int group_suite;	/* multicast cipher */
@@ -475,7 +475,7 @@ struct ks_wlan_private {
 	unsigned int need_commit;	/* for ioctl */
 
 	/* DeviceIoControl */
-	bool is_device_open;
+	int is_device_open;
 	atomic_t event_count;
 	atomic_t rec_count;
 	int dev_count;
@@ -487,7 +487,7 @@ struct ks_wlan_private {
 	unsigned char firmware_version[128 + 1];
 	int version_size;
 
-	bool mac_address_valid;
+	int mac_address_valid;
 
 	int dev_state;
 
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1552811623-12131-1-git-send-email-payal.s.kshirsagar.98%40gmail.com.
For more options, visit https://groups.google.com/d/optout.