Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Bluetooth: btintel_pcie: Reword restart to recovery

This rewords the term restart with recovery since the intend is for
hardware recovery not a regular restart, also remove some debug logs
which might just clutter the output informing the recovery counter which
isn't really useful for regular users.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

+33 -38
+33 -38
drivers/bluetooth/btintel_pcie.c
··· 41 41 }; 42 42 MODULE_DEVICE_TABLE(pci, btintel_pcie_table); 43 43 44 - struct btintel_pcie_dev_restart_data { 44 + struct btintel_pcie_dev_recovery { 45 45 struct list_head list; 46 - u8 restart_count; 46 + u8 count; 47 47 time64_t last_error; 48 48 char name[]; 49 49 }; ··· 114 114 struct work_struct work; 115 115 }; 116 116 117 - static LIST_HEAD(btintel_pcie_restart_data_list); 118 - static DEFINE_SPINLOCK(btintel_pcie_restart_data_lock); 117 + static LIST_HEAD(btintel_pcie_recovery_list); 118 + static DEFINE_SPINLOCK(btintel_pcie_recovery_lock); 119 119 120 120 /* This function initializes the memory for DBGC buffers and formats the 121 121 * DBGC fragment which consists header info and DBGC buffer's LSB, MSB and ··· 2219 2219 return err; 2220 2220 } 2221 2221 2222 - static struct btintel_pcie_dev_restart_data *btintel_pcie_get_restart_data(struct pci_dev *pdev, 2223 - struct device *dev) 2222 + static struct btintel_pcie_dev_recovery * 2223 + btintel_pcie_get_recovery(struct pci_dev *pdev, struct device *dev) 2224 2224 { 2225 - struct btintel_pcie_dev_restart_data *tmp, *data = NULL; 2225 + struct btintel_pcie_dev_recovery *tmp, *data = NULL; 2226 2226 const char *name = pci_name(pdev); 2227 2227 struct hci_dev *hdev = to_hci_dev(dev); 2228 2228 2229 - spin_lock(&btintel_pcie_restart_data_lock); 2230 - list_for_each_entry(tmp, &btintel_pcie_restart_data_list, list) { 2229 + spin_lock(&btintel_pcie_recovery_lock); 2230 + list_for_each_entry(tmp, &btintel_pcie_recovery_list, list) { 2231 2231 if (strcmp(tmp->name, name)) 2232 2232 continue; 2233 2233 data = tmp; 2234 2234 break; 2235 2235 } 2236 - spin_unlock(&btintel_pcie_restart_data_lock); 2236 + spin_unlock(&btintel_pcie_recovery_lock); 2237 2237 2238 2238 if (data) { 2239 2239 bt_dev_dbg(hdev, "Found restart data for BDF: %s", data->name); ··· 2245 2245 return NULL; 2246 2246 2247 2247 strscpy_pad(data->name, name, strlen(name) + 1); 2248 - spin_lock(&btintel_pcie_restart_data_lock); 2249 - list_add_tail(&data->list, &btintel_pcie_restart_data_list); 2250 - spin_unlock(&btintel_pcie_restart_data_lock); 2248 + spin_lock(&btintel_pcie_recovery_lock); 2249 + list_add_tail(&data->list, &btintel_pcie_recovery_list); 2250 + spin_unlock(&btintel_pcie_recovery_lock); 2251 2251 2252 2252 return data; 2253 2253 } 2254 2254 2255 2255 static void btintel_pcie_free_restart_list(void) 2256 2256 { 2257 - struct btintel_pcie_dev_restart_data *tmp; 2257 + struct btintel_pcie_dev_recovery *tmp; 2258 2258 2259 - while ((tmp = list_first_entry_or_null(&btintel_pcie_restart_data_list, 2259 + while ((tmp = list_first_entry_or_null(&btintel_pcie_recovery_list, 2260 2260 typeof(*tmp), list))) { 2261 2261 list_del(&tmp->list); 2262 2262 kfree(tmp); 2263 2263 } 2264 2264 } 2265 2265 2266 - static void btintel_pcie_inc_restart_count(struct pci_dev *pdev, 2267 - struct device *dev) 2266 + static void btintel_pcie_inc_recovery_count(struct pci_dev *pdev, 2267 + struct device *dev) 2268 2268 { 2269 - struct btintel_pcie_dev_restart_data *data; 2270 - struct hci_dev *hdev = to_hci_dev(dev); 2269 + struct btintel_pcie_dev_recovery *data; 2271 2270 time64_t retry_window; 2272 2271 2273 - data = btintel_pcie_get_restart_data(pdev, dev); 2272 + data = btintel_pcie_get_recovery(pdev, dev); 2274 2273 if (!data) 2275 2274 return; 2276 2275 2277 2276 retry_window = ktime_get_boottime_seconds() - data->last_error; 2278 - if (data->restart_count == 0) { 2277 + if (data->count == 0) { 2279 2278 data->last_error = ktime_get_boottime_seconds(); 2280 - data->restart_count++; 2281 - bt_dev_dbg(hdev, "First iteration initialise. last_error: %lld seconds restart_count: %d", 2282 - data->last_error, data->restart_count); 2279 + data->count++; 2283 2280 } else if (retry_window < BTINTEL_PCIE_RESET_WINDOW_SECS && 2284 - data->restart_count <= BTINTEL_PCIE_FLR_MAX_RETRY) { 2285 - data->restart_count++; 2286 - bt_dev_dbg(hdev, "Flr triggered within the max retry time so increment the restart_count: %d", 2287 - data->restart_count); 2281 + data->count <= BTINTEL_PCIE_FLR_MAX_RETRY) { 2282 + data->count++; 2288 2283 } else if (retry_window > BTINTEL_PCIE_RESET_WINDOW_SECS) { 2289 2284 data->last_error = 0; 2290 - data->restart_count = 0; 2291 - bt_dev_dbg(hdev, "Flr triggered out of the retry window, so reset counters"); 2285 + data->count = 0; 2292 2286 } 2293 2287 } 2294 2288 ··· 2368 2374 2369 2375 static void btintel_pcie_hw_error(struct hci_dev *hdev, u8 code) 2370 2376 { 2371 - struct btintel_pcie_dev_restart_data *data; 2377 + struct btintel_pcie_dev_recovery *data; 2372 2378 struct btintel_pcie_data *dev_data = hci_get_drvdata(hdev); 2373 2379 struct pci_dev *pdev = dev_data->pdev; 2374 2380 time64_t retry_window; ··· 2378 2384 return; 2379 2385 } 2380 2386 2381 - data = btintel_pcie_get_restart_data(pdev, &hdev->dev); 2387 + data = btintel_pcie_get_recovery(pdev, &hdev->dev); 2382 2388 if (!data) 2383 2389 return; 2384 2390 2385 2391 retry_window = ktime_get_boottime_seconds() - data->last_error; 2386 2392 2387 2393 if (retry_window < BTINTEL_PCIE_RESET_WINDOW_SECS && 2388 - data->restart_count >= BTINTEL_PCIE_FLR_MAX_RETRY) { 2394 + data->count >= BTINTEL_PCIE_FLR_MAX_RETRY) { 2389 2395 bt_dev_err(hdev, "Exhausted maximum: %d recovery attempts: %d", 2390 - BTINTEL_PCIE_FLR_MAX_RETRY, data->restart_count); 2391 - bt_dev_dbg(hdev, "Boot time: %lld seconds first_flr at: %lld seconds restart_count: %d", 2392 - ktime_get_boottime_seconds(), data->last_error, 2393 - data->restart_count); 2396 + BTINTEL_PCIE_FLR_MAX_RETRY, data->count); 2397 + bt_dev_dbg(hdev, "Boot time: %lld seconds", 2398 + ktime_get_boottime_seconds()); 2399 + bt_dev_dbg(hdev, "last error at: %lld seconds", 2400 + data->last_error); 2394 2401 return; 2395 2402 } 2396 - btintel_pcie_inc_restart_count(pdev, &hdev->dev); 2403 + btintel_pcie_inc_recovery_count(pdev, &hdev->dev); 2397 2404 btintel_pcie_reset(hdev); 2398 2405 } 2399 2406