drivers:staging:rtl8821ae: Fixed few coding style erors and warnings

Fixed multiple coding style errors and warnings
wifi.h:1077: WARNING: please, no space before tabs
wifi.h:762: WARNING: missing space after struct definition
wifi.h:972: WARNING: please, no spaces at the start of a line
wifi.h:1825: WARNING: Unnecessary space after function pointer name
wifi.h:1826: ERROR: "foo * bar" should be "foo *bar"
wifi.h:1099: WARNING: missing space after return type
wifi.h:1320: ERROR: Macros with complex values should be enclosed in parenthesis
wifi.h:1758: WARNING: Multiple spaces after return type
wifi.h:1855: ERROR: code indent should use tabs where possible
wifi.h:2303: ERROR: space prohibited after that open parenthesis '('
wifi.h:2408: ERROR: spaces required around that '=' (ctx:VxV)

Signed-off-by: Surendra Patil <31af38f9ca04f10a2e2bd3b840e6f43c8fe11b51@gmail.com>
Acked-by: Larry Finger <ed0f1d78b8c21b2970494a178da4bdfa8beba2a7@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/staging/rtl8821ae/wifi.h
+++ drivers/staging/rtl8821ae/wifi.h
@@ -40,10 +40,10 @@

 #define RF_CHANGE_BY_INIT		0
-#define RF_CHANGE_BY_IPS 		BIT(28)
-#define RF_CHANGE_BY_PS 		BIT(29)
-#define RF_CHANGE_BY_HW 		BIT(30)
-#define RF_CHANGE_BY_SW 		BIT(31)
+#define RF_CHANGE_BY_IPS		BIT(28)
+#define RF_CHANGE_BY_PS			BIT(29)
+#define RF_CHANGE_BY_HW			BIT(30)
+#define RF_CHANGE_BY_SW			BIT(31)

 #define IQK_ADDA_REG_NUM		16
 #define IQK_MAC_REG_NUM			4
@@ -69,7 +69,7 @@
 #define QBSS_LOAD_SIZE			5
 #define MAX_WMMELE_LENGTH		64

-#define TOTAL_CAM_ENTRY 		32
+#define TOTAL_CAM_ENTRY			32

 /*slot time for 11g. */
 #define RTL_SLOT_TIME_9			9
@@ -77,27 +77,27 @@

 /*related with tcp/ip. */
 /*if_ehther.h*/
-#define ETH_P_PAE 			0x888E	/*Port Access Entity
+#define ETH_P_PAE			0x888E	/*Port Access Entity
 						 *(IEEE 802.1X) */
-#define ETH_P_IP        		0x0800	/*Internet Protocol packet */
-#define ETH_P_ARP       		0x0806	/*Address Resolution packet */
-#define SNAP_SIZE 			6
+#define ETH_P_IP			0x0800	/*Internet Protocol packet */
+#define ETH_P_ARP			0x0806	/*Address Resolution packet */
+#define SNAP_SIZE			6
 #define PROTOC_TYPE_SIZE		2

 /*related with 802.11 frame*/
-#define MAC80211_3ADDR_LEN 		24
-#define MAC80211_4ADDR_LEN 		30
+#define MAC80211_3ADDR_LEN		24
+#define MAC80211_4ADDR_LEN		30

 #define CHANNEL_MAX_NUMBER		(14 + 24 + 21)	/* 14 is the max
 							 * channel number */
 #define CHANNEL_MAX_NUMBER_2G		14
-#define CHANNEL_MAX_NUMBER_5G	    	54 /* Please refer to
+#define CHANNEL_MAX_NUMBER_5G		54 /* Please refer to
 					    *"phy_GetChnlGroup8812A" and
 					    * "Hal_ReadTxPowerInfo8812A"*/
 #define CHANNEL_MAX_NUMBER_5G_80M	7
 #define CHANNEL_GROUP_MAX		(3 + 9)	/* ch1~3, ch4~9, ch10~14
 						 * total three groups */
-#define MAX_PG_GROUP 			13
+#define MAX_PG_GROUP			13
 #define	CHANNEL_GROUP_MAX_2G		3
 #define	CHANNEL_GROUP_IDX_5GL		3
 #define	CHANNEL_GROUP_IDX_5GM		6
@@ -119,7 +119,7 @@
 #define	MAX_CHNL_GROUP_5G		14

 /* BK, BE, VI, VO, HCCA, MANAGEMENT, COMMAND, HIGH, BEACON. */
-#define MAX_TX_QUEUE 			9
+#define MAX_TX_QUEUE			9

 #define TX_PWR_BY_RATE_NUM_BAND		2
 #define TX_PWR_BY_RATE_NUM_RF		4
@@ -127,11 +127,11 @@
 #define MAX_BASE_NUM_IN_PHY_REG_PG_24G  6
 #define MAX_BASE_NUM_IN_PHY_REG_PG_5G	5

-#define DELTA_SWINGIDX_SIZE	30
-#define BAND_NUM 				3
+#define DELTA_SWINGIDX_SIZE		30
+#define BAND_NUM			3
 /*Now, it's just for 8192ee
  *not OK yet, keep it 0*/
-#define DMA_IS_64BIT 0
+#define DMA_IS_64BIT			0
 #define RTL8192EE_SEG_NUM		1 /* 0:2 seg, 1: 4 seg, 2: 8 seg */

 struct txpower_info_2g {
@@ -219,7 +219,7 @@
 };

 enum scan_operation_backup_opt {
-	SCAN_OPT_BACKUP_BAND0=0,
+	SCAN_OPT_BACKUP_BAND0 = 0,
 	SCAN_OPT_BACKUP_BAND1,
 	SCAN_OPT_RESTORE,
 	SCAN_OPT_MAX
@@ -645,9 +645,9 @@
 };

 enum ratr_table_mode {
-	RATR_INX_WIRELESS_NGB = 0,		// BGN 40 Mhz 2SS 1SS
-	RATR_INX_WIRELESS_NG = 1,		// GN or N
-	RATR_INX_WIRELESS_NB = 2,		// BGN 20 Mhz 2SS 1SS  or BN
+	RATR_INX_WIRELESS_NGB = 0,		/* BGN 40 Mhz 2SS 1SS */
+	RATR_INX_WIRELESS_NG = 1,		/* GN or N */
+	RATR_INX_WIRELESS_NB = 2,		/* BGN 20 Mhz 2SS 1SS  or BN */
 	RATR_INX_WIRELESS_N = 3,
 	RATR_INX_WIRELESS_GB = 4,
 	RATR_INX_WIRELESS_G = 5,
@@ -759,7 +759,7 @@
 	struct rtl_ht_agg agg;
 };

-struct rssi_sta{
+struct rssi_sta {
 	long undecorated_smoothed_pwdb;
 };

@@ -899,7 +899,7 @@
 	u16 reg_2ghz_ctl;
 };

