From patchwork Fri Nov 22 09:11:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 21677 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 542E12096D for ; Fri, 22 Nov 2013 09:11:57 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id wo20sf3055730obc.1 for ; Fri, 22 Nov 2013 01:11:56 -0800 (PST) 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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=pM0wD+4AmtnJbWpwgJdXEkTMulquDCIjobdYN7gIMu8=; b=dlP4vEC3iIfmvrEPDRar1d3AONcGKLE4L8M53/Uc7sDJvGgFi6KlogbTAC6IjDoQCT XIIiIxuOVI+3PhvuLnHUBd0SnHOHiopPSA2FsoJBMAxmNUszuFirW+HMqgV74E5s68eM K3+VGpU36KIv7fyI5NnMYJaVjMspzdLcZD5Pb3csq9MYipmG9A0kcrH+xOkzl1yQXgND LmfAM96iGpcCgumlsqrXqnYUsDH9H5+y33rgMKgcK3ACNbCLl0T1P3qfDxQ04/FDJq7B eV/5JDuJmbA8d/rXBEY1HCrLo0SSMxcO7DfZa5rkHHmUai+sa2wg2qcA00/VYBmjPpw8 iOsg== X-Gm-Message-State: ALoCoQn/rK96pwJPpKU69eHiLH9zEMK5UfOaNJHTppJDHpv/5Ox1ONBZskkxRMNSyIEYt8aIGbfh X-Received: by 10.43.146.73 with SMTP id jx9mr3143459icc.7.1385111516723; Fri, 22 Nov 2013 01:11:56 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.94.41 with SMTP id cz9ls43558qeb.57.gmail; Fri, 22 Nov 2013 01:11:56 -0800 (PST) X-Received: by 10.221.39.195 with SMTP id tn3mr10354024vcb.2.1385111516604; Fri, 22 Nov 2013 01:11:56 -0800 (PST) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id ph5si12358177veb.14.2013.11.22.01.11.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 22 Nov 2013 01:11:56 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.178 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.178; Received: by mail-vc0-f178.google.com with SMTP id lh4so684781vcb.9 for ; Fri, 22 Nov 2013 01:11:56 -0800 (PST) X-Received: by 10.221.40.10 with SMTP id to10mr10436508vcb.22.1385111516528; Fri, 22 Nov 2013 01:11:56 -0800 (PST) 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.220.174.196 with SMTP id u4csp25828vcz; Fri, 22 Nov 2013 01:11:56 -0800 (PST) X-Received: by 10.180.160.212 with SMTP id xm20mr1656802wib.33.1385111515668; Fri, 22 Nov 2013 01:11:55 -0800 (PST) Received: from mail-we0-f174.google.com (mail-we0-f174.google.com [74.125.82.174]) by mx.google.com with ESMTPS id ux10si12734711wjc.81.2013.11.22.01.11.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 22 Nov 2013 01:11:55 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.174 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=74.125.82.174; Received: by mail-we0-f174.google.com with SMTP id q58so855043wes.33 for ; Fri, 22 Nov 2013 01:11:55 -0800 (PST) X-Received: by 10.180.10.74 with SMTP id g10mr1693125wib.11.1385111515028; Fri, 22 Nov 2013 01:11:55 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id bs15sm13724920wib.10.2013.11.22.01.11.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Nov 2013 01:11:54 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org Cc: Alexandre Courbot , Linus Walleij Subject: [PATCH] gpio: pl061: proper error messages Date: Fri, 22 Nov 2013 10:11:49 +0100 Message-Id: <1385111509-1376-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.8.3.1 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.220.178 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: , This makes the PL061 driver print proper error messages when probe fails, and also tell us when the chip is finally registered. Signed-off-by: Linus Walleij --- arch/arm/mach-integrator/Kconfig | 1 + drivers/gpio/gpio-pl061.c | 22 +++++++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-integrator/Kconfig b/arch/arm/mach-integrator/Kconfig index 46be99007529..71089d4df8da 100644 --- a/arch/arm/mach-integrator/Kconfig +++ b/arch/arm/mach-integrator/Kconfig @@ -31,6 +31,7 @@ config INTEGRATOR_IMPD1 tristate "Include support for Integrator/IM-PD1" depends on ARCH_INTEGRATOR_AP select ARM_VIC + select ARM_AMBA help The IM-PD1 is an add-on logic module for the Integrator which allows ARM(R) Ltd PrimeCells to be developed and evaluated. diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c index f22f7f3e2e53..f08e5e2cbe50 100644 --- a/drivers/gpio/gpio-pl061.c +++ b/drivers/gpio/gpio-pl061.c @@ -270,26 +270,34 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id) if (pdata) { chip->gc.base = pdata->gpio_base; irq_base = pdata->irq_base; - if (irq_base <= 0) + if (irq_base <= 0) { + dev_err(&adev->dev, "invalid IRQ base in pdata\n"); return -ENODEV; + } } else { chip->gc.base = -1; irq_base = 0; } if (!devm_request_mem_region(dev, adev->res.start, - resource_size(&adev->res), "pl061")) + resource_size(&adev->res), "pl061")) { + dev_err(&adev->dev, "no memory region\n"); return -EBUSY; + } chip->base = devm_ioremap(dev, adev->res.start, resource_size(&adev->res)); - if (!chip->base) + if (!chip->base) { + dev_err(&adev->dev, "could not remap memory\n"); return -ENOMEM; + } chip->domain = irq_domain_add_simple(adev->dev.of_node, PL061_GPIO_NR, irq_base, &pl061_domain_ops, chip); - if (!chip->domain) + if (!chip->domain) { + dev_err(&adev->dev, "no irq domain\n"); return -ENODEV; + } spin_lock_init(&chip->lock); @@ -314,8 +322,10 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id) */ writeb(0, chip->base + GPIOIE); /* disable irqs */ irq = adev->irq[0]; - if (irq < 0) + if (irq < 0) { + dev_err(&adev->dev, "invalid IRQ\n"); return -ENODEV; + } irq_set_chained_handler(irq, pl061_irq_handler); irq_set_handler_data(irq, chip); @@ -331,6 +341,8 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id) } amba_set_drvdata(adev, chip); + dev_err(&adev->dev, "PL061 GPIO chip @%08x registered\n", + adev->res.start); return 0; }