From patchwork Thu Oct 22 08:32:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 55413 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id 2861923024 for ; Thu, 22 Oct 2015 08:32:58 +0000 (UTC) Received: by wicfg8 with SMTP id fg8sf16701599wic.0 for ; Thu, 22 Oct 2015 01:32: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:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=QlEsSGGaNLJa0mHxn4p8PME3VPX20X5cuhEjkA3lwLw=; b=TrSwEMTPYC8wCsOdajpG1B1uVy8WJWtmWLP9U4LZWvNkbarujdM8eBt1du0NulNsGE kea91Fa3715JmTX3qXJcmGgkiJlRmIo/dD8Mzr10hXfpAo16lFOjrEy/9cFyXFHwt17H rHtmBsYWpm8kta1omlSKRKGHiuYNFKBYdQgq3k9ARK2juKaIDo8BVp/z7Xj6ld66YSaV ViUFHKLcgePqvS4uD2qLsOWF8NvQy0IE7yaG6kTLLBzQkLY+DCDYLt8Wjy/Fx3wxasSm SxCDTTs6ICF/TrwOOcjT+Eq3I2xoVXLgAEkrFqS+elqnvkO+bCTBe9m/HeJtbu9LzLb9 PWOw== X-Gm-Message-State: ALoCoQlDRxOgXZKEMwLDx/KtA0lE+mCV4g32W4UdxkKZ7qCfoXL/55Ep50rC7GPa1NE+xn/YM+/Z X-Received: by 10.180.221.227 with SMTP id qh3mr3425728wic.2.1445502777490; Thu, 22 Oct 2015 01:32:57 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.164.77 with SMTP id n74ls282812lfe.94.gmail; Thu, 22 Oct 2015 01:32:57 -0700 (PDT) X-Received: by 10.25.141.198 with SMTP id p189mr5154377lfd.9.1445502777339; Thu, 22 Oct 2015 01:32:57 -0700 (PDT) Received: from mail-lf0-f45.google.com (mail-lf0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id e141si8920344lfe.84.2015.10.22.01.32.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Oct 2015 01:32:57 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by lfbn126 with SMTP id n126so5102458lfb.2 for ; Thu, 22 Oct 2015 01:32:57 -0700 (PDT) X-Received: by 10.112.64.72 with SMTP id m8mr7430334lbs.41.1445502777208; Thu, 22 Oct 2015 01:32: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.112.59.35 with SMTP id w3csp448130lbq; Thu, 22 Oct 2015 01:32:56 -0700 (PDT) X-Received: by 10.66.157.72 with SMTP id wk8mr15921491pab.132.1445502776134; Thu, 22 Oct 2015 01:32:56 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ep1si19422198pbd.256.2015.10.22.01.32.55; Thu, 22 Oct 2015 01:32:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-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 S1756745AbbJVIcz (ORCPT + 3 others); Thu, 22 Oct 2015 04:32:55 -0400 Received: from mail-lf0-f54.google.com ([209.85.215.54]:35237 "EHLO mail-lf0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756737AbbJVIcy (ORCPT ); Thu, 22 Oct 2015 04:32:54 -0400 Received: by lfbn126 with SMTP id n126so5100715lfb.2 for ; Thu, 22 Oct 2015 01:32:52 -0700 (PDT) X-Received: by 10.112.140.197 with SMTP id ri5mr7596687lbb.65.1445502772841; Thu, 22 Oct 2015 01:32:52 -0700 (PDT) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id um10sm2148562lbc.15.2015.10.22.01.32.51 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Oct 2015 01:32:52 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Arnd Bergmann , Michael Welling , Markus Pargmann Cc: Mark Brown , Amit Kucheria , Linus Walleij Subject: [PATCH 2/6] gpio: refer to gpio device in prints and debugfs Date: Thu, 22 Oct 2015 10:32:26 +0200 Message-Id: <1445502750-22672-3-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1445502750-22672-1-git-send-email-linus.walleij@linaro.org> References: <1445502750-22672-1-git-send-email-linus.walleij@linaro.org> Sender: linux-gpio-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-gpio@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=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) smtp.mailfrom=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: , We use the new struct device inside gpio_chip to related debug prints and warnings, and we also add it to the debugfs dump. Cc: Johan Hovold Cc: Michael Welling Cc: Markus Pargmann Signed-off-by: Linus Walleij --- drivers/gpio/gpiolib.c | 25 ++++++++++++++----------- drivers/gpio/gpiolib.h | 12 ++++++------ 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 0ab4f75b7f8e..7861791657b5 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -208,7 +208,7 @@ static int gpiochip_add_to_list(struct gpio_chip *chip) if (pos != &gpio_chips && pos->prev != &gpio_chips) { _chip = list_entry(pos->prev, struct gpio_chip, list); if (_chip->base + _chip->ngpio > chip->base) { - dev_err(chip->dev, + dev_err(&chip->device, "GPIO integer space overlap, cannot add chip\n"); err = -EBUSY; } @@ -270,7 +270,7 @@ static int gpiochip_set_desc_names(struct gpio_chip *gc) gpio = gpio_name_to_desc(gc->names[i]); if (gpio) - dev_warn(gc->dev, "Detected name collision for " + dev_warn(&gc->device, "Detected name collision for " "GPIO name '%s'\n", gc->names[i]); } @@ -456,7 +456,8 @@ void gpiochip_remove(struct gpio_chip *chip) spin_unlock_irqrestore(&gpio_lock, flags); if (requested) - dev_crit(chip->dev, "REMOVING GPIOCHIP WITH GPIOS STILL REQUESTED\n"); + dev_crit(&chip->device, + "REMOVING GPIOCHIP WITH GPIOS STILL REQUESTED\n"); device_del(&chip->device); ida_simple_remove(&gpio_ida, chip->id); @@ -2534,14 +2535,16 @@ static void gpiolib_seq_stop(struct seq_file *s, void *v) static int gpiolib_seq_show(struct seq_file *s, void *v) { struct gpio_chip *chip = v; - struct device *dev; - - seq_printf(s, "%sGPIOs %d-%d", (char *)s->private, - chip->base, chip->base + chip->ngpio - 1); - dev = chip->dev; - if (dev) - seq_printf(s, ", %s/%s", dev->bus ? dev->bus->name : "no-bus", - dev_name(dev)); + struct device *parent; + + seq_printf(s, "%s%s: GPIOs %d-%d", (char *)s->private, + dev_name(&chip->device), + chip->base, chip->base + chip->ngpio - 1); + parent = chip->dev; + if (parent) + seq_printf(s, ", parent: %s/%s", + parent->bus ? parent->bus->name : "no-bus", + dev_name(parent)); if (chip->label) seq_printf(s, ", %s", chip->label); if (chip->can_sleep) diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h index 78e634d1c719..be29037e56b9 100644 --- a/drivers/gpio/gpiolib.h +++ b/drivers/gpio/gpiolib.h @@ -132,17 +132,17 @@ static int __maybe_unused gpio_chip_hwgpio(const struct gpio_desc *desc) /* With chip prefix */ #define chip_emerg(chip, fmt, ...) \ - pr_emerg("GPIO chip %s: " fmt, chip->label, ##__VA_ARGS__) + dev_emerg(&chip->device, "(%s): " fmt, chip->label, ##__VA_ARGS__) #define chip_crit(chip, fmt, ...) \ - pr_crit("GPIO chip %s: " fmt, chip->label, ##__VA_ARGS__) + dev_crit(&chip->device, "(%s): " fmt, chip->label, ##__VA_ARGS__) #define chip_err(chip, fmt, ...) \ - pr_err("GPIO chip %s: " fmt, chip->label, ##__VA_ARGS__) + dev_err(&chip->device, "(%s): " fmt, chip->label, ##__VA_ARGS__) #define chip_warn(chip, fmt, ...) \ - pr_warn("GPIO chip %s: " fmt, chip->label, ##__VA_ARGS__) + dev_warn(&chip->device, "(%s): " fmt, chip->label, ##__VA_ARGS__) #define chip_info(chip, fmt, ...) \ - pr_info("GPIO chip %s: " fmt, chip->label, ##__VA_ARGS__) + dev_info(&chip->device, "(%s): " fmt, chip->label, ##__VA_ARGS__) #define chip_dbg(chip, fmt, ...) \ - pr_debug("GPIO chip %s: " fmt, chip->label, ##__VA_ARGS__) + dev_dbg(&chip->device, "(%s): " fmt, chip->label, ##__VA_ARGS__) #ifdef CONFIG_GPIO_SYSFS