Commit 75b6a61a authored by Dan Williams's avatar Dan Williams Committed by John W. Linville
Browse files

libertas: restyle Marvell & IEEE TLV structure names



Easier to read and more conformant with kernel style.

Signed-off-by: default avatarDan Williams <dcbw@redhat.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 5fd164e9
Loading
Loading
Loading
Loading
+12 −14
Original line number Diff line number Diff line
@@ -207,7 +207,7 @@ static int generate_domain_info_11d(struct parsed_region_chan_11d
	lbs_deb_11d("nr_subband=%x\n", domaininfo->nr_subband);
	lbs_deb_hex(LBS_DEB_11D, "domaininfo", (char *)domaininfo,
		COUNTRY_CODE_LEN + 1 +
		sizeof(struct ieeetypes_subbandset) * nr_subband);
		sizeof(struct ieee_subbandset) * nr_subband);
	return 0;
}

@@ -302,11 +302,9 @@ done:
 *  @param parsed_region_chan   pointer to parsed_region_chan_11d
 *  @return 	                0
*/
static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
				 countryinfo,
static int parse_domain_info_11d(struct ieee_ie_country_info_full_set *countryinfo,
				 u8 band,
				 struct parsed_region_chan_11d *
				 parsed_region_chan)
				 struct parsed_region_chan_11d *parsed_region_chan)
{
	u8 nr_subband, nrchan;
	u8 lastchan, firstchan;
@@ -331,7 +329,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
	lbs_deb_hex(LBS_DEB_11D, "countryinfo", (u8 *) countryinfo, 30);

	if ((*(countryinfo->countrycode)) == 0
	    || (countryinfo->len <= COUNTRY_CODE_LEN)) {
	    || (countryinfo->header.len <= COUNTRY_CODE_LEN)) {
		/* No region Info or Wrong region info: treat as No 11D info */
		goto done;
	}
@@ -349,8 +347,8 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
	memcpy(parsed_region_chan->countrycode, countryinfo->countrycode,
	       COUNTRY_CODE_LEN);

	nr_subband = (countryinfo->len - COUNTRY_CODE_LEN) /
	    sizeof(struct ieeetypes_subbandset);
	nr_subband = (countryinfo->header.len - COUNTRY_CODE_LEN) /
	    sizeof(struct ieee_subbandset);

