From patchwork Fri Mar 21 09:42:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 26796 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f197.google.com (mail-ve0-f197.google.com [209.85.128.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0DDD620143 for ; Fri, 21 Mar 2014 09:42:57 +0000 (UTC) Received: by mail-ve0-f197.google.com with SMTP id pa12sf5094167veb.4 for ; Fri, 21 Mar 2014 02:42:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=I1cfjOnMhsOniFOZe/ypBXYLN+U6Vh2bsLttk8qkW1Q=; b=lG1H2ntOEhXg5ZHtrtwvx8ElKrKTiRaWJzlVz9o72e8BVH+zZgfjyEU4MPovFTWbvJ RvmGNEPMqwz1O7mMP5WQdttmQGts3OJ7PypSPr0gHLAR4suOWu09cHJlUiBpVGVhbRXX azgx7oP7HxPOf1mSGSlbt4eFcf9rYHPNwj1n9y+3vGsXesi5YCZ3PaOpVfWmZiZE/sMi JaiG7+5k7ZzqVCmnBmSs1+dYOVUnJ4sCIFIjxwW+BP9KoMU4xNCnMbf5TM1cD90WyMG4 iRAujf+pPCpivIo6INX/N5KQT5Ssp7FQ3iaNfh1U3rJZkkmnZh99RFuVSMiTqCZXyUpl N3ZA== X-Gm-Message-State: ALoCoQmjJt5I9AKQErx1fWdWSIhbW/Ba5vEtYgpnT1w2ArhQg0ygvGUl6o6wDVG+g+zWH7cnaZWo X-Received: by 10.236.132.239 with SMTP id o75mr8596757yhi.19.1395394977736; Fri, 21 Mar 2014 02:42:57 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.49.166 with SMTP id q35ls621483qga.89.gmail; Fri, 21 Mar 2014 02:42:57 -0700 (PDT) X-Received: by 10.52.180.98 with SMTP id dn2mr28668vdc.58.1395394977652; Fri, 21 Mar 2014 02:42:57 -0700 (PDT) Received: from mail-ve0-f180.google.com (mail-ve0-f180.google.com [209.85.128.180]) by mx.google.com with ESMTPS id xs6si1030457vec.56.2014.03.21.02.42.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 21 Mar 2014 02:42:57 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.180; Received: by mail-ve0-f180.google.com with SMTP id jz11so2223044veb.25 for ; Fri, 21 Mar 2014 02:42:57 -0700 (PDT) X-Received: by 10.220.106.84 with SMTP id w20mr36875310vco.18.1395394977570; Fri, 21 Mar 2014 02:42:57 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.78.9 with SMTP id i9csp17617vck; Fri, 21 Mar 2014 02:42:57 -0700 (PDT) X-Received: by 10.67.13.226 with SMTP id fb2mr30844133pad.146.1395394976753; Fri, 21 Mar 2014 02:42:56 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f8si3315956pbc.329.2014.03.21.02.42.55; Fri, 21 Mar 2014 02:42:55 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760690AbaCUJmo (ORCPT + 26 others); Fri, 21 Mar 2014 05:42:44 -0400 Received: from mail-wg0-f42.google.com ([74.125.82.42]:59069 "EHLO mail-wg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760576AbaCUJmi (ORCPT ); Fri, 21 Mar 2014 05:42:38 -0400 Received: by mail-wg0-f42.google.com with SMTP id y10so1397837wgg.1 for ; Fri, 21 Mar 2014 02:42:37 -0700 (PDT) X-Received: by 10.194.174.197 with SMTP id bu5mr1099719wjc.71.1395394957480; Fri, 21 Mar 2014 02:42:37 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id at10sm11855712wjc.6.2014.03.21.02.42.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Mar 2014 02:42:36 -0700 (PDT) From: Linus Walleij To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: linux-gpio@vger.kernel.org, Linus Walleij Subject: [PATCH 2/2] pinctrl: nomadik: factor in platform data container Date: Fri, 21 Mar 2014 10:42:32 +0100 Message-Id: <1395394952-31545-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.8.5.3 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The old platform data struct is just a leftover from the times when the driver was not probed exclusively from the device tree. Factor this into the general state container and simplify the probe path. Signed-off-by: Linus Walleij --- drivers/pinctrl/pinctrl-nomadik.c | 39 +++++++++------------------------------ 1 file changed, 9 insertions(+), 30 deletions(-) diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c index ee6a8ca264fc..51f28c927c7e 100644 --- a/drivers/pinctrl/pinctrl-nomadik.c +++ b/drivers/pinctrl/pinctrl-nomadik.c @@ -246,19 +246,6 @@ enum nmk_gpio_slpm { NMK_GPIO_SLPM_WAKEUP_DISABLE = NMK_GPIO_SLPM_NOCHANGE, }; -/* - * Platform data to register a block: only the initial gpio/irq number. - */ -struct nmk_gpio_platform_data { - char *name; - int first_gpio; - int first_irq; - int num_gpio; - u32 (*get_latent_status)(unsigned int bank); - void (*set_ioforce)(bool enable); - bool supports_sleepmode; -}; - struct nmk_gpio_chip { struct gpio_chip chip; struct irq_domain *domain; @@ -1240,39 +1227,33 @@ static const struct irq_domain_ops nmk_gpio_irq_simple_ops = { static int nmk_gpio_probe(struct platform_device *dev) { - struct nmk_gpio_platform_data *pdata; struct device_node *np = dev->dev.of_node; struct nmk_gpio_chip *nmk_chip; struct gpio_chip *chip; struct resource *res; struct clk *clk; int latent_irq; + bool supports_sleepmode; void __iomem *base; int irq; int ret; - pdata = devm_kzalloc(&dev->dev, sizeof(*pdata), GFP_KERNEL); - if (!pdata) - return -ENOMEM; - if (of_get_property(np, "st,supports-sleepmode", NULL)) - pdata->supports_sleepmode = true; + supports_sleepmode = true; + else + supports_sleepmode = false; if (of_property_read_u32(np, "gpio-bank", &dev->id)) { dev_err(&dev->dev, "gpio-bank property not found\n"); return -EINVAL; } - pdata->first_gpio = dev->id * NMK_GPIO_PER_CHIP; - pdata->num_gpio = NMK_GPIO_PER_CHIP; - irq = platform_get_irq(dev, 0); if (irq < 0) return irq; + /* It's OK for this IRQ not to be present */ latent_irq = platform_get_irq(dev, 1); - if (latent_irq >= 0 && !pdata->get_latent_status) - return -EINVAL; res = platform_get_resource(dev, IORESOURCE_MEM, 0); base = devm_ioremap_resource(&dev->dev, res); @@ -1298,15 +1279,13 @@ static int nmk_gpio_probe(struct platform_device *dev) nmk_chip->chip = nmk_gpio_template; nmk_chip->parent_irq = irq; nmk_chip->latent_parent_irq = latent_irq; - nmk_chip->get_latent_status = pdata->get_latent_status; - nmk_chip->set_ioforce = pdata->set_ioforce; - nmk_chip->sleepmode = pdata->supports_sleepmode; + nmk_chip->sleepmode = supports_sleepmode; spin_lock_init(&nmk_chip->lock); chip = &nmk_chip->chip; - chip->base = pdata->first_gpio; - chip->ngpio = pdata->num_gpio; - chip->label = pdata->name ?: dev_name(&dev->dev); + chip->base = dev->id * NMK_GPIO_PER_CHIP; + chip->ngpio = NMK_GPIO_PER_CHIP; + chip->label = dev_name(&dev->dev); chip->dev = &dev->dev; chip->owner = THIS_MODULE;