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=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 7481BC4724C for ; Thu, 30 Apr 2020 16:39:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4D08A2070B for ; Thu, 30 Apr 2020 16:39:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726285AbgD3QjC (ORCPT ); Thu, 30 Apr 2020 12:39:02 -0400 Received: from mga12.intel.com ([192.55.52.136]:30305 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726130AbgD3QjC (ORCPT ); Thu, 30 Apr 2020 12:39:02 -0400 IronPort-SDR: s1/X7CvdGxPyXDk8DbROCbtkFZQsR7tP9i+JAxhlmxfOtjuTX36Rqu8Iau7ay4ufZ+oaGtZa18 yguDMghOXyXA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Apr 2020 09:38:59 -0700 IronPort-SDR: ME5Ydnoy+OAr2lFUJblXA0A6ioZNOJkRmsQr7GxyMwPdnz/fSx/zy5+Unt5y3JubqY9W4wfgY3 OHFKiMXFCseg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,336,1583222400"; d="scan'208";a="261836945" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga006.jf.intel.com with ESMTP; 30 Apr 2020 09:38:52 -0700 Received: from andy by smile with local (Exim 4.93) (envelope-from ) id 1jUCD9-003x70-2a; Thu, 30 Apr 2020 19:38:55 +0300 Date: Thu, 30 Apr 2020 19:38:55 +0300 From: Andy Shevchenko To: Syed Nayyar Waris Cc: akpm@linux-foundation.org, vilhelm.gray@gmail.com, linus.walleij@linaro.org, bgolaszewski@baylibre.com, michal.simek@xilinx.com, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 4/4] gpio: xilinx: Utilize for_each_set_clump macro Message-ID: <20200430163855.GU185537@smile.fi.intel.com> References: <80745504d15c87aa1da0d4be3c16d1279f48615b.1588112716.git.syednwaris@gmail.com> <20200429102114.GF185537@smile.fi.intel.com> <20200430161514.GA7107@syed> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200430161514.GA7107@syed> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org On Thu, Apr 30, 2020 at 09:45:14PM +0530, Syed Nayyar Waris wrote: > On Wed, Apr 29, 2020 at 01:21:14PM +0300, Andy Shevchenko wrote: > > On Wed, Apr 29, 2020 at 04:39:47AM +0530, Syed Nayyar Waris wrote: ... > > > + const unsigned long state_size = BITS_PER_TYPE(*state); > > > > This '*state' is unneeded complication, use BITS_PER_U32. > > > > > +#define TOTAL_BITS BITS_PER_TYPE(chip->gpio_state) > > > > This macro makes code uglier, besides the fact of absence of #undef. > > And also see above. > > Thank you for your review comments. Just want to clarify, you want > a new macro to be created - 'BITS_PER_U32' ? It's already there (read bits.h). > Also, don't you think that with BITS_PER_TYPE(), in case later the type > of 'state' changes, it will be reflected in this code without any code > change? If it changes the bits per type will be least issues there. The rationale behind is to have code readable. In proposed change it is not. > Let me know if I have misunderstood something. > > > > > > + DECLARE_BITMAP(old, TOTAL_BITS); > > > + DECLARE_BITMAP(new, TOTAL_BITS); > > > + DECLARE_BITMAP(changed, TOTAL_BITS); -- With Best Regards, Andy Shevchenko 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=-0.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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 4F693C4724C for ; Thu, 30 Apr 2020 16:39:11 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 1CCCC2070B for ; Thu, 30 Apr 2020 16:39:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="qXzK21EE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1CCCC2070B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject: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=X+U0fbby9iD4UROB+9vCrrpl8H2V2MQwFk/sc5iDiXw=; b=qXzK21EEwIX3hm kgm5jNYdq8O7h2IS8ud1HwNskUoAjFAKN81kJ/gNHZ1WTBwW5B6XZFb1vYOXT7Mm24x95VjGQlC1S Zij+5FxLMOrhe+3cBX5G22TFG8XpBVVgtlx+YSxkh4P5Zu5r9jqYAiGkUr7SWawxvfJBIrtahwjI9 kBq6l7Vel5u11Y9U7AO8udCqCLBnKAzFk+sU+pmKrunsF1ANcHbKHCNYaRG/4XcTb1TpGbzmu94m0 OvR+EgqX+fb3E83GowJq0X/4K3FGre1RvplSNuImgLBXWV9ZXeFCqJMbAUWi5dw8pyqvuRjMkPIfJ RqhBeWRxUaOStywlfTSw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jUCDL-0002lJ-LP; Thu, 30 Apr 2020 16:39:07 +0000 Received: from mga12.intel.com ([192.55.52.136]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jUCDI-0002iq-E6 for linux-arm-kernel@lists.infradead.org; Thu, 30 Apr 2020 16:39:05 +0000 IronPort-SDR: B40m2+N/K6idejYeDx3liAegQ0Hg6AlBKfae6mpZEkaP+4IeQ+iuSCIaw8jGr9hlzFWKG7NGAS TeeFCxpd6tHQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Apr 2020 09:38:59 -0700 IronPort-SDR: ME5Ydnoy+OAr2lFUJblXA0A6ioZNOJkRmsQr7GxyMwPdnz/fSx/zy5+Unt5y3JubqY9W4wfgY3 OHFKiMXFCseg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,336,1583222400"; d="scan'208";a="261836945" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga006.jf.intel.com with ESMTP; 30 Apr 2020 09:38:52 -0700 Received: from andy by smile with local (Exim 4.93) (envelope-from ) id 1jUCD9-003x70-2a; Thu, 30 Apr 2020 19:38:55 +0300 Date: Thu, 30 Apr 2020 19:38:55 +0300 From: Andy Shevchenko To: Syed Nayyar Waris Subject: Re: [PATCH v3 4/4] gpio: xilinx: Utilize for_each_set_clump macro Message-ID: <20200430163855.GU185537@smile.fi.intel.com> References: <80745504d15c87aa1da0d4be3c16d1279f48615b.1588112716.git.syednwaris@gmail.com> <20200429102114.GF185537@smile.fi.intel.com> <20200430161514.GA7107@syed> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200430161514.GA7107@syed> 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-20200430_093904_547857_F4315E05 X-CRM114-Status: GOOD ( 12.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linus.walleij@linaro.org, vilhelm.gray@gmail.com, michal.simek@xilinx.com, bgolaszewski@baylibre.com, akpm@linux-foundation.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Apr 30, 2020 at 09:45:14PM +0530, Syed Nayyar Waris wrote: > On Wed, Apr 29, 2020 at 01:21:14PM +0300, Andy Shevchenko wrote: > > On Wed, Apr 29, 2020 at 04:39:47AM +0530, Syed Nayyar Waris wrote: ... > > > + const unsigned long state_size = BITS_PER_TYPE(*state); > > > > This '*state' is unneeded complication, use BITS_PER_U32. > > > > > +#define TOTAL_BITS BITS_PER_TYPE(chip->gpio_state) > > > > This macro makes code uglier, besides the fact of absence of #undef. > > And also see above. > > Thank you for your review comments. Just want to clarify, you want > a new macro to be created - 'BITS_PER_U32' ? It's already there (read bits.h). > Also, don't you think that with BITS_PER_TYPE(), in case later the type > of 'state' changes, it will be reflected in this code without any code > change? If it changes the bits per type will be least issues there. The rationale behind is to have code readable. In proposed change it is not. > Let me know if I have misunderstood something. > > > > > > + DECLARE_BITMAP(old, TOTAL_BITS); > > > + DECLARE_BITMAP(new, TOTAL_BITS); > > > + DECLARE_BITMAP(changed, TOTAL_BITS); -- 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