Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp701261ybe; Thu, 19 Sep 2019 02:21:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqxIhQWgSj6DHyNrYya47AVje9hhX/T3ObeBmk2d8sQqOGeDX5wDN6aZBfnEMNGdowBje7J1 X-Received: by 2002:a50:a666:: with SMTP id d93mr14723086edc.217.1568884883025; Thu, 19 Sep 2019 02:21:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568884883; cv=none; d=google.com; s=arc-20160816; b=jURnMoZr2C1CQ7XpaCFVnTzNI2TtQJ0ctk0BO2caOjQbQiJ7gaHpGs4DHPiMzEQlVK GRI8a48tdzKagUWMvgDq55TZiNS26ba5Ah05CSkIUm9HgsDJ9sB2IMdowF2oODnsJgeJ Vac8h2eJzUlnu/4vLwWjiYy/NvR+0CAtiyJ5b9RYXHlmcUJ60+n2T/0OSCUPuze2sxAf H6XFPvgQZeiz52KeTmlNkOFTin/i/XhmCSgF87sofhRFkb+SZ8DNdJRC7e6idreLwRFD B18ptezEBgA+DggRqFkE6Zgvdf+4cbEMoldCFuHO2tOMLWZtwU7uJ/X6JZ8q8BFW+6rk 3CKQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=d5jEgfLonWDOY4gG+bQfNvM3LOy7AfPuT16vQNF0Rko=; b=hic7tB5cgf1IkubMHBF2Y3kMvOvdS4apuTO76xQC4jt1VBGOnJc1YAGaKA0HqG5jEB eK85tD3yX/9dUZsjvbX6+aW+4dhxNemtiuodHV6roaQb1sDrBeYzsHzd98MGEp6P3lnZ RwAHtB10Lhs1T4oEW9ctUZPCXTrQN8rEEvmKaFLqfMSd7rYMvyjDRm+b1gmL5LWBSALv jV2eJ6nVEqfGIxo27X4RTveXwi2uMC1qVhapzFIwywsrGFaNhpYzZRTxtJUMXRIdw4+K 2vWNk8BnU3Igxzsdr/i0ecULRn8fQcYU+CtLQPpfoqD9YkoAbgQAbLH0hc+Uj3vEXJ/H 7tlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b="YFWb/OnK"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 7si4210755ejz.151.2019.09.19.02.20.59; Thu, 19 Sep 2019 02:21:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@rasmusvillemoes.dk header.s=google header.b="YFWb/OnK"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388832AbfISJRm (ORCPT + 99 others); Thu, 19 Sep 2019 05:17:42 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:36702 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388820AbfISJRj (ORCPT ); Thu, 19 Sep 2019 05:17:39 -0400 Received: by mail-lf1-f68.google.com with SMTP id x80so1816093lff.3 for ; Thu, 19 Sep 2019 02:17:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=d5jEgfLonWDOY4gG+bQfNvM3LOy7AfPuT16vQNF0Rko=; b=YFWb/OnKgEGSzwhOTk8kfD9okuzk0BzEGCLfTis5hVAJfxOgbf0kFsfDJOY3GC35Mm io9DQ9d0PWtExT99gqG2Eh0R31/mvlKOtoNGmK2XUeuFrcUx/aNk4BePlU/97Ikm3n1T 7muS0OZKkkqB+4A84Pxo3WwqACT6GLrGbMKDo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=d5jEgfLonWDOY4gG+bQfNvM3LOy7AfPuT16vQNF0Rko=; b=trGjgdE5YnIZepzX0Dga5/30BVqLgPg9xmvkrpCcSNRMlkMYaCyoUWhipr4BArokcb NbQJZUj3NWWToWtv7MeAA+L90hVf43mQk6fIoz+m0zIHB7MOaSroYBPfNQNoGwFx24gK 39BEuJJMV6gFgtMee7K1ADAMXx/83B1yeD/1/ykNPal8Ny08150gaOtZsdC+MG/ot6Ys FKLVH/2INR7U66MwQESnOAchTU17/YsckZufL450ULtKV613Li4THm3UmDMhdtyEc6SX Z875aGdVwGJbTl6wO14rRHHt4BpgED+mAPqaY81CiOFd+uGluKL+ErRfmCt02YslhCsz gVzA== X-Gm-Message-State: APjAAAWqwKFcEpZ4sQgwepgsXY+pyckaenBy5xkErs6boL8WqltspOJC 162xfgipwDSJixzkTjOEdVi98A== X-Received: by 2002:a19:14f:: with SMTP id 76mr4339385lfb.92.1568884657005; Thu, 19 Sep 2019 02:17:37 -0700 (PDT) Received: from prevas-ravi.prevas.se ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id x3sm1016789ljm.103.2019.09.19.02.17.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2019 02:17:36 -0700 (PDT) From: Rasmus Villemoes To: Thierry Reding , Heiko Stuebner Cc: David Wu , Rasmus Villemoes , linux-pwm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] pwm: rockchip: simplify rockchip_pwm_get_state() Date: Thu, 19 Sep 2019 11:17:27 +0200 Message-Id: <20190919091728.24756-1-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The way state->enabled is computed is rather convoluted and hard to read - both branches of the if() actually do the exact same thing. So remove the if(), and further simplify " ? true : false" to "". Signed-off-by: Rasmus Villemoes --- I stumbled on this while trying to understand how the pwm subsystem works. This patch is a semantic no-op, but it's also possible that, say, the first branch simply contains a "double negative" so either the != should be == or the "false : true" should be "true : false". drivers/pwm/pwm-rockchip.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/pwm/pwm-rockchip.c b/drivers/pwm/pwm-rockchip.c index 51b96cb7dd25..54c6399e3f00 100644 --- a/drivers/pwm/pwm-rockchip.c +++ b/drivers/pwm/pwm-rockchip.c @@ -83,12 +83,7 @@ static void rockchip_pwm_get_state(struct pwm_chip *chip, state->duty_cycle = DIV_ROUND_CLOSEST_ULL(tmp, clk_rate); val = readl_relaxed(pc->base + pc->data->regs.ctrl); - if (pc->data->supports_polarity) - state->enabled = ((val & enable_conf) != enable_conf) ? - false : true; - else - state->enabled = ((val & enable_conf) == enable_conf) ? - true : false; + state->enabled = ((val & enable_conf) == enable_conf); if (pc->data->supports_polarity) { if (!(val & PWM_DUTY_POSITIVE)) -- 2.20.1