package/devel/binutils: Update to 2.27
[openwrt/staging/chunkeey.git] / package / kernel / mac80211 / patches / 656-0003-rtl8xxxu-Use-a-struct-rtl8xxxu_fileops-in-rtl8xxxu_i.patch
1 From 2fc5dd27bf9b75d83a7071d13cca044bc39748fb Mon Sep 17 00:00:00 2001
2 From: Jes Sorensen <Jes.Sorensen@redhat.com>
3 Date: Tue, 20 Sep 2016 21:19:28 -0400
4 Subject: [PATCH] rtl8xxxu: Use a struct rtl8xxxu_fileops * in
5 rtl8xxxu_init_device()
6
7 This saves some 217, or about, derefences of priv->fops.
8
9 Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
10 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
11 ---
12 .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 37 +++++++++++-----------
13 1 file changed, 19 insertions(+), 18 deletions(-)
14
15 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
16 +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
17 @@ -3886,6 +3886,7 @@ static int rtl8xxxu_init_device(struct i
18 {
19 struct rtl8xxxu_priv *priv = hw->priv;
20 struct device *dev = &priv->udev->dev;
21 + struct rtl8xxxu_fileops *fops = priv->fops;
22 bool macpower;
23 int ret;
24 u8 val8;
25 @@ -3904,7 +3905,7 @@ static int rtl8xxxu_init_device(struct i
26 else
27 macpower = true;
28
29 - ret = priv->fops->power_on(priv);
30 + ret = fops->power_on(priv);
31 if (ret < 0) {
32 dev_warn(dev, "%s: Failed power on\n", __func__);
33 goto exit;
34 @@ -3921,7 +3922,7 @@ static int rtl8xxxu_init_device(struct i
35 /*
36 * Set RX page boundary
37 */
38 - rtl8xxxu_write16(priv, REG_TRXFF_BNDY + 2, priv->fops->trxff_boundary);
39 + rtl8xxxu_write16(priv, REG_TRXFF_BNDY + 2, fops->trxff_boundary);
40
41 ret = rtl8xxxu_download_firmware(priv);
42 dev_dbg(dev, "%s: download_firmware %i\n", __func__, ret);
43 @@ -3932,8 +3933,8 @@ static int rtl8xxxu_init_device(struct i
44 if (ret)
45 goto exit;
46
47 - if (priv->fops->phy_init_antenna_selection)
48 - priv->fops->phy_init_antenna_selection(priv);
49 + if (fops->phy_init_antenna_selection)
50 + fops->phy_init_antenna_selection(priv);
51
52 ret = rtl8xxxu_init_mac(priv);
53
54 @@ -3946,7 +3947,7 @@ static int rtl8xxxu_init_device(struct i
55 if (ret)
56 goto exit;
57
58 - ret = priv->fops->init_phy_rf(priv);
59 + ret = fops->init_phy_rf(priv);
60 if (ret)
61 goto exit;
62
63 @@ -3971,7 +3972,7 @@ static int rtl8xxxu_init_device(struct i
64 /*
65 * Set TX buffer boundary
66 */
67 - val8 = priv->fops->total_page_num + 1;
68 + val8 = fops->total_page_num + 1;
69
70 rtl8xxxu_write8(priv, REG_TXPKTBUF_BCNQ_BDNY, val8);
71 rtl8xxxu_write8(priv, REG_TXPKTBUF_MGQ_BDNY, val8);
72 @@ -3984,14 +3985,14 @@ static int rtl8xxxu_init_device(struct i
73 * The vendor drivers set PBP for all devices, except 8192e.
74 * There is no explanation for this in any of the sources.
75 */
76 - val8 = (priv->fops->pbp_rx << PBP_PAGE_SIZE_RX_SHIFT) |
77 - (priv->fops->pbp_tx << PBP_PAGE_SIZE_TX_SHIFT);
78 + val8 = (fops->pbp_rx << PBP_PAGE_SIZE_RX_SHIFT) |
79 + (fops->pbp_tx << PBP_PAGE_SIZE_TX_SHIFT);
80 if (priv->rtl_chip != RTL8192E)
81 rtl8xxxu_write8(priv, REG_PBP, val8);
82
83 dev_dbg(dev, "%s: macpower %i\n", __func__, macpower);
84 if (!macpower) {
85 - ret = priv->fops->llt_init(priv);
86 + ret = fops->llt_init(priv);
87 if (ret) {
88 dev_warn(dev, "%s: LLT table init failed\n", __func__);
89 goto exit;
90 @@ -4000,12 +4001,12 @@ static int rtl8xxxu_init_device(struct i
91 /*
92 * Chip specific quirks
93 */
94 - priv->fops->usb_quirks(priv);
95 + fops->usb_quirks(priv);
96
97 /*
98 * Enable TX report and TX report timer for 8723bu/8188eu/...
99 */
100 - if (priv->fops->has_tx_report) {
101 + if (fops->has_tx_report) {
102 val8 = rtl8xxxu_read8(priv, REG_TX_REPORT_CTRL);
103 val8 |= TX_REPORT_CTRL_TIMER_ENABLE;
104 rtl8xxxu_write8(priv, REG_TX_REPORT_CTRL, val8);
105 @@ -4140,8 +4141,8 @@ static int rtl8xxxu_init_device(struct i
106 rtl8xxxu_write8(priv, REG_RSV_CTRL, val8);
107 }
108
109 - if (priv->fops->init_aggregation)
110 - priv->fops->init_aggregation(priv);
111 + if (fops->init_aggregation)
112 + fops->init_aggregation(priv);
113
114 /*
115 * Enable CCK and OFDM block
116 @@ -4158,7 +4159,7 @@ static int rtl8xxxu_init_device(struct i
117 /*
118 * Start out with default power levels for channel 6, 20MHz
119 */
120 - priv->fops->set_tx_power(priv, 1, false);
121 + fops->set_tx_power(priv, 1, false);
122
123 /* Let the 8051 take control of antenna setting */
124 if (priv->rtl_chip != RTL8192E) {
125 @@ -4174,8 +4175,8 @@ static int rtl8xxxu_init_device(struct i
126
127 rtl8xxxu_write16(priv, REG_FAST_EDCA_CTRL, 0);
128
129 - if (priv->fops->init_statistics)
130 - priv->fops->init_statistics(priv);
131 + if (fops->init_statistics)
132 + fops->init_statistics(priv);
133
134 if (priv->rtl_chip == RTL8192E) {
135 /*
136 @@ -4193,12 +4194,12 @@ static int rtl8xxxu_init_device(struct i
137
138 rtl8723a_phy_lc_calibrate(priv);
139
140 - priv->fops->phy_iq_calibrate(priv);
141 + fops->phy_iq_calibrate(priv);
142
143 /*
144 * This should enable thermal meter
145 */
146 - if (priv->fops->gen2_thermal_meter)
147 + if (fops->gen2_thermal_meter)
148 rtl8xxxu_write_rfreg(priv,
149 RF_A, RF6052_REG_T_METER_8723B, 0x37cf8);
150 else