Fix lockdep warning during device probing: move sysfs initialization out of code protected by a spin lock.
Signed-off-by: Alexandre Bounine <alexandre.boun...@idt.com> Cc: Matt Porter <mpor...@kernel.crashing.org> Cc: Andre van Herk <andre.van.h...@prodrive-technologies.com> Cc: Barry Wood <barry.w...@idt.com> Cc: linux-kernel@vger.kernel.org --- drivers/rapidio/switches/idt_gen2.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/rapidio/switches/idt_gen2.c b/drivers/rapidio/switches/idt_gen2.c index 9f7fe21..e67b923 100644 --- a/drivers/rapidio/switches/idt_gen2.c +++ b/drivers/rapidio/switches/idt_gen2.c @@ -436,10 +436,11 @@ static int idtg2_probe(struct rio_dev *rdev, const struct rio_device_id *id) RIO_STD_RTE_DEFAULT_PORT, IDT_NO_ROUTE); } + spin_unlock(&rdev->rswitch->lock); + /* Create device-specific sysfs attributes */ idtg2_sysfs(rdev, true); - spin_unlock(&rdev->rswitch->lock); return 0; } @@ -452,11 +453,9 @@ static void idtg2_remove(struct rio_dev *rdev) return; } rdev->rswitch->ops = NULL; - + spin_unlock(&rdev->rswitch->lock); /* Remove device-specific sysfs attributes */ idtg2_sysfs(rdev, false); - - spin_unlock(&rdev->rswitch->lock); } static struct rio_device_id idtg2_id_table[] = { -- 1.7.8.4