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=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=ham 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 70C66C433E0 for ; Thu, 14 Jan 2021 17:57:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 330A423B4B for ; Thu, 14 Jan 2021 17:57:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728486AbhANR51 (ORCPT ); Thu, 14 Jan 2021 12:57:27 -0500 Received: from smtprelay0237.hostedemail.com ([216.40.44.237]:60208 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725854AbhANR50 (ORCPT ); Thu, 14 Jan 2021 12:57:26 -0500 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay03.hostedemail.com (Postfix) with ESMTP id 4A746837F24D; Thu, 14 Jan 2021 17:56:45 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: vein42_380c97427528 X-Filterd-Recvd-Size: 2342 Received: from [192.168.1.159] (unknown [47.151.137.21]) (Authenticated sender: joe@perches.com) by omf06.hostedemail.com (Postfix) with ESMTPA; Thu, 14 Jan 2021 17:56:43 +0000 (UTC) Message-ID: Subject: Re: [PATCH v2 3/4] staging: hikey9xx: phy-hi3670-usb3.c: hi3670_is_abbclk_seleted() returns bool From: Joe Perches To: Mauro Carvalho Chehab , Vinod Koul Cc: Alex Dewar , Greg Kroah-Hartman , Yu Chen , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Date: Thu, 14 Jan 2021 09:56:41 -0800 In-Reply-To: References: Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.38.1-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2021-01-14 at 18:35 +0100, Mauro Carvalho Chehab wrote: > Instead of using 1/0 for true/false, change the type to boolean > and change the returned value. [] > diff --git a/drivers/staging/hikey9xx/phy-hi3670-usb3.c b/drivers/staging/hikey9xx/phy-hi3670-usb3.c [] > @@ -326,24 +326,24 @@ static int hi3670_phy_set_params(struct hi3670_priv *priv) >   return ret; >  } > > -static int hi3670_is_abbclk_seleted(struct hi3670_priv *priv) > +static bool hi3670_is_abbclk_seleted(struct hi3670_priv *priv) Presumably this should be "selected" not "seleted" >  { >   u32 reg; > >   if (!priv->sctrl) { >   dev_err(priv->dev, "priv->sctrl is null!\n"); > - return 1; > + return true; >   } > >   if (regmap_read(priv->sctrl, SCTRL_SCDEEPSLEEPED, ®)) { >   dev_err(priv->dev, "SCTRL_SCDEEPSLEEPED read failed!\n"); > - return 1; > + return true; >   } > >   if ((reg & USB_CLK_SELECTED) == 0) > - return 1; > + return true; > > - return 0; > + return false; >  } if (foo) return true; return false; should generally be consolidated into a single test. So this is perhaps better as: return (!(reg & USB_CLK_SELECTED)); But the return value seems backwards.