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=-3.8 required=3.0 tests=BAYES_00,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 DECD2C433B4 for ; Thu, 8 Apr 2021 15:09:59 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 7D196610F9 for ; Thu, 8 Apr 2021 15:09:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7D196610F9 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+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=desiato.20200630; 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=i3LEMu2tMnXtXXhI8ULODM6bmCu8isMG4S8wTNYzf0c=; b=NX/0ykd9ZRGNyEftelUOYPt/B FO5cdOAFsEByax58uG1Ns5jcgOIYacm7SJkvlTDZp5E7vh6UHw1wpfjQzR6BCca7WQ/OlajDHqwEP y1BES/HQSrBDyutO3YFXZNqoncsI0JfjB3gCDgxJBrgs98tUAWz+jWcrUafV/WlI+iwUE9GXMV96e gN3+d9G0TAU52AbnQ0pYYWSxtB4OLoCWZ2VL5BV+HQYbW2EuR9Z7toTYd/aL4XQaFucn4vuYOMZ13 ROZA7TvhvpHWBajaK1eez3hqjWJVzs+Nzbh4QMlMBYUu7z0e6YKl3qb5HSs74Nsh20YOpYeZQlJRN eh9460Zew==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lUWGe-008Kcq-Js; Thu, 08 Apr 2021 15:08:24 +0000 Received: from mga18.intel.com ([134.134.136.126]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lUWGZ-008Kbw-2p for linux-arm-kernel@lists.infradead.org; Thu, 08 Apr 2021 15:08:21 +0000 IronPort-SDR: TefL4ngSAj9zbCJO8YNxe7/K4ATf67Jqo000lWDwOYntd+yDOu94JvvZxlc0qqdDzHl6Dof2Bv q7FgM9m2YQIA== X-IronPort-AV: E=McAfee;i="6000,8403,9948"; a="181098044" X-IronPort-AV: E=Sophos;i="5.82,206,1613462400"; d="scan'208";a="181098044" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2021 08:08:16 -0700 IronPort-SDR: eyr3XZ4aMEISqgXdcU5mtNIg+bh+K3PnYPQbTtIz5W7c8WvkKTZStEsTbpK2D+42s2odi13GjK UVm7E8cJyBiQ== X-IronPort-AV: E=Sophos;i="5.82,206,1613462400"; d="scan'208";a="449710603" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2021 08:08:13 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1lUWGO-002JkX-L9; Thu, 08 Apr 2021 18:08:08 +0300 Date: Thu, 8 Apr 2021 18:08:08 +0300 From: Andy Shevchenko To: linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Shubhrajyoti Datta , Srinivas Neeli , Michal Simek , Linus Walleij , Bartosz Golaszewski , Yury Norov , Rasmus Villemoes , Syed Nayyar Waris , vilhelm.gray@gmail.com Subject: Re: [PATCH v1 4/5] gpio: xilinx: Switch to use bitmap APIs Message-ID: References: <20210408145601.68651-1-andriy.shevchenko@linux.intel.com> <20210408145601.68651-5-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210408145601.68651-5-andriy.shevchenko@linux.intel.com> 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-20210408_160819_456294_CA440E66 X-CRM114-Status: GOOD ( 15.51 ) 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, Apr 08, 2021 at 05:56:00PM +0300, Andy Shevchenko wrote: > It seems that Xilinx GPIO driver operates with bit arrays longer than 32 and > thus can leverage bitmap APIs for that. It makes code better to understand. > > The ->probe() function is modified to try read properties for both channels > since is_dual check makes only sense for the amount of pins used for the second > channel. On top of that kzalloc() guarantees zero initial values for the fields > in the private data structure, hence drop unneeded conditionals and assignments. > > The change is inspired by Syed Nayyar Waris' ideas about bitmap API extension. As I was afraid in the cover letter, I found some mistakes already. In any case, I'll wait for the comments and test of other patches if possible. Out of curiosity, below I point out the issues. ... > + return bitmap_bitremap(gpio, chip->sw_map, chip->hw_map, chip->gc.ngpio); Seems we have to use 64 instead of ngpio here. ... > + bitmap_replace(state, chip->state, hw_bits, hw_mask, gc->ngpio); Ditto. ... > + bitmap_copy(chip->state, state, gc->ngpio); Ditto. ... > + for_each_set_bit(bit, all, 64) > + generic_handle_irq(irq_find_mapping(gc->irq.domain, bit)); Here should be used gpio actually and ngpio IIUC. -- 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