From patchwork Wed May 8 13:29:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 16799 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f199.google.com (mail-qc0-f199.google.com [209.85.216.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3A62E238FB for ; Wed, 8 May 2013 13:30:41 +0000 (UTC) Received: by mail-qc0-f199.google.com with SMTP id c10sf2252615qcz.6 for ; Wed, 08 May 2013 06:30:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=uHhlyynVMvvWZG6rUTDv8VbhkgX6COs7ZkkzhDuJJww=; b=bMGlJBBA8OTXIzcCHx27irEPR1BpPo0vSZ2n9e0c2EqGA9iIRTjkESVB/v2FUdji+p 9kFWn5iWoi/FjL0ZoHapzjxtFlRqy4uuimc07hBxkRjjaEkZqfQtBgAycqXs8xwRIb8z ZW2DuyvNcIXwHASVwOTglGW9S7fi5rBgdZZrcNG2szO6ANaqOP+fbw7P1ANRdm9+ZJXI K6uXXHhJFPMmHrX7OmEYrzYPhHh9ePVITvSe4EBlTFfROj/kSx5zNih9QVJLvcUaXqNe BERJN/cUv6JrXt4eFhBBdId5WB3uqCtEfKkMWCJdCPxupnft+8kxWrbcnoq6CvAZwfSU gB2g== X-Received: by 10.224.217.195 with SMTP id hn3mr7483365qab.5.1368019820030; Wed, 08 May 2013 06:30:20 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.133.4 with SMTP id oy4ls830921qeb.73.gmail; Wed, 08 May 2013 06:30:19 -0700 (PDT) X-Received: by 10.220.83.138 with SMTP id f10mr4541691vcl.7.1368019819712; Wed, 08 May 2013 06:30:19 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id ec8si15068876vdb.59.2013.05.08.06.30.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 May 2013 06:30:19 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id hf12so1641319vcb.33 for ; Wed, 08 May 2013 06:30:19 -0700 (PDT) X-Received: by 10.52.53.36 with SMTP id y4mr3575794vdo.51.1368019819628; Wed, 08 May 2013 06:30:19 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp6883veb; Wed, 8 May 2013 06:30:19 -0700 (PDT) X-Received: by 10.194.59.132 with SMTP id z4mr10885988wjq.57.1368019818712; Wed, 08 May 2013 06:30:18 -0700 (PDT) Received: from mail-we0-x22e.google.com (mail-we0-x22e.google.com [2a00:1450:400c:c03::22e]) by mx.google.com with ESMTPS id r5si1935748wij.21.2013.05.08.06.30.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 May 2013 06:30:18 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c03::22e is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=2a00:1450:400c:c03::22e; Received: by mail-we0-f174.google.com with SMTP id x53so1801347wes.33 for ; Wed, 08 May 2013 06:30:18 -0700 (PDT) X-Received: by 10.194.59.132 with SMTP id z4mr10885924wjq.57.1368019818209; Wed, 08 May 2013 06:30:18 -0700 (PDT) Received: from localhost.localdomain (cpc34-aztw25-2-0-cust250.18-1.cable.virginmedia.com. [86.16.136.251]) by mx.google.com with ESMTPSA id h8sm7063221wiz.9.2013.05.08.06.30.15 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 May 2013 06:30:16 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: arnd@arndb.de, linus.walleij@stericsson.com, srinidhi.kasagar@stericsson.com, Lee Jones Subject: [PATCH 8/9] pinctrl: abx500: Rejiggle platform data and DT initialisation Date: Wed, 8 May 2013 14:29:08 +0100 Message-Id: <1368019749-19455-9-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1368019749-19455-1-git-send-email-lee.jones@linaro.org> References: <1368019749-19455-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQn5Xtbz0M5NMzgoCxrqkJh01h9GMooLqVfvqpJ3J5znBqlhkBqWb6j6LvzWbgfvp3Bk0OMC X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.174 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 Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , A pointer to GPIO platform data is always passed to the driver now, so there's little point in checking for 'pdata' and executing the DT case if it's not there. The difference between booting with DT and !DT is when booting with DT, plat_id is not populated. Thus, in the DT case we have to use a DT match table in order to find out which platform we're executing on. So, we're changing the semantics here to only use the match table if no plat_id is supplied though platform data. Signed-off-by: Lee Jones --- drivers/pinctrl/pinctrl-abx500.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/pinctrl/pinctrl-abx500.c b/drivers/pinctrl/pinctrl-abx500.c index 2a2a9df..6d45327 100644 --- a/drivers/pinctrl/pinctrl-abx500.c +++ b/drivers/pinctrl/pinctrl-abx500.c @@ -851,23 +851,12 @@ static int abx500_gpio_probe(struct platform_device *pdev) if (abx500_pdata) pdata = abx500_pdata->gpio; - if (!pdata) { - if (np) { - const struct of_device_id *match; - match = of_match_device(abx500_gpio_match, &pdev->dev); - if (!match) - return -ENODEV; - id = (unsigned long)match->data; - } else { - dev_err(&pdev->dev, "gpio dt and platform data missing\n"); - return -ENODEV; - } + if (!(pdata || np)) { + dev_err(&pdev->dev, "gpio dt and platform data missing\n"); + return -ENODEV; } - if (platid) - id = platid->driver_data; - pct = devm_kzalloc(&pdev->dev, sizeof(struct abx500_pinctrl), GFP_KERNEL); if (pct == NULL) { @@ -882,6 +871,16 @@ static int abx500_gpio_probe(struct platform_device *pdev) pct->chip.dev = &pdev->dev; pct->chip.base = (np) ? -1 : pdata->gpio_base; + if (platid) + id = platid->driver_data; + else if (np) { + const struct of_device_id *match; + + match = of_match_device(abx500_gpio_match, &pdev->dev); + if (match) + id = (unsigned long)match->data; + } + /* initialize the lock */ mutex_init(&pct->lock);