linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Buesch <mb@bu3sch.de>
To: "Alina Friedrichsen" <x-alina@gmx.net>
Cc: linux-wireless@vger.kernel.org, linville@tuxdriver.com,
	johannes@sipsolutions.net
Subject: Re: [PATCH] b43: Accessing the TSF via mac80211
Date: Sun, 25 Jan 2009 13:57:04 +0100	[thread overview]
Message-ID: <200901251357.05020.mb@bu3sch.de> (raw)
In-Reply-To: <200901251355.49220.mb@bu3sch.de>

On Sunday 25 January 2009 13:55:49 Michael Buesch wrote:
> On Sunday 25 January 2009 13:51:50 Michael Buesch wrote:
> > On Sunday 25 January 2009 13:41:51 Alina Friedrichsen wrote:
> > > This allows the mac80211 high level code to access the TSF. This is e.g. needed for BSSID merges in the IBSS mode.
> > 
> > Thanks, can you also remove our private debugfs hook?
> > 
> > > Signed-off-by: Alina Friedrichsen <x-alina@gmx.net>
> > > ---
> > > diff -urN wireless-testing.orig/drivers/net/wireless/b43/main.c wireless-testing/drivers/net/wireless/b43/main.c
> > > --- wireless-testing.orig/drivers/net/wireless/b43/main.c	2009-01-25 06:12:13.000000000 +0100
> > > +++ wireless-testing/drivers/net/wireless/b43/main.c	2009-01-25 13:09:35.000000000 +0100
> > > @@ -3177,6 +3177,25 @@
> > >  	return 0;
> > >  }
> > >  
> > > +static u64 b43_op_get_tsf(struct ieee80211_hw *hw)
> > > +{
> > > +	struct b43_wl *wl = hw_to_b43_wl(hw);
> > > +	struct b43_wldev *dev = wl->current_dev;
> > > +	u64 tsf;
> > > +
> > 
> > You must add a check and locking here.
> > 
> > 	if (dev && (b43_status(dev) >= B43_STAT_INITIALIZED)) {
> > 		mutex_lock(&wl->mutex);
> > 		spin_lock_irq(&wl->irq_lock);
> > 
> > > +	b43_tsf_read(dev, &tsf);
> > 
> > 		spin_unlock_irq(&wl->irq_lock);
> > 		mutex_unlock(&wl->mutex);
> > 	} else
> > 		tsf = 0; //FIXME what to do on error?
> > 
> > > +	return tsf;
> > > +}
> 
> Whoops, I got it wrong :D
> This is what it should look like:
> 
> static u64 b43_op_get_tsf(struct ieee80211_hw *hw)
> {
>        struct b43_wl *wl = hw_to_b43_wl(hw);
>        struct b43_wldev *dev = wl->current_dev;
>        u64 tsf;
> 
> 	mutex_lock(&wl->mutex);
> 	spin_lock_irq(&wl->irq_lock);
> 	if (dev && (b43_status(dev) >= B43_STAT_INITIALIZED))
> 		b43_tsf_read(dev, &tsf);
> 	else
> 		tsf = 0;//FIXME? what to do on error?
> 	spin_unlock_irq(&wl->irq_lock);
> 	mutex_unlock(&wl->mutex);
> 
>        return tsf;
> }
> 

Damn, I'm not awake, yet.
The   dev = wl->current_dev   also must be inside of the mutex.

-- 
Greetings, Michael.

  reply	other threads:[~2009-01-25 12:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-25 12:41 [PATCH] b43: Accessing the TSF via mac80211 Alina Friedrichsen
2009-01-25 12:51 ` Michael Buesch
2009-01-25 12:55   ` Michael Buesch
2009-01-25 12:57     ` Michael Buesch [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-01-25 14:06 Alina Friedrichsen

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=200901251357.05020.mb@bu3sch.de \
    --to=mb@bu3sch.de \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=x-alina@gmx.net \
    /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;
as well as URLs for NNTP newsgroup(s).