Re: [PATCH v2] net: davicom: dm9000: Avoid spinlock recursion during dm9000_timeout routine

From: xiang fei
Date: Sat Jul 15 2017 - 04:57:05 EST


Hi,
In this patch, I don't change the routine of dm9000_phy_write().
I just abstract the real phy operation from dm9000_phy_write()
to make a new function dm9000_phy_write_reg(),
which contains no lock.

It is called in dm9000_phy_write() or dm9000_init_dm9000().
Since dm9000_timeout() holds the main spinlock through the
entire routine, dm9000_phy_write_reg() called in this routine is
protected from another thread. I think there is no need to
acquire any locks.

The only problem is dm9000_init_dm9000() may be called
in dm9000_open(). If another thread calls dm9000_open()
in timeout may cause race condition.

dm9000_init_dm9000() needs lock to avoid race condition,
did you mean that?
Thanks!