From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C73DC282CF for ; Tue, 29 Jan 2019 00:50:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 46825214DA for ; Tue, 29 Jan 2019 00:50:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727967AbfA2AuZ (ORCPT ); Mon, 28 Jan 2019 19:50:25 -0500 Received: from mx0b-002e3701.pphosted.com ([148.163.143.35]:34680 "EHLO mx0b-002e3701.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726803AbfA2AuY (ORCPT ); Mon, 28 Jan 2019 19:50:24 -0500 X-Greylist: delayed 15754 seconds by postgrey-1.27 at vger.kernel.org; Mon, 28 Jan 2019 19:50:23 EST Received: from pps.filterd (m0134423.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x0SKQbXw014900; Mon, 28 Jan 2019 20:27:01 GMT Received: from g4t3427.houston.hpe.com (g4t3427.houston.hpe.com [15.241.140.73]) by mx0b-002e3701.pphosted.com with ESMTP id 2qa7xcrcpp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 28 Jan 2019 20:27:00 +0000 Received: from g9t2301.houston.hpecorp.net (g9t2301.houston.hpecorp.net [16.220.97.129]) by g4t3427.houston.hpe.com (Postfix) with ESMTP id 5DC405C; Mon, 28 Jan 2019 20:26:59 +0000 (UTC) Received: from anatevka (anatevka.americas.hpqcorp.net [10.34.81.61]) by g9t2301.houston.hpecorp.net (Postfix) with ESMTP id 90D224A; Mon, 28 Jan 2019 20:26:56 +0000 (UTC) Date: Mon, 28 Jan 2019 13:26:56 -0700 From: Jerry Hoemann To: Guenter Roeck Cc: Matti Vaittinen , mazziesaccount@gmail.com, heikki.haikola@fi.rohmeurope.com, mikko.mutanen@fi.rohmeurope.com, lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, broonie@kernel.org, gregkh@linuxfoundation.org, rafael@kernel.org, mturquette@baylibre.com, sboyd@kernel.org, linus.walleij@linaro.org, bgolaszewski@baylibre.com, sre@kernel.org, lgirdwood@gmail.com, a.zummo@towertech.it, alexandre.belloni@bootlin.com, wim@linux-watchdog.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-gpio@vger.kernel.org, linux-pm@vger.kernel.org, linux-rtc@vger.kernel.org, linux-watchdog@vger.kernel.org Subject: Re: [RFC PATCH v2 08/10] rtc: bd70528: Initial support for ROHM bd70528 RTC Message-ID: <20190128202656.GA17466@anatevka> Reply-To: Jerry.Hoemann@hpe.com References: <20190125110536.GA29321@localhost.localdomain> <35bbc5b9-5f8c-ec80-3eaa-bb2c0e2812c9@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <35bbc5b9-5f8c-ec80-3eaa-bb2c0e2812c9@roeck-us.net> User-Agent: Mutt/1.10.1 (2018-07-13) X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-01-28_11:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=771 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901280152 Sender: linux-rtc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rtc@vger.kernel.org On Sat, Jan 26, 2019 at 08:30:24AM -0800, Guenter Roeck wrote: > On 1/25/19 3:05 AM, Matti Vaittinen wrote: > > +static int bd70528_set_wake(struct bd70528 *bd70528, > > + int enable, int *old_state) > > +{ > > + int ret; > > + unsigned int ctrl_reg; > > + > > + ret = regmap_read(bd70528->chip.regmap, BD70528_REG_WAKE_EN, &ctrl_reg); > > + if (ret) > > + return ret; > > + > > + if (old_state) { > > + if (ctrl_reg & BD70528_MASK_WAKE_EN) > > + *old_state |= BD70528_WAKE_STATE_BIT; > > + else > > + *old_state &= ~BD70528_WAKE_STATE_BIT; > > + > > + if ((!enable) == (!(*old_state & BD70528_WAKE_STATE_BIT))) > > + return 0; > > I think > if (enable == !!(*old_state & BD70528_WAKE_STATE_BIT)) > would be much better readable. Even if not, there are way too many () > in the above conditional. > The substitution is not equivalent to original. I think you mean: if (!!enable == !!(*old_state & BD70528_WAKE_STATE_BIT)) -- ----------------------------------------------------------------------------- Jerry Hoemann Software Engineer Hewlett Packard Enterprise -----------------------------------------------------------------------------