Linux wireless drivers development
 help / color / mirror / Atom feed
From: Zhu Yi <yi.zhu@intel.com>
To: linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org,
	ipw3945-devel@lists.sourceforge.net,
	Samuel Ortiz <samuel.ortiz@intel.com>,
	Reinette Chatre <reinette.chatre@intel.com>
Subject: [PATCH 14/43] iwl3945: Remove power related definitions from 3945 code
Date: Fri, 19 Dec 2008 10:37:14 +0800	[thread overview]
Message-ID: <1229654263-21454-15-git-send-email-yi.zhu@intel.com> (raw)
In-Reply-To: <1229654263-21454-14-git-send-email-yi.zhu@intel.com>

From: Samuel Ortiz <samuel.ortiz@intel.com>

Most of the power (not TX power, but power management) structures and
definitions are duplicated accross iwl-power.h and iwl-3945.h. We should try
to only use the iwl header.

Signed-off-by: Samuel Ortiz <samuel.ortiz@intel.com>
Acked-by: Abhijeet Kolekar <abhijeet.kolekar@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-3945.h     |   28 +--------------------------
 drivers/net/wireless/iwlwifi/iwl-power.h    |   16 +++++++++++++++
 drivers/net/wireless/iwlwifi/iwl3945-base.c |   25 ++++++++++++-----------
 3 files changed, 30 insertions(+), 39 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h
index 6d0ec0a..dd15b32 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.h
@@ -47,6 +47,7 @@ extern struct pci_device_id iwl3945_hw_card_ids[];
 #include "iwl-prph.h"
 #include "iwl-3945-hw.h"
 #include "iwl-debug.h"
+#include "iwl-power.h"
 #include "iwl-3945-led.h"
 
 /* Highest firmware API version supported */
