int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord, void *val, u32 *len) 
static int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord, void *val, u32 *len) 
int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord,			void *val, u32 *len){	struct ipw2100_ordinals *ordinals = &priv->ordinals;	u32 addr;	u32 field_info;	u16 field_len;	u16 field_count;	u32 total_length;	if (ordinals->table1_addr == 0) {		printk(KERN_WARNING DRV_NAME ": attempt to use fw ordinals "		       "before they have been loaded.\n");		return -EINVAL;	}	if (IS_ORDINAL_TABLE_ONE(ordinals, ord)) {		if (*len < IPW_ORD_TAB_1_ENTRY_SIZE) {			*len = IPW_ORD_TAB_1_ENTRY_SIZE;			printk(KERN_WARNING DRV_NAME			       ": ordinal buffer length too small, need %zd\n",			       IPW_ORD_TAB_1_ENTRY_SIZE);			return -EINVAL;		}		read_nic_dword(priv->net_dev, ordinals->table1_addr + (ord << 2),			       &addr);		read_nic_dword(priv->net_dev, addr, val);		*len = IPW_ORD_TAB_1_ENTRY_SIZE;		return 0;	}	if (IS_ORDINAL_TABLE_TWO(ordinals, ord)) {		ord -= IPW_START_ORD_TAB_2;		/* get the address of statistic */		read_nic_dword(priv->net_dev, ordinals->table2_addr + (ord << 3),			       &addr);		/* get the second DW of statistics ;		 * two 16-bit words - first is length, second is count */		read_nic_dword(priv->net_dev,			       ordinals->table2_addr + (ord << 3) + sizeof(u32),			       &field_info);		/* get each entry length */		field_len = *((u16 *)&field_info);		/* get number of entries */		field_count = *(((u16 *)&field_info) + 1);		/* abort if no enought memory */		total_length = field_len * field_count;		if (total_length > *len) {			*len = total_length;			return -EINVAL;		}		*len = total_length;		if (!total_length)			return 0;		/* read the ordinal data from the SRAM */		read_nic_memory(priv->net_dev, addr, total_length, val);		return 0;	}	printk(KERN_WARNING DRV_NAME ": ordinal %d neither in table 1 nor "	       "in table 2\n", ord);	return -EINVAL;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/c4aee8c21ff5d8d6f9a27112468f5e840d5ced1b/ipw2100.c/buggy/drivers/net/wireless/ipw2100.c