-struct dynamic_primary_cca{
+struct dynamic_primary_cca {
 	u8 pricca_flag;
 	u8 intf_flag;
 	u8 intf_type;
@@ -939,14 +939,14 @@
 	P2P_PS_ENABLE = 1,
 	P2P_PS_SCAN = 2,
 	P2P_PS_SCAN_DONE = 3,
-	P2P_PS_ALLSTASLEEP = 4, // for P2P GO
+	P2P_PS_ALLSTASLEEP = 4, /* for P2P GO */
 };

 enum p2p_ps_mode {
 	P2P_PS_NONE = 0,
 	P2P_PS_CTWINDOW = 1,
 	P2P_PS_NOA = 2,
-	P2P_PS_MIX = 3, // CTWindow and NoA
+	P2P_PS_MIX = 3, /* CTWindow and NoA */
 };

 struct rtl_p2p_ps_info {
@@ -969,7 +969,7 @@
 	u32 noa_start_time[P2P_MAX_NOA_NUM];
 };

- struct p2p_ps_offload_t {
+struct p2p_ps_offload_t {
 	u8 Offload_En:1;
 	u8 role:1; /* 1: Owner, 0: Client */
 	u8 CTWindow_En:1;
@@ -981,7 +981,7 @@
 };

 #define IQK_MATRIX_REG_NUM	8
-#define IQK_MATRIX_SETTINGS_NUM	 (14+24+21) // Channels_2_4G_NUM + Channels_5G_20M_NUM + Channels_5G
+#define IQK_MATRIX_SETTINGS_NUM	 (14+24+21) /* Channels_2_4G_NUM + Channels_5G_20M_NUM + Channels_5G */
 struct iqk_matrix_regs {
 	bool b_iqk_done;
 	long value[1][IQK_MATRIX_REG_NUM];
@@ -1074,12 +1074,12 @@
 	enum rt_polarity_ctl polarity_ctl;
 };

-#define RTL_AGG_STOP 						0
+#define RTL_AGG_STOP						0
 #define RTL_AGG_PROGRESS					1
-#define RTL_AGG_START 						2
+#define RTL_AGG_START						2
 #define RTL_AGG_OPERATIONAL					3
-#define RTL_RX_AGG_START 					1
-#define RTL_RX_AGG_STOP 					0
+#define RTL_RX_AGG_START					1
+#define RTL_RX_AGG_STOP						0

 struct rtl_priv;
 struct rtl_io {
@@ -1092,13 +1092,13 @@
 	/*PCI IO map */
 	unsigned long pci_base_addr;	/*device I/O address */

-	void (*write8_async) (struct rtl_priv * rtlpriv, u32 addr, u8 val);
-	void (*write16_async) (struct rtl_priv * rtlpriv, u32 addr, u16 val);
-	void (*write32_async) (struct rtl_priv * rtlpriv, u32 addr, u32 val);
-
-	u8(*read8_sync) (struct rtl_priv * rtlpriv, u32 addr);
-	u16(*read16_sync) (struct rtl_priv * rtlpriv, u32 addr);
-	u32(*read32_sync) (struct rtl_priv * rtlpriv, u32 addr);
+	void (*write8_async)(struct rtl_priv *rtlpriv, u32 addr, u8 val);
+	void (*write16_async)(struct rtl_priv *rtlpriv, u32 addr, u16 val);
+	void (*write32_async)(struct rtl_priv *rtlpriv, u32 addr, u32 val);
+
+	u8 (*read8_sync)(struct rtl_priv *rtlpriv, u32 addr);
+	u16 (*read16_sync)(struct rtl_priv *rtlpriv, u32 addr);
+	u32 (*read32_sync)(struct rtl_priv *rtlpriv, u32 addr);

 };

@@ -1317,9 +1317,9 @@

 };

-#define ASSOCIATE_ENTRY_NUM	32+1
-
-struct fast_ant_trainning{
+#define ASSOCIATE_ENTRY_NUM	(32+1)
+
+struct fast_ant_trainning {
 	u8 bssid[6];
 	u8 antsel_rx_keep_0;
 	u8 antsel_rx_keep_1;
@@ -1427,19 +1427,19 @@
 	char bb_swing_diff_5g;

 	u8 delta_swing_table_idx_24gccka_p[DELTA_SWINGIDX_SIZE];
-    u8 delta_swing_table_idx_24gccka_n[DELTA_SWINGIDX_SIZE];
-    u8 delta_swing_table_idx_24gcckb_p[DELTA_SWINGIDX_SIZE];
+	u8 delta_swing_table_idx_24gccka_n[DELTA_SWINGIDX_SIZE];
+	u8 delta_swing_table_idx_24gcckb_p[DELTA_SWINGIDX_SIZE];
 	u8 delta_swing_table_idx_24gcckb_n[DELTA_SWINGIDX_SIZE];
 	u8 delta_swing_table_idx_24ga_p[DELTA_SWINGIDX_SIZE];
-   	u8 delta_swing_table_idx_24ga_n[DELTA_SWINGIDX_SIZE];
-    u8 delta_swing_table_idx_24gb_p[DELTA_SWINGIDX_SIZE];
-   	u8 delta_swing_table_idx_24gb_n[DELTA_SWINGIDX_SIZE];
-    u8 delta_swing_table_idx_5ga_p[BAND_NUM][DELTA_SWINGIDX_SIZE];
-    u8 delta_swing_table_idx_5ga_n[BAND_NUM][DELTA_SWINGIDX_SIZE];
-    u8 delta_swing_table_idx_5gb_p[BAND_NUM][DELTA_SWINGIDX_SIZE];
-    u8 delta_swing_table_idx_5gb_n[BAND_NUM][DELTA_SWINGIDX_SIZE];
-    u8 delta_swing_table_idx_24ga_p_8188e[DELTA_SWINGIDX_SIZE];
-    u8 delta_swing_table_idx_24ga_n_8188e[DELTA_SWINGIDX_SIZE];
+	u8 delta_swing_table_idx_24ga_n[DELTA_SWINGIDX_SIZE];
+	u8 delta_swing_table_idx_24gb_p[DELTA_SWINGIDX_SIZE];
+	u8 delta_swing_table_idx_24gb_n[DELTA_SWINGIDX_SIZE];
+	u8 delta_swing_table_idx_5ga_p[BAND_NUM][DELTA_SWINGIDX_SIZE];
+	u8 delta_swing_table_idx_5ga_n[BAND_NUM][DELTA_SWINGIDX_SIZE];
+	u8 delta_swing_table_idx_5gb_p[BAND_NUM][DELTA_SWINGIDX_SIZE];
+	u8 delta_swing_table_idx_5gb_n[BAND_NUM][DELTA_SWINGIDX_SIZE];
+	u8 delta_swing_table_idx_24ga_p_8188e[DELTA_SWINGIDX_SIZE];
+	u8 delta_swing_table_idx_24ga_n_8188e[DELTA_SWINGIDX_SIZE];

 	/* DMSP */
@@ -1451,7 +1451,7 @@
 	struct fast_ant_trainning fat_table;

 	u8	resp_tx_path;
-	u8 	path_sel;
+	u8	path_sel;
 	u32	patha_sum;
 	u32	pathb_sum;
 	u32	patha_cnt;
@@ -1671,7 +1671,6 @@
 	u8 rx_mimo_evm_dbm[4];
 	u16 cfo_short[4]; 		/* per-path's Cfo_short */
 	u16 cfo_tail[4];
-
 	u8 rx_pwr[4]; /* per-path's pwdb */
 	u8 rx_snr[4]; /* per-path's SNR */
 	u8 bandwidth;
@@ -1756,48 +1755,48 @@
 	void *proximity_priv;
 	int (*proxim_rx)(struct ieee80211_hw *hw, struct rtl_stats *status,
 			 struct sk_buff *skb);
-	u8  (*proxim_get_var)(struct ieee80211_hw *hw, u8 type);
+	u8 (*proxim_get_var)(struct ieee80211_hw *hw, u8 type);
 };

 struct rtl_hal_ops {
-	int (*init_sw_vars) (struct ieee80211_hw * hw);
-	void (*deinit_sw_vars) (struct ieee80211_hw * hw);
-	void (*read_eeprom_info) (struct ieee80211_hw * hw);
-	void (*interrupt_recognized) (struct ieee80211_hw * hw,
-				      u32 * p_inta, u32 * p_intb);
-	int (*hw_init) (struct ieee80211_hw * hw);
-	void (*hw_disable) (struct ieee80211_hw * hw);
-	void (*hw_suspend) (struct ieee80211_hw * hw);
-	void (*hw_resume) (struct ieee80211_hw * hw);
-	void (*enable_interrupt) (struct ieee80211_hw * hw);
-	void (*disable_interrupt) (struct ieee80211_hw * hw);
-	int (*set_network_type) (struct ieee80211_hw * hw,
-				 enum nl80211_iftype type);
+	int (*init_sw_vars)(struct ieee80211_hw *hw);
+	void (*deinit_sw_vars)(struct ieee80211_hw *hw);
+	void (*read_eeprom_info)(struct ieee80211_hw *hw);
+	void (*interrupt_recognized)(struct ieee80211_hw *hw,
+				     u32 *p_inta, u32 *p_intb);
+	int (*hw_init)(struct ieee80211_hw *hw);
+	void (*hw_disable)(struct ieee80211_hw *hw);
+	void (*hw_suspend)(struct ieee80211_hw *hw);
+	void (*hw_resume)(struct ieee80211_hw *hw);
+	void (*enable_interrupt)(struct ieee80211_hw *hw);
+	void (*disable_interrupt)(struct ieee80211_hw *hw);
+	int (*set_network_type)(struct ieee80211_hw *hw,
+				enum nl80211_iftype type);
 	void (*set_chk_bssid)(struct ieee80211_hw *hw,
 			      bool check_bssid);
-	void (*set_bw_mode) (struct ieee80211_hw * hw,
-			     enum nl80211_channel_type ch_type);
-	 u8(*switch_channel) (struct ieee80211_hw * hw);
-	void (*set_qos) (struct ieee80211_hw * hw, int aci);
-	void (*set_bcn_reg) (struct ieee80211_hw * hw);
-	void (*set_bcn_intv) (struct ieee80211_hw * hw);
-	void (*update_interrupt_mask) (struct ieee80211_hw * hw,
-				       u32 add_msr, u32 rm_msr);
-	void (*get_hw_reg) (struct ieee80211_hw * hw, u8 variable, u8 * val);
-	void (*set_hw_reg) (struct ieee80211_hw * hw, u8 variable, u8 * val);
-	void (*update_rate_tbl) (struct ieee80211_hw * hw,
-				 struct ieee80211_sta *sta, u8 rssi_level);
-	void (*pre_fill_tx_bd_desc) (struct ieee80211_hw *hw, u8 *tx_bd_desc,
-				     u8 *desc, u8 queue_index,
-				     struct sk_buff *skb, dma_addr_t addr);
-	u16 (*rx_desc_buff_remained_cnt) (struct ieee80211_hw *hw,
-					  u8 queue_index);
-	void (*rx_check_dma_ok) (struct ieee80211_hw *hw, u8 *header_desc,
-				 u8 queue_index);
-	void (*fill_tx_desc) (struct ieee80211_hw * hw,
-			      struct ieee80211_hdr * hdr,
-			      u8 * pdesc_tx, u8 * pbd_desc,
-			      struct ieee80211_tx_info * info,
+	void (*set_bw_mode)(struct ieee80211_hw *hw,
+			    enum nl80211_channel_type ch_type);
+	u8 (*switch_channel)(struct ieee80211_hw *hw);
+	void (*set_qos)(struct ieee80211_hw *hw, int aci);
+	void (*set_bcn_reg)(struct ieee80211_hw *hw);
+	void (*set_bcn_intv)(struct ieee80211_hw *hw);
+	void (*update_interrupt_mask)(struct ieee80211_hw *hw,
+				      u32 add_msr, u32 rm_msr);
+	void (*get_hw_reg)(struct ieee80211_hw *hw, u8 variable, u8 *val);
+	void (*set_hw_reg)(struct ieee80211_hw *hw, u8 variable, u8 *val);
+	void (*update_rate_tbl)(struct ieee80211_hw *hw,
+				struct ieee80211_sta *sta, u8 rssi_level);
+	void (*pre_fill_tx_bd_desc)(struct ieee80211_hw *hw, u8 *tx_bd_desc,
+				    u8 *desc, u8 queue_index,
+				    struct sk_buff *skb, dma_addr_t addr);
+	u16 (*rx_desc_buff_remained_cnt)(struct ieee80211_hw *hw,
+					 u8 queue_index);
+	void (*rx_check_dma_ok)(struct ieee80211_hw *hw, u8 *header_desc,
+				u8 queue_index);
+	void (*fill_tx_desc)(struct ieee80211_hw *hw,
+			     struct ieee80211_hdr *hdr,
+			     u8 *pdesc_tx, u8 *pbd_desc,
+			     struct ieee80211_tx_info *info,
 /*<delete in kernel start>*/
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
 /*<delete in kernel end>*/
@@ -1805,74 +1804,77 @@
 /*<delete in kernel start>*/
 #endif
 /*<delete in kernel end>*/
-			      struct sk_buff * skb, u8 hw_queue,
+			      struct sk_buff *skb, u8 hw_queue,
 			      struct rtl_tcb_desc *ptcb_desc);
-	void (*fill_tx_cmddesc) (struct ieee80211_hw * hw, u8 * pdesc,
-				 bool b_firstseg, bool b_lastseg,
-				 struct sk_buff * skb);
-	 bool(*query_rx_desc) (struct ieee80211_hw * hw,
-			       struct rtl_stats * status,
-			       struct ieee80211_rx_status * rx_status,
-			       u8 * pdesc, struct sk_buff * skb);
-	void (*set_channel_access) (struct ieee80211_hw * hw);
-	 bool(*radio_onoff_checking) (struct ieee80211_hw * hw, u8 * valid);
-	void (*dm_watchdog) (struct ieee80211_hw * hw);
-	void (*scan_operation_backup) (struct ieee80211_hw * hw, u8 operation);
-	 bool(*set_rf_power_state) (struct ieee80211_hw * hw,
-				    enum rf_pwrstate rfpwr_state);
-	void (*led_control) (struct ieee80211_hw * hw,
-			     enum led_ctl_mode ledaction);
-	void (*set_desc) (struct ieee80211_hw *hw, u8 * pdesc, bool istx,
-			  u8 desc_name, u8 * val);
-	 u32(*get_desc) (u8 * pdesc, bool istx, u8 desc_name);
-	bool (*is_tx_desc_closed) (struct ieee80211_hw *hw,
-				   u8 hw_queue, u16 index);
-	void (*tx_polling) (struct ieee80211_hw * hw, u8 hw_queue);
-	void (*enable_hw_sec) (struct ieee80211_hw * hw);
-	void (*set_key) (struct ieee80211_hw * hw, u32 key_index,
-			 u8 * p_macaddr, bool is_group, u8 enc_algo,
-			 bool is_wepkey, bool clear_all);
-	void (*init_sw_leds) (struct ieee80211_hw * hw);
-	 u32(*get_bbreg) (struct ieee80211_hw * hw, u32 regaddr, u32 bitmask);
-	void (*set_bbreg) (struct ieee80211_hw * hw, u32 regaddr, u32 bitmask,
-			   u32 data);
-	 u32(*get_rfreg) (struct ieee80211_hw * hw, enum radio_path rfpath,
-			  u32 regaddr, u32 bitmask);
-	void (*set_rfreg) (struct ieee80211_hw * hw, enum radio_path rfpath,
-			   u32 regaddr, u32 bitmask, u32 data);
+	void (*fill_tx_cmddesc)(struct ieee80211_hw *hw, u8 *pdesc,
+				bool b_firstseg, bool b_lastseg,
+				struct sk_buff *skb);
+	bool (*query_rx_desc)(struct ieee80211_hw *hw,
+			      struct rtl_stats *status,
+			      struct ieee80211_rx_status *rx_status,
+			      u8 *pdesc, struct sk_buff *skb);
+	void (*set_channel_access)(struct ieee80211_hw *hw);
+	bool (*radio_onoff_checking)(struct ieee80211_hw *hw, u8 *valid);
+	void (*dm_watchdog)(struct ieee80211_hw *hw);
+	void (*scan_operation_backup)(struct ieee80211_hw *hw, u8 operation);
+	bool (*set_rf_power_state)(struct ieee80211_hw *hw,
+				   enum rf_pwrstate rfpwr_state);
+	void (*led_control)(struct ieee80211_hw *hw,
+			    enum led_ctl_mode ledaction);
+	void (*set_desc)(struct ieee80211_hw *hw, u8 *pdesc, bool istx,
+			 u8 desc_name, u8 *val);
+	u32 (*get_desc)(u8 *pdesc, bool istx, u8 desc_name);
+	bool (*is_tx_desc_closed)(struct ieee80211_hw *hw,
+				  u8 hw_queue, u16 index);
+	void (*tx_polling)(struct ieee80211_hw *hw, u8 hw_queue);
+	void (*enable_hw_sec)(struct ieee80211_hw *hw);
+	void (*set_key)(struct ieee80211_hw *hw, u32 key_index,
+			u8 *p_macaddr, bool is_group, u8 enc_algo,
+			bool is_wepkey, bool clear_all);
+	void (*init_sw_leds)(struct ieee80211_hw *hw);
+	u32 (*get_bbreg)(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask);
+	void (*set_bbreg)(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask,
+			  u32 data);
+	u32 (*get_rfreg)(struct ieee80211_hw *hw, enum radio_path rfpath,
+			 u32 regaddr, u32 bitmask);
+	void (*set_rfreg)(struct ieee80211_hw *hw, enum radio_path rfpath,
+			  u32 regaddr, u32 bitmask, u32 data);
 	void (*allow_all_destaddr)(struct ieee80211_hw *hw,
-		bool allow_all_da, bool write_into_reg);
-	void (*linked_set_reg) (struct ieee80211_hw * hw);
-	void (*check_switch_to_dmdp) (struct ieee80211_hw * hw);
-	void (*dualmac_easy_concurrent) (struct ieee80211_hw *hw);
-	void (*dualmac_switch_to_dmdp) (struct ieee80211_hw *hw);
-	void (*c2h_command_handle) (struct ieee80211_hw *hw);
-	void (*bt_wifi_media_status_notify) (struct ieee80211_hw *hw, bool mstate);
-	void (*bt_turn_off_bt_coexist_before_enter_lps) (struct ieee80211_hw *hw);
-	void (*fill_h2c_cmd) (struct ieee80211_hw *hw, u8 element_id,
-			      u32 cmd_len, u8 *p_cmdbuffer);
-	bool (*get_btc_status) (void);
-  	u32 (*rx_command_packet_handler)(struct ieee80211_hw *hw, struct rtl_stats status, struct sk_buff *skb);
+				   bool allow_all_da, bool write_into_reg);
+	void (*linked_set_reg)(struct ieee80211_hw *hw);
+	void (*check_switch_to_dmdp)(struct ieee80211_hw *hw);
+	void (*dualmac_easy_concurrent)(struct ieee80211_hw *hw);
+	void (*dualmac_switch_to_dmdp)(struct ieee80211_hw *hw);
+	void (*c2h_command_handle)(struct ieee80211_hw *hw);
+	void (*bt_wifi_media_status_notify)(struct ieee80211_hw *hw,
+					    bool mstate);
+	void (*bt_turn_off_bt_coexist_before_enter_lps)(struct ieee80211_hw *hw);
+	void (*fill_h2c_cmd)(struct ieee80211_hw *hw, u8 element_id,
+			     u32 cmd_len, u8 *p_cmdbuffer);
+	bool (*get_btc_status)(void);
+	u32 (*rx_command_packet_handler)(struct ieee80211_hw *hw,
+					 struct rtl_stats status,
+					 struct sk_buff *skb);
 };

 struct rtl_intf_ops {
 	/*com */
 	void (*read_efuse_byte)(struct ieee80211_hw *hw, u16 _offset, u8 *pbuf);
-	int (*adapter_start) (struct ieee80211_hw * hw);
-	void (*adapter_stop) (struct ieee80211_hw * hw);
+	int (*adapter_start)(struct ieee80211_hw *hw);
+	void (*adapter_stop)(struct ieee80211_hw *hw);
 	bool (*check_buddy_priv)(struct ieee80211_hw *hw,
-			struct rtl_priv **buddy_priv);
+				 struct rtl_priv **buddy_priv);

 /*<delete in kernel start>*/
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0))
-	int (*adapter_tx) (struct ieee80211_hw * hw, struct sk_buff * skb,
-			   struct rtl_tcb_desc *ptcb_desc);
+	int (*adapter_tx)(struct ieee80211_hw *hw, struct sk_buff *skb,
+			  struct rtl_tcb_desc *ptcb_desc);
 #else
 /*<delete in kernel end>*/
