Received: by 10.213.65.68 with SMTP id h4csp584142imn; Tue, 13 Mar 2018 13:57:41 -0700 (PDT) X-Google-Smtp-Source: AG47ELsT0x8vVzFOwXY0reclDK+dao7ayYDZKkMsq+Y5/I17XxwDdJMJCUSQ6Bu6XSKpUtqcVYEz X-Received: by 10.98.204.69 with SMTP id a66mr1893891pfg.33.1520974661285; Tue, 13 Mar 2018 13:57:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520974661; cv=none; d=google.com; s=arc-20160816; b=PVnDBoAKIVgQraLfdbZ71QfGRL4cjLXf5fIqkIL7Dsfm2At6z0OdR7DBZbICyXa1/C 8tWGdw47lvrKxcbHIL37hvlZ4XY5pIdzfJB42kYd3rSUC5G4ehPXyBsdW2x1c6NaJLoq 67ChNwVDiQF4kse8qxq9sBgyTuh+eCTLWoywrcNlXfXX+gYCH/EjKu82qzGQl10pD6TE Cff6olUbYGIoEu8ZHr63fGucVkl5oxDNk8lQb+n+/GQd3glaL7fvsunAa7yS88DtyC2X VH8EWwwsc0J3zbW7YB+0qim63NBkG2wYDSqHzfWM3A4R2E2i+XcflLONk1wcF3Ts+/le 2R7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=Ia8tbfDfboL8mvPQzU7Eeb5RK03ungYm3RkVgkc+TOk=; b=YnFrW7PtHewO79ljkDswlzN3i6mALmWLWXTqomTlxRKEPimo6gmyUW8tUrHctn/wEF EWWL7dKUchwzPxpp6eUgKQqhqoP0fAzZNLCyEinxKXOFJyYH8J1DCPODvfYA8b4yGltK QcsHH2PCDk0RJm+/ROrFhA1I368dgfzPqgs8hTs/WPliBdo3bhJnATozqZyyn1XFb1K7 3L5z1caPmFh637+9cRpbDiO0bay3nMJRvDudcStl2K5i200WHcxL5liSxiwhg2r3iywz dOLi4xoPowep3iQyrR/ITmwXttgEOCKe5yh7IF+91dn8fbeO6/y+mhhGRajLA2PjxcIY R8fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RMCBYpfC; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e11si677800pgn.19.2018.03.13.13.57.26; Tue, 13 Mar 2018 13:57:41 -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=@gmail.com header.s=20161025 header.b=RMCBYpfC; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753124AbeCMU4d (ORCPT + 99 others); Tue, 13 Mar 2018 16:56:33 -0400 Received: from mail-qt0-f171.google.com ([209.85.216.171]:46434 "EHLO mail-qt0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752592AbeCMU4b (ORCPT ); Tue, 13 Mar 2018 16:56:31 -0400 Received: by mail-qt0-f171.google.com with SMTP id m13so1172003qtg.13 for ; Tue, 13 Mar 2018 13:56:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Ia8tbfDfboL8mvPQzU7Eeb5RK03ungYm3RkVgkc+TOk=; b=RMCBYpfCckWX98IfZ76tASV970FawPPjg7jfGFplZYlXeRkidpz6QSyL7+UvYATBIZ 3N+swiK3LIQGHcZf53FN7a48Mz7Vywz861sI60Y0YP0KZAUPtbQjsX15+nv8FxUMlDRa Px+PyY9zfcF2X/NyLzZBec1UiEE9uysqwH6GmazsBcqN4pEKyLlWf3j73yeMfsNRdCWO c0y5lF8RcZCJOL7Vj/yISH6QhuwgD+Y3RQ94YZToGHfuxmzkx3SQEHOd3F3CA7apUPb0 OK+G8Wv92AqAL7nRHXcejPxKuUO8IkLZu4ydQETib9XBgTxGqFx+kQf3wH8LGgCJh19x lznw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Ia8tbfDfboL8mvPQzU7Eeb5RK03ungYm3RkVgkc+TOk=; b=bsnXJbuuOetC8NYC8Kr0EgPLa2jPAN7Mwq+v66KGGC3RnxrkXYfqYBxFkCOINIBwC3 68BgQ6z0zFF83hIYxmaB9C7f+eWFzgHLFYPSoS/9yY73djM1OxQnBTaocInuoJEh+69k qHOKQ027kmXmaORVzRZv6Hse/2D0cYeKcuWRyLHF7931bPhEBMeJrm/YZdDEz6iVDxHg VlBIzVcxA6Pi0YKMbvvNdecSce7B09E+Exbto+XLZCVPcC2Nkfrihz5uRaCxwroGBtnk wfwfEECBSE9sqxTRwTTnzAiuBVjOFcYQ/i8ebRWnRKqNvHqXgszzZyqHnauolbBISkQN czrw== X-Gm-Message-State: AElRT7H2eYJ8HvOFKtMWAGjHCera4qF+esj6dVmK+xmSAFAkvvINlY/9 UqAcBPs5bcS4xNPAabHlwcm3IIHHSeKfQxbmboY= X-Received: by 10.200.39.217 with SMTP id x25mr3276290qtx.266.1520974591117; Tue, 13 Mar 2018 13:56:31 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.195.80 with HTTP; Tue, 13 Mar 2018 13:56:30 -0700 (PDT) In-Reply-To: <3969f155-c3bf-44c5-d056-825e71d42152@amd.com> References: <152055660594.63229.5131049527614494130.stgit@sosxen2.amd.com> <152055669123.63229.1692099069085978884.stgit@sosxen2.amd.com> <3969f155-c3bf-44c5-d056-825e71d42152@amd.com> From: Andy Shevchenko Date: Tue, 13 Mar 2018 22:56:30 +0200 Message-ID: Subject: Re: [PATCH v2 5/5] iommu/amd - Add a debugfs entry to specify a IOMMU device table entry To: Gary R Hook Cc: "iommu@lists.linux-foundation.org" , Joerg Roedel , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 13, 2018 at 8:54 PM, Gary R Hook wrote: > On 03/13/2018 12:20 PM, Andy Shevchenko wrote: >>> + } 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. sscanf() has an enormous overhead for cases like this. simple ret = kstrtoint(); if (ret) ... do error handling ... -- With Best Regards, Andy Shevchenko