Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3370315pxb; Mon, 9 Nov 2020 09:23:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJzzdU872S34/fowFwMOuX8xpO8tPBMWbdhJ/HAk6iOQ9l0WBiPouyBqN0Oba4AhmY2t714i X-Received: by 2002:a17:906:a891:: with SMTP id ha17mr16840455ejb.116.1604942622470; Mon, 09 Nov 2020 09:23:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604942622; cv=none; d=google.com; s=arc-20160816; b=lZj0EE6IjsawBg2EfFK1u8JWdj7lTs3SteBdpIvjl/fT1hivmdUgawvGOAimTINQe8 1whfCBZlUBv0VPn/EEfF9mSdKEL7C4P2GmDl7mymJCLlvW/Bo3OD5+ljyH4HsJlpfIYY 5O+IKe5yPJs+7PvaJPlCvfi0aLvXRxu7iw1agj6bwoa+7bQvTiUSatHUyPk4lLid8MTx BxqRFiVzB5kYj7VV4q3WxoFNM1agM22Scr1K644XNXdnjguGDf74YIPtqpf+xsZLpRS2 PeCkWoNbsxpml2pnmEpuV4Tphh9GXMkHjMRJ2PAJ8M1dfaWYH1rpoZPhQLv6Tg5Mghwu OGEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=5DiMk6juXV9+l+JbgPL0AKYgJALZ853CskwDiy2D1Gc=; b=xJjH6Ku4yn8c2nZyDuR6MNXYfhUzuYykG2nYLso7Tw2snQBmUqEnQsCg+2vyTUpskM bpskgqor83WXLxb5czicjEZI/1H+Yxp8U/ELgDwcFdfxaWrnkmXcfN7tdlcUOgLkNLtW ZTlgsGrHxVjm1CZNVe66yodaUIb92aiRd9zeD8Lu0hCqACCy/Swg7r9agduQe6A2+Or1 GvwS3ZKA0pJuVvh7+x/zb+lBzpnnmzR8+MuDMFmyyMu0/8mS2sNylItsR7fwjle0u6rX iETOlrdQ/ECtAQ7VjzL3QS6aoxEiR/++CZSpn7zDXIavL9Q6OmvlR6fWqnZjkLlkz2SZ WQ9w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ba14si7515847edb.54.2020.11.09.09.23.19; Mon, 09 Nov 2020 09:23:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730928AbgKIRVV (ORCPT + 99 others); Mon, 9 Nov 2020 12:21:21 -0500 Received: from mga11.intel.com ([192.55.52.93]:15903 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730706AbgKIRVV (ORCPT ); Mon, 9 Nov 2020 12:21:21 -0500 IronPort-SDR: ZW5IqiRoQEBW/rQ+fkBRMmWt8VniP4JJaanZ7aOI5tuz5vNfRdMXr7Ain1+XY/udlJASi6ereZ mvt7H1Y9SeqA== X-IronPort-AV: E=McAfee;i="6000,8403,9800"; a="166329501" X-IronPort-AV: E=Sophos;i="5.77,463,1596524400"; d="scan'208";a="166329501" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2020 09:21:20 -0800 IronPort-SDR: A4eSjrjqpfJfkTizVTZkSMuHaiIfk/cCuliExX/anFiyOMtQtGl5XfEkTN0CFmOznpRKuBLyqf JMOZ8d3gfM7A== X-IronPort-AV: E=Sophos;i="5.77,463,1596524400"; d="scan'208";a="530836851" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2020 09:21:18 -0800 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1kcAs0-005F7O-G2; Mon, 09 Nov 2020 19:22:20 +0200 Date: Mon, 9 Nov 2020 19:22:20 +0200 From: Andy Shevchenko To: William Breathitt Gray Cc: Syed Nayyar Waris , Arnd Bergmann , Linus Walleij , Andrew Morton , "open list:GPIO SUBSYSTEM" , "linux-kernel@vger.kernel.org" , Michal Simek , Bartosz Golaszewski , Linux ARM Subject: Re: [PATCH v12 4/4] gpio: xilinx: Utilize generic bitmap_get_value and _set_value Message-ID: <20201109172220.GI4077@smile.fi.intel.com> References: <15a044d3ba23f00c31fd09437bdd3e5924bb91cd.1603055402.git.syednwaris@gmail.com> <20201101150033.GA68138@shinobu> <20201109123411.GA19869@syed> <20201109134128.GA5596@shinobu> <20201109164529.GA28710@syed.domain.name> <20201109171140.GA14045@shinobu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201109171140.GA14045@shinobu> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 09, 2020 at 12:11:40PM -0500, William Breathitt Gray wrote: > On Mon, Nov 09, 2020 at 10:15:29PM +0530, Syed Nayyar Waris wrote: > > On Mon, Nov 09, 2020 at 03:41:53PM +0100, Arnd Bergmann wrote: ... > > static inline void bitmap_set_value(unsigned long *map, > > - unsigned long value, > > + unsigned long value, const size_t length, > > unsigned long start, unsigned long nbits) > > { > > const size_t index = BIT_WORD(start); > > @@ -15,6 +15,10 @@ static inline void bitmap_set_value(unsigned long *map, > > } else { > > map[index + 0] &= ~BITMAP_FIRST_WORD_MASK(start); > > map[index + 0] |= value << offset; > > + > > + if (index + 1 >= length) > > + __builtin_unreachable(); > > + > > map[index + 1] &= ~BITMAP_LAST_WORD_MASK(start + nbits); > > map[index + 1] |= value >> space; > > } > > Hi Syed, > > Let's rename 'length' to 'nbits' as Arnd suggested, and rename 'nbits' > to value_width. length here is in longs. I guess this is the point of entire patch. But to me sounds like it would be better to have simply bitmap_set_value64() / bitmap_set_value32() with proper optimization done and forget about variadic ones for now. -- With Best Regards, Andy Shevchenko