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=-4.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, 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 3A225C49ED9 for ; Wed, 11 Sep 2019 00:27:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0BFB8216F4 for ; Wed, 11 Sep 2019 00:27:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="EzMngyN8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726239AbfIKA1X (ORCPT ); Tue, 10 Sep 2019 20:27:23 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:44181 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726126AbfIKA1X (ORCPT ); Tue, 10 Sep 2019 20:27:23 -0400 Received: by mail-lf1-f67.google.com with SMTP id q11so13704lfc.11 for ; Tue, 10 Sep 2019 17:27:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WajEOxLInLugBAoDBpA/UZhycoI/rEzq/XTRSPCwG6E=; b=EzMngyN8/VFtydsD0WIWfF50NQaPkM2eq8VQZ1+mbgQSlXsfBVGI+7MkTEJzrMepjE N5dzp3wn51b/B2O+rrJbqNGUKq5JuOmTT6211sd23WXSiR3zd2dGAm9f8pa0q1IGg2IK 7UUdZYscZWrzG/He/DIZfQEpeLTSwcEo3eedfyMyU6cEaPIfRhxowWNF6pc2dPeVa5X5 v3AHcOmN5viENhp+J71IZD/ZGQXMj0xOiHP+s7iSQW7MdcXBb3q+PaJlOw5FzNIHbjK7 mYXUmu9PfI0jRJ5VcJqvushgAmgG0XP8z+66xHsDuZzkpejBCpjVGlQGBPgYhkvRR1n8 BBEg== 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; bh=WajEOxLInLugBAoDBpA/UZhycoI/rEzq/XTRSPCwG6E=; b=S2UR1TPOgsglLHl0Xzk9Q56KiOiIdkJcbk5CI7pjIpPOWRntmDBtYjsuVtJQQBDvfZ X9/5UXUCS6KJp99+l6zWIYumU86G5g6xZp/9tNQa5RMsn5qelTzyJUIECJl2vOeKMnbk nLc1aikPIcMtL4fvqYy9yMsELwbw1hPrWuH229RbDO27WTaJm1x+vql8RTjd+fIfbNXA Addf6bI/udSPHccNMwNBjvPmXQuITPfeQsrYJubWkGMxXSmmsKMIVj32qBu2FH8qanoi 5p5ZJGDMBW7E3qWomajQ46nFkPIH+ZBkfE+OUTHzloze9qz1yoecczNn3VLz9oFCTZTk ei3w== X-Gm-Message-State: APjAAAXrd2PWdt4kRFw3mwpu+XEdB2/W3PMxuOPF5qA+ErpXsaH4gDy9 vJDcFboiYgF03z4rm/E6FsN3/z80Cj8JJvaavdCFLw== X-Google-Smtp-Source: APXvYqzTq8nRKqDrSo4UwdKaMsjIls0OQxxqbEF2KXMZYG4h+hjc3wihhhumQbhxZ9JIU9zTtyDhgWLKDvdddWxQFZc= X-Received: by 2002:a19:14f:: with SMTP id 76mr21572482lfb.92.1568161641802; Tue, 10 Sep 2019 17:27:21 -0700 (PDT) MIME-Version: 1.0 References: <20190905141304.22005-1-alexandre.belloni@bootlin.com> In-Reply-To: <20190905141304.22005-1-alexandre.belloni@bootlin.com> From: Linus Walleij Date: Wed, 11 Sep 2019 01:27:10 +0100 Message-ID: Subject: Re: [PATCH] pinctrl: at91-pio4: implement .get_multiple and .set_multiple To: Alexandre Belloni Cc: Ludovic Desroches , Nicolas Ferre , "open list:GPIO SUBSYSTEM" , Linux ARM , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org On Thu, Sep 5, 2019 at 3:13 PM Alexandre Belloni wrote: > > Implement .get_multiple and .set_multiple to allow reading or setting > multiple pins simultaneously. Pins in the same bank will all be switched at > the same time, improving synchronization and performances. > > Signed-off-by: Alexandre Belloni Good initiative! > + for (bank = 0; bank < atmel_pioctrl->nbanks; bank++) {> + unsigned int word = bank; > + unsigned int offset = 0; > + unsigned int reg; > + > +#if ATMEL_PIO_NPINS_PER_BANK != BITS_PER_LONG Should it not be > rather than != ? > + word = BIT_WORD(bank * ATMEL_PIO_NPINS_PER_BANK); > + offset = bank * ATMEL_PIO_NPINS_PER_BANK % BITS_PER_LONG; > +#endif This doesn't look good for multiplatform kernels. We need to get rid of any compiletime constants like this. Not your fault I suppose it is already there, but this really need to be fixed. Any ideas? Yours, Linus Walleij 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=-4.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, 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 9DCF2C49ED9 for ; Wed, 11 Sep 2019 00:27:31 +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 707872171F for ; Wed, 11 Sep 2019 00:27:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="GzF1Yrpo"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="EzMngyN8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 707872171F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org 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:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=yyIMtCiwXjWppYU/8JnGVWvt19hCj03i+0jjNn3fq4s=; b=GzF1YrpoU3y8cb OrjbJX6sG7u9o0w3uHzhqPf6Z+TSwM7sDYpG24H7r61d6GOU6YksmDsBNGTmbQYTJusuNIXtsHXeb X74ApAVR1oykrZ4I/j0yKsyTkb8Hwwh3ZkZBmR6KsrdsxL4ddxiOxqQ6+nYkaF0ULK76khml/5TU4 yYq/b1VB6k7wrN8EvI7xLiGF6quwzR76wJmQ7zyHLwuA8xMO7QUN7Xp40ciUfd5XRUAMNsENgw7u8 ON6hDAdOWHRCJEmX4XF4OWLD+xtbP+qjkb6sWdA3eKCJGzxnXEsGK51iAQtktdC4pBi9JR4Ptx/pw ISgSKhBkG/7ydz+J2qPA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i7qTm-0003PU-61; Wed, 11 Sep 2019 00:27:26 +0000 Received: from mail-lf1-x141.google.com ([2a00:1450:4864:20::141]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i7qTj-0003LE-9q for linux-arm-kernel@lists.infradead.org; Wed, 11 Sep 2019 00:27:24 +0000 Received: by mail-lf1-x141.google.com with SMTP id x80so14972112lff.3 for ; Tue, 10 Sep 2019 17:27:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WajEOxLInLugBAoDBpA/UZhycoI/rEzq/XTRSPCwG6E=; b=EzMngyN8/VFtydsD0WIWfF50NQaPkM2eq8VQZ1+mbgQSlXsfBVGI+7MkTEJzrMepjE N5dzp3wn51b/B2O+rrJbqNGUKq5JuOmTT6211sd23WXSiR3zd2dGAm9f8pa0q1IGg2IK 7UUdZYscZWrzG/He/DIZfQEpeLTSwcEo3eedfyMyU6cEaPIfRhxowWNF6pc2dPeVa5X5 v3AHcOmN5viENhp+J71IZD/ZGQXMj0xOiHP+s7iSQW7MdcXBb3q+PaJlOw5FzNIHbjK7 mYXUmu9PfI0jRJ5VcJqvushgAmgG0XP8z+66xHsDuZzkpejBCpjVGlQGBPgYhkvRR1n8 BBEg== 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; bh=WajEOxLInLugBAoDBpA/UZhycoI/rEzq/XTRSPCwG6E=; b=BEVYpuy5G3y31qWChS0eaLo9Lx64OfXC7FxgeIDIJoYOFuHo3cSjqJW1IT5M2nKq+E UDB2UWY+g66V9VTx63sDqMDnJW8japwQgv0qVaviAgOl2uo2HsJzQpVYh30ZurKAI9Up vtg6u5Kk/H4jqk7h0kGy/egD6NE12gQcbrMvsEVbfYydaEMTA3n8KMWVK2qX/Mpf5Uv4 QYrD8PVjsyiYgD12rwo0+k5+/deESc7bt+j4EAq5JhrsvKZt+B9oTQ0DsXYSgziAIFjw IUkeuEvXxvkIhX6wCDIZOabBeulNeHnbiTmjIGRqzbofuPhxytXafI1Q+hcZOfDz/C1c OxRg== X-Gm-Message-State: APjAAAUBpHiYMvL1X5d/RQts9IQNWABEp3jlnr0VxfSbH1ryk65aSHHk eXUSHy2G6ojw2YCsPzwforAXVeBKkay40wSEzRj1mA== X-Google-Smtp-Source: APXvYqzTq8nRKqDrSo4UwdKaMsjIls0OQxxqbEF2KXMZYG4h+hjc3wihhhumQbhxZ9JIU9zTtyDhgWLKDvdddWxQFZc= X-Received: by 2002:a19:14f:: with SMTP id 76mr21572482lfb.92.1568161641802; Tue, 10 Sep 2019 17:27:21 -0700 (PDT) MIME-Version: 1.0 References: <20190905141304.22005-1-alexandre.belloni@bootlin.com> In-Reply-To: <20190905141304.22005-1-alexandre.belloni@bootlin.com> From: Linus Walleij Date: Wed, 11 Sep 2019 01:27:10 +0100 Message-ID: Subject: Re: [PATCH] pinctrl: at91-pio4: implement .get_multiple and .set_multiple To: Alexandre Belloni X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190910_172723_349643_30EBA47F X-CRM114-Status: GOOD ( 11.21 ) 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: "open list:GPIO SUBSYSTEM" , Ludovic Desroches , Linux ARM , "linux-kernel@vger.kernel.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, Sep 5, 2019 at 3:13 PM Alexandre Belloni wrote: > > Implement .get_multiple and .set_multiple to allow reading or setting > multiple pins simultaneously. Pins in the same bank will all be switched at > the same time, improving synchronization and performances. > > Signed-off-by: Alexandre Belloni Good initiative! > + for (bank = 0; bank < atmel_pioctrl->nbanks; bank++) {> + unsigned int word = bank; > + unsigned int offset = 0; > + unsigned int reg; > + > +#if ATMEL_PIO_NPINS_PER_BANK != BITS_PER_LONG Should it not be > rather than != ? > + word = BIT_WORD(bank * ATMEL_PIO_NPINS_PER_BANK); > + offset = bank * ATMEL_PIO_NPINS_PER_BANK % BITS_PER_LONG; > +#endif This doesn't look good for multiplatform kernels. We need to get rid of any compiletime constants like this. Not your fault I suppose it is already there, but this really need to be fixed. Any ideas? Yours, Linus Walleij _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel