linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] iwlwifi: turn on a lockdep assertion
@ 2012-06-09 15:57 Dan Carpenter
  2012-06-09 18:12 ` Johannes Berg
  0 siblings, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2012-06-09 15:57 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Wey-Yi Guy, Intel Linux Wireless, John W. Linville,
	linux-wireless, kernel-janitors

CMD_SYNC is zero so the if (cmd->flags & CMD_SYNC) is never true.  I
think it should be if (cmd->flags == CMD_SYNC).  This enables a lockdep
assertion.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
index e55ec6c..c5ccdfa 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
@@ -1259,7 +1259,7 @@ int iwl_dvm_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
 	 * the mutex, this ensures we don't try to send two
 	 * (or more) synchronous commands at a time.
 	 */
-	if (cmd->flags & CMD_SYNC)
+	if (cmd->flags == CMD_SYNC)
 		lockdep_assert_held(&priv->mutex);
 
 	if (priv->ucode_owner == IWL_OWNERSHIP_TM &&

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [patch] iwlwifi: turn on a lockdep assertion
  2012-06-09 15:57 [patch] iwlwifi: turn on a lockdep assertion Dan Carpenter
@ 2012-06-09 18:12 ` Johannes Berg
  2012-06-09 19:07   ` Dan Carpenter
  2012-06-10 11:25   ` [patch v2] " Dan Carpenter
  0 siblings, 2 replies; 7+ messages in thread
From: Johannes Berg @ 2012-06-09 18:12 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Wey-Yi Guy, Intel Linux Wireless, John W. Linville,
	linux-wireless, kernel-janitors

On Sat, 2012-06-09 at 18:57 +0300, Dan Carpenter wrote:
> CMD_SYNC is zero so the if (cmd->flags & CMD_SYNC) is never true.  I
> think it should be if (cmd->flags == CMD_SYNC).  This enables a lockdep
> assertion.

Good catch, thanks. It should really be if (!(cmd->flags & CMD_ASYNC))
though I think as there could be other flags set which don't make it
non-sync.

I'll commit a fix on Monday unless you want to send a separate patch
(which I'll then pick up on Monday :-) )

johannes



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch] iwlwifi: turn on a lockdep assertion
  2012-06-09 18:12 ` Johannes Berg
@ 2012-06-09 19:07   ` Dan Carpenter
  2012-06-10 11:25   ` [patch v2] " Dan Carpenter
  1 sibling, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2012-06-09 19:07 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Wey-Yi Guy, Intel Linux Wireless, John W. Linville,
	linux-wireless, kernel-janitors

On Sat, Jun 09, 2012 at 08:12:56PM +0200, Johannes Berg wrote:
> On Sat, 2012-06-09 at 18:57 +0300, Dan Carpenter wrote:
> > CMD_SYNC is zero so the if (cmd->flags & CMD_SYNC) is never true.  I
> > think it should be if (cmd->flags == CMD_SYNC).  This enables a lockdep
> > assertion.
> 
> Good catch, thanks. It should really be if (!(cmd->flags & CMD_ASYNC))
> though I think as there could be other flags set which don't make it
> non-sync.
> 
> I'll commit a fix on Monday unless you want to send a separate patch
> (which I'll then pick up on Monday :-) )


Sure.  I'll resend it.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [patch v2] iwlwifi: turn on a lockdep assertion
  2012-06-09 18:12 ` Johannes Berg
  2012-06-09 19:07   ` Dan Carpenter
@ 2012-06-10 11:25   ` Dan Carpenter
  2012-06-10 15:25     ` walter harms
  2012-06-11  6:56     ` Johannes Berg
  1 sibling, 2 replies; 7+ messages in thread
From: Dan Carpenter @ 2012-06-10 11:25 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Wey-Yi Guy, Intel Linux Wireless, John W. Linville,
	linux-wireless, kernel-janitors

CMD_SYNC is zero so the if (cmd->flags & CMD_SYNC) is never true and we
never check the assertion.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: enables the assertion even more than v1 (based on feedback from
Johannes Berg).

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
index e55ec6c..5c04895 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
@@ -1259,7 +1259,7 @@ int iwl_dvm_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
 	 * the mutex, this ensures we don't try to send two
 	 * (or more) synchronous commands at a time.
 	 */
-	if (cmd->flags & CMD_SYNC)
+	if (!(cmd->flags & CMD_ASYNC))
 		lockdep_assert_held(&priv->mutex);
 
 	if (priv->ucode_owner == IWL_OWNERSHIP_TM &&

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [patch v2] iwlwifi: turn on a lockdep assertion
  2012-06-10 11:25   ` [patch v2] " Dan Carpenter
@ 2012-06-10 15:25     ` walter harms
  2012-06-10 15:39       ` Dan Carpenter
  2012-06-11  6:56     ` Johannes Berg
  1 sibling, 1 reply; 7+ messages in thread
From: walter harms @ 2012-06-10 15:25 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Johannes Berg, Wey-Yi Guy, Intel Linux Wireless, John W. Linville,
	linux-wireless, kernel-janitors



Am 10.06.2012 13:25, schrieb Dan Carpenter:
> CMD_SYNC is zero so the if (cmd->flags & CMD_SYNC) is never true and we
> never check the assertion.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> v2: enables the assertion even more than v1 (based on feedback from
> Johannes Berg).

The important part is CMD_SYNC -> CMD_ASYNC

re,
 wh


> 
> diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
> index e55ec6c..5c04895 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
> @@ -1259,7 +1259,7 @@ int iwl_dvm_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
>  	 * the mutex, this ensures we don't try to send two
>  	 * (or more) synchronous commands at a time.
>  	 */
> -	if (cmd->flags & CMD_SYNC)
> +	if (!(cmd->flags & CMD_ASYNC))
>  		lockdep_assert_held(&priv->mutex);
>  
>  	if (priv->ucode_owner == IWL_OWNERSHIP_TM &&
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch v2] iwlwifi: turn on a lockdep assertion
  2012-06-10 15:25     ` walter harms
@ 2012-06-10 15:39       ` Dan Carpenter
  0 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2012-06-10 15:39 UTC (permalink / raw)
  To: walter harms
  Cc: Johannes Berg, Wey-Yi Guy, Intel Linux Wireless, John W. Linville,
	linux-wireless, kernel-janitors

On Sun, Jun 10, 2012 at 05:25:05PM +0200, walter harms wrote:
> 
> 
> Am 10.06.2012 13:25, schrieb Dan Carpenter:
> > CMD_SYNC is zero so the if (cmd->flags & CMD_SYNC) is never true and we
> > never check the assertion.
> > 
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> > v2: enables the assertion even more than v1 (based on feedback from
> > Johannes Berg).
> 
> The important part is CMD_SYNC -> CMD_ASYNC

Not really, no.  I considered Johannes's version for my first patch
but I decided to be conservative because I didn't know the code well
enough to say what is safe.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch v2] iwlwifi: turn on a lockdep assertion
  2012-06-10 11:25   ` [patch v2] " Dan Carpenter
  2012-06-10 15:25     ` walter harms
@ 2012-06-11  6:56     ` Johannes Berg
  1 sibling, 0 replies; 7+ messages in thread
From: Johannes Berg @ 2012-06-11  6:56 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Wey-Yi Guy, Intel Linux Wireless, John W. Linville,
	linux-wireless, kernel-janitors

On Sun, 2012-06-10 at 14:25 +0300, Dan Carpenter wrote:
> CMD_SYNC is zero so the if (cmd->flags & CMD_SYNC) is never true and we
> never check the assertion.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> v2: enables the assertion even more than v1 (based on feedback from
> Johannes Berg).

Thanks, I picked this up.

johannes


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-06-11  6:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-09 15:57 [patch] iwlwifi: turn on a lockdep assertion Dan Carpenter
2012-06-09 18:12 ` Johannes Berg
2012-06-09 19:07   ` Dan Carpenter
2012-06-10 11:25   ` [patch v2] " Dan Carpenter
2012-06-10 15:25     ` walter harms
2012-06-10 15:39       ` Dan Carpenter
2012-06-11  6:56     ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).