From patchwork Wed Feb 26 19:37:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 3728211 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B17C59F2F7 for ; Wed, 26 Feb 2014 19:42:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D1676201CD for ; Wed, 26 Feb 2014 19:42:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2395720127 for ; Wed, 26 Feb 2014 19:42:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754011AbaBZThb (ORCPT ); Wed, 26 Feb 2014 14:37:31 -0500 Received: from mail-ie0-f177.google.com ([209.85.223.177]:63185 "EHLO mail-ie0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754007AbaBZThT (ORCPT ); Wed, 26 Feb 2014 14:37:19 -0500 Received: by mail-ie0-f177.google.com with SMTP id rl12so1062965iec.8 for ; Wed, 26 Feb 2014 11:37:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=subject:to:from:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-type:content-transfer-encoding; bh=aEgXofSlOdl/f7+A3SApgL/VcoBVzA/+nmwMZrroTlg=; b=j7r6wjHcIC/uK63BMyF5FwMbaMHytGNMvG93frJ+fsfNYJVw3vbX33BNe9yObWUNHV t68q9hRxweseLpxQ0AMy8DEzLcBtOt0V30sW0FkcXKOV9gTJWIQeQC3GFuOXe8EcHxdS pHzxtt7yLagiGJWXiGrPEKezHiajjZc1X2Ghu5KefIBGt/II00ogxNFpOg0WJKlhem7w e7yNdDQ5471Y2dbU59Di2XwMaHQGnXjNno4oepaUb0lFAdxq3n8V/FwP4f9m6VfQa2xF KyPneCvU6ghzVvli+YQg4v+QBNpWL39nr9q5ooVzJ0BGyArYEYJhaBGSBJdNGoWwMrcI 5SZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:from:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-type :content-transfer-encoding; bh=aEgXofSlOdl/f7+A3SApgL/VcoBVzA/+nmwMZrroTlg=; b=kBIwMqE8YKiOvEiRJHeqL9MtVDoNrJOUuQm/6e4gIjmY0wCtwd8X2Tki7rZs9mOhnn RlHRyehc1nojC1Se788M4XVs/QJl2VAqQnbqNt7BLNk+STqzlqEItRDvpV3JgbVKIYAp Qd602O9/8/ibOzs4sKoF730qnRU8Pnq6keNbhzGutiQzlr9NRrl44BV3a70vh/qbm7kr 21/8Kfcb7CLtZWDgHlUcJ8apRQr1fT3QcKInZpBuS2G0ONgXWMELwCGYVi2ebx3BDpcT qflmPmbrP4+8OZ44XceRso0a7B9pN5mvmwAa9dPAfrov1rfqcluhahTj54n/nq22A+vS doqQ== X-Gm-Message-State: ALoCoQl3l95Nw+uMysDwEDRU0uyKiWMb/L3MOJIxfVM04FM+qMWeY8HrcaG8JnUwTd1NZB3oz/uVZSoX5LevdiVy6Kou46/0IlPyyKEaH0Na/1ps53WGRG3ezLPHWsIjzaYYamjI9LNTPPtxAgM2L3+O4bvSX9Ao+iZ+EMqeCgZbJVn0LGYT5NmPig4gw4LrUKsbdsMEsjMb7uq2MF2wdK8EYrqUnpxi3XiY9ndqKfC4BbD3QhZF1Pc= X-Received: by 10.50.182.170 with SMTP id ef10mr1349632igc.9.1393443438745; Wed, 26 Feb 2014 11:37:18 -0800 (PST) Received: from localhost ([172.16.49.60]) by mx.google.com with ESMTPSA id dz8sm51443795igb.5.2014.02.26.11.37.18 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 26 Feb 2014 11:37:18 -0800 (PST) Subject: [PATCH 2/9] vsprintf: Add support for IORESOURCE_UNSET in %pR To: linux-pci@vger.kernel.org From: Bjorn Helgaas Cc: linux-kernel@vger.kernel.org Date: Wed, 26 Feb 2014 12:37:16 -0700 Message-ID: <20140226193716.10125.11835.stgit@bhelgaas-glaptop.roam.corp.google.com> In-Reply-To: <20140226192614.10125.68711.stgit@bhelgaas-glaptop.roam.corp.google.com> References: <20140226192614.10125.68711.stgit@bhelgaas-glaptop.roam.corp.google.com> User-Agent: StGit/0.16 MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Sometimes we have a struct resource where we know the type (MEM/IO/etc.) and the size, but we haven't assigned address space for it. The IORESOURCE_UNSET flag is a way to indicate this situation. For these "unset" resources, the start address is meaningless, so print only the size, e.g., - pci 0000:0c:00.0: reg 184: [mem 0x00000000-0x00001fff 64bit] + pci 0000:0c:00.0: reg 184: [mem size 0x2000 64bit] For %pr (printing with raw flags), we still print the address range, because %pr is mostly used for debugging anyway. Signed-off-by: Bjorn Helgaas --- include/linux/ioport.h | 2 +- lib/vsprintf.c | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/include/linux/ioport.h b/include/linux/ioport.h index 9fcaac8bc4f6..5e3a906cc089 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h @@ -51,7 +51,7 @@ struct resource { #define IORESOURCE_EXCLUSIVE 0x08000000 /* Userland may not map this resource */ #define IORESOURCE_DISABLED 0x10000000 -#define IORESOURCE_UNSET 0x20000000 +#define IORESOURCE_UNSET 0x20000000 /* No address assigned yet */ #define IORESOURCE_AUTO 0x40000000 #define IORESOURCE_BUSY 0x80000000 /* Driver has marked this resource busy */ diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 185b6d300ebc..c14669f4ffc4 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -719,10 +719,15 @@ char *resource_string(char *buf, char *end, struct resource *res, specp = &mem_spec; decode = 0; } - p = number(p, pend, res->start, *specp); - if (res->start != res->end) { - *p++ = '-'; - p = number(p, pend, res->end, *specp); + if (decode && res->flags & IORESOURCE_UNSET) { + p = string(p, pend, "size ", str_spec); + p = number(p, pend, res->end - res->start + 1, *specp); + } else { + p = number(p, pend, res->start, *specp); + if (res->start != res->end) { + *p++ = '-'; + p = number(p, pend, res->end, *specp); + } } if (decode) { if (res->flags & IORESOURCE_MEM_64)