Received: by 10.213.65.68 with SMTP id h4csp527883imn; Tue, 13 Mar 2018 11:56:30 -0700 (PDT) X-Google-Smtp-Source: AG47ELvrs716aY+aq3Y0gOu39nR4JQTkfuuZV3wtPP4NhFn+ylxpjPodSMjMGWWvPZpWRXycgtWa X-Received: by 10.98.163.67 with SMTP id s64mr1575288pfe.67.1520967390703; Tue, 13 Mar 2018 11:56:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520967390; cv=none; d=google.com; s=arc-20160816; b=zr2tHgYyFaUkfVBM7D9PPn4P+HAbceN/vflbXe3Uaumg8l7FR9OQuE1tT8K5lCePTj rAga04YDZnrNiXpPMLAHUKxHWGZoGf/u4l3XwDa13rVfu+3xQSj4ksKpP0ArpyTY5KgA Qk8RU6bDnwnFC+mVpYwEw4kHt/sfqtqSdPzlsR1q5zgAQBDIklHmy6apFrFsqtX0EX/P k9822Jj3ZnPugZSzj4RcS3HrzxQstTk4U3nVN7btbWjgddUrbiRkv7qOM4TNsGk1uhUw bYRG81PzqcJsfkVzK6KC3xckUhjVmPqNFeNj/IhkTt/u22elJAkkYPQJZZi+jdbRZvVn 0Hyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:arc-authentication-results; bh=yirwQAtVwREl4vs5q1k6pupVPeIWpo8k98KZ/UzyvM8=; b=gwWs//YLd/FJNo3KkbrGx2mz2jvrrwV2VTvr97D5mlfbyM3TGgVu/7XtOu2/qR8ygg ZuA7ZgX3SALLz+xCgdzwnk6EJlWFBC2MCIBQ4gN8ql/8Dld1alGSUXjsH5poVX5xGCgH tiUV3N6PEgTEnCLvDfjRCIIdTajGvZLM35a5XqHw9ip63o4Bq6g0LG3Z3TPzCGGOomEK vtwLZuyF4hotGxkk1EJ181ptmHFZT1vj5evUfkmsx1SVlvVMMxGLpiugPCqyPZItrb0p OMGqsBvUE6BAa8qc97s2miv2Xoo6eWAqpQ7s+6LOaja8UWE7GX5y/B6ZYHmWkkfVGeRw gO3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=0Mp12OE2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k3si579533pff.82.2018.03.13.11.56.13; Tue, 13 Mar 2018 11:56:30 -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; Authentication-Results: mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=0Mp12OE2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752624AbeCMSyZ (ORCPT + 99 others); Tue, 13 Mar 2018 14:54:25 -0400 Received: from mail-bn3nam01on0067.outbound.protection.outlook.com ([104.47.33.67]:48000 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751412AbeCMSyX (ORCPT ); Tue, 13 Mar 2018 14:54:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=yirwQAtVwREl4vs5q1k6pupVPeIWpo8k98KZ/UzyvM8=; b=0Mp12OE2O4P3halDxVXhNQwRcZvaYKedA0PWl2I8QtzElosjP48CrYQ/ooRmhO3VLZV2tgiCEdUIHJuJNlK6opB46VZWakrqvWss8V1NtuUg6cJI2fA1bVRAV1v0mC07DZTHD5DMGe6Yxvlm4s40a/XuoJiK/jRvVSLWYrtpY6k= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Gary.Hook@amd.com; Received: from [10.236.109.62] (165.204.78.1) by SN1PR12MB0703.namprd12.prod.outlook.com (2a01:111:e400:c42a::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.548.13; Tue, 13 Mar 2018 18:54:20 +0000 Subject: Re: [PATCH v2 5/5] iommu/amd - Add a debugfs entry to specify a IOMMU device table entry To: Andy Shevchenko Cc: "iommu@lists.linux-foundation.org" , Joerg Roedel , Linux Kernel Mailing List References: <152055660594.63229.5131049527614494130.stgit@sosxen2.amd.com> <152055669123.63229.1692099069085978884.stgit@sosxen2.amd.com> From: Gary R Hook Message-ID: <3969f155-c3bf-44c5-d056-825e71d42152@amd.com> Date: Tue, 13 Mar 2018 13:54:15 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: MWHPR08CA0048.namprd08.prod.outlook.com (2603:10b6:300:c0::22) To SN1PR12MB0703.namprd12.prod.outlook.com (2a01:111:e400:c42a::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 2070de1b-b8e1-4722-7bfb-08d58913d521 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:SN1PR12MB0703; X-Microsoft-Exchange-Diagnostics: 1;SN1PR12MB0703;3:Qg8IK8Y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pfG4mpH097AU0An1i85510ZDIgS1nnxzdeqjjZpuIQ/qXbdSgL2B+d4DAFlbsYTV5pS9RVaeeKN9xeChTiNDmNPXAnxioYP6B/kCCILWV8gwpgSy2gjYk6R4gOTucPFeGpXSx0i5PE+7n8aFVXNFY12wQT3J9ifYneYQ+PtkbfHF6PztNfZ4n0j6ojQT7+Iexj0Fs+XuqWuq6chfZYxTu1iIsexoAl7wJzIisCCcPmQPvp8GnJ62EAW55bss6YR/Hpa/1CmO69x65InkqziWA5ODRK/JOPaGJ1uYQpTiyPeLTVE84v9J7Fzs2eU9pfUFMZ+J2DzcNbSBZW5ZU216;4:mZrVa+zaF77lTxBINLFW74BvqNpMHvWXueQLksOVarDWtsd+pHbdNGfbStNfIcURl/b6KYUxp7WuuuJZSa0fnpWyE+CUFlQy26qyrNluIf4T2ZLFW40Yz3Z1AL0Ot+zVPqgeUD5H4sMW/o38JvnwSNGVhut7bXM9MRSTiZrKYW7y1yYrGI7pIYNa39RWtmVD24vjh+6kxIsPOj6YmQpCrc9GcxQ2NS0TEFTiLzc0Cab8kXBqpVfGP1Y7HRL1YxNM5vu0riQH0rDi6m4M0lZtlg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93001095)(3231221)(944501244)(52105095)(6055026)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(6072148)(201708071742011);SRVR:SN1PR12MB0703;BCL:0;PCL:0;RULEID:;SRVR:SN1PR12MB0703; X-Forefront-PRVS: 0610D16BBE X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6049001)(346002)(376002)(396003)(366004)(39860400002)(39380400002)(189003)(199004)(52116002)(76176011)(23676004)(65806001)(7736002)(16526019)(65956001)(36756003)(67846002)(66066001)(47776003)(105586002)(68736007)(305945005)(26005)(16576012)(65826007)(64126003)(316002)(186003)(6246003)(58126008)(77096007)(2486003)(52146003)(53546011)(386003)(5660300001)(54906003)(25786009)(6916009)(3846002)(53936002)(6116002)(4326008)(8936002)(6666003)(106356001)(72206003)(39060400002)(2950100002)(31686004)(229853002)(31696002)(50466002)(86362001)(6486002)(230700001)(2906002)(8676002)(97736004)(478600001)(81156014)(81166006);DIR:OUT;SFP:1101;SCL:1;SRVR:SN1PR12MB0703;H:[10.236.109.62];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtTTjFQUjEyTUIwNzAzOzIzOlBKWVNSS204cTNhYS9XTk1HS0lxd1FZUVZ4?= =?utf-8?B?ZjBwME01Y2JaQ0VqcVlUUUptMU9rWlZTaWF0dzNMbVBEM04vMGliS0kzMUJu?= =?utf-8?B?Wk55VU5pRmVVQ25YMWlXY3ljWUJteU9uWnB0TWZ5aUxYY2habklQUFNhQnY0?= =?utf-8?B?SnlpejlsNDMyYWZIOXg1cDBhcEV2R25kSXBZOVA2SnJwQVVkM040YjBYSFB5?= =?utf-8?B?Zy8wOFZ1TVJOYmwyZnUwV2VSL3hKUmdWb2NEbUZEaHQ2bkY2Z0FjWVhVZVpD?= =?utf-8?B?eWlFK0pnZ1RPN2Jsd05JWWpXL0NWcFdxM05GZWszc3VGV0ZZcFN2YWJTanVz?= =?utf-8?B?c0ZaZXFXcGh3RktFQTlFbTZTNzdRZ0lQaHF3VWZ3aVM2ci9FaWVkRVBtenhL?= =?utf-8?B?RXVCaUNoUmxhVXNxV2pFdFZtQ3RaUHFzWHVqc2FtUXNOdTBrU3VmQ09iL3Js?= =?utf-8?B?dzkveENpZk92ckNGbytaTXZybkF3Q3Q5T2poZG5mUkVQclNvRERjSVZVVit1?= =?utf-8?B?QnQ2S0d6anVKR3NnZVluZlNIVHExa3dBb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zE/YGcbwH0Bb+EzDtdL4exFLkEE/TujPGa0/4PQ7sWLyHdq4ILhjSbqHEosrl39N0yedCc94gugspM49ZUGhd7GlJ9EOh59wIqLwbfxKY33M/aos3SLNroOYOYl/4iugxmFQ6ikO+8YCT4tTMgp9E=;5:RKB/fT5YM5M+s+YvdQ+kSeVMxR8zoGgJy4bnqPlflYJBRFJqViH3hXdspQSMrS72fw/KN6qNu02N5dk57W09ldbrUK/SazlYm1h9lGZ3IEPa3OKbdZirMYFzNitn13ee+22UjcmfjibRXv5vp2seu6B5YI6PVPpHWaZktPvLJT4=;24:Q9pEPnAqzCnYk4UiAxW5yXZy2awH4TRAbTp4RlWgj92PdEly7XFVZxGn2hzmw/rP1v52Vnfzr8YPakqZrrXvyTISb3hdhPiiwENZ1d0HHBw=;7:fBLSivoYMaPJz2fv5V7l4GFHhO2yJOTztZ18xVh7fFxY0VwcNA5ufFYygNmAt2+mdrLUf1+/HQXPgUrO/5vuK36sRxb9TspWjiAtiJF6v9A6IzQX1+8YAiCiBQLjOZ4D53v8+HlxyI0eKSFVzaII9roOzKCm29pD+QpO6dLp38ceAO9vSIA/19WOVs7LTn88QyQjGtmurgIScq+1KXx0RQTT1m2Ahw6cd+B6GoWgnfn8LidGbScW7741Jd10+u6D SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;SN1PR12MB0703;20:RQUH00MKJvIhMcFoKoMhBmH5he8pODk3I+Oe1SiIic5kRfliANOj7tzhY8nKGYXr4ER1GHvJSlIeghDWNsZ9QucwDi5C9r5EsctveefaiSsxX1i1WBmUe1y4N5SiHBWvZ1S6RXqOcGEb509wkqt1FuGc6rnz4oudIj5NE4dB2dui5pa0RGc/swsXZZQYHFR6TJU1NFDNHbw2p0VT5QvpTvAajTcCp4ra+spDwRlP2yrsR5pb0wdPU5iHdvsuzGw5 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2018 18:54:20.9199 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2070de1b-b8e1-4722-7bfb-08d58913d521 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0703 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/13/2018 12:20 PM, Andy Shevchenko wrote: > >> + oboff += OSCNPRINTF("%02x:%02x:%x (%u / %04x)\n", >> + PCI_BUS_NUM(amd_iommu_devid), >> + PCI_SLOT(amd_iommu_devid), >> + PCI_FUNC(amd_iommu_devid), > > Perhaps at some point we will have an extension to %p to print PCI BDFs. But until then.... ;-) >> + if (strnchr(obuf, OBUFLEN, ':')) >> + { > > Style D'oh! >> + } else if (obuf[0] == '0' && obuf[1] == 'x') { >> + n = sscanf(obuf, "%x", &amd_iommu_devid); >> + } else { >> + n = sscanf(obuf, "%d", &amd_iommu_devid); >> + } > > kstrtoint() ? I see various mechanisms for this sort of thing, and simply chose one. Am happy to use whatever is preferred.