-	int (*adapter_tx) (struct ieee80211_hw *hw,
-			   struct ieee80211_sta *sta,
-			   struct sk_buff *skb,
-			   struct rtl_tcb_desc *ptcb_desc);
+	int (*adapter_tx)(struct ieee80211_hw *hw,
+			  struct ieee80211_sta *sta,
+			  struct sk_buff *skb,
+			  struct rtl_tcb_desc *ptcb_desc);
 /*<delete in kernel start>*/
 #endif
 /*<delete in kernel end>*/
@@ -1881,22 +1883,22 @@
 #else
 	void (*flush)(struct ieee80211_hw *hw, bool drop);
 #endif
-	int (*reset_trx_ring) (struct ieee80211_hw * hw);
+	int (*reset_trx_ring)(struct ieee80211_hw *hw);
 /*<delete in kernel start>*/
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0))
-	bool (*waitq_insert) (struct ieee80211_hw *hw, struct sk_buff *skb);
+	bool (*waitq_insert)(struct ieee80211_hw *hw, struct sk_buff *skb);
 #else
 /*<delete in kernel end>*/
-	bool (*waitq_insert) (struct ieee80211_hw *hw,
-			      struct ieee80211_sta *sta,
-			      struct sk_buff *skb);
+	bool (*waitq_insert)(struct ieee80211_hw *hw,
+			     struct ieee80211_sta *sta,
+			     struct sk_buff *skb);
 /*<delete in kernel start>*/
 #endif
 /*<delete in kernel end>*/

 	/*pci */
-	void (*disable_aspm) (struct ieee80211_hw * hw);
-	void (*enable_aspm) (struct ieee80211_hw * hw);
+	void (*disable_aspm)(struct ieee80211_hw *hw);
+	void (*enable_aspm)(struct ieee80211_hw *hw);

 	/*usb */
 };