	for (j = 0, lastchan = 0; j < nr_subband; j++) {

@@ -502,7 +500,7 @@ int lbs_cmd_802_11d_domain_info(struct lbs_private *priv,
{
	struct cmd_ds_802_11d_domain_info *pdomaininfo =
	    &cmd->params.domaininfo;
	struct mrvlietypes_domainparamset *domain = &pdomaininfo->domain;
	struct mrvl_ie_domain_param_set *domain = &pdomaininfo->domain;
	u8 nr_subband = priv->domainreg.nr_subband;

	lbs_deb_enter(LBS_DEB_11D);
@@ -524,16 +522,16 @@ int lbs_cmd_802_11d_domain_info(struct lbs_private *priv,
	       sizeof(domain->countrycode));

	domain->header.len =
	    cpu_to_le16(nr_subband * sizeof(struct ieeetypes_subbandset) +
	    cpu_to_le16(nr_subband * sizeof(struct ieee_subbandset) +
			     sizeof(domain->countrycode));

	if (nr_subband) {
		memcpy(domain->subband, priv->domainreg.subband,
		       nr_subband * sizeof(struct ieeetypes_subbandset));
		       nr_subband * sizeof(struct ieee_subbandset));

		cmd->size = cpu_to_le16(sizeof(pdomaininfo->action) +
					     le16_to_cpu(domain->header.len) +
					     sizeof(struct mrvlietypesheader) +
					     sizeof(struct mrvl_ie_header) +
					     S_DS_GEN);
	} else {
		cmd->size =
@@ -556,7 +554,7 @@ done:
int lbs_ret_802_11d_domain_info(struct cmd_ds_command *resp)
{
	struct cmd_ds_802_11d_domain_info *domaininfo = &resp->params.domaininforesp;
	struct mrvlietypes_domainparamset *domain = &domaininfo->domain;
	struct mrvl_ie_domain_param_set *domain = &domaininfo->domain;
	u16 action = le16_to_cpu(domaininfo->action);
	s16 ret = 0;
	u8 nr_subband = 0;
@@ -567,7 +565,7 @@ int lbs_ret_802_11d_domain_info(struct cmd_ds_command *resp)
		(int)le16_to_cpu(resp->size));

	nr_subband = (le16_to_cpu(domain->header.len) - COUNTRY_CODE_LEN) /
		      sizeof(struct ieeetypes_subbandset);
		      sizeof(struct ieee_subbandset);

	lbs_deb_11d("domain info resp: nr_subband %d\n", nr_subband);

+15 −14
Original line number Diff line number Diff line
@@ -20,35 +20,36 @@
struct cmd_ds_command;

/** Data structure for Country IE*/
struct ieeetypes_subbandset {
struct ieee_subbandset {
	u8 firstchan;
	u8 nrchan;
	u8 maxtxpwr;
} __attribute__ ((packed));

struct ieeetypes_countryinfoset {
	u8 element_id;
	u8 len;
struct ieee_ie_country_info_set {
	struct ieee_ie_header header;

	u8 countrycode[COUNTRY_CODE_LEN];
	struct ieeetypes_subbandset subband[1];
	struct ieee_subbandset subband[1];
};

struct ieeetypes_countryinfofullset {
	u8 element_id;
	u8 len;
struct ieee_ie_country_info_full_set {
	struct ieee_ie_header header;

	u8 countrycode[COUNTRY_CODE_LEN];
	struct ieeetypes_subbandset subband[MRVDRV_MAX_SUBBAND_802_11D];
	struct ieee_subbandset subband[MRVDRV_MAX_SUBBAND_802_11D];
} __attribute__ ((packed));

struct mrvlietypes_domainparamset {
	struct mrvlietypesheader header;
struct mrvl_ie_domain_param_set {
	struct mrvl_ie_header header;

	u8 countrycode[COUNTRY_CODE_LEN];
	struct ieeetypes_subbandset subband[1];
	struct ieee_subbandset subband[1];
} __attribute__ ((packed));

struct cmd_ds_802_11d_domain_info {
	__le16 action;
	struct mrvlietypes_domainparamset domain;
	struct mrvl_ie_domain_param_set domain;
} __attribute__ ((packed));

/** domain regulatory information */
@@ -57,7 +58,7 @@ struct lbs_802_11d_domain_reg {
	u8 countrycode[COUNTRY_CODE_LEN];
	/** No. of subband*/
	u8 nr_subband;
	struct ieeetypes_subbandset subband[MRVDRV_MAX_SUBBAND_802_11D];
	struct ieee_subbandset subband[MRVDRV_MAX_SUBBAND_802_11D];
};

struct chan_power_11d {
+14 −14
Original line number Diff line number Diff line
@@ -342,13 +342,13 @@ static int lbs_adhoc_start(struct lbs_private *priv,
	WARN_ON(!assoc_req->channel);

	/* set Physical parameter set */
	cmd.ds.elementid = WLAN_EID_DS_PARAMS;
	cmd.ds.len = 1;
	cmd.ds.header.id = WLAN_EID_DS_PARAMS;
	cmd.ds.header.len = 1;
	cmd.ds.channel = assoc_req->channel;

	/* set IBSS parameter set */
	cmd.ibss.elementid = WLAN_EID_IBSS_PARAMS;
	cmd.ibss.len = 2;
	cmd.ibss.header.id = WLAN_EID_IBSS_PARAMS;
	cmd.ibss.header.len = 2;
	cmd.ibss.atimwindow = cpu_to_le16(0);

	/* set capability info */
@@ -1558,11 +1558,11 @@ int lbs_cmd_80211_associate(struct lbs_private *priv,
	struct bss_descriptor *bss = &assoc_req->bss;
	u8 *pos;
	u16 tmpcap, tmplen;
	struct mrvlietypes_ssidparamset *ssid;
	struct mrvlietypes_dsparamset *ds;
	struct mrvlietypes_cfparamset *cf;
	struct mrvlietypes_ratesparamset *rates;
	struct mrvlietypes_rsnparamset *rsn;
	struct mrvl_ie_ssid_param_set *ssid;
	struct mrvl_ie_ds_param_set *ds;
	struct mrvl_ie_cf_param_set *cf;
	struct mrvl_ie_rates_param_set *rates;
	struct mrvl_ie_rsn_param_set *rsn;

	lbs_deb_enter(LBS_DEB_ASSOC);

@@ -1586,27 +1586,27 @@ int lbs_cmd_80211_associate(struct lbs_private *priv,
	pos += sizeof(passo->bcnperiod);
	pos += sizeof(passo->dtimperiod);

	ssid = (struct mrvlietypes_ssidparamset *) pos;
	ssid = (struct mrvl_ie_ssid_param_set *) pos;
	ssid->header.type = cpu_to_le16(TLV_TYPE_SSID);
	tmplen = bss->ssid_len;
	ssid->header.len = cpu_to_le16(tmplen);
	memcpy(ssid->ssid, bss->ssid, tmplen);
	pos += sizeof(ssid->header) + tmplen;

	ds = (struct mrvlietypes_dsparamset *) pos;
	ds = (struct mrvl_ie_ds_param_set *) pos;
	ds->header.type = cpu_to_le16(TLV_TYPE_PHY_DS);
	ds->header.len = cpu_to_le16(1);
	ds->channel = bss->phy.ds.channel;
	pos += sizeof(ds->header) + 1;

	cf = (struct mrvlietypes_cfparamset *) pos;
	cf = (struct mrvl_ie_cf_param_set *) pos;
	cf->header.type = cpu_to_le16(TLV_TYPE_CF);
	tmplen = sizeof(*cf) - sizeof (cf->header);
	cf->header.len = cpu_to_le16(tmplen);
	/* IE payload should be zeroed, firmware fills it in for us */
	pos += sizeof(*cf);

	rates = (struct mrvlietypes_ratesparamset *) pos;
	rates = (struct mrvl_ie_rates_param_set *) pos;
	rates->header.type = cpu_to_le16(TLV_TYPE_RATES);
	memcpy(&rates->rates, &bss->rates, MAX_RATES);
	tmplen = MAX_RATES;
@@ -1628,7 +1628,7 @@ int lbs_cmd_80211_associate(struct lbs_private *priv,
	lbs_set_basic_rate_flags(rates->rates, tmplen);

	if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) {
		rsn = (struct mrvlietypes_rsnparamset *) pos;
		rsn = (struct mrvl_ie_rsn_param_set *) pos;
		/* WPA_IE or WPA2_IE */
		rsn->header.type = cpu_to_le16((u16) assoc_req->wpa_ie[0]);
		tmplen = (u16) assoc_req->wpa_ie[1];
+2 −2
Original line number Diff line number Diff line
@@ -1470,8 +1470,8 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
		break;
	case CMD_802_11_LED_GPIO_CTRL:
		{
			struct mrvlietypes_ledgpio *gpio =
			    (struct mrvlietypes_ledgpio*)
			struct mrvl_ie_ledgpio *gpio =
			    (struct mrvl_ie_ledgpio*)
			    cmdptr->params.ledgpio.data;

			memmove(&cmdptr->params.ledgpio,
+4 −4
Original line number Diff line number Diff line
@@ -183,12 +183,12 @@ out_unlock:
 */
static void *lbs_tlv_find(uint16_t tlv_type, const uint8_t *tlv, uint16_t size)
{
	struct mrvlietypesheader *tlv_h;
	struct mrvl_ie_header *tlv_h;
	uint16_t length;
	ssize_t pos = 0;

	while (pos < size) {
		tlv_h = (struct mrvlietypesheader *) tlv;
		tlv_h = (struct mrvl_ie_header *) tlv;
		if (!tlv_h->len)
			return NULL;
		if (tlv_h->type == cpu_to_le16(tlv_type))
@@ -206,7 +206,7 @@ static ssize_t lbs_threshold_read(uint16_t tlv_type, uint16_t event_mask,
				  size_t count, loff_t *ppos)
{
	struct cmd_ds_802_11_subscribe_event *subscribed;
	struct mrvlietypes_thresholds *got;
	struct mrvl_ie_thresholds *got;
	struct lbs_private *priv = file->private_data;
	ssize_t ret = 0;
	size_t pos = 0;
@@ -259,7 +259,7 @@ static ssize_t lbs_threshold_write(uint16_t tlv_type, uint16_t event_mask,
				   loff_t *ppos)
{
	struct cmd_ds_802_11_subscribe_event *events;
	struct mrvlietypes_thresholds *tlv;
	struct mrvl_ie_thresholds *tlv;
	struct lbs_private *priv = file->private_data;
	ssize_t buf_size;
	int value, freq, new_mask;
Loading