[PATCH 3/6] powerpc/powernv: Replace variables with flags

Gavin Shan shangw at linux.vnet.ibm.com
Wed Jun 26 20:08:14 EST 2013


On Wed, Jun 26, 2013 at 10:12:16AM +0100, David Laight wrote:
>> 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.

>> +
>> +#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_FS
>
>All 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



More information about the Linuxppc-dev mailing list