Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp397727ybl; Fri, 9 Aug 2019 07:39:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqznjf0NkkytmH/x1SIPTwF4kZf0UWSSCpQaPI7f2ABogfByPdoxlB9SaNFuPKkD+l3QIGIc X-Received: by 2002:a17:902:ab83:: with SMTP id f3mr19363215plr.122.1565361559044; Fri, 09 Aug 2019 07:39:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565361559; cv=none; d=google.com; s=arc-20160816; b=nstMfZT7H0z4/xggY/fMOzhKHE1DUxGZ1haECBO+f96OVINykQJT+XbcuopQuldD4R 8Dnss785qPYk8NPRIPStrRAO4FVrUvB1jzEi0rqgR/5206TVAd+aNn1KfDN5Th/yN8/l VZoS7ODdpk511KAqFtqRYeKjcdGxcMPfmEIFT66NGG740uirtoC7ypAL0Qj3567AaS3I KoPza7eTPv/SRHx8pSI8mEAABYF34feVfma5foFiM2lWnS6iSZFBwban9tOr4iFI1pv8 nly6UjD0VkHMQ+EXUrzolC+eLhHrcsZXqsBdtixZwTtP6fNvbeVOxyXWfJSSQhWRd11Q 4RWg== 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=ysOMbjPRwhgNQpQgTAgrcyG66FJ3G75jDWP+pibU3RI=; b=j9C9UN4Kk2xxuO/84lscBnNBQ2YE+U33mmLYLDWzJWXo9oGdB0KCh2+Ipned+6R5LW nBgYowhkEb8nzIw2gr6KKlagp49aQKzTdYVw3FBd5oap8xBFbOtnTTkRTLz8aI/CNBbd EzcNRZonRQR6S5yVZ4yKJ7wtxRpKvpMljZ4X/MQ6E8hI+jZMEmRNNXUYUonHf0589oRM KvNqhAiM6CdG8f8QOoif7RhO5rW+cukhV3bp9R8C0M24YaB4moLFPix6OhMsD7H8+gzp qVJmP0G4XOtUwSYLb6HYV7gEJAdzawBr4SUKkfnEipsDGGx30ARHHDpd78VZvWQA5aS7 cAHw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j64si59356250pge.556.2019.08.09.07.39.02; Fri, 09 Aug 2019 07:39:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407085AbfHIOTC convert rfc822-to-8bit (ORCPT + 99 others); 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-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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