On Wed, Apr 06, 2011 at 11:16:07AM -0400, Alan Stern wrote:
> On Wed, 6 Apr 2011, Joerg Roedel wrote:

> The counter really should be a bool: Has the chipset already been
> probed or not?  After all, nobody cares how many times this routine was 
> called.
> 
> > +   spin_unlock_irqrestore(&amd_lock, flags);
> 
> This code now contains a bug: You incremented the probe_count _before_
> doing the probe.  If another thread calls this routine right now, it
> will get an incorrect result.
> 
> Fixing this up should be fairly easy.

Hmm, we can get rid of the amd_lock completly if every thread uses the
following call-order:

        usb_amd_find_chipset_info();
        usb_amd_quirk_pll_enable();
        usb_amd_quirk_pll_disable();
        usb_amd_dev_put();

In that case we can just change the probe_count and isoc_reqs into
atomic_t with some care and should be fine, no?
Problem is that I don't know if the above call-order is guaranteed.

        Joerg

-- 
AMD Operating System Research Center

Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo, Andrew Bowd
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632

_______________________________________________
stable mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/stable

Reply via email to