Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3667452ybt; Tue, 23 Jun 2020 08:00:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXZFF43vM137S3odNur5IjVHuqDDJgJrcRs/WBwf348LxSwW6fglnk4FwLaK2XVaM6zKxT X-Received: by 2002:a17:906:509:: with SMTP id j9mr20137115eja.341.1592924410822; Tue, 23 Jun 2020 08:00:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592924410; cv=none; d=google.com; s=arc-20160816; b=C2GYQgQ5kXEDG2zhI0moa8EyTs0hRthxvhc2WMMXFgvTLnz1aAeSWRSPVuVoEw+cAe b96TPiBKff7VMRHvzaFdlA73m5rvV6cAx0GnVlLFil4OwJA1u24YrehMyATbmwZ7IjMA 0b0qRdo+cUei7ZjaRJ3X9+U+ltI0+5gqh6Ejv7ur/FT8J+hjQpQYTTStsAF39uMM1WRT WgNiE3OOCuuzX2TA7JpRqEsD7MZtBmEKSkfqUz+ZYxHBBsx0c8YVvSdbKNqFuGxVTtcM ibjKvntxbPFadiFG1M+MzTfzjooFPR30iQ0Dg2yOHsPf9FA9Awi7qhc2VciSbSMA0fln CzoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=J4HxoBhAqdjdeFIWH9OoaqNHyRFBuXJYmIQIXVS69Wo=; b=fifZ7OYs42r25Of3JM7P21xbEREosq/WdO6jG6Tmm8hwaMO/GeNUXS0rdYleB4EWGy lNaSRsJyc9S0Ve9zd4E6YC/PaRfu7sWRAoniSJJE4/Z85m6oz4xMrXYo4f0lEC7g733a xnUzwPxBjURlUNJeR74tQujR0iXzgN+Z0dPrYyO1o8bt0WSN3xjZp7mM9wU0u9q9urPt APvRcvo3uUQJcTBMYTc17dnzucmGHQ69FGknjFLKWH9eibDx2H6juyvuFYo/i7FRS3FE 7WtzbAKDKvGwLlP2RPrJvJGKxweeOZCL5WyWMgv+RD59v3GQRwKwWqxQmKJY4jpSfL7u 09vg== 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 du14si6659732ejc.721.2020.06.23.07.59.46; Tue, 23 Jun 2020 08:00:10 -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 S1732881AbgFWO54 (ORCPT + 99 others); Tue, 23 Jun 2020 10:57:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732859AbgFWO5z (ORCPT ); Tue, 23 Jun 2020 10:57:55 -0400 Received: from laurent.telenet-ops.be (laurent.telenet-ops.be [IPv6:2a02:1800:110:4::f00:19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34276C061798 for ; Tue, 23 Jun 2020 07:57:54 -0700 (PDT) Received: from ramsan ([IPv6:2a02:1810:ac12:ed20:26:93a1:ff06:f8b0]) by laurent.telenet-ops.be with bizsmtp id uexs2200P4qCYS801exsSt; Tue, 23 Jun 2020 16:57:52 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1jnkMy-0007V6-Kn; Tue, 23 Jun 2020 16:57:52 +0200 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1jnkMy-0007WW-Io; Tue, 23 Jun 2020 16:57:52 +0200 From: Geert Uytterhoeven To: Linus Walleij , Bartosz Golaszewski , Andy Shevchenko Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 0/2] gpio: aggregator: Misc parsing improvements Date: Tue, 23 Jun 2020 16:57:46 +0200 Message-Id: <20200623145748.28877-1-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Linus, Bartosz, Andy, This patch series contains two improvements for the parsing code in the GPIO Aggregator. The second one converts the driver to use bitmap_parselist() for parsing GPIO offsets and/or ranges, as suggested by Andy[1]. Note that I'm not super happy with the mask[] array 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. I also considered getting rid of the custom isrange() function. However, the check for "!isrange(offsets)" cannot be replaced by a check for bitmap_parselist() returning -EINVAL, as bitmap_parselist() happily accepts an empty list. Hence I'm afraid isrange() has to stay. Andy also suggested to use strstrip() in get_arg(). However, I see no point in that, as get_arg() has to find the end of the actual parameter anyway. Thanks for your comments! [1] https://lore.kernel.org/r/20200520121420.GA1867563@smile.fi.intel.com Geert Uytterhoeven (2): gpio: aggregator: Drop pre-initialization in get_arg() gpio: aggregator: Use bitmap_parselist() for parsing GPIO offsets drivers/gpio/gpio-aggregator.c | 46 ++++++++++++---------------------- 1 file changed, 16 insertions(+), 30 deletions(-) -- 2.17.1 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