Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1671481imm; Thu, 14 Jun 2018 01:46:43 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJfCBL2EAYDljgwwNTechMkQleP/cTesqh2s/rkyMSDn9OjqZqpZ8iZB7C1DH1fxtKMtr6N X-Received: by 2002:a17:902:6686:: with SMTP id e6-v6mr2009051plk.35.1528966003219; Thu, 14 Jun 2018 01:46:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528966003; cv=none; d=google.com; s=arc-20160816; b=f9oFLdqy3i9irlTEMCutntkullasWxUfu0ysu7M/uPeW7lgAo72YfMIXp7D2h23NDr MOexNUPOFL+n7Xk7NVNlAINbmIoMkDh0GDGzShXrwyY2VK3fjCRrBNga2OGIyFfEMcPN e89ytcQosl+pR4NhMKyJa9h8yl0vGPc1G83gZKVKJCByWZh0kLrAxBfOPnFzB/l2zbpJ YxpFnX6YLiRUn1x1UdmgSzsKZhpDU0tYvilj2edEtpOU4HNjHfcJ1WoPldTQvOcb4fdT Y4Nb1JACjeJXTJvjq5ZNXxBrZMXNYa1r46dAXhRSeZAlkieMfYobpJGX5WTNVaRKqfox kCkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=ICIgJhCgp6638ARAjh/M+gfA32sf5yYiUytOtitAcck=; b=xKTMjWmugx478wOqdC2w21QCfzxuhkX9kxL720vUwkjaQ5tp4IQ6Q9COSVK1HCgHky GhUmjHuoYni+7FWh6Kwstp/IDrTgTRV6jfrSNb6uBGpMxcNDmp1SJCWRKOgoOh4V/G0o 0BFo/GVPmV+MSzsY6w0iJDDkqclxu4KH5jsWUSgqITj+Qmsljsm1ey9XzjWmoKY6mx2X LuM0rjdmwhuChHgaYvvZKBUiWVvQG0kWYQfLJhkvFnrI6L8UdVuYiUHdAf43aachFI8d Fc9UGoc8Sbyz9BIShKzXGFMjV8y2ZNJCcHlBV3gv2DY4d2FXbKbvMXlWM9yF2rUijyDc 97/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XhrRyjZG; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j6-v6si4051699pgs.615.2018.06.14.01.46.28; Thu, 14 Jun 2018 01:46:43 -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; dkim=pass header.i=@linaro.org header.s=google header.b=XhrRyjZG; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754687AbeFNIqE (ORCPT + 99 others); Thu, 14 Jun 2018 04:46:04 -0400 Received: from mail-it0-f66.google.com ([209.85.214.66]:39192 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752928AbeFNIp7 (ORCPT ); Thu, 14 Jun 2018 04:45:59 -0400 Received: by mail-it0-f66.google.com with SMTP id p185-v6so7606126itp.4 for ; Thu, 14 Jun 2018 01:45:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ICIgJhCgp6638ARAjh/M+gfA32sf5yYiUytOtitAcck=; b=XhrRyjZGiPWcFQAO7ZSUm1r0mUk3nxjTXjHlqHemsoMDEjn8deRDwtFcOA64sQ/nWg cqL/MqZf0TGS6lNMkEJcput9ttZe/SXHagAsYaKoW1oLO7Wow9ozuV2SCA1ddoKNB5z1 p6qvqbifG5kLY85y8KeJCzu9+Wq3sgtSqFFKg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ICIgJhCgp6638ARAjh/M+gfA32sf5yYiUytOtitAcck=; b=HFddmBWSqCzFWOEVwx/yfHIUBQ7TVh0Byi4ekOI1GM6QkVsru4zU/fC5kx0fpcLm8Q ZHKiaNtWjAx2Ya6y2tzUS4f5pIo7i/YO/ycCt7VpG+ZBBvvLtC/FRpEx24zogkewSL5r GItoOPtYSn0m1pate0DdtVZtYBCclETc/AyiWDJ7k48l9uHNlM2vYeIKpYTVnY9qfJ2t NaC/MrCwF29M4f6qR53FwgG8SO3/o1wPXKStTuB+9YgdMHedSGG+pRIt+Y1ia7/1d8pm yREdr2QSMXFXYVB8VyRxxV5MCk0uAI9UFY+hIeWqEbpkpxiyIjCpvJSajGErkQ19zQI9 oO4A== X-Gm-Message-State: APt69E1260n5x4Clju76M27j/BZ0sVwg21FBE05H3ctyiodI920wwuhn YATwYOAQL0ZQV2I50xJxueb1jJ63d8J8tE41dM0WEDNC X-Received: by 2002:a24:690f:: with SMTP id e15-v6mr1405061itc.70.1528965958760; Thu, 14 Jun 2018 01:45:58 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4f:78c9:0:0:0:0:0 with HTTP; Thu, 14 Jun 2018 01:45:57 -0700 (PDT) In-Reply-To: <20180609140224.32606-6-jmkrzyszt@gmail.com> References: <20180609140224.32606-1-jmkrzyszt@gmail.com> <20180609140224.32606-6-jmkrzyszt@gmail.com> From: Linus Walleij Date: Thu, 14 Jun 2018 10:45:57 +0200 Message-ID: Subject: Re: [PATCH 06/10] ARM: OMAP1: ams-delta FIQ: don't use static GPIO numbers To: Janusz Krzysztofik Cc: Dmitry Torokhov , Tony Lindgren , Aaro Koskinen , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Andrew Morton , Randy Dunlap , Liam Girdwood , Mark Brown , Linux ARM , Linux Input , Linux-OMAP , "open list:GPIO SUBSYSTEM" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jun 9, 2018 at 4:02 PM, Janusz Krzysztofik wrote: > With introduction of GPIO lookup tables to Amstrad Delta board init > file, semantics of symbols representing OMAP GPIO pins defined in > changed from statically assigned global GPIO > numbers to hardware pin numbers local to OMAP "gpio-0-15" chip. > > This patch modifies deferred FIQ interrupt handler so it no longer uses > static GPIO numbers in favour of IRQ data descriptors obtained at FIQ > initialization time from descriptor of the GPIO chip with use of its > hardware pin numbers. The chip descriptor is passed from the board > init file. > > As a benefit, the deferred FIQ handler should work faster. > > Signed-off-by: Janusz Krzysztofik Making the kernel a better place, so: Acked-by: Linus Walleij > +/* > + * Some drivers may not use GPIO lookup tables but need to be provided > + * with GPIO numbers. The same applies to GPIO based IRQ lines - some > + * drivers may even not use GPIO layer but expect just IRQ numbers. > + * We could either define GPIO lookup tables then use them on behalf > + * of those devices, or we can use GPIO driver level methods for > + * identification of GPIO and IRQ numbers. For the purpose of the latter, > + * defina a helper function which identifies GPIO chips by their labels. > + */ > +static int gpiochip_match_by_label(struct gpio_chip *chip, void *data) > +{ > + char *label = data; > + > + return !strcmp(label, chip->label); > +} > + > +/* > + * The purpose of this function is to take care of proper initialization of > + * devices and data structures which depend on GPIO lines provided by OMAP GPIO > + * banks but their drivers don't use GPIO lookup tables or GPIO layer at all. > + * The function may be called as soon as OMAP GPIO devices are probed. > + * Since that happens at postcore_initcall, it can be called successfully > + * from init_machine or later. > + * Dependent devices may be registered from within this function or later. > + */ > +static void __init omap_gpio_deps_init(void) > +{ > + struct gpio_chip *chip; > + > + chip = gpiochip_find(OMAP_GPIO_LABEL, gpiochip_match_by_label); > + if (!chip) { > + pr_err("%s: OMAP GPIO chip not found\n", __func__); > + return; > + } > + > + ams_delta_init_fiq(chip); > +} This is some real stunt work isn't it. We should really think about ways to get gpiolib more helpful for board setups like this, but it seems complex. Yours, Linus Walleij