@@ -2027,21 +2029,21 @@
 };

 struct rtl_btc_ops {
-	void (*btc_init_variables) (struct rtl_priv *rtlpriv);
-	void (*btc_init_hal_vars) (struct rtl_priv *rtlpriv);
-	void (*btc_init_hw_config) (struct rtl_priv *rtlpriv);
-	void (*btc_ips_notify) (struct rtl_priv *rtlpriv, u8 type);
-	void (*btc_scan_notify) (struct rtl_priv *rtlpriv, u8 scantype);
-	void (*btc_connect_notify) (struct rtl_priv *rtlpriv, u8 action);
-	void (*btc_mediastatus_notify) (struct rtl_priv *rtlpriv,
-					enum rt_media_status mstatus);
-	void (*btc_periodical) (struct rtl_priv *rtlpriv);
-	void (*btc_halt_notify) (void);
-	void (*btc_btinfo_notify) (struct rtl_priv *rtlpriv,
-				   u8 * tmp_buf, u8 length);
-	bool (*btc_is_limited_dig) (struct rtl_priv *rtlpriv);
-	bool (*btc_is_disable_edca_turbo) (struct rtl_priv *rtlpriv);
-	bool (*btc_is_bt_disabled) (struct rtl_priv *rtlpriv);
+	void (*btc_init_variables)(struct rtl_priv *rtlpriv);
+	void (*btc_init_hal_vars)(struct rtl_priv *rtlpriv);
+	void (*btc_init_hw_config)(struct rtl_priv *rtlpriv);
+	void (*btc_ips_notify)(struct rtl_priv *rtlpriv, u8 type);
+	void (*btc_scan_notify)(struct rtl_priv *rtlpriv, u8 scantype);
+	void (*btc_connect_notify)(struct rtl_priv *rtlpriv, u8 action);
+	void (*btc_mediastatus_notify)(struct rtl_priv *rtlpriv,
+				       enum rt_media_status mstatus);
+	void (*btc_periodical)(struct rtl_priv *rtlpriv);
+	void (*btc_halt_notify)(void);
+	void (*btc_btinfo_notify)(struct rtl_priv *rtlpriv,
+				  u8 *tmp_buf, u8 length);
+	bool (*btc_is_limited_dig)(struct rtl_priv *rtlpriv);
+	bool (*btc_is_disable_edca_turbo)(struct rtl_priv *rtlpriv);
+	bool (*btc_is_bt_disabled)(struct rtl_priv *rtlpriv);
 };

 struct rtl_bt_coexist {
@@ -2120,57 +2122,57 @@
 #define rtl_hal(rtlpriv)	(&((rtlpriv)->rtlhal))
 #define rtl_efuse(rtlpriv)	(&((rtlpriv)->efuse))
 #define rtl_psc(rtlpriv)	(&((rtlpriv)->psc))
-#define rtl_sec(rtlpriv) 	(&((rtlpriv)->sec))
-#define rtl_dm(rtlpriv)	(&((rtlpriv)->dm))
+#define rtl_sec(rtlpriv)	(&((rtlpriv)->sec))
+#define rtl_dm(rtlpriv)		(&((rtlpriv)->dm))
 /***************************************
     Bluetooth Co-existance Related
 ****************************************/

 enum bt_ant_num {
-        ANT_X2 = 0,
-        ANT_X1 = 1,
+	ANT_X2 = 0,
+	ANT_X1 = 1,
 };

 enum bt_co_type {
-        BT_2WIRE = 0,
-        BT_ISSC_3WIRE = 1,
-        BT_ACCEL = 2,
-        BT_CSR_BC4 = 3,
-        BT_CSR_BC8 = 4,
-        BT_RTL8756 = 5,
-        BT_RTL8723A = 6,
-        BT_RTL8821A = 7,
-        BT_RTL8723B = 8,
-        BT_RTL8192E = 9,
-        BT_RTL8812A = 11,
-};
-
-enum bt_total_ant_num{
+	BT_2WIRE = 0,
+	BT_ISSC_3WIRE = 1,
+	BT_ACCEL = 2,
+	BT_CSR_BC4 = 3,
+	BT_CSR_BC8 = 4,
+	BT_RTL8756 = 5,
+	BT_RTL8723A = 6,
+	BT_RTL8821A = 7,
+	BT_RTL8723B = 8,
+	BT_RTL8192E = 9,
+	BT_RTL8812A = 11,
+};
+
+enum bt_total_ant_num {
 	ANT_TOTAL_X2 = 0,
 	ANT_TOTAL_X1 = 1
 };

 enum bt_cur_state {
-        BT_OFF = 0,
-        BT_ON = 1,
+	BT_OFF = 0,
+	BT_ON = 1,
 };

 enum bt_service_type {
-        BT_SCO = 0,
-        BT_A2DP = 1,
-        BT_HID = 2,
-        BT_HID_IDLE = 3,
-        BT_SCAN = 4,
-        BT_IDLE = 5,
-        BT_OTHER_ACTION = 6,
-        BT_BUSY = 7,
-        BT_OTHERBUSY = 8,
-        BT_PAN = 9,
+	BT_SCO = 0,
+	BT_A2DP = 1,
+	BT_HID = 2,
+	BT_HID_IDLE = 3,
+	BT_SCAN = 4,
+	BT_IDLE = 5,
+	BT_OTHER_ACTION = 6,
+	BT_BUSY = 7,
+	BT_OTHERBUSY = 8,
+	BT_PAN = 9,
 };

 enum bt_radio_shared {
-        BT_RADIO_SHARED = 0,
-        BT_RADIO_INDIVIDUAL = 1,
+	BT_RADIO_SHARED = 0,
+	BT_RADIO_INDIVIDUAL = 1,
 };

 struct bt_coexist_info {
@@ -2255,11 +2257,11 @@

 /* Write data to memory */
 #define WRITEEF1BYTE(_ptr, _val)	\
-	(*((u8 *)(_ptr)))=EF1BYTE(_val)
+	((*((u8 *)(_ptr))) = EF1BYTE(_val))
 #define WRITEEF2BYTE(_ptr, _val)	\
-	(*((u16 *)(_ptr)))=EF2BYTE(_val)
+	((*((u16 *)(_ptr))) = EF2BYTE(_val))
 #define WRITEEF4BYTE(_ptr, _val)	\
-	(*((u32 *)(_ptr)))=EF4BYTE(_val)
+	((*((u32 *)(_ptr))) = EF4BYTE(_val))

 /*Example:
 BIT_LEN_MASK_32(0) => 0x00000000
@@ -2298,17 +2300,17 @@
 value to host byte ordering.*/
 #define LE_BITS_TO_4BYTE(__pstart, __bitoffset, __bitlen) \
 	( \
-		( LE_P4BYTE_TO_HOST_4BYTE(__pstart) >> (__bitoffset) )  & \
+		(LE_P4BYTE_TO_HOST_4BYTE(__pstart) >> (__bitoffset))  & \
 		BIT_LEN_MASK_32(__bitlen) \
 	)
 #define LE_BITS_TO_2BYTE(__pstart, __bitoffset, __bitlen) \
 	( \
-		( LE_P2BYTE_TO_HOST_2BYTE(__pstart) >> (__bitoffset) ) & \
+		(LE_P2BYTE_TO_HOST_2BYTE(__pstart) >> (__bitoffset)) & \
 		BIT_LEN_MASK_16(__bitlen) \
 	)
 #define LE_BITS_TO_1BYTE(__pstart, __bitoffset, __bitlen) \
 	( \
-		( LE_P1BYTE_TO_HOST_1BYTE(__pstart) >> (__bitoffset) ) & \
+		(LE_P1BYTE_TO_HOST_1BYTE(__pstart) >> (__bitoffset)) & \
 		BIT_LEN_MASK_8(__bitlen) \
 	)

@@ -2318,17 +2320,17 @@
 #define LE_BITS_CLEARED_TO_4BYTE(__pstart, __bitoffset, __bitlen) \
 	( \
 		LE_P4BYTE_TO_HOST_4BYTE(__pstart)  & \
-		( ~BIT_OFFSET_LEN_MASK_32(__bitoffset, __bitlen) ) \
+		(~BIT_OFFSET_LEN_MASK_32(__bitoffset, __bitlen)) \
 	)
 #define LE_BITS_CLEARED_TO_2BYTE(__pstart, __bitoffset, __bitlen) \
 	( \
 		LE_P2BYTE_TO_HOST_2BYTE(__pstart) & \
-		( ~BIT_OFFSET_LEN_MASK_16(__bitoffset, __bitlen) ) \
+		(~BIT_OFFSET_LEN_MASK_16(__bitoffset, __bitlen)) \
 	)
 #define LE_BITS_CLEARED_TO_1BYTE(__pstart, __bitoffset, __bitlen) \
 	( \
 		LE_P1BYTE_TO_HOST_1BYTE(__pstart) & \
-		( ~BIT_OFFSET_LEN_MASK_8(__bitoffset, __bitlen) ) \
+		(~BIT_OFFSET_LEN_MASK_8(__bitoffset, __bitlen)) \
 	)

 /*Description:
@@ -2337,19 +2339,19 @@
 	*((u32 *)(__pstart)) = EF4BYTE \
 	( \
 		LE_BITS_CLEARED_TO_4BYTE(__pstart, __bitoffset, __bitlen) | \
-		( (((u32)__val) & BIT_LEN_MASK_32(__bitlen)) << (__bitoffset) )\
+		((((u32)__val) & BIT_LEN_MASK_32(__bitlen)) << (__bitoffset))\
        );
 #define SET_BITS_TO_LE_2BYTE(__pstart, __bitoffset, __bitlen, __val) \
 	*((u16 *)(__pstart)) = EF2BYTE \
 	( \
 		LE_BITS_CLEARED_TO_2BYTE(__pstart, __bitoffset, __bitlen) | \
-		( (((u16)__val) & BIT_LEN_MASK_16(__bitlen)) << (__bitoffset) )\
+		((((u16)__val) & BIT_LEN_MASK_16(__bitlen)) << (__bitoffset))\
        );
 #define SET_BITS_TO_LE_1BYTE(__pstart, __bitoffset, __bitlen, __val) \
 	*((u8 *)(__pstart)) = EF1BYTE \
 	( \
 		LE_BITS_CLEARED_TO_1BYTE(__pstart, __bitoffset, __bitlen) | \
-		( (((u8)__val) & BIT_LEN_MASK_8(__bitlen)) << (__bitoffset) ) \
+		((((u8)__val) & BIT_LEN_MASK_8(__bitlen)) << (__bitoffset)) \
        );

 #define	N_BYTE_ALIGMENT(__value, __aligment) ((__aligment == 1) ? \
@@ -2359,18 +2361,18 @@
 	mem access macro define end
 ****************************************/

-#define byte(x,n) ((x >> (8 * n)) & 0xff)
+#define byte(x, n) ((x >> (8 * n)) & 0xff)

 #define packet_get_type(_packet) (EF1BYTE((_packet).octet[0]) & 0xFC)
-#define RTL_WATCH_DOG_TIME    	2000
+#define RTL_WATCH_DOG_TIME	2000
 #define MSECS(t)		msecs_to_jiffies(t)
-#define WLAN_FC_GET_VERS(fc) 	((fc) & IEEE80211_FCTL_VERS)
-#define WLAN_FC_GET_TYPE(fc) 	((fc) & IEEE80211_FCTL_FTYPE)
-#define WLAN_FC_GET_STYPE(fc) 	((fc) & IEEE80211_FCTL_STYPE)
-#define WLAN_FC_MORE_DATA(fc) 	((fc) & IEEE80211_FCTL_MOREDATA)
-#define SEQ_TO_SN(seq) 		(((seq) & IEEE80211_SCTL_SEQ) >> 4)
-#define SN_TO_SEQ(ssn) 		(((ssn) << 4) & IEEE80211_SCTL_SEQ)
-#define MAX_SN 			((IEEE80211_SCTL_SEQ) >> 4)
+#define WLAN_FC_GET_VERS(fc)	((fc) & IEEE80211_FCTL_VERS)
+#define WLAN_FC_GET_TYPE(fc)	((fc) & IEEE80211_FCTL_FTYPE)
+#define WLAN_FC_GET_STYPE(fc)	((fc) & IEEE80211_FCTL_STYPE)
+#define WLAN_FC_MORE_DATA(fc)	((fc) & IEEE80211_FCTL_MOREDATA)
+#define SEQ_TO_SN(seq)		(((seq) & IEEE80211_SCTL_SEQ) >> 4)
+#define SN_TO_SEQ(ssn)		(((ssn) << 4) & IEEE80211_SCTL_SEQ)
+#define MAX_SN			((IEEE80211_SCTL_SEQ) >> 4)

 #define	RT_RF_OFF_LEVL_ASPM		BIT(0)	/*PCI ASPM */
 #define	RT_RF_OFF_LEVL_CLK_REQ		BIT(1)	/*PCI clock request */
@@ -2397,13 +2399,13 @@
 	container_of(container_of(x, struct delayed_work, work), y, z)

 #define FILL_OCTET_STRING(_os,_octet,_len)	\
-		(_os).octet=(u8*)(_octet);		\
-		(_os).length=(_len);
+		(_os).octet = (u8 *)(_octet);		\
+		(_os).length = (_len);

 #define CP_MACADDR(des,src)	\
-	((des)[0]=(src)[0],(des)[1]=(src)[1],\
-	(des)[2]=(src)[2],(des)[3]=(src)[3],\
-	(des)[4]=(src)[4],(des)[5]=(src)[5])
+	((des)[0] = (src)[0],(des)[1] = (src)[1],\
+	(des)[2] = (src)[2],(des)[3] = (src)[3],\
+	(des)[4] = (src)[4],(des)[5] = (src)[5])

 static inline u8 rtl_read_byte(struct rtl_priv *rtlpriv, u32 addr)
 {


tests: fix whitespace in refs/rename.c

tests: fix whitespace in refs/rename.c

--- tests-clar/refs/rename.c
+++ tests-clar/refs/rename.c
@@ -19,19 +19,19 @@

 void test_refs_rename__initialize(void)
 {
-   g_repo = cl_git_sandbox_init("testrepo");
+	g_repo = cl_git_sandbox_init("testrepo");
 }

 void test_refs_rename__cleanup(void)
 {
-   cl_git_sandbox_cleanup();
+	cl_git_sandbox_cleanup();
 }

 void test_refs_rename__loose(void)
 {
-   // rename a loose reference
+	// rename a loose reference
 	git_reference *looked_up_ref, *another_looked_up_ref;
 	git_buf temp_path = GIT_BUF_INIT;
 	const char *new_name = "refs/tags/Nemo/knows/refs.kung-fu";
@@ -72,7 +72,7 @@

 void test_refs_rename__packed(void)
 {
-   // rename a packed reference (should make it loose)
+	// rename a packed reference (should make it loose)
 	git_reference *looked_up_ref, *another_looked_up_ref;
 	git_buf temp_path = GIT_BUF_INIT;
 	const char *brand_new_name = "refs/heads/brand_new_name";
@@ -113,7 +113,7 @@

 void test_refs_rename__packed_doesnt_pack_others(void)
 {
-   // renaming a packed reference does not pack another reference which happens to be in both loose and pack state
+	// renaming a packed reference does not pack another reference which happens to be in both loose and pack state
 	git_reference *looked_up_ref, *another_looked_up_ref;
 	git_buf temp_path = GIT_BUF_INIT;
 	const char *brand_new_name = "refs/heads/brand_new_name";
@@ -154,7 +154,7 @@

 void test_refs_rename__name_collision(void)
 {
-   // can not rename a reference with the name of an existing reference
+	// can not rename a reference with the name of an existing reference
 	git_reference *looked_up_ref;

 	/* An existing reference... */
@@ -173,7 +173,7 @@

 void test_refs_rename__invalid_name(void)
 {
-   // can not rename a reference with an invalid name
+	// can not rename a reference with an invalid name
 	git_reference *looked_up_ref;

 	/* An existing oid reference... */
@@ -199,7 +199,7 @@

 void test_refs_rename__force_loose_packed(void)
 {
-   // can force-rename a packed reference with the name of an existing loose and packed reference
+	// can force-rename a packed reference with the name of an existing loose and packed reference
 	git_reference *looked_up_ref;
 	git_oid oid;

@@ -223,7 +223,7 @@

 void test_refs_rename__force_loose(void)
 {
-   // can force-rename a loose reference with the name of an existing loose reference
+	// can force-rename a loose reference with the name of an existing loose reference
 	git_reference *looked_up_ref;
 	git_oid oid;

@@ -232,7 +232,7 @@
 	git_oid_cpy(&oid, git_reference_target(looked_up_ref));

 	/* Can be force-renamed to the name of another existing reference. */
-   cl_git_pass(git_reference_rename(looked_up_ref, "refs/heads/test", 1));
+	cl_git_pass(git_reference_rename(looked_up_ref, "refs/heads/test", 1));
 	git_reference_free(looked_up_ref);

 	/* Check we actually renamed it */
@@ -250,7 +250,7 @@

 void test_refs_rename__overwrite(void)
 {
-   // can not overwrite name of existing reference
+	// can not overwrite name of existing reference
 	git_reference *ref, *ref_one, *ref_one_new, *ref_two;
 	git_oid id;

@@ -281,7 +281,7 @@

 void test_refs_rename__prefix(void)
 {
-   // can be renamed to a new name prefixed with the old name
+	// can be renamed to a new name prefixed with the old name
 	git_reference *ref, *ref_two, *looked_up_ref;
 	git_oid id;

@@ -313,33 +313,33 @@

 void test_refs_rename__move_up(void)
 {
-   // can move a reference to a upper reference hierarchy
-    git_reference *ref, *ref_two, *looked_up_ref;
-    git_oid id;
-
-    cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
-    cl_assert(git_reference_type(ref) & GIT_REF_OID);
-
-    git_oid_cpy(&id, git_reference_target(ref));
-
-    /* Create loose references */
-    cl_git_pass(git_reference_create(&ref_two, g_repo, ref_two_name_new, &id, 0));
-    git_reference_free(ref_two);
-
-    /* An existing reference... */
-    cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name_new));
-
-    /* Can be renamed upward the reference tree. */
-    cl_git_pass(git_reference_rename(looked_up_ref, ref_two_name, 0));
-    git_reference_free(looked_up_ref);
-
-    /* Check we actually renamed it */
-    cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name));
-    cl_assert_equal_s(looked_up_ref->name, ref_two_name);
-    git_reference_free(looked_up_ref);
-    cl_git_fail(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name_new));
-    git_reference_free(ref);
-    git_reference_free(looked_up_ref);
+	// can move a reference to a upper reference hierarchy
+	git_reference *ref, *ref_two, *looked_up_ref;
+	git_oid id;
+
+	cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
+	cl_assert(git_reference_type(ref) & GIT_REF_OID);
+
+	git_oid_cpy(&id, git_reference_target(ref));
+
+	/* Create loose references */
+	cl_git_pass(git_reference_create(&ref_two, g_repo, ref_two_name_new, &id, 0));
+	git_reference_free(ref_two);
+
+	/* An existing reference... */
+	cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name_new));
+
+	/* Can be renamed upward the reference tree. */
+	cl_git_pass(git_reference_rename(looked_up_ref, ref_two_name, 0));
+	git_reference_free(looked_up_ref);
+
+	/* Check we actually renamed it */
+	cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name));
+	cl_assert_equal_s(looked_up_ref->name, ref_two_name);
+	git_reference_free(looked_up_ref);
+	cl_git_fail(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name_new));
+	git_reference_free(ref);
+	git_reference_free(looked_up_ref);
 }

 void test_refs_rename__propagate_eexists(void)


increased max texture units to 32

increased max texture units to 32

--- RenderingContext/RenderingParameters.h
+++ RenderingContext/RenderingParameters.h
@@ -1078,7 +1078,7 @@
 	DISABLED
 };

-constexpr static const uint8_t MAX_TEXTURES = 8;
+constexpr static const uint8_t MAX_TEXTURES = 32;

 //! @}
 }


