From patchwork Tue Mar 12 21:46:04 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: 10851005 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 5AE921390 for ; Wed, 13 Mar 2019 11:33:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4846A29B72 for ; Wed, 13 Mar 2019 11:33:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3CDA929B75; Wed, 13 Mar 2019 11:33:44 +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 E148D29B72 for ; Wed, 13 Mar 2019 11:33:43 +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:References:In-Reply-To: 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: List-Owner; bh=UVM00WxeSJwsa8zci4/FYk9ci72TkRQSIjjhr53IH1E=; b=s+lUw0l2IZPLYC UQd0Rouoco/yAeEaf7sI69FgP1Yf+e4WX8WTNAfrnPbvWHchalUOZvo3M71qlDVGWFsq4dtYSlKxc X6OzsV0MxPlHTWstmUs1gPmXkuFVZ00QTI5dvYvr+KoUIqYSdNKdiPTWNUPQxK47sPyGEMNR6WvQ9 Sy2Gc7lYnO6KRp7UOHQVg8kftCqvhypINc6HJTPwXeApJJfK1t9SliJY9EUvzXUSCOdcdHV4q/bvR E7jaGAk8Ub/PYA1ymoswySEpIVL+fTVvbdXSoGleOT7ofbMqQwm0tq8NaDeTkaiqT3j+qJw1HeROd GkGG85PmKGrvBsJdYoKw==; 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 1h428i-0003Q0-Oq; Wed, 13 Mar 2019 11:33:40 +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 1h426m-0008SO-Va for linux-rockchip@bombadil.infradead.org; Wed, 13 Mar 2019 11:31:40 +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:References:In-Reply-To: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:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Wz8urcAB/MO2L4VBosAc2yx6ef6SdhN1n9BJjC9FcGc=; b=AMTc9Maay/AVBhJMqgaVd0r6Sh s0kMr/aMBgL1yZ6uauaebXmCQiYFL3pS9jP8NxtZ3qTUKPVe2iuglVvrLwZG4y+uLyYk1RuN1mtIb cN0zkK2OdcLtmPBDw2aBSE6yeuLneit4jNmai82PlY13qoRtOlzgBrEuAawN6+CCquakrhBKMNcjI ehNARbNlAtKl8IWB7DjssglXDH42pwxYUKOgIlrQKd/sRqjFNChHjlixm9iO/8lsRylNJhow0sO33 NeC1t2o+0kbTtiZrf/gHLazhi5ukLOVtqn3HsSiEd8dJzVdMNejn4+MXxB5YbTD9RLdPVV/5dCbzH ResOF7Rg==; 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 1h3pEP-0006gf-F2 for linux-rockchip@lists.infradead.org; Tue, 12 Mar 2019 21:46:42 +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-0007AT-3m; 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-0005iL-IA; 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 2/3] pwm: sun4i: Don't update the state for the caller of pwm_apply_state() Date: Tue, 12 Mar 2019 22:46:04 +0100 Message-Id: <20190312214605.10223-3-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190312214605.10223-1-u.kleine-koenig@pengutronix.de> References: <20190312214605.10223-1-u.kleine-koenig@pengutronix.de> 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_174641_631161_34F4D78D X-CRM114-Status: UNSURE ( 9.69 ) X-CRM114-Notice: Please train this message. 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 The pwm-sun4i driver is one of only two PWM drivers which updates the state for the caller of pwm_apply_state(). This might have surprising results if the caller reuses the values expecting them to still represent the same state. Also note that this feedback was incomplete as the matching struct pwm_device::state wasn't updated and so pwm_get_state still returned the originally requested state. Signed-off-by: Uwe Kleine-König --- drivers/pwm/pwm-sun4i.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c index 470d4f71e7eb..142a603fe7ea 100644 --- a/drivers/pwm/pwm-sun4i.c +++ b/drivers/pwm/pwm-sun4i.c @@ -193,12 +193,6 @@ static int sun4i_pwm_calculate(struct sun4i_pwm_chip *sun4i_pwm, *dty = div; *prsclr = prescaler; - div = (u64)pval * NSEC_PER_SEC * *prd; - state->period = DIV_ROUND_CLOSEST_ULL(div, clk_rate); - - div = (u64)pval * NSEC_PER_SEC * *dty; - state->duty_cycle = DIV_ROUND_CLOSEST_ULL(div, clk_rate); - return 0; }