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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C8853E9370C for ; Thu, 5 Oct 2023 11:57:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1ohFjaBxruUWhZHo1oagTYuTe9IwWmsQa9faZPkTnyI=; b=sa5qRAHip/es8h twCJoOmCW1bYG0oj/T6ORPzPv9l1Nvi2V3SlRem2JJQl63HyBvLM1OeAH5hGUISoCl/LFQ4DeM36E BiK7kefEGo9kuc6CpvBm8N47F3WvqSICaLH+6HgvPekhE0UMKYRRaP2Y8m2vJnZFOWKEcuo5p8nnB WtCm4YxHOAcSu0cS/SecIf8xjFInyrxUu7Pev66nWitvv77PZNJ/BFegvTcn+A4JGLcUmkGxMKePJ 7IkP8HSuUm4wwWQnHZFeKqAXiivKEp+gbEFTn5vKtp31nC892QUdGm7RmklCBzYVTQYsnLy7M7pOz cEYcNLF4uQScnF3ZSwyg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qoMy0-002VIH-1V; Thu, 05 Oct 2023 11:56:32 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qoMxw-002VFQ-2v for linux-arm-kernel@lists.infradead.org; Thu, 05 Oct 2023 11:56:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696506988; x=1728042988; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=tXYScCQloVsf+4gJdEXKIeLEpV9gui3O8J54Ug/L2KY=; b=hPyDoqHm5CBqPoAfhKZTHte4ftdThE7qe2NQ9f9BH+K/gqCp9irN6sQ5 H/M3wEMS4B+1fBmV7hnrhRDpHmIxLyCphKTqQzgsdm79/b++hUFlbj0TU 9pCv6JR1fbJQk34p8fOV2G2GTnJ+fHHJGuV9zkOeKyn/WNbYtupQOo0Dt ax+eL8gefLJ3xlQNTImrCfRZsb5Z5CVip7SkpZwJXivMgV+JieNVLIstM NFTqkabepSL+/k1W5o2Xh/zVh3KX1gExZTuOhdWfYlABl4JDxWIoDk5lO RcYdMNc+XwVFwNkBFkcVWn42zvwuwFxZSRwWkewRrWLaUwp4zaP6PE/YZ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10853"; a="368546541" X-IronPort-AV: E=Sophos;i="6.03,203,1694761200"; d="scan'208";a="368546541" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2023 04:56:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10853"; a="701629587" X-IronPort-AV: E=Sophos;i="6.03,203,1694761200"; d="scan'208";a="701629587" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga003.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2023 04:56:21 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.97-RC1) (envelope-from ) id 1qoMxl-000000030t3-0Z6W; Thu, 05 Oct 2023 14:56:17 +0300 Date: Thu, 5 Oct 2023 14:56:16 +0300 From: Andy Shevchenko To: Ryan Chen Cc: "jk@codeconstruct.com.au" , Brendan Higgins , Benjamin Herrenschmidt , Joel Stanley , Rob Herring , Krzysztof Kozlowski , Andrew Jeffery , Philipp Zabel , Wolfram Sang , "linux-i2c@vger.kernel.org" , Florian Fainelli , Jean Delvare , William Zhang , Tyrone Ting , Tharun Kumar P , Conor Dooley , Phil Edworthy , "openbmc@lists.ozlabs.org" , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-aspeed@lists.ozlabs.org" , "=linux-kernel@vger.kernel.org" <=linux-kernel@vger.kernel.org>, Andi Shyti Subject: Re: [PATCH v12 2/2] i2c: aspeed: support ast2600 i2c new register mode driver Message-ID: References: <20230714074522.23827-1-ryan_chen@aspeedtech.com> <20230714074522.23827-3-ryan_chen@aspeedtech.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231005_045629_012413_3D929618 X-CRM114-Status: GOOD ( 23.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Oct 05, 2023 at 06:21:35AM +0000, Ryan Chen wrote: > > From: Andy Shevchenko > > Sent: Tuesday, September 5, 2023 7:55 PM > > On Tue, Sep 05, 2023 at 06:52:37AM +0000, Ryan Chen wrote: > > > > From: Andy Shevchenko > > > > Sent: Friday, July 14, 2023 4:55 PM > > > > On Fri, Jul 14, 2023 at 03:45:22PM +0800, Ryan Chen wrote: ... > > > divisor = DIV_ROUND_UP(base_clk[3], > > i2c_bus->timing_info.bus_freq_hz); > > > for_each_set_bit(divisor, &divisor, 32) { > > > > This is wrong. > > > > > if ((divisor + 1) <= 32) > > > break; > > > > > divisor >>= 1; > > > > And this. > > > > > baseclk_idx++; > > > > > } > > > > for_each_set_bit() should use two different variables. > > Will update by following. > > for_each_set_bit(bit, &divisor, 32) { > divisor >>= 1; > baseclk_idx++; > } It's unclear what you are trying to achieve here as the code is not equivalent to the above. > > > } else { > > > baseclk_idx = i + 1; > > > divisor = DIV_ROUND_UP(base_clk[i], > > i2c_bus->timing_info.bus_freq_hz); > > > } > > > } ... > > > divisor = min_t(unsigned long, divisor, 32); > > > > Can't you use min()? min_t is a beast with some subtle corner cases. > > > Will update to > divisor = min(divisor, (unsigned long)32); No, the idea behind min() is that _both_ arguments are of the same type, the proposed above is wrong. -- With Best Regards, Andy Shevchenko _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel