From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752536AbbHLMUw (ORCPT ); Wed, 12 Aug 2015 08:20:52 -0400 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:40399 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750735AbbHLMUv (ORCPT ); Wed, 12 Aug 2015 08:20:51 -0400 From: Mark Brown To: Liam Girdwood Cc: linux-kernel@vger.kernel.org, Mark Brown Date: Wed, 12 Aug 2015 13:20:41 +0100 Message-Id: <1439382043-24857-1-git-send-email-broonie@kernel.org> X-Mailer: git-send-email 2.5.0 X-SA-Exim-Connect-IP: 94.175.94.161 X-SA-Exim-Mail-From: broonie@sirena.org.uk Subject: [PATCH 1/3] regulator: core: Reduce rdev locking region when releasing regulator X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on mezzanine.sirena.org.uk) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When we release a regulator we need to remove references to it from the rdev which means locking the rdev. Currently we also free resources associated with the regulator inside the rdev lock but there is no need to do this, we can reduce the region the lock is held by restricting it to just actions that affect the rdev. Signed-off-by: Mark Brown --- drivers/regulator/core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 62e4f3b..89be8e2 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1601,14 +1601,15 @@ static void _regulator_put(struct regulator *regulator) if (regulator->dev) sysfs_remove_link(&rdev->dev.kobj, regulator->supply_name); mutex_lock(&rdev->mutex); - kfree(regulator->supply_name); list_del(®ulator->list); - kfree(regulator); rdev->open_count--; rdev->exclusive = 0; mutex_unlock(&rdev->mutex); + kfree(regulator->supply_name); + kfree(regulator); + module_put(rdev->owner); } -- 2.5.0