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=-0.8 required=3.0 tests=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 E8775C31E40 for ; Fri, 9 Aug 2019 14:19:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C8CDD2171F for ; Fri, 9 Aug 2019 14:19:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407061AbfHIOTC convert rfc822-to-8bit (ORCPT ); Fri, 9 Aug 2019 10:19:02 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:41937 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726342AbfHIOTB (ORCPT ); Fri, 9 Aug 2019 10:19:01 -0400 Received: by mail-qk1-f194.google.com with SMTP id g17so1058726qkk.8; Fri, 09 Aug 2019 07:19:00 -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=TEfOzDxFX7gDpnqMzrlBGrH3Syt9gXqMdj4yqEybIZo=; b=QXHfe+5F2OOhd2CElNQM4DMdlNJ4IJl8fINRHiW3jKlocffCMbvetrzZAqZj73zlmj KWvFoVIYkOHvDj1DaYKbfsuCvroIUYFb3KL+M9mkFDlElbx/WQrXDrEmoD9TEU4aBY4V KOYSTDW4jBYl1Q1ouhbunaHKhuxt1uFwhly4aynTDR3/pFoatrZAGcllqAX3imwjf7rg Zvptpq+bditHfN3KQpZl7biqacUzCNzWVHXcWNc47zgDNuTW5Ddvc7FolbuGOSKoYWHe U95f/JthiUb4jQ8Awib8m4ByohBD8ZbF9S/ymEA2OIxhbWwKX69SfaGeAtETxlf7AIPX 4bTg== X-Gm-Message-State: APjAAAULwbc9OKX1TGlOPd/2K493GXivn5Vz3PzAouoEWlMHdClUpahm 1/NNzHwi7xx3joyV/qXpaBZpTVA/KRvGrriqZOs= X-Google-Smtp-Source: APXvYqwdOIIhs7aYJbryOrEuz/1xQSAZBUfsTj7jxd0qGAmaTDwXDUSNUG1kGVNfZ5fjxOBFSW0skDDZmykp0YbSLSg= X-Received: by 2002:a37:984:: with SMTP id 126mr12380366qkj.3.1565360340175; Fri, 09 Aug 2019 07:19:00 -0700 (PDT) MIME-Version: 1.0 References: <20190731195713.3150463-1-arnd@arndb.de> <20190731195713.3150463-6-arnd@arndb.de> In-Reply-To: From: Arnd Bergmann Date: Fri, 9 Aug 2019 16:18:43 +0200 Message-ID: Subject: Re: [PATCH 05/14] gpio: lpc32xx: allow building on non-lpc32xx targets To: Bartosz Golaszewski Cc: soc@kernel.org, arm-soc , Vladimir Zapolskiy , Sylvain Lemieux , Russell King , Gregory Clement , Linus Walleij , Jason Cooper , Andrew Lunn , Sebastian Hesselbarth , "David S. Miller" , Greg Kroah-Hartman , Alan Stern , Guenter Roeck , linux-gpio , netdev , linux-serial@vger.kernel.org, USB list , LINUXWATCHDOG , Lee Jones , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org On Mon, Aug 5, 2019 at 10:28 AM Bartosz Golaszewski wrote: > > pt., 2 sie 2019 o 13:20 Arnd Bergmann napisał(a): > > > > On Fri, Aug 2, 2019 at 9:10 AM Bartosz Golaszewski > > wrote: > > > > -#include > > > > -#include > > > > +#define _GPREG(x) (x) > > > > > > What purpose does this macro serve? > > > > > > > > > > > #define LPC32XX_GPIO_P3_INP_STATE _GPREG(0x000) > > > > #define LPC32XX_GPIO_P3_OUTP_SET _GPREG(0x004) > > > > In the existing code base, this macro converts a register offset to > > an __iomem pointer for a gpio register. I changed the definition of the > > macro here to keep the number of changes down, but I it's just > > as easy to remove it if you prefer. > > Could you just add a comment so that it's clear at first glance? I ended up removing the macro. With the change to keep the reg_base as a struct member, this ends up being a relatively small change, and it's more straightforward that way. > > > > @@ -167,14 +166,26 @@ struct lpc32xx_gpio_chip { > > > > struct gpio_regs *gpio_grp; > > > > }; > > > > > > > > +void __iomem *gpio_reg_base; > > > > > > Any reason why this can't be made part of struct lpc32xx_gpio_chip? > > > > It could be, but it's the same for each instance, and not known until > > probe() time, so the same pointer would need to be copied into each > > instance that is otherwise read-only. > > > > Let me know if you'd prefer me to rework these two things or leave > > them as they are. > > I would prefer not to have global state in the driver, let's just > store the pointer in the data passed to gpiochip_add_data(). Ok, done. Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnd Bergmann Subject: Re: [PATCH 05/14] gpio: lpc32xx: allow building on non-lpc32xx targets Date: Fri, 9 Aug 2019 16:18:43 +0200 Message-ID: References: <20190731195713.3150463-1-arnd@arndb.de> <20190731195713.3150463-6-arnd@arndb.de> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Bartosz Golaszewski Cc: soc@kernel.org, arm-soc , Vladimir Zapolskiy , Sylvain Lemieux , Russell King , Gregory Clement , Linus Walleij , Jason Cooper , Andrew Lunn , Sebastian Hesselbarth , "David S. Miller" , Greg Kroah-Hartman , Alan Stern , Guenter Roeck , linux-gpio , netdev , linux-serial@vger.kernel.org, USB list , LINUXWATCHDOG List-Id: linux-serial@vger.kernel.org On Mon, Aug 5, 2019 at 10:28 AM Bartosz Golaszewski wrote: > > pt., 2 sie 2019 o 13:20 Arnd Bergmann napisał(a): > > > > On Fri, Aug 2, 2019 at 9:10 AM Bartosz Golaszewski > > wrote: > > > > -#include > > > > -#include > > > > +#define _GPREG(x) (x) > > > > > > What purpose does this macro serve? > > > > > > > > > > > #define LPC32XX_GPIO_P3_INP_STATE _GPREG(0x000) > > > > #define LPC32XX_GPIO_P3_OUTP_SET _GPREG(0x004) > > > > In the existing code base, this macro converts a register offset to > > an __iomem pointer for a gpio register. I changed the definition of the > > macro here to keep the number of changes down, but I it's just > > as easy to remove it if you prefer. > > Could you just add a comment so that it's clear at first glance? I ended up removing the macro. With the change to keep the reg_base as a struct member, this ends up being a relatively small change, and it's more straightforward that way. > > > > @@ -167,14 +166,26 @@ struct lpc32xx_gpio_chip { > > > > struct gpio_regs *gpio_grp; > > > > }; > > > > > > > > +void __iomem *gpio_reg_base; > > > > > > Any reason why this can't be made part of struct lpc32xx_gpio_chip? > > > > It could be, but it's the same for each instance, and not known until > > probe() time, so the same pointer would need to be copied into each > > instance that is otherwise read-only. > > > > Let me know if you'd prefer me to rework these two things or leave > > them as they are. > > I would prefer not to have global state in the driver, let's just > store the pointer in the data passed to gpiochip_add_data(). Ok, done. Arnd 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=-0.8 required=3.0 tests=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 7E45DC433FF for ; Fri, 9 Aug 2019 14:19:10 +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 508ED2171F for ; Fri, 9 Aug 2019 14:19:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="q3wYIA1k" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 508ED2171F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arndb.de 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=tVU/GpIjNKU7s+kSiAAO/1ctJ8MKQtiNTjCH3/dJCmY=; b=q3wYIA1kkZiD9v /RSU4u1m3HxcTxlm8CXlfvoXC2QxIJKDgmQWd6rnF2U7tFydoiQv8+VKlIWih1wFv/vPzPPmSHxFt Bp9OdAw9tqPYWSvHLHAPD7EYw4sqD3vRf7bCizhHXfGTmsouQfK7iWn6hjBh7cetjigNG+lX5Ps0i 5MmNNLvLN4bmfntN9hQ7+q0JLKgKTqqwiENqzSpVOK8N5bO81eqBcZ4ZUOz3ZjRUUFyMqDYuvMlb9 2ZXFpcal2uadxyAbZAB4djwrSDyf2IWRirsDFWDHOPXuLvXddeMjogpE+8mNLyFsbv8BT9CDaUdqt 0zuxzM069dBNLAZiYEzQ==; 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 1hw5jU-0003FL-J3; Fri, 09 Aug 2019 14:19:04 +0000 Received: from mail-qk1-f193.google.com ([209.85.222.193]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hw5jS-0003EH-3v for linux-arm-kernel@lists.infradead.org; Fri, 09 Aug 2019 14:19:03 +0000 Received: by mail-qk1-f193.google.com with SMTP id s145so71745165qke.7 for ; Fri, 09 Aug 2019 07:19:01 -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=TEfOzDxFX7gDpnqMzrlBGrH3Syt9gXqMdj4yqEybIZo=; b=fVWTgTiuj2/re3JdUGmsltEqvlcvhEgPa+1iLD8UzDajp5IVE4ZaifTiuYiXg1X7GM KJ4JbrfSEgV1qb5qnMagSOJb3ATLdCaGUxex0tfxAm7KRsbMq0/8/TLmFO6TJYcOQLzU 74A+cspcEqBkw6R37uuuWYjmVXRYLKTWqo8mdSYWxcPgszxMWTMJn16zGoZpJc3vJnG+ 58g/chm54TnAVxKGbtGwPovGt8l0YMQZsd6vdXuGcVp1ODcxhstkNVdeyOVwlNOAeJDG dlMJQ+Zwi0oH+G8i2ymS2RIfbZB7WP0XTceD/ImedWlnt20OMlmzhz3Pj+uXhIjuPn25 rYVg== X-Gm-Message-State: APjAAAVUGq5Vrg+23JYOxf+Wj4mWVzCDXpB4ITYSsEUq2F0cjfFeReoi Jl+ZLYBIX23Cv9ZIV6riblRkvjJ4+rHgjYJalAA= X-Google-Smtp-Source: APXvYqwdOIIhs7aYJbryOrEuz/1xQSAZBUfsTj7jxd0qGAmaTDwXDUSNUG1kGVNfZ5fjxOBFSW0skDDZmykp0YbSLSg= X-Received: by 2002:a37:984:: with SMTP id 126mr12380366qkj.3.1565360340175; Fri, 09 Aug 2019 07:19:00 -0700 (PDT) MIME-Version: 1.0 References: <20190731195713.3150463-1-arnd@arndb.de> <20190731195713.3150463-6-arnd@arndb.de> In-Reply-To: From: Arnd Bergmann Date: Fri, 9 Aug 2019 16:18:43 +0200 Message-ID: Subject: Re: [PATCH 05/14] gpio: lpc32xx: allow building on non-lpc32xx targets To: Bartosz Golaszewski X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190809_071902_162236_637AF7B2 X-CRM114-Status: GOOD ( 19.96 ) 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: Andrew Lunn , LINUXWATCHDOG , LKML , Jason Cooper , "David S. Miller" , Greg Kroah-Hartman , Gregory Clement , USB list , Russell King , Vladimir Zapolskiy , linux-gpio , soc@kernel.org, netdev , Alan Stern , Guenter Roeck , linux-serial@vger.kernel.org, Sylvain Lemieux , Lee Jones , Linus Walleij , arm-soc , Sebastian Hesselbarth Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org T24gTW9uLCBBdWcgNSwgMjAxOSBhdCAxMDoyOCBBTSBCYXJ0b3N6IEdvbGFzemV3c2tpCjxiZ29s YXN6ZXdza2lAYmF5bGlicmUuY29tPiB3cm90ZToKPgo+IHB0LiwgMiBzaWUgMjAxOSBvIDEzOjIw IEFybmQgQmVyZ21hbm4gPGFybmRAYXJuZGIuZGU+IG5hcGlzYcWCKGEpOgo+ID4KPiA+IE9uIEZy aSwgQXVnIDIsIDIwMTkgYXQgOToxMCBBTSBCYXJ0b3N6IEdvbGFzemV3c2tpCj4gPiA8YmdvbGFz emV3c2tpQGJheWxpYnJlLmNvbT4gd3JvdGU6Cj4gPiA+ID4gLSNpbmNsdWRlIDxtYWNoL2hhcmR3 YXJlLmg+Cj4gPiA+ID4gLSNpbmNsdWRlIDxtYWNoL3BsYXRmb3JtL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