From patchwork Fri Jan 24 09:27:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 233274 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDC84C2D0DB for ; Fri, 24 Jan 2020 09:43:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 924CB21734 for ; Fri, 24 Jan 2020 09:43:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579859027; bh=KAzaguREQ3RaeAQy55+/Xuv+pFlbqm53eOVOgzlveEM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=UOKMw0VWCsl9UZfnxE3dbPk0suwceQdwD3w1qhIA7/Lhm5hBjn7T1ygR0PZDTToeY 79v39fSahbQBw+49qWdD9IRLYawbXjXylzFGnZMyu8Ys812ZO2CwQhBRiaVfReYzHw iEOwrYvkW+84cLfw+/mRJINu55u8+F6V8zqHLabk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733199AbgAXJnX (ORCPT ); Fri, 24 Jan 2020 04:43:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:41348 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733082AbgAXJnW (ORCPT ); Fri, 24 Jan 2020 04:43:22 -0500 Received: from localhost (unknown [145.15.244.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6554020718; Fri, 24 Jan 2020 09:43:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579859001; bh=KAzaguREQ3RaeAQy55+/Xuv+pFlbqm53eOVOgzlveEM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r0AW0ZPDwDg3BrCIPUBsu1jbR80FWUVRt48NRK1CyXlID9x6Ak4Zdc62d6MtZ2cvN rKycpKtZPlohlk0zLmpVpbMFFZmDZTgzxJcM6BYGuXqCzRM3bCDOnzwd9zUPlxC64x SeO1e1r4vHToOf1mxWsBrZGfuBWaQbq/MCJ2XdRQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , Hans de Goede , Thierry Reding , Sasha Levin Subject: [PATCH 4.14 019/343] pwm: lpss: Release runtime-pm reference from the drivers remove callback Date: Fri, 24 Jan 2020 10:27:17 +0100 Message-Id: <20200124092922.155017203@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200124092919.490687572@linuxfoundation.org> References: <20200124092919.490687572@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Hans de Goede [ Upstream commit 42885551cedb45961879d2fc3dc3c4dc545cc23e ] For each pwm output which gets enabled through pwm_lpss_apply(), we do a pm_runtime_get_sync(). This commit adds pm_runtime_put() calls to pwm_lpss_remove() to balance these when the driver gets removed with some of the outputs still enabled. Fixes: f080be27d7d9 ("pwm: lpss: Add support for runtime PM") Acked-by: Andy Shevchenko Signed-off-by: Hans de Goede Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin --- drivers/pwm/pwm-lpss.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/pwm/pwm-lpss.c b/drivers/pwm/pwm-lpss.c index 1e69c1c9ec096..7a4a6406cf69a 100644 --- a/drivers/pwm/pwm-lpss.c +++ b/drivers/pwm/pwm-lpss.c @@ -216,6 +216,12 @@ EXPORT_SYMBOL_GPL(pwm_lpss_probe); int pwm_lpss_remove(struct pwm_lpss_chip *lpwm) { + int i; + + for (i = 0; i < lpwm->info->npwm; i++) { + if (pwm_is_enabled(&lpwm->chip.pwms[i])) + pm_runtime_put(lpwm->chip.dev); + } return pwmchip_remove(&lpwm->chip); } EXPORT_SYMBOL_GPL(pwm_lpss_remove);