2012/7/29 Thomas Huehn <thomas@xxxxxxxxxxxxxxxxxxxxxxx>: > Hi Nick, > > >> Anyway if readability is the issue we can just do something like >> >> int txpower_halfdb = 0; >> >> [...] >> >> if(ah->power_level) { >> txpower_halfdb = ah->power_level * 2; >> } else { >> txpower_halfdb = AR5K_TUNE_MAX_TXPOWER; >> } >> >> and then it'll look like this >> >> ret = ath5k_hw_txpower(ah, channel, txpower_halfdb); > > > I like this way you proposed here. But it is quite personal and compact > wise the other version is in lead. > The thing is it doesn't initialize ah->ah_txpower.txp_requested, read below. >> > >> (wouldn't it be weird if someone from above asked us >> what tx power was requested and we reply with max tx power ?). > > you mean in case someone from above did never requested something but > ask us what was requested and we tell him that nothing was requested > thats why we use max tx_power ... makes more sense ? :) > I mean that ah->ah_txpower.txp_requested or ah->ah_txpower.txp_user_pwr in your case, both implicate that they are initialized by the user. We shouldn't initialize them ourselves. Think of it like this: we don't have permission to write this variable, we only read it. If you didn't like my example and you think it doesn't make sense, here is another one: How will we distinguish the case when a user asks for the max power from the case where we have initialized ah->ah_txpower.txp_requested to max ? -- GPG ID: 0xEE878588 As you read this post global entropy rises. Have Fun ;-) Nick -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html