Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1298355lqg; Sun, 3 Mar 2024 04:08:09 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUzQnTeIfHwanY7gHULI9jrX+grz1XkTAs4mEIm24+A+Puv3uaNQOe9jSsTRuZ25WeWiZ7Wx0Ql8TmSktrp1LlZvsKEdMO6dT1gj9WSBg== X-Google-Smtp-Source: AGHT+IEHQu+O1SYOSCNF4d6M8LJqeyyDDlaIPqtre/ntwIibc9bXw9LCoZrRhk8DTuty7fuW/Qu7 X-Received: by 2002:a17:902:eb87:b0:1db:bec6:9147 with SMTP id q7-20020a170902eb8700b001dbbec69147mr8727547plg.44.1709467689204; Sun, 03 Mar 2024 04:08:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709467689; cv=pass; d=google.com; s=arc-20160816; b=bt0gmaziNvxcoW+Gv4BsKPC0Drdcd7cuPInKuFLiDAyvimCqdqglRQmB7GpQgU6scu +9WigkH5tTTZlTGMIgQJUfJrbZ+JGdgTSOc95pw+iImrjXdEG4gUg/+uzs+MfK/TCdCX uBwXciNo+FVEu7gs+KewxOr7Fd5SLGWyOwqn105s1lcdSy0+KJ0awwH4+dlIrsqVOL4V 1XPi/W+/3bOb/dUNpmm/SO/vTJAvFGiZUPmtOjRv+1zVNbEE7Nz+Po6s9Iu+ouEi7oJZ QqH4p99WOllzS6ArdeS6IXseMerQ4tJJlh2LA/ZC1f8bwPMSyLIyKXDUh0axwP5IRYI0 muug== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=oJ4/K0qAza53le5QcMygSACRzbto2zA6GTadRjH3myM=; fh=MgiuNzkgsJnJb7zFyopDLB3ux57EkU4f3oZJ7cPMsnU=; b=OBSGRD88TGXJyxoy1Wc2H4ipXLkE83DYv79yLq99ShF40R8A9S0AtGSnJEvlbADtIR 9EtjLGzhy9J8/XMfy4szeLkQZ80RJIh4CvIYQ/ehIQObVe7JlVY4s/FTBwooLvS3jpWs Wae9sEQuzDnK9MSh+8KeQOk5odvAHtSQJb9sS6wSY4Ew786I5J3dKGU/S+JG5CMWcaaa 4rhIurC7qZ9vn22Cre536YO3LU/PRiwaS2CpUxHunnxbZ2cTlY3eKjgZrzlWvjLTD7Ny SKlItQYCplavVl3sXGMQxN2h8886g/ICGpoKKlJ/wDhm1c/9N73+mY3n6U0AUGxKNRQE t4gA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-89721-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89721-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id cp12-20020a170902e78c00b001dcfa81a98esi2439804plb.223.2024.03.03.04.08.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Mar 2024 04:08:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89721-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-89721-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89721-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 42FC52834E6 for ; Sun, 3 Mar 2024 12:07:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 22A60BE68; Sun, 3 Mar 2024 12:07:46 +0000 (UTC) Received: from fgw22-7.mail.saunalahti.fi (fgw22-7.mail.saunalahti.fi [62.142.5.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C937AD24 for ; Sun, 3 Mar 2024 12:07:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.142.5.83 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709467665; cv=none; b=cSCmFy8tlQRsY2CT5qmCSYuKdgZF5VTJ2Zv6gOdatNJJtwwfSXHyWE9bAt0mOvliy//GSlShYfNJ5cpczTT2L+QQP7quEQeIX2rIq6Hq9I8BZyfxHuiPwIHcMSafduIWu8MA+PvDJ0nr62HE3fjfy+uHteZ+Bn28d8El9a43hsk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709467665; c=relaxed/simple; bh=8TfYbH/Sb4JWApIFsRo+aPKWTwj/9+8x40iu73tFba4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=K5EfG7lPwMaNfa3T6EcRuFQls5fqxT6PkUu/NRjaKWVcAe8KJkd1+QD5vpwLErHSqvG/2ct/pdHWeFYj+ss8bOl98iKAQGSpUNC4jKXvm9w772JYSj8zQcXdn2jeKob/9JZnA4+Lu3qKl5wyKyHuTlZSSyGEbL756WCz6ye6qRs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=fail smtp.mailfrom=gmail.com; arc=none smtp.client-ip=62.142.5.83 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=gmail.com Received: from localhost (88-113-26-217.elisa-laajakaista.fi [88.113.26.217]) by fgw22.mail.saunalahti.fi (Halon) with ESMTP id 9ef0446a-d956-11ee-a9de-005056bdf889; Sun, 03 Mar 2024 14:07:35 +0200 (EET) From: Andy Shevchenko To: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Michael Turquette , Stephen Boyd , Andy Shevchenko Subject: [PATCH v1 1/1] clk: fractional-divider: Use bit operations consistently Date: Sun, 3 Mar 2024 14:07:32 +0200 Message-ID: <20240303120732.240355-1-andy.shevchenko@gmail.com> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Use BIT() where makes sense. This alings usage of bit operations in the same pieces of code. Moreover, strictly speaking by the letter of the C standard, left shift of 1 by 31 bits is UB (undefined behaviour), switching to BIT() addresses that as well. Signed-off-by: Andy Shevchenko --- drivers/clk/clk-fractional-divider.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/clk/clk-fractional-divider.c b/drivers/clk/clk-fractional-divider.c index 5067e067e906..a0178182fc72 100644 --- a/drivers/clk/clk-fractional-divider.c +++ b/drivers/clk/clk-fractional-divider.c @@ -140,8 +140,8 @@ void clk_fractional_divider_general_approximation(struct clk_hw *hw, } if (fd->flags & CLK_FRAC_DIVIDER_ZERO_BASED) { - max_m = 1 << fd->mwidth; - max_n = 1 << fd->nwidth; + max_m = BIT(fd->mwidth); + max_n = BIT(fd->nwidth); } else { max_m = GENMASK(fd->mwidth - 1, 0); max_n = GENMASK(fd->nwidth - 1, 0); @@ -182,8 +182,8 @@ static int clk_fd_set_rate(struct clk_hw *hw, unsigned long rate, u32 val; if (fd->flags & CLK_FRAC_DIVIDER_ZERO_BASED) { - max_m = 1 << fd->mwidth; - max_n = 1 << fd->nwidth; + max_m = BIT(fd->mwidth); + max_n = BIT(fd->nwidth); } else { max_m = GENMASK(fd->mwidth - 1, 0); max_n = GENMASK(fd->nwidth - 1, 0); -- 2.44.0