OSDN Git Service

ath10k: add struct ath10k_bus_params
authorErik Stromdahl <erik.stromdahl@gmail.com>
Tue, 4 Sep 2018 12:03:19 +0000 (15:03 +0300)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 6 Sep 2018 16:13:50 +0000 (19:13 +0300)
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>
drivers/net/wireless/ath/ath10k/ahb.c
drivers/net/wireless/ath/ath10k/core.c
drivers/net/wireless/ath/ath10k/core.h
drivers/net/wireless/ath/ath10k/pci.c
drivers/net/wireless/ath/ath10k/sdio.c
drivers/net/wireless/ath/ath10k/snoc.c
drivers/net/wireless/ath/ath10k/usb.c

index be90c9e..cfe4552 100644 (file)
@@ -750,7 +750,7 @@ static int ath10k_ahb_probe(struct platform_device *pdev)
        enum ath10k_hw_rev hw_rev;
        size_t size;
        int ret;
-       u32 chip_id;
+       struct ath10k_bus_params bus_params;
 
        of_id = of_match_device(ath10k_ahb_of_match, &pdev->dev);
        if (!of_id) {
@@ -806,14 +806,14 @@ static int ath10k_ahb_probe(struct platform_device *pdev)
 
        ath10k_pci_ce_deinit(ar);
 
-       chip_id = ath10k_ahb_soc_read32(ar, SOC_CHIP_ID_ADDRESS);
-       if (chip_id == 0xffffffff) {
+       bus_params.chip_id = ath10k_ahb_soc_read32(ar, SOC_CHIP_ID_ADDRESS);
+       if (bus_params.chip_id == 0xffffffff) {
                ath10k_err(ar, "failed to get chip id\n");
                ret = -ENODEV;
                goto err_halt_device;
        }
 
-       ret = ath10k_core_register(ar, chip_id);
+       ret = ath10k_core_register(ar, &bus_params);
        if (ret) {
                ath10k_err(ar, "failed to register driver core: %d\n", ret);
                goto err_halt_device;
index 4a56b60..df8e7f7 100644 (file)
@@ -2924,9 +2924,10 @@ err:
        return;
 }
 
-int ath10k_core_register(struct ath10k *ar, u32 chip_id)
+int ath10k_core_register(struct ath10k *ar,
+                        const struct ath10k_bus_params *bus_params)
 {
-       ar->chip_id = chip_id;
+       ar->chip_id = bus_params->chip_id;
        queue_work(ar->workqueue, &ar->register_work);
 
        return 0;
index 27df8ac..5505ead 100644 (file)
@@ -915,6 +915,10 @@ struct ath10k_per_peer_tx_stats {
        u32     reserved2;
 };
 
+struct ath10k_bus_params {
+       u32 chip_id;
+};
+
 struct ath10k {
        struct ath_common ath_common;
        struct ieee80211_hw *hw;
@@ -1204,7 +1208,8 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode,
                      const struct ath10k_fw_components *fw_components);
 int ath10k_wait_for_suspend(struct ath10k *ar, u32 suspend_opt);
 void ath10k_core_stop(struct ath10k *ar);
-int ath10k_core_register(struct ath10k *ar, u32 chip_id);
+int ath10k_core_register(struct ath10k *ar,
+                        const struct ath10k_bus_params *bus_params);
 void ath10k_core_unregister(struct ath10k *ar);
 
 #endif /* _CORE_H_ */
index 001eb13..c337a8b 100644 (file)
@@ -3501,7 +3501,7 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
        struct ath10k *ar;
        struct ath10k_pci *ar_pci;
        enum ath10k_hw_rev hw_rev;
-       u32 chip_id;
+       struct ath10k_bus_params bus_params;
        bool pci_ps;
        int (*pci_soft_reset)(struct ath10k *ar);
        int (*pci_hard_reset)(struct ath10k *ar);
@@ -3637,19 +3637,19 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
                goto err_free_irq;
        }
 
-       chip_id = ath10k_pci_soc_read32(ar, SOC_CHIP_ID_ADDRESS);
-       if (chip_id == 0xffffffff) {
+       bus_params.chip_id = ath10k_pci_soc_read32(ar, SOC_CHIP_ID_ADDRESS);
+       if (bus_params.chip_id == 0xffffffff) {
                ath10k_err(ar, "failed to get chip id\n");
                goto err_free_irq;
        }
 
-       if (!ath10k_pci_chip_is_supported(pdev->device, chip_id)) {
+       if (!ath10k_pci_chip_is_supported(pdev->device, bus_params.chip_id)) {
                ath10k_err(ar, "device %04x with chip_id %08x isn't supported\n",
-                          pdev->device, chip_id);
+                          pdev->device, bus_params.chip_id);
                goto err_free_irq;
        }
 
-       ret = ath10k_core_register(ar, chip_id);
+       ret = ath10k_core_register(ar, &bus_params);
        if (ret) {
                ath10k_err(ar, "failed to register driver core: %d\n", ret);
                goto err_free_irq;
index 7f61591..1d4fd23 100644 (file)
@@ -1941,7 +1941,8 @@ static int ath10k_sdio_probe(struct sdio_func *func,
        struct ath10k_sdio *ar_sdio;
        struct ath10k *ar;
        enum ath10k_hw_rev hw_rev;
-       u32 chip_id, dev_id_base;
+       u32 dev_id_base;
+       struct ath10k_bus_params bus_params;
        int ret, i;
 
        /* Assumption: All SDIO based chipsets (so far) are QCA6174 based.
@@ -2036,8 +2037,8 @@ static int ath10k_sdio_probe(struct sdio_func *func,
        }
 
        /* TODO: don't know yet how to get chip_id with SDIO */
-       chip_id = 0;
-       ret = ath10k_core_register(ar, chip_id);
+       bus_params.chip_id = 0;
+       ret = ath10k_core_register(ar, &bus_params);
        if (ret) {
                ath10k_err(ar, "failed to register driver core: %d\n", ret);
                goto err_free_wq;
index eabf422..21b525a 100644 (file)
@@ -1283,6 +1283,7 @@ static int ath10k_snoc_probe(struct platform_device *pdev)
        struct ath10k *ar;
        int ret;
        u32 i;
+       struct ath10k_bus_params bus_params;
 
        of_id = of_match_device(ath10k_snoc_dt_match, &pdev->dev);
        if (!of_id) {
@@ -1350,7 +1351,8 @@ static int ath10k_snoc_probe(struct platform_device *pdev)
                goto err_free_irq;
        }
 
-       ret = ath10k_core_register(ar, drv_data->hw_rev);
+       bus_params.chip_id = drv_data->hw_rev;
+       ret = ath10k_core_register(ar, &bus_params);
        if (ret) {
                ath10k_err(ar, "failed to register driver core: %d\n", ret);
                goto err_hw_power_off;
index d4803ff..275e00b 100644 (file)
@@ -983,7 +983,7 @@ static int ath10k_usb_probe(struct usb_interface *interface,
        struct usb_device *dev = interface_to_usbdev(interface);
        int ret, vendor_id, product_id;
        enum ath10k_hw_rev hw_rev;
-       u32 chip_id;
+       struct ath10k_bus_params bus_params;
 
        /* Assumption: All USB based chipsets (so far) are QCA9377 based.
         * 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,
        ar->id.device = product_id;
 
        /* TODO: don't know yet how to get chip_id with USB */
-       chip_id = 0;
-       ret = ath10k_core_register(ar, chip_id);
+       bus_params.chip_id = 0;
+       ret = ath10k_core_register(ar, &bus_params);
        if (ret) {
                ath10k_warn(ar, "failed to register driver core: %d\n", ret);
                goto err;