aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordave graham <david.graham@intel.com>2009-02-15 02:46:10 -0500
committerDavid S. Miller <davem@davemloft.net>2009-02-15 02:46:10 -0500
commit0a834a36ac92375cd82d9e4fe4f571e257997d6a (patch)
tree5c9ffb2dafe2aa7f26b68d16d2ec3eb93311a38a
parent5e30589521518bff36fd2638b3c3d69679c50436 (diff)
e1000e: Remove mutex_trylock and associated WARN on failure.
Single-thread access must be ensured for ICH8 NVM and PHY operations. This synchronization is provided by the nvm_mutex. To assist in understanding the contexts from which this code could be reached, a WARN was output if the mutex was not going to be immediately acquirable (if !mutex_trylock()). The code has now been optimized, and we have verified that the few remaining mutex contentions are reasonable and non-blocking, and it is time to remove the mutex_trylock() and WARN messages. Signed-off-by: dave graham <david.graham@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/e1000e/ich8lan.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
index e415e81ecd3e..6d1aab6316ba 100644
--- a/drivers/net/e1000e/ich8lan.c
+++ b/drivers/net/e1000e/ich8lan.c
@@ -390,8 +390,6 @@ static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter)
390} 390}
391 391
392static DEFINE_MUTEX(nvm_mutex); 392static DEFINE_MUTEX(nvm_mutex);
393static pid_t nvm_owner_pid = -1;
394static char nvm_owner_name[TASK_COMM_LEN] = "";
395 393
396/** 394/**
397 * e1000_acquire_swflag_ich8lan - Acquire software control flag 395 * e1000_acquire_swflag_ich8lan - Acquire software control flag
@@ -408,16 +406,7 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
408 406
409 might_sleep(); 407 might_sleep();
410 408
411 if (!mutex_trylock(&nvm_mutex)) { 409 mutex_lock(&nvm_mutex);
412 WARN(1, KERN_ERR "e1000e mutex contention. Owned by process "
413 "%s (pid %d), required by process %s (pid %d)\n",
414 nvm_owner_name, nvm_owner_pid,
415 current->comm, current->pid);
416
417 mutex_lock(&nvm_mutex);
418 }
419 nvm_owner_pid = current->pid;
420 strncpy(nvm_owner_name, current->comm, TASK_COMM_LEN);
421 410
422 while (timeout) { 411 while (timeout) {
423 extcnf_ctrl = er32(EXTCNF_CTRL); 412 extcnf_ctrl = er32(EXTCNF_CTRL);
@@ -435,8 +424,6 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
435 hw_dbg(hw, "FW or HW has locked the resource for too long.\n"); 424 hw_dbg(hw, "FW or HW has locked the resource for too long.\n");
436 extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG; 425 extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG;
437 ew32(EXTCNF_CTRL, extcnf_ctrl); 426 ew32(EXTCNF_CTRL, extcnf_ctrl);
438 nvm_owner_pid = -1;
439 strcpy(nvm_owner_name, "");
440 mutex_unlock(&nvm_mutex); 427 mutex_unlock(&nvm_mutex);
441 return -E1000_ERR_CONFIG; 428 return -E1000_ERR_CONFIG;
442 } 429 }
@@ -460,8 +447,6 @@ static void e1000_release_swflag_ich8lan(struct e1000_hw *hw)
460 extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG; 447 extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG;
461 ew32(EXTCNF_CTRL, extcnf_ctrl); 448 ew32(EXTCNF_CTRL, extcnf_ctrl);
462 449
463 nvm_owner_pid = -1;
464 strcpy(nvm_owner_name, "");
465 mutex_unlock(&nvm_mutex); 450 mutex_unlock(&nvm_mutex);
466} 451}
467 452