diff options
author | Johannes Berg <johannes.berg@intel.com> | 2010-04-28 15:09:13 -0400 |
---|---|---|
committer | Reinette Chatre <reinette.chatre@intel.com> | 2010-05-10 18:08:53 -0400 |
commit | 93b1a2f919a752bb689fdb0c5817c643c2f74435 (patch) | |
tree | cf80efe86323660a0b23031217b4ca32a52058cc | |
parent | 3e4de7616fea5c68a9300af0e347a7f014ddcc63 (diff) |
iwl3945: remove ucode access indirection
As these function pointers will always point to
the 3945 functions, we can just call them directly
and avoid the indirection.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945.c | 40 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl3945-base.c | 39 |
2 files changed, 30 insertions, 49 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 1e9593968c36..a4d842a05836 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
@@ -2751,51 +2751,12 @@ static int iwl3945_load_bsm(struct iwl_priv *priv) | |||
2751 | return 0; | 2751 | return 0; |
2752 | } | 2752 | } |
2753 | 2753 | ||
2754 | #define IWL3945_UCODE_GET(item) \ | ||
2755 | static u32 iwl3945_ucode_get_##item(const struct iwl_ucode_header *ucode,\ | ||
2756 | u32 api_ver) \ | ||
2757 | { \ | ||
2758 | return le32_to_cpu(ucode->u.v1.item); \ | ||
2759 | } | ||
2760 | |||
2761 | static u32 iwl3945_ucode_get_header_size(u32 api_ver) | ||
2762 | { | ||
2763 | return UCODE_HEADER_SIZE(1); | ||
2764 | } | ||
2765 | static u32 iwl3945_ucode_get_build(const struct iwl_ucode_header *ucode, | ||
2766 | u32 api_ver) | ||
2767 | { | ||
2768 | return 0; | ||
2769 | } | ||
2770 | static u8 *iwl3945_ucode_get_data(const struct iwl_ucode_header *ucode, | ||
2771 | u32 api_ver) | ||
2772 | { | ||
2773 | return (u8 *) ucode->u.v1.data; | ||
2774 | } | ||
2775 | |||
2776 | IWL3945_UCODE_GET(inst_size); | ||
2777 | IWL3945_UCODE_GET(data_size); | ||
2778 | IWL3945_UCODE_GET(init_size); | ||
2779 | IWL3945_UCODE_GET(init_data_size); | ||
2780 | IWL3945_UCODE_GET(boot_size); | ||
2781 | |||
2782 | static struct iwl_hcmd_ops iwl3945_hcmd = { | 2754 | static struct iwl_hcmd_ops iwl3945_hcmd = { |
2783 | .rxon_assoc = iwl3945_send_rxon_assoc, | 2755 | .rxon_assoc = iwl3945_send_rxon_assoc, |
2784 | .commit_rxon = iwl3945_commit_rxon, | 2756 | .commit_rxon = iwl3945_commit_rxon, |
2785 | .send_bt_config = iwl_send_bt_config, | 2757 | .send_bt_config = iwl_send_bt_config, |
2786 | }; | 2758 | }; |
2787 | 2759 | ||
2788 | static struct iwl_ucode_ops iwl3945_ucode = { | ||
2789 | .get_header_size = iwl3945_ucode_get_header_size, | ||
2790 | .get_build = iwl3945_ucode_get_build, | ||
2791 | .get_inst_size = iwl3945_ucode_get_inst_size, | ||
2792 | .get_data_size = iwl3945_ucode_get_data_size, | ||
2793 | .get_init_size = iwl3945_ucode_get_init_size, | ||
2794 | .get_init_data_size = iwl3945_ucode_get_init_data_size, | ||
2795 | .get_boot_size = iwl3945_ucode_get_boot_size, | ||
2796 | .get_data = iwl3945_ucode_get_data, | ||
2797 | }; | ||
2798 | |||
2799 | static struct iwl_lib_ops iwl3945_lib = { | 2760 | static struct iwl_lib_ops iwl3945_lib = { |
2800 | .txq_attach_buf_to_tfd = iwl3945_hw_txq_attach_buf_to_tfd, | 2761 | .txq_attach_buf_to_tfd = iwl3945_hw_txq_attach_buf_to_tfd, |
2801 | .txq_free_tfd = iwl3945_hw_txq_free_tfd, | 2762 | .txq_free_tfd = iwl3945_hw_txq_free_tfd, |
@@ -2847,7 +2808,6 @@ static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = { | |||
2847 | }; | 2808 | }; |
2848 | 2809 | ||
2849 | static const struct iwl_ops iwl3945_ops = { | 2810 | static const struct iwl_ops iwl3945_ops = { |
2850 | .ucode = &iwl3945_ucode, | ||
2851 | .lib = &iwl3945_lib, | 2811 | .lib = &iwl3945_lib, |
2852 | .hcmd = &iwl3945_hcmd, | 2812 | .hcmd = &iwl3945_hcmd, |
2853 | .utils = &iwl3945_hcmd_utils, | 2813 | .utils = &iwl3945_hcmd_utils, |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 9486b3248245..e9de10964c51 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -2109,6 +2109,28 @@ static void iwl3945_nic_start(struct iwl_priv *priv) | |||
2109 | iwl_write32(priv, CSR_RESET, 0); | 2109 | iwl_write32(priv, CSR_RESET, 0); |
2110 | } | 2110 | } |
2111 | 2111 | ||
2112 | #define IWL3945_UCODE_GET(item) \ | ||
2113 | static u32 iwl3945_ucode_get_##item(const struct iwl_ucode_header *ucode)\ | ||
2114 | { \ | ||
2115 | return le32_to_cpu(ucode->u.v1.item); \ | ||
2116 | } | ||
2117 | |||
2118 | static u32 iwl3945_ucode_get_header_size(u32 api_ver) | ||
2119 | { | ||
2120 | return UCODE_HEADER_SIZE(1); | ||
2121 | } | ||
2122 | |||
2123 | static u8 *iwl3945_ucode_get_data(const struct iwl_ucode_header *ucode) | ||
2124 | { | ||
2125 | return (u8 *) ucode->u.v1.data; | ||
2126 | } | ||
2127 | |||
2128 | IWL3945_UCODE_GET(inst_size); | ||
2129 | IWL3945_UCODE_GET(data_size); | ||
2130 | IWL3945_UCODE_GET(init_size); | ||
2131 | IWL3945_UCODE_GET(init_data_size); | ||
2132 | IWL3945_UCODE_GET(boot_size); | ||
2133 | |||
2112 | /** | 2134 | /** |
2113 | * iwl3945_read_ucode - Read uCode images from disk file. | 2135 | * iwl3945_read_ucode - Read uCode images from disk file. |
2114 | * | 2136 | * |
@@ -2157,7 +2179,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv) | |||
2157 | goto error; | 2179 | goto error; |
2158 | 2180 | ||
2159 | /* Make sure that we got at least our header! */ | 2181 | /* Make sure that we got at least our header! */ |
2160 | if (ucode_raw->size < priv->cfg->ops->ucode->get_header_size(1)) { | 2182 | if (ucode_raw->size < iwl3945_ucode_get_header_size(1)) { |
2161 | IWL_ERR(priv, "File size way too small!\n"); | 2183 | IWL_ERR(priv, "File size way too small!\n"); |
2162 | ret = -EINVAL; | 2184 | ret = -EINVAL; |
2163 | goto err_release; | 2185 | goto err_release; |
@@ -2168,13 +2190,12 @@ static int iwl3945_read_ucode(struct iwl_priv *priv) | |||
2168 | 2190 | ||
2169 | priv->ucode_ver = le32_to_cpu(ucode->ver); | 2191 | priv->ucode_ver = le32_to_cpu(ucode->ver); |
2170 | api_ver = IWL_UCODE_API(priv->ucode_ver); | 2192 | api_ver = IWL_UCODE_API(priv->ucode_ver); |
2171 | inst_size = priv->cfg->ops->ucode->get_inst_size(ucode, api_ver); | 2193 | inst_size = iwl3945_ucode_get_inst_size(ucode); |
2172 | data_size = priv->cfg->ops->ucode->get_data_size(ucode, api_ver); | 2194 | data_size = iwl3945_ucode_get_data_size(ucode); |
2173 | init_size = priv->cfg->ops->ucode->get_init_size(ucode, api_ver); | 2195 | init_size = iwl3945_ucode_get_init_size(ucode); |
2174 | init_data_size = | 2196 | init_data_size = iwl3945_ucode_get_init_data_size(ucode); |
2175 | priv->cfg->ops->ucode->get_init_data_size(ucode, api_ver); | 2197 | boot_size = iwl3945_ucode_get_boot_size(ucode); |
2176 | boot_size = priv->cfg->ops->ucode->get_boot_size(ucode, api_ver); | 2198 | src = iwl3945_ucode_get_data(ucode); |
2177 | src = priv->cfg->ops->ucode->get_data(ucode, api_ver); | ||
2178 | 2199 | ||
2179 | /* api_ver should match the api version forming part of the | 2200 | /* api_ver should match the api version forming part of the |
2180 | * firmware filename ... but we don't check for that and only rely | 2201 | * firmware filename ... but we don't check for that and only rely |
@@ -2223,7 +2244,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv) | |||
2223 | 2244 | ||
2224 | 2245 | ||
2225 | /* Verify size of file vs. image size info in file's header */ | 2246 | /* Verify size of file vs. image size info in file's header */ |
2226 | if (ucode_raw->size != priv->cfg->ops->ucode->get_header_size(api_ver) + | 2247 | if (ucode_raw->size != iwl3945_ucode_get_header_size(api_ver) + |
2227 | inst_size + data_size + init_size + | 2248 | inst_size + data_size + init_size + |
2228 | init_data_size + boot_size) { | 2249 | init_data_size + boot_size) { |
2229 | 2250 | ||