@@ -246,33 +247,6 @@ struct iwl3945_clip_group {
 /* Minimum number of queues. MAX_NUM is defined in hw specific files */
 #define IWL_MIN_NUM_QUEUES	4
 
-/* Power management (not Tx power) structures */
-
-struct iwl3945_power_vec_entry {
-	struct iwl_powertable_cmd cmd;
-	u8 no_dtim;
-};
-#define IWL_POWER_RANGE_0  (0)
-#define IWL_POWER_RANGE_1  (1)
-
-#define IWL_POWER_MODE_CAM	0x00	/* Continuously Aware Mode, always on */
-#define IWL_POWER_INDEX_3	0x03
-#define IWL_POWER_INDEX_5	0x05
-#define IWL_POWER_AC		0x06
-#define IWL_POWER_BATTERY	0x07
-#define IWL_POWER_LIMIT		0x07
-#define IWL_POWER_MASK		0x0F
-#define IWL_POWER_ENABLED	0x10
-#define IWL_POWER_LEVEL(x)	((x) & IWL_POWER_MASK)
-
-struct iwl3945_power_mgr {
-	spinlock_t lock;
-	struct iwl3945_power_vec_entry pwr_range_0[IWL_POWER_AC];
-	struct iwl3945_power_vec_entry pwr_range_1[IWL_POWER_AC];
-	u8 active_index;
-	u32 dtim_val;
-};
-
 #define IEEE80211_DATA_LEN              2304
 #define IEEE80211_4ADDR_LEN             30
 #define IEEE80211_HLEN                  (IEEE80211_4ADDR_LEN)
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.h b/drivers/net/wireless/iwlwifi/iwl-power.h
index fa098d8..7cab04f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-power.h
+++ b/drivers/net/wireless/iwlwifi/iwl-power.h
@@ -42,7 +42,10 @@ enum {
 	IWL_POWER_INDEX_5,
 	IWL_POWER_AUTO,
 	IWL_POWER_MAX = IWL_POWER_AUTO,
+	IWL39_POWER_AC = IWL_POWER_AUTO, /* 0x06 */
 	IWL_POWER_AC,
+	IWL39_POWER_BATTERY = IWL_POWER_AC, /* 0x07 */
+	IWL39_POWER_LIMIT = IWL_POWER_AC,
 	IWL_POWER_BATTERY,
 };
 
@@ -56,6 +59,11 @@ enum {
 #define IWL_POWER_MASK		0x0F
 #define IWL_POWER_ENABLED	0x10
 
+#define IWL_POWER_RANGE_0  (0)
+#define IWL_POWER_RANGE_1  (1)
+
+#define IWL_POWER_LEVEL(x)	((x) & IWL_POWER_MASK)
+
 /* Power management (not Tx power) structures */
 
 struct iwl_power_vec_entry {
@@ -78,6 +86,14 @@ struct iwl_power_mgr {
 	u8 power_disabled; /* flag to disable using power saving level */
 };
 
+struct iwl3945_power_mgr {
+	spinlock_t lock;
+	struct iwl_power_vec_entry pwr_range_0[IWL_POWER_AC];
+	struct iwl_power_vec_entry pwr_range_1[IWL_POWER_AC];
+	u8 active_index;
+	u32 dtim_val;
+};
+
 void iwl_setup_power_deferred_work(struct iwl_priv *priv);
 void iwl_power_cancel_timeout(struct iwl_priv *priv);
 int iwl_power_update_mode(struct iwl_priv *priv, bool force);
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index ee77066..9eb5b12 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -1817,7 +1817,7 @@ static void iwl3945_activate_qos(struct iwl3945_priv *priv, u8 force)
 
 /* default power management (not Tx power) table values */
 /* for TIM  0-10 */
-static struct iwl3945_power_vec_entry range_0[IWL_POWER_AC] = {
+static struct iwl_power_vec_entry range_0[IWL39_POWER_AC] = {
 	{{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0},
 	{{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500), SLP_VEC(1, 2, 3, 4, 4)}, 0},
 	{{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(300), SLP_VEC(2, 4, 6, 7, 7)}, 0},
@@ -1827,7 +1827,7 @@ static struct iwl3945_power_vec_entry range_0[IWL_POWER_AC] = {
 };
 
 /* for TIM > 10 */
-static struct iwl3945_power_vec_entry range_1[IWL_POWER_AC] = {
+static struct iwl_power_vec_entry range_1[IWL39_POWER_AC] = {
 	{{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0},
 	{{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500),
 		 SLP_VEC(1, 2, 3, 4, 0xFF)}, 0},
@@ -1844,7 +1844,7 @@ int iwl3945_power_init_handle(struct iwl3945_priv *priv)
 {
 	int rc = 0, i;
 	struct iwl3945_power_mgr *pow_data;
-	int size = sizeof(struct iwl3945_power_vec_entry) * IWL_POWER_AC;
+	int size = sizeof(struct iwl_power_vec_entry) * IWL39_POWER_AC;
 	u16 pci_pm;
 
 	IWL_DEBUG_POWER("Initialize power \n");
@@ -1867,7 +1867,7 @@ int iwl3945_power_init_handle(struct iwl3945_priv *priv)
 
 		IWL_DEBUG_POWER("adjust power command flags\n");
 
-		for (i = 0; i < IWL_POWER_AC; i++) {
+		for (i = 0; i < IWL39_POWER_AC; i++) {
 			cmd = &pow_data->pwr_range_0[i].cmd;
 
 			if (pci_pm & 0x1)
@@ -1885,7 +1885,7 @@ static int iwl3945_update_power_cmd(struct iwl3945_priv *priv,
 	int rc = 0, i;
 	u8 skip;
 	u32 max_sleep = 0;
-	struct iwl3945_power_vec_entry *range;
+	struct iwl_power_vec_entry *range;
 	u8 period = 0;
 	struct iwl3945_power_mgr *pow_data;
 
@@ -1953,10 +1953,10 @@ static int iwl3945_send_power_mode(struct iwl3945_priv *priv, u32 mode)
 	 * if plugged into AC power, set to CAM ("continuously aware mode"),
 	 * else user level */
 	switch (mode) {
-	case IWL_POWER_BATTERY:
+	case IWL39_POWER_BATTERY:
 		final_mode = IWL_POWER_INDEX_3;
 		break;
-	case IWL_POWER_AC:
+	case IWL39_POWER_AC:
 		final_mode = IWL_POWER_MODE_CAM;
 		break;
 	default:
@@ -7528,8 +7528,9 @@ static ssize_t store_power_level(struct device *d,
 		goto out;
 	}
 
-	if ((mode < 1) || (mode > IWL_POWER_LIMIT) || (mode == IWL_POWER_AC))
-		mode = IWL_POWER_AC;
+	if ((mode < 1) || (mode > IWL39_POWER_LIMIT) ||
+	    (mode == IWL39_POWER_AC))
+		mode = IWL39_POWER_AC;
 	else
 		mode |= IWL_POWER_ENABLED;
 
@@ -7577,10 +7578,10 @@ static ssize_t show_power_level(struct device *d,
 	p += sprintf(p, "%d ", level);
 	switch (level) {
 	case IWL_POWER_MODE_CAM:
-	case IWL_POWER_AC:
+	case IWL39_POWER_AC:
 		p += sprintf(p, "(AC)");
 		break;
-	case IWL_POWER_BATTERY:
+	case IWL39_POWER_BATTERY:
 		p += sprintf(p, "(BATTERY)");
 		break;
 	default:
@@ -7986,7 +7987,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
 
 	priv->rates_mask = IWL_RATES_MASK;
 	/* If power management is turned on, default to AC mode */
-	priv->power_mode = IWL_POWER_AC;
+	priv->power_mode = IWL39_POWER_AC;
 	priv->user_txpower_limit = IWL_DEFAULT_TX_POWER;
 
 	err = iwl3945_init_channel_map(priv);
-- 
1.5.3.6


  reply	other threads:[~2008-12-19  2:45 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-19  2:37 [PATCH 00/43] iwl3945 merges into iwlagn (Dec 19) Zhu Yi
2008-12-19  2:37 ` [PATCH 01/43] iwlwifi: 3945 extract flow handler definitions into iwl-3945-fh.h Zhu Yi
2008-12-19  2:37   ` [PATCH 02/43] iwlwifi: 3945 unfold iwl-3945-commands.h Zhu Yi
2008-12-19  2:37     ` [PATCH 03/43] iwlwifi: 3945 remove current_rate from station entry Zhu Yi
2008-12-19  2:37       ` [PATCH 04/43] iwlwifi: use iwl-commands.h also in 3945 Zhu Yi
2008-12-19  2:37         ` [PATCH 05/43] iwlwifi: 3945 remove duplicated code from iwl-3945-commands.h Zhu Yi
2008-12-19  2:37           ` [PATCH 06/43] iwlwifi: 3945 drop usage of union tsf Zhu Yi
2008-12-19  2:37             ` [PATCH 07/43] iwlwifi: 3945 remove iwl-3945-commands.h Zhu Yi
2008-12-19  2:37               ` [PATCH 08/43] iwl3945: Getting rid of iwl-3945-debug.h Zhu Yi
2008-12-19  2:37                 ` [PATCH 09/43] iwl3945: Remove DRV_NAME dependenies Zhu Yi
2008-12-19  2:37                   ` [PATCH 10/43] iwl3945: Getting rid of iwl3945_eeprom_channel Zhu Yi
2008-12-19  2:37                     ` [PATCH 11/43] iwl3945: Have consistant and not redefined HW constants Zhu Yi
2008-12-19  2:37                       ` [PATCH 12/43] iwl3945: Use iwl-agn-rs.h rates definitions Zhu Yi
2008-12-19  2:37                         ` [PATCH 13/43] iwl3945: Getting rid of iwl-3945-led.h Zhu Yi
2008-12-19  2:37                           ` Zhu Yi [this message]
2008-12-19  2:37                             ` [PATCH 15/43] iwl3945: iwl3945_queue and iwl3945_channel_info replacement Zhu Yi
2008-12-19  2:37                               ` [PATCH 16/43] iwlwifi: emliminate iwl3945_mac_get_stats mac80211 handler Zhu Yi
2008-12-19  2:37                                 ` [PATCH 17/43] iwl3945: Change IWLWIFI_VERSION constant name Zhu Yi
2008-12-19  2:37                                   ` [PATCH 18/43] iwl3945: include iwl-core.h Zhu Yi
2008-12-19  2:37                                     ` [PATCH 19/43] iwl3945: replace iwl_3945_cfg with iwl_cfg Zhu Yi
2008-12-19  2:37                                       ` [PATCH 20/43] iwl3945: move structures from iwl-3945.h to iwl-dev.h Zhu Yi
2008-12-19  2:37                                         ` [PATCH 21/43] iwl3945: remove duplicate structures from iwl-3945.h Zhu Yi
2008-12-19  2:37                                           ` [PATCH 22/43] iwl3945: replace iwl3945_broadcast_addr with iwl_bcast_addr Zhu Yi
2008-12-19  2:37                                             ` [PATCH 23/43] iwlwifi: beautify code Zhu Yi
2008-12-19  2:37                                               ` [PATCH 24/43] iwl3945: use iwl_rx_mem_buffer Zhu Yi
2008-12-19  2:37                                                 ` [PATCH 25/43] iwl3945: use iwl_rx_queue in iwl3945 Zhu Yi
2008-12-19  2:37                                                   ` [PATCH 26/43] iwl3945: use iwl_hw_params in iwl3945_priv Zhu Yi
2008-12-19  2:37                                                     ` [PATCH 27/43] iwl3945: rename iwl3945_priv variables Zhu Yi
2008-12-19  2:37                                                       ` [PATCH 28/43] iwl3945: replaces iwl3945_priv with iwl_priv Zhu Yi
2008-12-19  2:37                                                         ` [PATCH 29/43] iwl3945: use iwl-io.h and delete iwl-3945-io.h Zhu Yi
2008-12-19  2:37                                                           ` [PATCH 30/43] iwlwifi: add more comments to IWL_DL_xx Zhu Yi
2008-12-19  2:37                                                             ` [PATCH 31/43] iwlwifi: clean up printing Zhu Yi
2008-12-19  2:37                                                               ` [PATCH 32/43] iwlwifi: replace IWL_WARNING with IWL_WARN Zhu Yi
2008-12-19  2:37                                                                 ` [PATCH 33/43] iwlwifi: replace IWL_ERROR with IWL_ERR Zhu Yi
2008-12-19  2:37                                                                   ` [PATCH 34/43] iwlwifi: use iwl_cmd instead of iwl3945_cmd Zhu Yi
2008-12-19  2:37                                                                     ` [PATCH 35/43] iwl3945: use iwl_mod_params for 3945 Zhu Yi
2008-12-19  2:37                                                                       ` [PATCH 36/43] iwl3945: cleanup and remove duplicate code Zhu Yi
2008-12-19  2:37                                                                         ` [PATCH 37/43] iwl3945: add load ucode op Zhu Yi
2008-12-19  2:37                                                                           ` [PATCH 38/43] iwl3945: add apm ops Zhu Yi
2008-12-19  2:37                                                                             ` [PATCH 39/43] iwl3945: add set_pwr_src Zhu Yi
2008-12-19  2:37                                                                               ` [PATCH 40/43] iwl3945: simplify iwl3945_pci_probe Zhu Yi
2008-12-19  2:37                                                                                 ` [PATCH 41/43] iwl3945: release resources before shutting down Zhu Yi
2008-12-19  2:37                                                                                   ` [PATCH 42/43] iwl3945: use iwl_get_hw_mode Zhu Yi
2008-12-19  2:37                                                                                     ` [PATCH 43/43] iwl3945: use iwl_rb_status Zhu Yi
2008-12-19 19:32 ` [PATCH 00/43] iwl3945 merges into iwlagn (Dec 19) drago01
2008-12-19 20:51   ` Luis R. Rodriguez
2008-12-19 21:15     ` drago01
2008-12-19 21:20       ` Stefanik Gábor
2008-12-22  3:55   ` Zhu Yi
2008-12-22  6:57     ` [ipw3945-devel] " Rafał Miłecki
2008-12-19 21:08 ` Maxim Levitsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1229654263-21454-15-git-send-email-yi.zhu@intel.com \
    --to=yi.zhu@intel.com \
    --cc=ipw3945-devel@lists.sourceforge.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=reinette.chatre@intel.com \
    --cc=samuel.ortiz@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox