Skip to content

Commit c0d8d56

Browse files
erstromKalle Valo
authored andcommitted
ath10k: add struct ath10k_bus_params
This struct is used as argument to ath10k_core_register in order to make it easier to add more bus parameters in the future. Signed-off-by: Erik Stromdahl <erik.stromdahl@gmail.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
1 parent 39501ea commit c0d8d56

File tree

7 files changed

+29
-20
lines changed

7 files changed

+29
-20
lines changed

drivers/net/wireless/ath/ath10k/ahb.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ static int ath10k_ahb_probe(struct platform_device *pdev)
750750
enum ath10k_hw_rev hw_rev;
751751
size_t size;
752752
int ret;
753-
u32 chip_id;
753+
struct ath10k_bus_params bus_params;
754754

755755
of_id = of_match_device(ath10k_ahb_of_match, &pdev->dev);
756756
if (!of_id) {
@@ -806,14 +806,14 @@ static int ath10k_ahb_probe(struct platform_device *pdev)
806806

807807
ath10k_pci_ce_deinit(ar);
808808

809-
chip_id = ath10k_ahb_soc_read32(ar, SOC_CHIP_ID_ADDRESS);
810-
if (chip_id == 0xffffffff) {
809+
bus_params.chip_id = ath10k_ahb_soc_read32(ar, SOC_CHIP_ID_ADDRESS);
810+
if (bus_params.chip_id == 0xffffffff) {
811811
ath10k_err(ar, "failed to get chip id\n");
812812
ret = -ENODEV;
813813
goto err_halt_device;
814814
}
815815

816-
ret = ath10k_core_register(ar, chip_id);
816+
ret = ath10k_core_register(ar, &bus_params);
817817
if (ret) {
818818
ath10k_err(ar, "failed to register driver core: %d\n", ret);
819819
goto err_halt_device;

drivers/net/wireless/ath/ath10k/core.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2924,9 +2924,10 @@ static void ath10k_core_register_work(struct work_struct *work)
29242924
return;
29252925
}
29262926

2927-
int ath10k_core_register(struct ath10k *ar, u32 chip_id)
2927+
int ath10k_core_register(struct ath10k *ar,
2928+
const struct ath10k_bus_params *bus_params)
29282929
{
2929-
ar->chip_id = chip_id;
2930+
ar->chip_id = bus_params->chip_id;
29302931
queue_work(ar->workqueue, &ar->register_work);
29312932

29322933
return 0;

drivers/net/wireless/ath/ath10k/core.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,10 @@ struct ath10k_per_peer_tx_stats {
915915
u32 reserved2;
916916
};
917917

918+
struct ath10k_bus_params {
919+
u32 chip_id;
920+
};
921+
918922
struct ath10k {
919923
struct ath_common ath_common;
920924
struct ieee80211_hw *hw;
@@ -1204,7 +1208,8 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode,
12041208
const struct ath10k_fw_components *fw_components);
12051209
int ath10k_wait_for_suspend(struct ath10k *ar, u32 suspend_opt);
12061210
void ath10k_core_stop(struct ath10k *ar);
1207-
int ath10k_core_register(struct ath10k *ar, u32 chip_id);
1211+
int ath10k_core_register(struct ath10k *ar,
1212+
const struct ath10k_bus_params *bus_params);
12081213
void ath10k_core_unregister(struct ath10k *ar);
12091214

12101215
#endif /* _CORE_H_ */

drivers/net/wireless/ath/ath10k/pci.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3501,7 +3501,7 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
35013501
struct ath10k *ar;
35023502
struct ath10k_pci *ar_pci;
35033503
enum ath10k_hw_rev hw_rev;
3504-
u32 chip_id;
3504+
struct ath10k_bus_params bus_params;
35053505
bool pci_ps;
35063506
int (*pci_soft_reset)(struct ath10k *ar);
35073507
int (*pci_hard_reset)(struct ath10k *ar);
@@ -3637,19 +3637,19 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
36373637
goto err_free_irq;
36383638
}
36393639

3640-
chip_id = ath10k_pci_soc_read32(ar, SOC_CHIP_ID_ADDRESS);
3641-
if (chip_id == 0xffffffff) {
3640+
bus_params.chip_id = ath10k_pci_soc_read32(ar, SOC_CHIP_ID_ADDRESS);
3641+
if (bus_params.chip_id == 0xffffffff) {
36423642
ath10k_err(ar, "failed to get chip id\n");
36433643
goto err_free_irq;
36443644
}
36453645

3646-
if (!ath10k_pci_chip_is_supported(pdev->device, chip_id)) {
3646+
if (!ath10k_pci_chip_is_supported(pdev->device, bus_params.chip_id)) {
36473647
ath10k_err(ar, "device %04x with chip_id %08x isn't supported\n",
3648-
pdev->device, chip_id);
3648+
pdev->device, bus_params.chip_id);
36493649
goto err_free_irq;
36503650
}
36513651

3652-
ret = ath10k_core_register(ar, chip_id);
3652+
ret = ath10k_core_register(ar, &bus_params);
36533653
if (ret) {
36543654
ath10k_err(ar, "failed to register driver core: %d\n", ret);
36553655
goto err_free_irq;

drivers/net/wireless/ath/ath10k/sdio.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1941,7 +1941,8 @@ static int ath10k_sdio_probe(struct sdio_func *func,
19411941
struct ath10k_sdio *ar_sdio;
19421942
struct ath10k *ar;
19431943
enum ath10k_hw_rev hw_rev;
1944-
u32 chip_id, dev_id_base;
1944+
u32 dev_id_base;
1945+
struct ath10k_bus_params bus_params;
19451946
int ret, i;
19461947

19471948
/* Assumption: All SDIO based chipsets (so far) are QCA6174 based.
@@ -2036,8 +2037,8 @@ static int ath10k_sdio_probe(struct sdio_func *func,
20362037
}
20372038

20382039
/* TODO: don't know yet how to get chip_id with SDIO */
2039-
chip_id = 0;
2040-
ret = ath10k_core_register(ar, chip_id);
2040+
bus_params.chip_id = 0;
2041+
ret = ath10k_core_register(ar, &bus_params);
20412042
if (ret) {
20422043
ath10k_err(ar, "failed to register driver core: %d\n", ret);
20432044
goto err_free_wq;

drivers/net/wireless/ath/ath10k/snoc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1283,6 +1283,7 @@ static int ath10k_snoc_probe(struct platform_device *pdev)
12831283
struct ath10k *ar;
12841284
int ret;
12851285
u32 i;
1286+
struct ath10k_bus_params bus_params;
12861287

12871288
of_id = of_match_device(ath10k_snoc_dt_match, &pdev->dev);
12881289
if (!of_id) {
@@ -1350,7 +1351,8 @@ static int ath10k_snoc_probe(struct platform_device *pdev)
13501351
goto err_free_irq;
13511352
}
13521353

1353-
ret = ath10k_core_register(ar, drv_data->hw_rev);
1354+
bus_params.chip_id = drv_data->hw_rev;
1355+
ret = ath10k_core_register(ar, &bus_params);
13541356
if (ret) {
13551357
ath10k_err(ar, "failed to register driver core: %d\n", ret);
13561358
goto err_hw_power_off;

drivers/net/wireless/ath/ath10k/usb.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,7 @@ static int ath10k_usb_probe(struct usb_interface *interface,
983983
struct usb_device *dev = interface_to_usbdev(interface);
984984
int ret, vendor_id, product_id;
985985
enum ath10k_hw_rev hw_rev;
986-
u32 chip_id;
986+
struct ath10k_bus_params bus_params;
987987

988988
/* Assumption: All USB based chipsets (so far) are QCA9377 based.
989989
* If there will be newer chipsets that does not use the hw reg
@@ -1017,8 +1017,8 @@ static int ath10k_usb_probe(struct usb_interface *interface,
10171017
ar->id.device = product_id;
10181018

10191019
/* TODO: don't know yet how to get chip_id with USB */
1020-
chip_id = 0;
1021-
ret = ath10k_core_register(ar, chip_id);
1020+
bus_params.chip_id = 0;
1021+
ret = ath10k_core_register(ar, &bus_params);
10221022
if (ret) {
10231023
ath10k_warn(ar, "failed to register driver core: %d\n", ret);
10241024
goto err;

0 commit comments

Comments
 (0)