Staging: silicom: bp_mod.h: checkpatch tab and space cleanup

fifth chunk of bp_mod.h's cleanup

Signed-off-by: Daniel Cotey <9c95cc6deb8bec4b60b427646c9e62be765dda9d@bansheeslibrary.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/staging/silicom/bp_mod.h
+++ drivers/staging/silicom/bp_mod.h
@@ -328,16 +328,16 @@
 	 (pid == SILICOM_XE10G2BPILR_SSID))

 #define BP10GB_IF_SERIES(pid) \
-          ((pid==SILICOM_PE10G2BPTCX4_SSID)|| \
-          (pid==SILICOM_PE10G2BPTSR_SSID)|| \
-          (pid==SILICOM_PE10G2BPTLR_SSID)|| \
-          (pid==SILICOM_PE10G2BPTT_SSID))
+	((pid == SILICOM_PE10G2BPTCX4_SSID) || \
+	 (pid == SILICOM_PE10G2BPTSR_SSID) || \
+	 (pid == SILICOM_PE10G2BPTLR_SSID) || \
+	 (pid == SILICOM_PE10G2BPTT_SSID))

 #define BP10G_CX4_SERIES(pid) \
-    (pid==SILICOM_PE10G2BPICX4_SSID)
+	(pid == SILICOM_PE10G2BPICX4_SSID)

 #define BP10GB_CX4_SERIES(pid) \
-    (pid==SILICOM_PE10G2BPTCX4_SSID)
+	(pid == SILICOM_PE10G2BPTCX4_SSID)

 #define SILICOM_M2EG2BPFI6_SSID       0x0501
 #define SILICOM_M2EG2BPFI6LX_SSID     0x0502


Maildir: \Recent flags weren't set correctly if mail was saved externally.

--- src/lib-storage/index/maildir/maildir-sync-index.c
+++ src/lib-storage/index/maildir/maildir-sync-index.c
@@ -338,10 +338,7 @@
 			   messages. When saving/copying messages with flags
 			   they're stored to cur/ and uidlist treats them
 			   as non-recent. */
-			if ((uflags & MAILDIR_UIDLIST_REC_FLAG_RECENT) != 0) {
-				if (uid > first_recent_uid)
-					first_recent_uid = uid;
-			} else {
+			if ((uflags & MAILDIR_UIDLIST_REC_FLAG_RECENT) == 0) {
 				if (uid >= first_recent_uid)
 					first_recent_uid = uid + 1;
 			}


USB: gadget: Fix unused variable warning in ci13xxx_udc

Signed-off-by: Pavankumar Kondeti <e4a0348e45a0df0ba79f6b06c66df8ae7aca44a4@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/usb/gadget/ci13xxx_udc.c
+++ drivers/usb/gadget/ci13xxx_udc.c
@@ -1843,7 +1843,7 @@
 __acquires(mEp->lock)
 {
 	struct ci13xxx_req *mReq, *mReqTemp;
-	int retval;
+	int uninitialized_var(retval);

 	trace("%p", mEp);


Add more docs

Add more docs

--- src/lib/renderer/enesim_renderer_gradient_radial.c
+++ src/lib/renderer/enesim_renderer_gradient_radial.c
@@ -323,6 +323,11 @@
 		*center_y = thiz->center.y;
 }

+/**
+ * Set the X coordinate center of a radial gradient renderer
+ * @param[in] r The gradient renderer to set the center on
+ * @param[in] center_x The X coordinate of the center
+ */
 EAPI void enesim_renderer_gradient_radial_center_x_set(Enesim_Renderer *r, double center_x)
 {
 	Enesim_Renderer_Gradient_Radial *thiz;
@@ -332,6 +337,11 @@
 	thiz->changed = EINA_TRUE;
 }

+/**
+ * Set the Y coordinate center of a radial gradient renderer
+ * @param[in] r The gradient renderer to set the center on
+ * @param[in] center_y The Y coordinate of the center
+ */
 EAPI void enesim_renderer_gradient_radial_center_y_set(Enesim_Renderer *r, double center_y)
 {
 	Enesim_Renderer_Gradient_Radial *thiz;
@@ -341,6 +351,11 @@
 	thiz->changed = EINA_TRUE;
 }

+/**
+ * Get the X coordinate center of a radial gradient renderer
+ * @param[in] r The gradient renderer to get the center from
+ * @return The X coordinate of the center
+ */
 EAPI double enesim_renderer_gradient_radial_center_x_get(Enesim_Renderer *r)
 {
 	Enesim_Renderer_Gradient_Radial *thiz;
@@ -349,6 +364,11 @@
 	return thiz->center.x;
 }

+/**
+ * Get the Y coordinate center of a radial gradient renderer
+ * @param[in] r The gradient renderer to get the center from
+ * @return The Y coordinate of the center
+ */
 EAPI double enesim_renderer_gradient_radial_center_y_get(Enesim_Renderer *r)
 {
 	Enesim_Renderer_Gradient_Radial *thiz;
@@ -357,6 +377,12 @@
 	return thiz->center.y;
 }

+/**
+ * Set the focus position of a radial gradient renderer
+ * @param[in] r The gradient renderer to set the focus position on
+ * @param[in] focus_x The X coordinate of the focus
+ * @param[in] focus_y The Y coordinate of the focus
+ */
 EAPI void enesim_renderer_gradient_radial_focus_set(Enesim_Renderer *r, double focus_x, double focus_y)
 {
 	Enesim_Renderer_Gradient_Radial *thiz;
@@ -367,6 +393,12 @@
 	thiz->changed = EINA_TRUE;
 }

+/**
+ * Get the focus position of a radial gradient renderer
+ * @param[in] r The gradient renderer to get the center from
+ * @param[out] focus_x The pointer to store the X coordinate of the focus
+ * @param[out] focus_y The pointer to store the Y coordinate of the focus
+ */
 EAPI void enesim_renderer_gradient_radial_focus_get(Enesim_Renderer *r,
 							double *focus_x, double *focus_y)
 {
@@ -378,6 +410,12 @@
 	if (focus_y)
 		*focus_y = thiz->focus.y;
 }
+
+/**
+ * Set the focus X coordinate of a radial gradient renderer
+ * @param[in] r The gradient renderer to set the focus X coordinate on
+ * @param[in] focus_x The X coordinate of the focus
+ */
 EAPI void enesim_renderer_gradient_radial_focus_x_set(Enesim_Renderer *r, double focus_x)
 {
 	Enesim_Renderer_Gradient_Radial *thiz;
@@ -386,6 +424,12 @@
 	thiz->focus.x = focus_x;
 	thiz->changed = EINA_TRUE;
 }
+
+/**
+ * Set the focus Y coordinate of a radial gradient renderer
+ * @param[in] r The gradient renderer to set the focus Y coordinate on
+ * @param[in] focus_y The Y coordinate of the focus
+ */
 EAPI void enesim_renderer_gradient_radial_focus_y_set(Enesim_Renderer *r, double focus_y)
 {
 	Enesim_Renderer_Gradient_Radial *thiz;
@@ -394,6 +438,12 @@
 	thiz->focus.y = focus_y;
 	thiz->changed = EINA_TRUE;
 }
+
+/**
+ * Get the focus X coordinate of a radial gradient renderer
+ * @param[in] r The gradient renderer to get the X coordinate of the focus from
+ * @return The Y coordinate of the focus
+ */
 EAPI double enesim_renderer_gradient_radial_focus_x_get(Enesim_Renderer *r)
 {
 	Enesim_Renderer_Gradient_Radial *thiz;
@@ -401,6 +451,12 @@
 	thiz = ENESIM_RENDERER_GRADIENT_RADIAL(r);
 	return thiz->focus.x;
 }
+
+/**
+ * Get the focus Y coordinate of a radial gradient renderer
+ * @param[in] r The gradient renderer to get the Y coordinate of the focus from
+ * @return The Y coordinate of the focus
+ */
 EAPI double enesim_renderer_gradient_radial_focus_y_get(Enesim_Renderer *r)
 {
 	Enesim_Renderer_Gradient_Radial *thiz;
@@ -409,6 +465,15 @@
 	return thiz->focus.y;
 }

+/**
+ * @brief Set the radius of a radial gradient renderer.
+ *
+ * @param[in] r The radial gradient renderer.
+ * @param[in] radius The radius.
+ *
+ * This function sets the radius of the radial gradient renderer @p r to the
+ * value @p radius.
+ */
 EAPI void enesim_renderer_gradient_radial_radius_set(Enesim_Renderer *r, double radius)
 {
 	Enesim_Renderer_Gradient_Radial *thiz;
@@ -417,6 +482,13 @@
 	thiz->radius = radius;
 	thiz->changed = EINA_TRUE;
 }
+
+/**
+ * @brief Retrieve the radius of a radial gradient renderer.
+ *
+ * @param[in] r The radial gradient renderer.
+ * @return The radius
+ */
 EAPI double enesim_renderer_gradient_radial_radius_get(Enesim_Renderer *r)
 {
 	Enesim_Renderer_Gradient_Radial *thiz;


usb: fsl_mxc_udc.c: Remove compile-time dependency of MX35 SoC type

In order to support multiple SoC kernel image, compile-time dependency
on a specific SoC type should be avoided.

fsl_udc_clk_finalize is already protected by cpu_is_mx35(), so remove
the compile-time check for CONFIG_SOC_IMX35.

Signed-off-by: Fabio Estevam <679188261afeb60eb822cd934fd7b46a48ddd743@freescale.com>
Signed-off-by: Felipe Balbi <94dddeeef08b001e003cce128ddc162a4e2c6cd2@ti.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/usb/gadget/fsl_mxc_udc.c
+++ drivers/usb/gadget/fsl_mxc_udc.c
@@ -89,7 +89,6 @@
 void fsl_udc_clk_finalize(struct platform_device *pdev)
 {
 	struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data;
-#if defined(CONFIG_SOC_IMX35)
 	if (cpu_is_mx35()) {
 		unsigned int v;

@@ -102,7 +101,6 @@
 					USBPHYCTRL_OTGBASE_OFFSET));
 		}
 	}
-#endif

 	/* ULPI transceivers don't need usbpll */
 	if (pdata->phy_mode == FSL_USB2_PHY_ULPI) {


remove erroneous FIXMEs when re-starting oosplash.bin

--- desktop/unx/source/start.c
+++ desktop/unx/source/start.c
@@ -1003,12 +1003,16 @@

             switch (child_get_exit_code (info)) {
             case 79: // re-start with just -env: parameters
-                fprintf (stderr, "FIXME: re-start with just -env: params !\n");
+#if OSL_DEBUG_LEVEL > 0
+                fprintf (stderr, "oosplash: re-start with just -env: params !\n");
+#endif
                 bRestart = sal_True;
                 bAllArgs = sal_False;
                 break;
             case 81: // re-start with all arguments
-                fprintf (stderr, "FIXME: re-start with all params !\n");
+#if OSL_DEBUG_LEVEL > 0
+                fprintf (stderr, "oosplash: re-start with all params !\n");
+#endif
                 bRestart = sal_True;
                 bAllArgs = sal_True;
                 break;


Avoid a 'thundering herd' problem when many processes wait for free buffers.
Just wakeup one process (there is a possible bug here that will be fixed
in the next round of cleanup).

Some misc cleanup, especially in the comments.

--- kern/vfs_bio.c
+++ kern/vfs_bio.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: vfs_bio.c,v 1.35 2001/03/14 14:41:04 art Exp $	*/
+/*	$OpenBSD: vfs_bio.c,v 1.36 2001/03/30 10:30:26 art Exp $	*/
 /*	$NetBSD: vfs_bio.c,v 1.44 1996/06/11 11:15:36 pk Exp $	*/

 /*-
@@ -108,7 +108,18 @@
 					    struct ucred *, int));
 int count_lock_queue __P((void));

-/* We are currently only using *cleanbufs, but count all num*bufs */
+/*
+ * We keep a few counters to monitor the utilization of the buffer cache
+ *
+ *  numdirtybufs - number of dirty (B_DELWRI) buffers. unused.
+ *  lodirtybufs  - ? unused.
+ *  hidirtybufs  - ? unused.
+ *  numfreebufs  - number of buffers on BQ_LRU and BQ_AGE. unused.
+ *  numcleanbufs - number of clean (!B_DELWRI) buffers on BQ_LRU and BQ_AGE.
+ *    Used to track the need to speedup the syncer and for the syncer reserve.
+ *  numemptybufs - number of buffers on BQ_EMPTY. unused.
+ *  mincleanbufs - the lowest number of clean buffers this far.
+ */
 int numdirtybufs;	/* number of all dirty buffers */
 int lodirtybufs, hidirtybufs;
 int numfreebufs;	/* number of buffers on LRU+AGE free lists */
@@ -602,18 +613,16 @@
 	/* Allow disk interrupts. */
 	splx(s);

-	/* Wake up syncer process waiting for any buffer to become free. */
+	/* Wake up syncer process waiting for buffers */
 	if (syncer_needbuffer) {
+		wakeup(&syncer_needbuffer);
 		syncer_needbuffer = 0;
-		wakeup_one(&syncer_needbuffer);
-	}
-	if (numcleanbufs < locleanbufs + min(locleanbufs, 4))
-		speedup_syncer();
+	}

 	/* Wake up any processes waiting for any buffer to become free. */
 	if (needbuffer && (numcleanbufs > locleanbufs)) {
-		needbuffer = 0;
-		wakeup(&needbuffer);
+		needbuffer--;
+		wakeup_one(&needbuffer);
 	}

 	/* Wake up any proceeses waiting for _this_ buffer to become free. */
@@ -714,6 +723,7 @@
 		splx(s);
 	}
 	allocbuf(bp, size);
+
 	return (bp);
 }

@@ -839,11 +849,15 @@

 start:
 	s = splbio();
+	/*
+	 * If we're getting low on buffers kick the syncer to work harder.
+	 */
+	if (numcleanbufs < locleanbufs + min(locleanbufs, 4))
+		speedup_syncer();
+
 	if ((numcleanbufs <= locleanbufs) && curproc != syncerproc) {
 		/* wait for a free buffer of any kind */
-		if (needbuffer == 0)
-			speedup_syncer();
-		needbuffer = 1;
+		needbuffer++;
 		tsleep(&needbuffer, slpflag|(PRIBIO+1), "getnewbuf", slptimeo);
 		splx(s);
 		return (0);


usb: gadget: mv_udc: add iso support

usb: gadget: mv_udc: add iso support

In order to support iso, we need do the following things:
1. fix length for one dtd
2. allow req contains multiple packets for a ISO transfer

Signed-off-by: Chao Xie <4e92301452ced7a9cf1e5ca194da9c30c818b2d6@marvell.com>
Signed-off-by: Yu Xu <b4ca8d624cbf29d32e34e4bf4ed0400ebb0e41a9@marvell.com>
Signed-off-by: Neil Zhang <44598df26d893c659781f7c18c373aeb7f61dc4f@marvell.com>
Signed-off-by: Felipe Balbi <94dddeeef08b001e003cce128ddc162a4e2c6cd2@ti.com>

--- drivers/usb/gadget/mv_udc_core.c
+++ drivers/usb/gadget/mv_udc_core.c
@@ -355,17 +355,24 @@
 	return retval;
 }

-
 static struct mv_dtd *build_dtd(struct mv_req *req, unsigned *length,
 		dma_addr_t *dma, int *is_last)
 {
-	u32 temp;
 	struct mv_dtd *dtd;
 	struct mv_udc *udc;
+	struct mv_dqh *dqh;
+	u32 temp, mult = 0;

 	/* how big will this transfer be? */
-	*length = min(req->req.length - req->req.actual,
-			(unsigned)EP_MAX_LENGTH_TRANSFER);
+	if (usb_endpoint_xfer_isoc(req->ep->ep.desc)) {
+		dqh = req->ep->dqh;
+		mult = (dqh->max_packet_length >> EP_QUEUE_HEAD_MULT_POS)
+				& 0x3;
+		*length = min(req->req.length - req->req.actual,
+				(unsigned)(mult * req->ep->ep.maxpacket));
+	} else
+		*length = min(req->req.length - req->req.actual,
+				(unsigned)EP_MAX_LENGTH_TRANSFER);

 	udc = req->ep->udc;

@@ -406,6 +413,8 @@
 	/* Enable interrupt for the last dtd of a request */
 	if (*is_last && !req->req.no_interrupt)
 		temp |= DTD_IOC;
+
+	temp |= mult << 10;

 	dtd->size_ioc_sts = temp;

@@ -717,10 +726,6 @@
 	if (unlikely(!_ep || !ep->ep.desc)) {
 		dev_err(&udc->dev->dev, "%s, bad ep", __func__);
 		return -EINVAL;
-	}
-	if (ep->ep.desc->bmAttributes == USB_ENDPOINT_XFER_ISOC) {
-		if (req->req.length > ep->ep.maxpacket)
-			return -EMSGSIZE;
 	}

 	udc = ep->udc;


usb: gadget: u_data_hsic: Cancel pending MDM write work during remove

The HSIC bridge driver removes the data bridge platform device
during subsystem restart.  If gadget driver does not cancel pending
MDM write work, we end up accessing interface structure after it
is unbounded.

CRs-Fixed: 465383
Change-Id: I05fe3e2b625e87137681477aaaf1082ba1b81bae
Signed-off-by: Pavankumar Kondeti <e4a0348e45a0df0ba79f6b06c66df8ae7aca44a4@codeaurora.org>

--- drivers/usb/gadget/u_data_hsic.c
+++ drivers/usb/gadget/u_data_hsic.c
@@ -643,6 +643,9 @@
 	ep_out = port->out;
 	if (ep_out)
 		usb_ep_fifo_flush(ep_out);
+
+	/* cancel pending writes to MDM */
+	cancel_work_sync(&port->write_tomdm_w);

 	ghsic_data_free_buffers(port);


audit: wait_for_auditd rework for readability

We had some craziness with signed to unsigned long casting which appears
wholely unnecessary.  Just use signed long.  Even though 2 values of the
math equation are unsigned longs the result is expected to be a signed
long.  So why keep casting the result to signed long?  Just make it
signed long and use it.

We also remove the needless "timeout" variable.  We already have the
stack "sleep_time" variable.  Just use that...

Signed-off-by: Eric Paris <b0b36e3cd9ea4e5739ff430a3056fabf2fdb0376@redhat.com>


usb: phy: ab8500-usb: convert to devm_kzalloc

Convert local data allocation to devm_kzalloc and drop unnecessary fail
path code.

Acked-by: Linus Walleij <9cd9d802d23c0ed5e224beabf4ae4a5c478746ef@linaro.org>
Signed-off-by: Fabio Baltieri <161d407f4dc681bfd4aedb33b8273b2aafd727bc@linaro.org>
Signed-off-by: Felipe Balbi <94dddeeef08b001e003cce128ddc162a4e2c6cd2@ti.com>

--- drivers/usb/phy/phy-ab8500-usb.c
+++ drivers/usb/phy/phy-ab8500-usb.c
@@ -628,15 +628,13 @@
 		return -ENODEV;
 	}

-	ab = kzalloc(sizeof *ab, GFP_KERNEL);
+	ab = devm_kzalloc(&pdev->dev, sizeof(*ab), GFP_KERNEL);
 	if (!ab)
 		return -ENOMEM;

-	otg = kzalloc(sizeof *otg, GFP_KERNEL);
-	if (!otg) {
-		kfree(ab);
+	otg = devm_kzalloc(&pdev->dev, sizeof(*otg), GFP_KERNEL);
+	if (!otg)
 		return -ENOMEM;
-	}

 	ab->dev			= &pdev->dev;
 	ab->ab8500		= ab8500;
@@ -665,12 +663,12 @@

 	err = ab8500_usb_irq_setup(pdev, ab);
 	if (err < 0)
-		goto fail;
+		return err;

 	err = usb_add_phy(&ab->phy, USB_PHY_TYPE_USB2);
 	if (err) {
 		dev_err(&pdev->dev, "Can't register transceiver\n");
-		goto fail;
+		return err;
 	}

 	/* Needed to enable ID detection. */
@@ -679,10 +677,6 @@
 	dev_info(&pdev->dev, "revision 0x%2x driver initialized\n", rev);

 	return 0;
-fail:
-	kfree(otg);
-	kfree(ab);
-	return err;
 }

 static int ab8500_usb_remove(struct platform_device *pdev)
@@ -699,9 +693,6 @@
 	ab8500_usb_peri_phy_dis(ab);

 	platform_set_drvdata(pdev, NULL);
-
-	kfree(ab->phy.otg);
-	kfree(ab);

 	return 0;
 }


futex: separate futex_wait_queue_me() logic from futex_wait()

Refactor futex_wait() in preparation for futex_wait_requeue_pi(). In
order to reuse a good chunk of the futex_wait() code for the upcoming
futex_wait_requeue_pi() function, this patch breaks out the
queue-to-wakeup section of futex_wait() into futex_wait_queue_me().

Signed-off-by: Darren Hart <6620bce6bfb8b2ba8b188f43804848d35a9a4d76@us.ibm.com>
Reviewed-by: Thomas Gleixner <00e4cf8f46a57000a44449bf9dd8cbbcc209fd2a@linutronix.de>
Signed-off-by: Thomas Gleixner <00e4cf8f46a57000a44449bf9dd8cbbcc209fd2a@linutronix.de>

--- kernel/futex.c
+++ kernel/futex.c
@@ -1115,24 +1115,87 @@

 static long futex_wait_restart(struct restart_block *restart);

