Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp919112ybe; Thu, 19 Sep 2019 06:03:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqyPye6bKnTkfUdzdb0zxI0xxQBm+OyvAUWJ3S5mkeBz8or/+kX6/qAzj7MXzGh6FUp121sj X-Received: by 2002:aa7:cdd6:: with SMTP id h22mr14027384edw.132.1568898233119; Thu, 19 Sep 2019 06:03:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568898233; cv=none; d=google.com; s=arc-20160816; b=zbBEKctoAnCC7uGgZMwPIWaQ+nI1YSBCv2fqsxgF4IhaIQfUFo3KtIAPVq4ozGrGHf NX43PGRSfaGW16RMXW2lpjqo/YXm7fbGix8aUk9UwmSb30OEhhRnfICI78DZIuV8H2JW sb+oxPhNXa2WgrG4UUr5MntT69cECy3uChdLpJcuYkKfFAvXoisxH+mAE3D6+Nx4YC88 x5JBCNmFxa10RYj9p++PREYU7EcwQYMhli7B50v0HguT5NLr6gIto6+E/a5hYrhuDf44 IhXlKggI5EfpvD8R7W6N9I1esimKlDyDAm44wiqvNQCpv9XJM355C8KyxdoFfvWCevJj mosA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=SZPqO8bEIz9YatPjvE3k7/eXXcf9mfhuzuzqjT2HS2o=; b=DvgIQ+a7TK4uttgJPokqSLnQ5YqGXSLhX6Lg844gtV225WYdqpYjBUzySGxvOPWYMs qCstEwPnqpw+yJuD34XWZgqgNomNlxxlig69bqsey+OEg7x5zwUxKTMmqyWKzA0UNmXB t9vqUVSUiO1Jrb3QhLpLByE239zVuUJgeBS4YzJtElbWqJaBDx0hieDUyK7YAf+CpoKO OdRRFX3sHY9tOywn3VpIUavT4auFC9FUIsdDrlJf2pcP11G7QYZVo7jpDYxhGkFQ9n8E rxc1pUVYILyb8aFa/N0FwaAesNdtTzVe8doPD7n/Wm+MosViAeAsC6G4aVmGD5/pxhKr mhvA== ARC-Authentication-Results: i=1; mx.google.com; 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 v27si4404648ejb.182.2019.09.19.06.03.27; Thu, 19 Sep 2019 06:03:53 -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; 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 S2389512AbfISLLZ (ORCPT + 99 others); Thu, 19 Sep 2019 07:11:25 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:43157 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387690AbfISLLY (ORCPT ); Thu, 19 Sep 2019 07:11:24 -0400 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.92) (envelope-from ) id 1iAuLF-0001IP-5b; Thu, 19 Sep 2019 13:11:17 +0200 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1iAuLD-0002qQ-8O; Thu, 19 Sep 2019 13:11:15 +0200 Date: Thu, 19 Sep 2019 13:11:15 +0200 From: oUwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Rasmus Villemoes , David Wu Cc: Thierry Reding , Heiko Stuebner , linux-pwm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] pwm: rockchip: simplify rockchip_pwm_get_state() Message-ID: <20190919111115.5oraof2bdl4627xv@pengutronix.de> References: <20190919091728.24756-1-linux@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190919091728.24756-1-linux@rasmusvillemoes.dk> User-Agent: NeoMutt/20170113 (1.7.2) 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-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 19, 2019 at 11:17:27AM +0200, Rasmus Villemoes wrote: > 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". The change looks obviously right, it's a noop. I share your doubts however. The construct was introduced in commit 831b2790507b ("pwm: rockchip: Use same PWM ops for each IP") by David Wu. Before there were rockchip_pwm_get_state_v1 for the supports_polarity = false case and rockchip_pwm_get_state_v2 for supports_polarity = true. In both state->enabled was assigned true if ((val & enable_conf) == enable_conf). So I assume everything is fine. A confirmation by David would be great though. As a side note: Is there publicly available documentation for this IP? If a link were added to the driver's header we could check easily ourselves. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |