• Marek Vasut's avatar
    net: dsa: microchip: Add shared regmap mutex · 013572a2
    Marek Vasut authored
    The KSZ driver uses one regmap per register width (8/16/32), each with
    it's own lock, but accessing the same set of registers. In theory, it
    is possible to create a race condition between these regmaps, although
    the underlying bus (SPI or I2C) locking should assure nothing bad will
    really happen and the accesses would be correct.
    
    To make the driver do the right thing, add one single shared mutex for
    all the regmaps used by the driver instead. This assures that even if
    some future hardware is on a bus which does not serialize the accesses
    the same way SPI or I2C does, nothing bad will happen.
    
    Note that the status_mutex was unused and only initied, hence it was
    renamed and repurposed as the regmap mutex.
    Signed-off-by: default avatarMarek Vasut <marex@denx.de>
    Cc: Andrew Lunn <andrew@lunn.ch>
    Cc: David S. Miller <davem@davemloft.net>
    Cc: Florian Fainelli <f.fainelli@gmail.com>
    Cc: George McCollister <george.mccollister@gmail.com>
    Cc: Tristram Ha <Tristram.Ha@microchip.com>
    Cc: Woojung Huh <woojung.huh@microchip.com>
    Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    013572a2
ksz_common.c 11.2 KB