+/**
+ * futex_wait_queue_me() - queue_me() and wait for wakeup, timeout, or signal
+ * @hb:		the futex hash bucket, must be locked by the caller
+ * @q:		the futex_q to queue up on
+ * @timeout:	the prepared hrtimer_sleeper, or null for no timeout
+ * @wait:	the wait_queue to add to the futex_q after queueing in the hb
+ */
+static void futex_wait_queue_me(struct futex_hash_bucket *hb, struct futex_q *q,
+				struct hrtimer_sleeper *timeout,
+				wait_queue_t *wait)
+{
+	queue_me(q, hb);
+
+	/*
+	 * There might have been scheduling since the queue_me(), as we
+	 * cannot hold a spinlock across the get_user() in case it
+	 * faults, and we cannot just set TASK_INTERRUPTIBLE state when
+	 * queueing ourselves into the futex hash.  This code thus has to
+	 * rely on the futex_wake() code removing us from hash when it
+	 * wakes us up.
+	 */
+
+	/* add_wait_queue is the barrier after __set_current_state. */
+	__set_current_state(TASK_INTERRUPTIBLE);
+
+	/*
+	 * Add current as the futex_q waiter.  We don't remove ourselves from
+	 * the wait_queue because we are the only user of it.
+	 */
+	add_wait_queue(&q->waiter, wait);
+
+	/* Arm the timer */
+	if (timeout) {
+		hrtimer_start_expires(&timeout->timer, HRTIMER_MODE_ABS);
+		if (!hrtimer_active(&timeout->timer))
+			timeout->task = NULL;
+	}
+
+	/*
+	 * !plist_node_empty() is safe here without any lock.
+	 * q.lock_ptr != 0 is not safe, because of ordering against wakeup.
+	 */
+	if (likely(!plist_node_empty(&q->list))) {
+		/*
+		 * If the timer has already expired, current will already be
+		 * flagged for rescheduling. Only call schedule if there
+		 * is no timeout, or if it has yet to expire.
+		 */
+		if (!timeout || timeout->task)
+			schedule();
+	}
+	__set_current_state(TASK_RUNNING);
+}
+
 static int futex_wait(u32 __user *uaddr, int fshared,
 		      u32 val, ktime_t *abs_time, u32 bitset, int clockrt)
 {
-	struct task_struct *curr = current;
+	struct hrtimer_sleeper timeout, *to = NULL;
+	DECLARE_WAITQUEUE(wait, current);
 	struct restart_block *restart;
-	DECLARE_WAITQUEUE(wait, curr);
 	struct futex_hash_bucket *hb;
 	struct futex_q q;
 	u32 uval;
 	int ret;
-	struct hrtimer_sleeper t;
-	int rem = 0;

 	if (!bitset)
 		return -EINVAL;

 	q.pi_state = NULL;
 	q.bitset = bitset;
+
+	if (abs_time) {
+		to = &timeout;
+
+		hrtimer_init_on_stack(&to->timer, clockrt ? CLOCK_REALTIME :
+				      CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
+		hrtimer_init_sleeper(to, current);
+		hrtimer_set_expires_range_ns(&to->timer, *abs_time,
+					     current->timer_slack_ns);
+	}
+
 retry:
 	q.key = FUTEX_KEY_INIT;
 	ret = get_futex_key(uaddr, fshared, &q.key);
@@ -1178,75 +1241,22 @@
 		goto retry;
 	}
 	ret = -EWOULDBLOCK;
+
+	/* Only actually queue if *uaddr contained val.  */
 	if (unlikely(uval != val)) {
 		queue_unlock(&q, hb);
 		goto out_put_key;
 	}

-	/* Only actually queue if *uaddr contained val.  */
-	queue_me(&q, hb);
-
-	/*
-	 * There might have been scheduling since the queue_me(), as we
-	 * cannot hold a spinlock across the get_user() in case it
-	 * faults, and we cannot just set TASK_INTERRUPTIBLE state when
-	 * queueing ourselves into the futex hash.  This code thus has to
-	 * rely on the futex_wake() code removing us from hash when it
-	 * wakes us up.
-	 */
-
-	/* add_wait_queue is the barrier after __set_current_state. */
-	__set_current_state(TASK_INTERRUPTIBLE);
-	add_wait_queue(&q.waiter, &wait);
-	/*
-	 * !plist_node_empty() is safe here without any lock.
-	 * q.lock_ptr != 0 is not safe, because of ordering against wakeup.
-	 */
-	if (likely(!plist_node_empty(&q.list))) {
-		if (!abs_time)
-			schedule();
-		else {
-			hrtimer_init_on_stack(&t.timer,
-					      clockrt ? CLOCK_REALTIME :
-					      CLOCK_MONOTONIC,
-					      HRTIMER_MODE_ABS);
-			hrtimer_init_sleeper(&t, current);
-			hrtimer_set_expires_range_ns(&t.timer, *abs_time,
-						     current->timer_slack_ns);
-
-			hrtimer_start_expires(&t.timer, HRTIMER_MODE_ABS);
-			if (!hrtimer_active(&t.timer))
-				t.task = NULL;
-
-			/*
-			 * the timer could have already expired, in which
-			 * case current would be flagged for rescheduling.
-			 * Don't bother calling schedule.
-			 */
-			if (likely(t.task))
-				schedule();
-
-			hrtimer_cancel(&t.timer);
-
-			/* Flag if a timeout occured */
-			rem = (t.task == NULL);
-
-			destroy_hrtimer_on_stack(&t.timer);
-		}
-	}
-	__set_current_state(TASK_RUNNING);
-
-	/*
-	 * NOTE: we don't remove ourselves from the waitqueue because
-	 * we are the only user of it.
-	 */
+	/* queue_me and wait for wakeup, timeout, or a signal. */
+	futex_wait_queue_me(hb, &q, to, &wait);

 	/* If we were woken (and unqueued), we succeeded, whatever. */
 	ret = 0;
 	if (!unqueue_me(&q))
 		goto out_put_key;
 	ret = -ETIMEDOUT;
-	if (rem)
+	if (to && !to->task)
 		goto out_put_key;

 	/*
@@ -1275,6 +1285,10 @@
 out_put_key:
 	put_futex_key(fshared, &q.key);
 out:
+	if (to) {
+		hrtimer_cancel(&to->timer);
+		destroy_hrtimer_on_stack(&to->timer);
+	}
 	return ret;
 }


USB: iuu_phoenix.c: remove dbg() tracing calls

dbg() was used a lot a long time ago to trace code flow.  Now that we have
ftrace, this isn't needed at all, so remove these calls.

CC: Rusty Russell <df9728c9e5104131c08c7adb03af425394842596@rustcorp.com.au>
CC: Johan Hovold <6a430eed381e126d51a8cce8db662f765ce314bc@gmail.com>
CC: Alan Stern <75ea6bb7bfc1186f92d26164de5f9268c9a45b59@rowland.harvard.edu>
CC: Mauro Carvalho Chehab <ad86ba2154032c9f55743a190faa2459a9d61d42@redhat.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/usb/serial/iuu_phoenix.c
+++ drivers/usb/serial/iuu_phoenix.c
@@ -135,8 +135,6 @@
 	if (!port)
 		return;

-	dbg("%s", __func__);
-
 	if (priv) {
 		iuu_free_buf(priv);
 		dbg("%s - I will free all", __func__);
@@ -197,8 +195,6 @@
 	struct usb_serial_port *port = urb->context;
 	int result;
 	int status = urb->status;
-
-	dbg("%s - enter", __func__);

 	if (status) {
 		dbg("%s - status = %d", __func__, status);
@@ -221,7 +217,6 @@
 	struct iuu_private *priv = usb_get_serial_port_data(port);
 	int result;
 	char *buf_ptr = port->write_urb->transfer_buffer;
-	dbg("%s - enter", __func__);

 	/* Prepare the reset sequence */

@@ -254,8 +249,6 @@
 	struct iuu_private *priv = usb_get_serial_port_data(port);
 	u8 *st;
 	int status = urb->status;
-
-	dbg("%s - enter", __func__);

 	if (status) {
 		dbg("%s - status = %d", __func__, status);
@@ -299,8 +292,6 @@
 {
 	int result;

-	dbg("%s - enter", __func__);
-
 	memset(port->write_urb->transfer_buffer, IUU_GET_STATE_REGISTER, 1);
 	usb_fill_bulk_urb(port->write_urb, port->serial->dev,
 			  usb_sndbulkpipe(port->serial->dev,
@@ -318,8 +309,6 @@
 	struct usb_serial *serial = port->serial;
 	int actual = 0;

-	dbg("%s - enter", __func__);
-
 	/* send the data out the bulk port */

 	status =
@@ -341,10 +330,7 @@
 	struct usb_serial *serial = port->serial;
 	int actual = 0;

-	dbg("%s - enter", __func__);
-
 	/* send the data out the bulk port */
-
 	status =
 	    usb_bulk_msg(serial->dev,
 			 usb_rcvbulkpipe(serial->dev,
@@ -366,8 +352,6 @@
 	buf = kmalloc(8, GFP_KERNEL);
 	if (!buf)
 		return -ENOMEM;
-
-	dbg("%s - enter", __func__);

 	buf[0] = IUU_SET_LED;
 	buf[1] = R & 0xFF;
@@ -459,8 +443,6 @@
 	unsigned int P = 0;
 	unsigned int P2 = 0;
 	int frq = (int)dwFrq;
-
-	dbg("%s - enter", __func__);

 	if (frq == 0) {
 		priv->buf[Count++] = IUU_UART_WRITE_I2C;
@@ -590,8 +572,6 @@
 	u8 rxcmd = IUU_UART_RX;
 	struct iuu_private *priv = usb_get_serial_port_data(port);

-	dbg("%s - enter", __func__);
-
 	if (iuu_led(port, 0xF000, 0, 0, 0xFF) < 0)
 		return -EIO;

@@ -630,8 +610,6 @@
 	struct tty_struct *tty;
 	int status = urb->status;

-	dbg("%s - status = %d", __func__, status);
-
 	if (status) {
 		if (status == -EPROTO) {
 			/* reschedule needed */
@@ -659,7 +637,6 @@
 	int i;
 	int buf_len;
 	char *buf_ptr = port->write_urb->transfer_buffer;
-	dbg("%s - enter", __func__);

 	spin_lock_irqsave(&priv->lock, flags);
 	*buf_ptr++ = IUU_UART_ESC;
@@ -691,7 +668,6 @@
 static int iuu_read_buf(struct usb_serial_port *port, int len)
 {
 	int result;
-	dbg("%s - enter", __func__);

 	usb_fill_bulk_urb(port->read_urb, port->serial->dev,
 			  usb_rcvbulkpipe(port->serial->dev,
@@ -713,8 +689,6 @@
 	unsigned char *data = urb->transfer_buffer;
 	priv->poll++;

-	dbg("%s - enter", __func__);
-
 	if (status) {
 		dbg("%s - status = %d", __func__, status);
 		/* error stop all */
@@ -771,7 +745,6 @@
 {
 	struct iuu_private *priv = usb_get_serial_port_data(port);
 	unsigned long flags;
-	dbg("%s - enter", __func__);

 	if (count > 256)
 		return -ENOMEM;
@@ -791,8 +764,6 @@
 	struct usb_serial_port *port = urb->context;
 	int result;
 	int status = urb->status;
-
-	dbg("%s - status = %d", __func__, status);

 	if (status) {
 		/* error stop all */
@@ -1015,8 +986,6 @@
 	if (!serial)
 		return;

-	dbg("%s - port %d", __func__, port->number);
-
 	iuu_uart_off(port);
 	if (serial->dev) {
 		/* free writebuf */
@@ -1031,7 +1000,6 @@

 static void iuu_init_termios(struct tty_struct *tty)
 {
-	dbg("%s - enter", __func__);
 	*(tty->termios) = tty_std_termios;
 	tty->termios->c_cflag = CLOCAL | CREAD | CS8 | B9600
 				| TIOCM_CTS | CSTOPB | PARENB;
@@ -1188,8 +1156,6 @@
 	if (!buf)
 		return -ENOMEM;

-	dbg("%s - enter", __func__);
-
 	buf[0] = IUU_SET_VCC;
 	buf[1] = vcc & 0xFF;
 	buf[2] = (vcc >> 8) & 0xFF;
@@ -1250,15 +1216,11 @@

 static int iuu_create_sysfs_attrs(struct usb_serial_port *port)
 {
-	dbg("%s", __func__);
-
 	return device_create_file(&port->dev, &dev_attr_vcc_mode);
 }

 static int iuu_remove_sysfs_attrs(struct usb_serial_port *port)
 {
-	dbg("%s", __func__);
-
 	device_remove_file(&port->dev, &dev_attr_vcc_mode);
 	return 0;
 }


USB: iuu_phoenix: replace strict_strtoul() with kstrtoul()

The usage of strict_strtoul() is not preferred, because
strict_strtoul() is obsolete. Thus, kstrtoul() should be
used.

Signed-off-by: Jingoo Han <fc379137a64feb86ce38ec5811a14280acc1ccfc@samsung.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/usb/serial/iuu_phoenix.c
+++ drivers/usb/serial/iuu_phoenix.c
@@ -1164,7 +1164,7 @@
 	struct iuu_private *priv = usb_get_serial_port_data(port);
 	unsigned long v;

-	if (strict_strtoul(buf, 10, &v)) {
+	if (kstrtoul(buf, 10, &v)) {
 		dev_err(dev, "%s - vcc_mode: %s is not a unsigned long\n",
 				__func__, buf);
 		goto fail_store_vcc_mode;


fbdev: sh_mobile_meram: Enable/disable MERAM along with LCDC

The MERAM reference counts should be tied to the two LCDC devices (LCD/HDMI)
so that when they are enable/disabled, the MERAM is as well.

Signed-off-by: Damian Hobson-Garcia <a41aa2c1db5711c750c3663bc91515bf71c851f8@igel.co.jp>

--- drivers/video/sh_mobile_lcdcfb.c
+++ drivers/video/sh_mobile_lcdcfb.c
@@ -259,6 +259,8 @@
 		pm_runtime_get_sync(priv->dev);
 		if (priv->dot_clk)
 			clk_enable(priv->dot_clk);
+		if (priv->meram_dev && priv->meram_dev->pdev)
+			pm_runtime_get_sync(&priv->meram_dev->pdev->dev);
 	}
 }

@@ -267,6 +269,8 @@
 	if (atomic_sub_return(1, &priv->hw_usecnt) == -1) {
 		if (priv->dot_clk)
 			clk_disable(priv->dot_clk);
+		if (priv->meram_dev && priv->meram_dev->pdev)
+			pm_runtime_put_sync(&priv->meram_dev->pdev->dev);
 		pm_runtime_put(priv->dev);
 	}
 }


kernel: queue: Fix MISRA-C violation

kernel: queue: Fix MISRA-C violation

MISRA-C requires the right-hand operand of && or || operator does not
contain persistent effect.

MISRA-C rule 13.5

Signed-off-by: Flavio Ceolin <979b9165500b0741b9d0500e2efd74fc1547bff7@intel.com>

--- kernel/queue.c
+++ kernel/queue.c
@@ -235,12 +235,16 @@

 	unsigned int key = irq_lock();
 #if !defined(CONFIG_POLL)
-	struct k_thread *thread;
-
-	while ((head != NULL) &&
-		(thread = _unpend_first_thread(&queue->wait_q))) {
+	struct k_thread *thread = NULL;
+
+	if (head) {
+		thread = _unpend_first_thread(&queue->wait_q);
+	}
+
+	while ((head != NULL) && (thread != NULL)) {
 		prepare_thread_to_run(thread, head);
 		head = *(void **)head;
+		thread = _unpend_first_thread(&queue->wait_q);
 	}

 	if (head != NULL) {


sched: Remove obsolete comment in sched_init()

Remove the comment about calling alloc_bootmem() as it is not
called here since commit 36b7b6d465489c4754c4fd66fcec6086eba87896.

Signed-off-by: Jayson R. King <34c6fceca75e456f25e7e99531e2425c6c1de443@jaysonking.com>
Cc: Peter Zijlstra <3fddac958924aef220f202ca567388ddab3f14a8@infradead.org>
Cc: Jiri Kosina <f2fc8123700c95880a53d4a1576282f2ca68c4b0@kernel.org>
LKML-Reference: <18d5c0e9c7a63f162f0934a0350fa25fe14faba6@jaysonking.com>
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>


sched: fix cpu hotplug

sched: fix cpu hotplug

the CPU hotplug problems (crashes under high-volume unplug+replug
tests) seem to be related to migrate_dead_tasks().

Firstly I added traces to see all tasks being migrated with
migrate_live_tasks() and migrate_dead_tasks(). On my setup the problem
pops up (the one with "se == NULL" in the loop of
pick_next_task_fair()) shortly after the traces indicate that some has
been migrated with migrate_dead_tasks()). btw., I can reproduce it
much faster now with just a plain cpu down/up loop.

[disclaimer] Well, unless I'm really missing something important in
this late hour [/desclaimer] pick_next_task() is not something
appropriate for migrate_dead_tasks() :-)

the following change seems to eliminate the problem on my setup
(although, I kept it running only for a few minutes to get a few
messages indicating migrate_dead_tasks() does move tasks and the
system is still ok)

Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>

--- kernel/sched.c
+++ kernel/sched.c
@@ -5887,6 +5887,7 @@
 		next = pick_next_task(rq, rq->curr);
 		if (!next)
 			break;
+		next->sched_class->put_prev_task(rq, next);
 		migrate_dead(dead_cpu, next);

 	}


sched: fix sched_domain sysctl registration again

commit  029190c515f15f512ac85de8fc686d4dbd0ae731 (cpuset
sched_load_balance flag) was not tested SCHED_DEBUG enabled as
committed as it dereferences NULL when used and it reordered
the sysctl registration to cause it to never show any domains
or their tunables.

Fixes:

1) restore arch_init_sched_domains ordering
	we can't walk the domains before we build them

	presently we register cpus with empty directories (no domain
	directories or files).

2) make unregister_sched_domain_sysctl do nothing when already unregistered
	detach_destroy_domains is now called one set of cpus at a time
	unregister_syctl dereferences NULL if called with a null.

	While the the function would always dereference null if called
	twice, in the previous code it was always called once and then
	was followed a register.  So only the hidden bug of the
	sysctl_root_table not being allocated followed by an attempt to
	free it would have shown the error.

3) always call unregister and register in partition_sched_domains
	The code is "smart" about unregistering only needed domains.
	Since we aren't guaranteed any calls to unregister, always
	unregister.   Without calling register on the way out we
	will not have a table or any sysctl tree.

4) warn if register is called without unregistering
	The previous table memory is lost, leaving pointers to the
	later freed memory in sysctl and leaking the memory of the
	tables.

Before this patch on a 2-core 4-thread box compiled for SMT and NUMA,
the domains appear empty (there are actually 3 levels per cpu).  And as
soon as two domains a null pointer is dereferenced (unreliable in this
case is stack garbage):

bu19a:~# ls -R /proc/sys/kernel/sched_domain/
/proc/sys/kernel/sched_domain/:
cpu0  cpu1  cpu2  cpu3

/proc/sys/kernel/sched_domain/cpu0:

/proc/sys/kernel/sched_domain/cpu1:

/proc/sys/kernel/sched_domain/cpu2:

/proc/sys/kernel/sched_domain/cpu3:

bu19a:~# mkdir /dev/cpuset
bu19a:~# mount -tcpuset cpuset /dev/cpuset/
bu19a:~# cd /dev/cpuset/
bu19a:/dev/cpuset# echo 0 > sched_load_balance
bu19a:/dev/cpuset# mkdir one
bu19a:/dev/cpuset# echo 1 > one/cpus
bu19a:/dev/cpuset# echo 0 > one/sched_load_balance
Unable to handle kernel paging request for data at address 0x00000018
Faulting instruction address: 0xc00000000006b608
NIP: c00000000006b608 LR: c00000000006b604 CTR: 0000000000000000
REGS: c000000018d973f0 TRAP: 0300   Not tainted  (2.6.23-bml)
MSR: 9000000000009032 <EE,ME,IR,DR>  CR: 28242442  XER: 00000000
DAR: 0000000000000018, DSISR: 0000000040000000
TASK = c00000001912e340[1987] 'bash' THREAD: c000000018d94000 CPU: 2
..
NIP [c00000000006b608] .unregister_sysctl_table+0x38/0x110
LR [c00000000006b604] .unregister_sysctl_table+0x34/0x110
Call Trace:
[c000000018d97670] [c000000007017270] 0xc000000007017270 (unreliable)
[c000000018d97720] [c000000000058710] .detach_destroy_domains+0x30/0xb0
[c000000018d977b0] [c00000000005cf1c] .partition_sched_domains+0x1bc/0x230
[c000000018d97870] [c00000000009fdc4] .rebuild_sched_domains+0xb4/0x4c0
[c000000018d97970] [c0000000000a02e8] .update_flag+0x118/0x170
[c000000018d97a80] [c0000000000a1768] .cpuset_common_file_write+0x568/0x820
[c000000018d97c00] [c00000000009d95c] .cgroup_file_write+0x7c/0x180
[c000000018d97cf0] [c0000000000e76b8] .vfs_write+0xe8/0x1b0
[c000000018d97d90] [c0000000000e810c] .sys_write+0x4c/0x90
[c000000018d97e30] [c00000000000852c] syscall_exit+0x0/0x40

Signed-off-by: Milton Miller <8bd50e0fc26e21e23b28837d9acdf866b237c39d@bga.com>
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>

--- kernel/sched.c
+++ kernel/sched.c
@@ -5461,10 +5461,11 @@
 	struct ctl_table *entry = sd_alloc_ctl_entry(cpu_num + 1);
 	char buf[32];

+	WARN_ON(sd_ctl_dir[0].child);
+	sd_ctl_dir[0].child = entry;
+
 	if (entry == NULL)
 		return;
-
-	sd_ctl_dir[0].child = entry;

 	for_each_online_cpu(i) {
 		snprintf(buf, 32, "cpu%d", i);
@@ -5473,14 +5474,19 @@
 		entry->child = sd_alloc_ctl_cpu_table(i);
 		entry++;
 	}
+
+	WARN_ON(sd_sysctl_header);
 	sd_sysctl_header = register_sysctl_table(sd_ctl_root);
 }

+/* may be called multiple times per register */
 static void unregister_sched_domain_sysctl(void)
 {
-	unregister_sysctl_table(sd_sysctl_header);
+	if (sd_sysctl_header)
+		unregister_sysctl_table(sd_sysctl_header);
 	sd_sysctl_header = NULL;
-	sd_free_ctl_entry(&sd_ctl_dir[0].child);
+	if (sd_ctl_dir[0].child)
+		sd_free_ctl_entry(&sd_ctl_dir[0].child);
 }
 #else
 static void register_sched_domain_sysctl(void)
@@ -6424,13 +6430,17 @@
  */
 static int arch_init_sched_domains(const cpumask_t *cpu_map)
 {
+	int err;
+
 	ndoms_cur = 1;
 	doms_cur = kmalloc(sizeof(cpumask_t), GFP_KERNEL);
 	if (!doms_cur)
 		doms_cur = &fallback_doms;
 	cpus_andnot(*doms_cur, *cpu_map, cpu_isolated_map);
+	err = build_sched_domains(doms_cur);
 	register_sched_domain_sysctl();
-	return build_sched_domains(doms_cur);
+
+	return err;
 }

 static void arch_destroy_sched_domains(const cpumask_t *cpu_map)
@@ -6478,6 +6488,9 @@
 void partition_sched_domains(int ndoms_new, cpumask_t *doms_new)
 {
 	int i, j;
+
+	/* always unregister in case we don't destroy any domains */
+	unregister_sched_domain_sysctl();

 	if (doms_new == NULL) {
 		ndoms_new = 1;
@@ -6514,6 +6527,8 @@
 		kfree(doms_cur);
 	doms_cur = doms_new;
 	ndoms_cur = ndoms_new;
+
+	register_sched_domain_sysctl();
 }

 #if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)