From patchwork Tue Mar 12 21:46:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 10851003 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1F2C413B5 for ; Wed, 13 Mar 2019 11:33:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0BFA629B72 for ; Wed, 13 Mar 2019 11:33:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 004F929B75; Wed, 13 Mar 2019 11:33:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A17E929B72 for ; Wed, 13 Mar 2019 11:33:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject: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=qSgTIx7XCIrLzVZEzKPSBm5pFCsord4hOfr8a0rTNvs=; b=McxRRBak1RUQyd K4ewSosoEe7N1Z8mk4itvAJIPp+TPzd2IxkEr5YdRGB8dM2JsC55lrSNAD+gtySp8v+UsuEL9TtBp oChJN99meiSnEgtAE6fyMQYOYHj0OSLtiFCzxp93qpR5bplw1egrpCuV3pW1aQJGLhuLoaT+phXoL JMVOzeLkGISsmuloOF23iqedJtb58bG1i/TJ2BZHwXJv5/cIN7QebGE0WSgEWsA1zw8dZUc5Y5Erd D9RtJ/VjiKudL6a2r4ig6llrvaTI8tQejWpy9hw2MvIX4MrY35+gulE4/HtUQ8OIKMycVzOHtZjP0 xqi9zruHkD1asa/1xb2g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h428h-0003OD-7j; Wed, 13 Mar 2019 11:33:39 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h426l-0008SO-DH for linux-rockchip@bombadil.infradead.org; Wed, 13 Mar 2019 11:31:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=cCZYb7GtAI59KqOEq87jiihRN03tDVeIGlRhbACAYnU=; b=HawixyFCUuNE74QJ/iK1NUE7ML Qee8XZb6+UvASTju0qVDfJKmeMQVIKEAj8zzId/AmNza+mfCsuLGiDAsG8iwLUGvqAnwJqb0LuEuu VpoU4Ouj6xxkcLqoysE9KjL9BU0FJ9zV1+Wt7HCcbSNcYHqD7CXyUNvzoJ+ukORoE6fhamToQ5v+5 ukpLsvFuB9kQUup47O5qnXoLzYyEulzIkt7mFJR/GjgNyNURmC6ZAr+gaCYiczKnunPXezIMakWdi EKGjSJ5ue/8oN8/jMY/4gzDuO02nXALDbn4ZSiY3H1YxWAXP9J0gPw2EtQUH6/nmXeRQ4ca2Gt685 2o40gJ1Q==; Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h3pFi-0006iF-Ar for linux-rockchip@lists.infradead.org; Tue, 12 Mar 2019 21:48:03 +0000 Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1h3pDv-0007AR-3n; Tue, 12 Mar 2019 22:46:11 +0100 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1h3pDr-0005iF-8b; Tue, 12 Mar 2019 22:46:07 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Thierry Reding , Heiko Stuebner , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v2 0/3] pwm: ensure pwm_apply_state() doesn't modify the state argument Date: Tue, 12 Mar 2019 22:46:02 +0100 Message-Id: <20190312214605.10223-1-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-rockchip@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190312_174802_555837_93851DD8 X-CRM114-Status: GOOD ( 12.00 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pwm@vger.kernel.org, kernel@pengutronix.de, linux-rockchip@lists.infradead.org Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Hello, this series eventually makes the "state" parameter of pwm_apply_state() point to a const value. Two drivers (sun4i and rockchip) modfied the contents here with good intentions, but I believe that it does more harm than good. See the commit log of the last patch for a more detailed reasoning. The first two patches fix the two offending drivers to not modify the state variable, then in the last patch the prototype of pwm_apply_state() is changed to make the requirement to not change state obvious. Note that the prototype of pwm_apply_state() already had a const in include/linux/pwm.h for the !IS_ENABLED(CONFIG_PWM) case. Compared to v1 sent earlier today, the sun4i patch is new. I missed that there was a non-trivial change when preparing the patches and it was folded into the last patch. Thanks to Thierry for spotting this. The end result is unmodified. Best regards Uwe Uwe Kleine-König (3): pwm: rockchip: Don't update the state for the caller of pwm_apply_state() pwm: sun4i: Don't update the state for the caller of pwm_apply_state() pwm: ensure pwm_apply_state() doesn't modify the state argument drivers/pwm/core.c | 2 +- drivers/pwm/pwm-atmel-hlcdc.c | 2 +- drivers/pwm/pwm-atmel.c | 2 +- drivers/pwm/pwm-bcm-iproc.c | 2 +- drivers/pwm/pwm-cros-ec.c | 2 +- drivers/pwm/pwm-hibvt.c | 2 +- drivers/pwm/pwm-imx27.c | 2 +- drivers/pwm/pwm-lpss.c | 2 +- drivers/pwm/pwm-meson.c | 2 +- drivers/pwm/pwm-rcar.c | 2 +- drivers/pwm/pwm-rockchip.c | 10 ++-------- drivers/pwm/pwm-stm32-lp.c | 2 +- drivers/pwm/pwm-sun4i.c | 10 ++-------- drivers/pwm/pwm-zx.c | 2 +- include/linux/pwm.h | 4 ++-- 15 files changed, 18 insertions(+), 30 deletions(-)