Re: [PATCH 3/6] powerpc/powernv: Replace variables with flags
From: Gavin Shan <hidden>
Date: 2013-06-26 10:08:28
From: Gavin Shan <hidden>
Date: 2013-06-26 10:08:28
On Wed, Jun 26, 2013 at 10:12:16AM +0100, David Laight wrote:
quoted
We have 2 fields in "struct pnv_phb" to trace the states. The patch replace the fields with one and introduces flags for that. The patch doesn't impact the logic.What is the benefit of this change?
There might have more flags coming in. Putting all flags together could be maintained more easily. It doesn't save much memory as you pointed.
quoted
+ +#define PNV_EEH_STATE_ENABLED (1 << 0) /* EEH enabled */ +#define PNV_EEH_STATE_REMOVED (1 << 1) /* PHB removed */ + #endif /* CONFIG_EEH */ struct pnv_phb {@@ -92,8 +96,7 @@ struct pnv_phb { #ifdef CONFIG_EEH struct pnv_eeh_ops *eeh_ops; - int eeh_enabled; - int removed; + int eeh_state; #endif #ifdef CONFIG_DEBUG_FSAll I can see is that it possibly reduces a structure by 4 bytes while adding extra code. (On 64 bit systems there might be a 4 byte pad added.)
Thanks, Gavin