From patchwork Tue Mar 7 21:00:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: George Stark X-Patchwork-Id: 13164701 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2AAFFC6FA99 for ; Tue, 7 Mar 2023 21:02:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=fzrxEr1DV6UoTi13Y2GTgEdCoFyBxAuI+3QZmoEvZOI=; b=sbp4QLpBRbJ6p4 0x36K8TYK98eSPGC03DJfobQw9Rkiiahjt4hrounSY+QUI7Hbnz2rHrsUXw6W2VpwAwTFEfsfvx61 /X1ItMicHleDxYqzi2QXzabTby2KX6YKptxdnvuy60Zq9wxyIfHTlntC6sV5jalbEfFe0f4hnbNaG mhvyo/r/SqwNMU9ZBQjM5J2Puu0nPdRc8SIVTD5kYMghGFC51ti2uVDUTmDlCugJiPiIpt6rkIg/u Ibo9Ep2061XD8D8EXY156f1R6dQOFINMH7YZrkQa2L0MCMTzB5HoRfyUUZlX/ZmH1JAIuxoMdJhEP AelOxn8Y8HMQvrXi7BaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZeQp-002SJC-NG; Tue, 07 Mar 2023 21:01:11 +0000 Received: from mx.sberdevices.ru ([45.89.227.171]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZeQi-002SDY-TX for linux-arm-kernel@lists.infradead.org; Tue, 07 Mar 2023 21:01:10 +0000 Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id 610075FD31; Wed, 8 Mar 2023 00:00:53 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1678222853; bh=n7uelarKUUaeZ2SnEaQ3vwbd0u3Zv00FrAdmQ5cpVvY=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=i1v+rF0zh/wcscwgQJcUwBai8ousVafggtpd/rfB9noAmOTM9VfTk0Hxh06bHWz9w ZoRS8vKwLXINCde2jFPiXtCdxBTbrMUpAWuIwrr3lFjy5/0pK7RiCzRAsYa5+Rvpe4 472JEhHDOpQ/81/lyMZGtw3UKcXOX9Ehynf4TuTBGDfhenbtNw3vpfIiWdzOnUsoFO 419KseiiJqsuD6u9VcdL6OFrCECbYBBJCI6xuy0TwbwSzvLiw94eZEbIGlHDZgObN7 HY0kZLf8SpVogbj+WouX20gOPZAkeAa4Af00HDhqVPFkzhfONTw0uqFXfwiBKi4l4z 0Y+m4Wbs5X2Vg== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mx.sberdevices.ru (Postfix) with ESMTP; Wed, 8 Mar 2023 00:00:51 +0300 (MSK) From: George Stark To: , , , CC: , , , , , , George Stark Subject: [RFC PATCH v1] Revert "pwm: Clear chip_data in pwm_put()" Date: Wed, 8 Mar 2023 00:00:14 +0300 Message-ID: <20230307210014.1380102-1-gnstark@sberdevices.ru> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Originating-IP: [172.16.1.6] X-ClientProxiedBy: S-MS-EXCH01.sberdevices.ru (172.16.1.4) To S-MS-EXCH01.sberdevices.ru (172.16.1.4) X-KSMG-Rule-ID: 4 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiPhishing: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 1.1.2.30, bases: 2023/03/07 18:59:00 #20923273 X-KSMG-AntiVirus-Status: Clean, skipped X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230307_130105_490113_214F42D9 X-CRM114-Status: GOOD ( 12.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: George Stark This reverts commit e926b12c611c2095c7976e2ed31753ad6eb5ff1a. There're several issues with the original change: - it breaks generic semantics of set_driver_data-like routines that only client code controls lifetime of it's own data. - it breaks pwm-sti.c driver: pwm_set_chip_data is used only in probe stage then pwm_get_chip_data used in capture callback Change-Id: I5787c6b4c520d4a0997567c416b26fa4e0806b94 Signed-off-by: George Stark --- drivers/pwm/core.c | 1 - drivers/pwm/pwm-berlin.c | 1 + drivers/pwm/pwm-samsung.c | 1 + 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index e01147f66e15..3bc644cc16fe 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c @@ -1036,7 +1036,6 @@ 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 e157273fd2f7..953cc2bba314 100644 --- a/drivers/pwm/pwm-berlin.c +++ b/drivers/pwm/pwm-berlin.c @@ -84,6 +84,7 @@ 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 9c5b4f515641..7e5dbdd6fc64 100644 --- a/drivers/pwm/pwm-samsung.c +++ b/drivers/pwm/pwm-samsung.c @@ -249,6 +249,7 @@ 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) { kfree(pwm_get_chip_data(pwm)); + pwm_set_chip_data(pwm, NULL); } static int pwm_samsung_enable(struct pwm_chip *chip, struct pwm_device *pwm)