Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1198142ybt; Sat, 27 Jun 2020 00:59:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgMF2/wbOLbh36GuRof5LwMss7w+Von5kS0jvlw/IM0iwbFyLJoibwtex888ToAodEStoR X-Received: by 2002:a05:6402:1ca2:: with SMTP id cz2mr7057655edb.15.1593244770370; Sat, 27 Jun 2020 00:59:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593244770; cv=none; d=google.com; s=arc-20160816; b=mUpSxH8wYxYqRec05l9j08CmYGPDlY6heGPIhe4xCRGbz3ZDgANjTqgdIsl+IfMR1c qefVbU1o9GgJDU3JlziIrcbHmht9kkhlVPrI+Sclh7SRe3NKPqX6y2Q7iZ4rPvYXQEQX 7RCxRhrGmbbCNa7soyodYC50+TBXg73eH934IPYJaSwane/AInIKb5FbQ5ksLJi17Roh GoEat/lKcw+71j+9Mf+VyrBlQ+PTvWTcw3zmk9VMe0AySi4BRJPxBNKa9YfN4jNyTwuJ OBdufTowLNqqiJxLmRdxmjGe3e6Oa8Mq/eP6ncg1nnNYa+P+uwyxTX/4Dw2NwNbr/Tk+ GOwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=PwqxVIne10qqUcVKfsGPr/Ml+HefBONJjeU0IV6Kbfo=; b=UM4tHao0ozVpOmi11Mx9v+9iq8eNQH62UWfMvtQfZaNIxj9WX5IozDhC1lqthtXzpU IUbhU9UwHUXGIaSFDzPXVqrdZgN3fB7wN1I+ImbvSr40UrABw/vqrbQt4b3i8HCqqId7 AvlhTmK0s+2WZrsc4gQf38Ayo/CqL0/kesYIU5EKjNgnq0Zlt91AV1kkVHd0wFXmjhRq 1ZD1rj/uoG416AHC1zMomZSG58OnHh19GZx9PKXpqb8yNUQIzKsYkK37DnkZYhTl3BvO m2mxFCPUfM2GrGhvtjFSzpeX+OxNSDWwzUyuD7DOoUxI/99ei+4NO2lcuSKs1CpALSvG FNBg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u25si3977344ejj.175.2020.06.27.00.59.07; Sat, 27 Jun 2020 00:59:30 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726382AbgF0H6L convert rfc822-to-8bit (ORCPT + 99 others); Sat, 27 Jun 2020 03:58:11 -0400 Received: from mail-oi1-f195.google.com ([209.85.167.195]:34756 "EHLO mail-oi1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725980AbgF0H6K (ORCPT ); Sat, 27 Jun 2020 03:58:10 -0400 Received: by mail-oi1-f195.google.com with SMTP id e4so1958940oib.1; Sat, 27 Jun 2020 00:58:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=FEOix1PkmJ3Xu++XOiz630IHPluOaNyyv6Gt5QqasRA=; b=fqgYEG+zOrFBXq/UTt23d5o6YuURSPJts55aFRwNpZyVS+bC4CWPgJPs356PfC85EG n+KJWYdOxwzL8uAv9JWfbZn9cAilqGkm20qLpgR8hlOJdbl/ASf7hUXDJ/OJ2NBVnzxi k/rGsFD3lNHWMcI/1ErZxSufIZ3fO2nxlpsj5SuQCY9vFsUFcNfZBqubPIj6W/72ye6E wAsKHpc5BhD1yL5nJkvNGK2Ex7sBUesUfCLI6XOHBB4T0aV5cMhsKCy9eIRjkqMxTTck MEtFvhF0LIpiylN+PIJ9ju6BLmB2oRZ46i3snjWSZrF/kT/Mqpaxt5YZRt/YInlEsZXI +kLw== X-Gm-Message-State: AOAM531DKQ48YblDJW9WtIPgFbf4oFAcrfZyro2yWeD0PzIA7bvBjSob WGzvN3VWqg+5vVN/DxysL5EDvVrIDb3FRGnhD2c= X-Received: by 2002:aca:1801:: with SMTP id h1mr928201oih.148.1593244690056; Sat, 27 Jun 2020 00:58:10 -0700 (PDT) MIME-Version: 1.0 References: <20200623145748.28877-1-geert+renesas@glider.be> <20200623145748.28877-3-geert+renesas@glider.be> In-Reply-To: From: Geert Uytterhoeven Date: Sat, 27 Jun 2020 09:57:58 +0200 Message-ID: Subject: Re: [PATCH 2/2] gpio: aggregator: Use bitmap_parselist() for parsing GPIO offsets To: Andy Shevchenko Cc: Bartosz Golaszewski , Linus Walleij , linux-gpio , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andy, On Wed, Jun 24, 2020 at 3:41 PM Andy Shevchenko wrote: > On Wed, Jun 24, 2020 at 3:16 PM Bartosz Golaszewski > wrote: > > wt., 23 cze 2020 o 16:57 Geert Uytterhoeven > > napisaƂ(a): > > > > > > Replace the custom code to parse GPIO offsets and/or GPIO offset ranges > > > by a call to bitmap_parselist(), and an iteration over the returned bit > > > mask. > > > > > > This should have no impact on the format of the configuration parameters > > > written to the "new_device" virtual file in sysfs. > > > > > > Suggested-by: Andy Shevchenko > > > Signed-off-by: Geert Uytterhoeven > > > --- > > > I'm not super happy with the mask[] array, which is on the stack. > > > But there is no real limit on the number of GPIO lines provided by a > > > single gpiochip, except for the global ARCH_NR_GPIOS. > > > > Why not allocate it with bitmap_zalloc() then? Bartosz: Thanks, good idea! > I haven't got the original messages yet, so my thought is to actually > extract a helper from > gpiod_get_array_value_complex() or gpiod_set_array_value_complex() for > bitmap allocation. > But I didn't check if it's suitable here. So, bitmap_zalloc() would be helpful. /me confused This function is not about getting/setting multiple GPIO lines in a gpiochip, but about parsing a list of numbers and ranges. No gpiochip is involved. original message: https://lore.kernel.org/r/20200623145748.28877-3-geert+renesas@glider.be Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds