staging: wfx: drop useless structs only used in hif_ind_startup
authorJérôme Pouiller <jerome.pouiller@silabs.com>
Mon, 7 Sep 2020 10:15:11 +0000 (12:15 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 13 Sep 2020 07:23:04 +0000 (09:23 +0200)
The structs hif_capabilities, hif_otp_regul_sel_mode_info and
hif_otp_phy_info have no real reasons to exist. Drop them and simplify
access to fields of struct hif_ind_startup.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200907101521.66082-22-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wfx/hif_api_general.h
drivers/staging/wfx/main.c

index 0dc1317..4058016 100644 (file)
@@ -122,25 +122,6 @@ enum hif_fw_type {
        HIF_FW_TYPE_WSM  = 0x2
 };
 
-struct hif_capabilities {
-       u8     link_mode:2;
-       u8     reserved1:6;
-       u8     reserved2;
-       u8     reserved3;
-       u8     reserved4;
-} __packed;
-
-struct hif_otp_regul_sel_mode_info {
-       u8     region_sel_mode:4;
-       u8     reserved:4;
-} __packed;
-
-struct hif_otp_phy_info {
-       u8     phy1_region:3;
-       u8     phy0_region:3;
-       u8     otp_phy_ver:2;
-} __packed;
-
 struct hif_ind_startup {
        // As the others, this struct is interpreted as little endian by the
        // device. However, this struct is also used by the driver. We prefer to
@@ -156,14 +137,21 @@ struct hif_ind_startup {
        u8     mac_addr[2][ETH_ALEN];
        u8     api_version_minor;
        u8     api_version_major;
-       struct hif_capabilities capabilities;
+       u8     link_mode:2;
+       u8     reserved1:6;
+       u8     reserved2;
+       u8     reserved3;
+       u8     reserved4;
        u8     firmware_build;
        u8     firmware_minor;
        u8     firmware_major;
        u8     firmware_type;
        u8     disabled_channel_list[2];
-       struct hif_otp_regul_sel_mode_info regul_sel_mode_info;
-       struct hif_otp_phy_info otp_phy_info;
+       u8     region_sel_mode:4;
+       u8     reserved5:4;
+       u8     phy1_region:3;
+       u8     phy0_region:3;
+       u8     otp_phy_ver:2;
        u32    supported_rate_mask;
        u8     firmware_label[128];
 } __packed;
index 1017a22..2a9098b 100644 (file)
@@ -359,9 +359,8 @@ int wfx_probe(struct wfx_dev *wdev)
        dev_info(wdev->dev, "started firmware %d.%d.%d \"%s\" (API: %d.%d, keyset: %02X, caps: 0x%.8X)\n",
                 wdev->hw_caps.firmware_major, wdev->hw_caps.firmware_minor,
                 wdev->hw_caps.firmware_build, wdev->hw_caps.firmware_label,
-                wdev->hw_caps.api_version_major,
-                wdev->hw_caps.api_version_minor,
-                wdev->keyset, *((u32 *)&wdev->hw_caps.capabilities));
+                wdev->hw_caps.api_version_major, wdev->hw_caps.api_version_minor,
+                wdev->keyset, wdev->hw_caps.link_mode);
        snprintf(wdev->hw->wiphy->fw_version,
                 sizeof(wdev->hw->wiphy->fw_version),
                 "%d.%d.%d",
@@ -377,13 +376,13 @@ int wfx_probe(struct wfx_dev *wdev)
                goto err0;
        }
 
-       if (wdev->hw_caps.capabilities.link_mode == SEC_LINK_ENFORCED) {
+       if (wdev->hw_caps.link_mode == SEC_LINK_ENFORCED) {
                dev_err(wdev->dev,
                        "chip require secure_link, but can't negotiate it\n");
                goto err0;
        }
 
-       if (wdev->hw_caps.regul_sel_mode_info.region_sel_mode) {
+       if (wdev->hw_caps.region_sel_mode) {
                wdev->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels[11].flags |= IEEE80211_CHAN_NO_IR;
                wdev->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels[12].flags |= IEEE80211_CHAN_NO_IR;
                wdev->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels[13].flags |= IEEE80211_CHAN_DISABLED;