From patchwork Mon Dec 2 09:50:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 180561 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp4969181ile; Mon, 2 Dec 2019 01:50:41 -0800 (PST) X-Google-Smtp-Source: APXvYqyBhz4M/Il1YfO/LWVctZFjUefxIrRaBKBVExlmC+LxXzP3LdW1qvzlFgtfuVRDMkkAr88N X-Received: by 2002:a17:906:5c4d:: with SMTP id c13mr76237674ejr.80.1575280241066; Mon, 02 Dec 2019 01:50:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575280241; cv=none; d=google.com; s=arc-20160816; b=p2Poxl0EwiKwoM3qOi6mIoSXs7Z9SUk4t7V5082U0w9uIs4RSBCWwwBE0O9s8bWqYg fPG/lDF+Lk4l91S4i7UtRfEGOoBlnUD8y7sqyIPTFFaHoPojFVs4/uwY1YE/LzLqQXEo zbu9XHHJXGzUfi1nkmH9K9rLDa/rQHXorEd1lxzvK0pWNFSxIeOTeV5PcS5m5MRWXzWr Opoyet1OYHyaYVukhxZzFq75uuS2C/vPlpvAQDEPf8dzAaxu1OBtf8Iza+gC15kp7lIO kKF1YTZ7/sztauHnqNqY6L0oQ6rqMCOir0g1iohEALzf2Iug15volMRJlOt4B4gnPVVj HevA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=wN8Wz+OqrhKIKYPYJBtEtZFwg/h6OwVz+bEt3kPQDmY=; b=nLmPMmMIlGPGI8bG/hQ5ogcjpyAK2phYaYTm79WLG3dhPrWzQ49rqXlanL67c0EhHw WuYXZQL+v2AenKaaDfjP1TWMgwOqVrnX5MMohSBSx+oC7NF+ta/ZOVyJ6h2GiZrMZ8/+ MDY0s/iuWlYxe/LUpWiZQvgiPP239/rNBT4meW4ztZCzmTy39MHJrDuxxAUIAzTGXJqz hMS+dKUa0jZUos7RO0dd7KuU456s0BDq2W8oLQfYX4k90AalA5/Wb0CILSdbNzGTH9Zn bXeWkwoHLGG0dLVyanAMCZJOkc0xmwZiceEEOK1v/VB3zE1fOrtwEgGvXvBQIfjKhZs0 DuRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZBoXUFkb; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j29si22786482edj.327.2019.12.02.01.50.40; Mon, 02 Dec 2019 01:50:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZBoXUFkb; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726482AbfLBJuk (ORCPT + 15 others); Mon, 2 Dec 2019 04:50:40 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:37125 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726516AbfLBJuk (ORCPT ); Mon, 2 Dec 2019 04:50:40 -0500 Received: by mail-wr1-f65.google.com with SMTP id w15so12391054wru.4 for ; Mon, 02 Dec 2019 01:50:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=wN8Wz+OqrhKIKYPYJBtEtZFwg/h6OwVz+bEt3kPQDmY=; b=ZBoXUFkbnH8Nk0M78+uLkLXG2r75Jp55gnODei+w5Wzf8ES8AnNWwGP2DhStJrAiSw gAR7Pv4lO6AqALrbvke8JAPTsYYHnG11Fz2/1N1SBwTMTIC3Q5QCsmxgRn3D5f+dBl1a pm1arcPhf8wrapz+1b7sSCklviJUQTollywnruF+H3Gnpv46MIvMN4zm5FqmvmXFJEBT M3YQhtK5Ir/IrNoMOWlHDt42MhlitnP/OGCPvDfsbkl4NckIvaHpGfKQlLiSGZFENebi DAgzts4rJYtS5dWQQOfDkkZYo7MdZ6PYZXGJxL4npbE3v53vywwuFy5mNN/mGnjUNY1N aIUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wN8Wz+OqrhKIKYPYJBtEtZFwg/h6OwVz+bEt3kPQDmY=; b=jzBw9J9oi3lIWin1U9AaRsCeNYaqpXYckwL6SYANtGoMMOE4Ooyrzyzok/ip2VYoaX /ahTcRKtnwv8LRleGgJirIhXfp2M3TqDQxGOXlAO3xklPXhicItgIK2QrwcAhgmrFjf7 OtmxOSCr+lK4As9zssCwotr9gDX+QyPRruimYqV/vCtd2s8Pf7MUf1DkQ39wCTe8KEwU kqWZRZ3ag5pwm3XDU+UCcAWDjYCrOzH8C+/kTx9EqRtNhq9yBUeZ5RUQEiJy84WVbVla poGsFzgOiUnt2/obp27at0UBaWbOUiR2ukZNDhUD/QikP36xpvaWbsjioEua/ZGnCrmG zI6w== X-Gm-Message-State: APjAAAUrifFZ7HpidXvKl3sMVnl6DqHA3MiHDlasJ9Tt1NOdLfouQIUj E9Rg87g/wboQjU43c1uUD11toe2uQlk= X-Received: by 2002:adf:f64b:: with SMTP id x11mr49606523wrp.355.1575280237891; Mon, 02 Dec 2019 01:50:37 -0800 (PST) Received: from localhost.localdomain ([2.27.35.155]) by smtp.gmail.com with ESMTPSA id l3sm4629698wrt.29.2019.12.02.01.50.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Dec 2019 01:50:37 -0800 (PST) From: Lee Jones To: stable@vger.kernel.org Subject: [PATCH 4.9 6/6] pwm: Clear chip_data in pwm_put() Date: Mon, 2 Dec 2019 09:50:12 +0000 Message-Id: <20191202095012.559-6-lee.jones@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191202095012.559-1-lee.jones@linaro.org> References: <20191202095012.559-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Uwe Kleine-König [ Upstream commit e926b12c611c2095c7976e2ed31753ad6eb5ff1a ] After a PWM is disposed by its user the per chip data becomes invalid. Clear the data in common code instead of the device drivers to get consistent behaviour. Before this patch only three of nine drivers cleaned up here. Signed-off-by: Uwe Kleine-König Signed-off-by: Thierry Reding Signed-off-by: Lee Jones --- drivers/pwm/core.c | 1 + drivers/pwm/pwm-berlin.c | 1 - drivers/pwm/pwm-samsung.c | 1 - 3 files changed, 1 insertion(+), 2 deletions(-) -- 2.24.0 diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index a19246455c13..cc12032ee60d 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c @@ -858,6 +858,7 @@ void pwm_put(struct pwm_device *pwm) if (pwm->chip->ops->free) pwm->chip->ops->free(pwm->chip, pwm); + pwm_set_chip_data(pwm, NULL); pwm->label = NULL; module_put(pwm->chip->ops->owner); diff --git a/drivers/pwm/pwm-berlin.c b/drivers/pwm/pwm-berlin.c index 01339c152ab0..64d9bb1ac272 100644 --- a/drivers/pwm/pwm-berlin.c +++ b/drivers/pwm/pwm-berlin.c @@ -78,7 +78,6 @@ static void berlin_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm) { struct berlin_pwm_channel *channel = pwm_get_chip_data(pwm); - pwm_set_chip_data(pwm, NULL); kfree(channel); } diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c index f113cda47032..219757087995 100644 --- a/drivers/pwm/pwm-samsung.c +++ b/drivers/pwm/pwm-samsung.c @@ -235,7 +235,6 @@ static int pwm_samsung_request(struct pwm_chip *chip, struct pwm_device *pwm) static void pwm_samsung_free(struct pwm_chip *chip, struct pwm_device *pwm) { devm_kfree(chip->dev, pwm_get_chip_data(pwm)); - pwm_set_chip_data(pwm, NULL); } static int pwm_samsung_enable(struct pwm_chip *chip, struct pwm_device *pwm)