From patchwork Wed Apr 10 08:08:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1083246 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44fGyy2ptDz9s70 for ; Wed, 10 Apr 2019 18:09:30 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="jgFV5XP/"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 44fGyy1YmvzDqMn for ; Wed, 10 Apr 2019 18:09:30 +1000 (AEST) X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 44fGyQ5XwZzDqMb for ; Wed, 10 Apr 2019 18:09:02 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="jgFV5XP/"; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 44fGyQ2T61z9s9h; Wed, 10 Apr 2019 18:09:02 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1554883742; bh=S5ErKsyeOXo8OYumJdg7xhUKxnsGP/xIE/vYZ6PKFw8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jgFV5XP/1kHLD5vsSz/QPMr3s9LztNOB18gjljM6ekutFe+TmUA6tCMFI2LL7jXB6 xFh5rD6E9VFtuCKYUQdbZosnn2vWuJ4NF3rvMBVQuuXubDAEEYj8YXbVoTdwkKT1VE AHThsoUdCY4xsIfO6LoZ/IKzOzHMIKV6Mifp2ZtyQ6qoZvaaZtdmNYBM3og6ThY6oF Ha9AUk/+6SI/UonkbxZxeNzIourG5AT1RPNmwD0wUL3TWSxZrdASxSCcfgTXpDJfLh WXiOLak1ToCUbDTNSSDDZPr1Lhnnee9tXp28MusfSc+B02TlShgBycoKcoZqIN+TzO vukRLcQjUS0VQ== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Wed, 10 Apr 2019 18:08:51 +1000 Message-Id: <20190410080854.430335-5-amitay@ozlabs.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190410080854.430335-1-amitay@ozlabs.org> References: <20190410080854.430335-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 4/7] libpdbg: Replace warn/err with PR_WARNING/PR_ERROR X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "mailing list for https://github.com/open-power/pdbg development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Amitay Isaacs Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Signed-off-by: Amitay Isaacs --- libpdbg/kernel.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/libpdbg/kernel.c b/libpdbg/kernel.c index 8b597ef..9ff0174 100644 --- a/libpdbg/kernel.c +++ b/libpdbg/kernel.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -42,18 +41,20 @@ static int kernel_fsi_getcfam(struct fsi *fsi, uint32_t addr64, uint32_t *value) rc = lseek(fsi_fd, addr, SEEK_SET); if (rc < 0) { - warn("Failed to seek %s", FSI_CFAM_PATH); - return errno; + rc = errno; + PR_WARNING("Failed to seek %s", FSI_CFAM_PATH); + return rc; } rc = read(fsi_fd, &tmp, 4); if (rc < 0) { + rc = errno; if ((addr64 & 0xfff) != 0xc09) /* We expect reads of 0xc09 to occasionally * fail as the probing code uses it to see * if anything is present on the link. */ - warn("Failed to read from 0x%08" PRIx32 " (%016" PRIx32 ")", (uint32_t) addr, addr64); - return errno; + PR_ERROR("Failed to read from 0x%08" PRIx32 " (%016" PRIx32 ")", (uint32_t) addr, addr64); + return rc; } *value = be32toh(tmp); @@ -67,15 +68,17 @@ static int kernel_fsi_putcfam(struct fsi *fsi, uint32_t addr64, uint32_t data) rc = lseek(fsi_fd, addr, SEEK_SET); if (rc < 0) { - warn("Failed to seek %s", FSI_CFAM_PATH); - return errno; + rc = errno; + PR_WARNING("Failed to seek %s", FSI_CFAM_PATH); + return rc; } tmp = htobe32(data); rc = write(fsi_fd, &tmp, 4); if (rc < 0) { - warn("Failed to write to 0x%08" PRIx32 " (%016" PRIx32 ")", addr, addr64); - return errno; + rc = errno; + PR_ERROR("Failed to write to 0x%08" PRIx32 " (%016" PRIx32 ")", addr, addr64); + return rc; } return 0; @@ -97,12 +100,14 @@ static void kernel_fsi_scan_devices(void) int rc, fd; fd = open(FSI_SCAN_PATH, O_WRONLY | O_SYNC); - if (fd < 0) - err(errno, "Unable to open %s", FSI_SCAN_PATH); + if (fd < 0) { + PR_ERROR("Unable to open %s", FSI_SCAN_PATH); + return; + } rc = write(fd, &one, sizeof(one)); if (rc < 0) - err(errno, "Unable to write to %s", FSI_SCAN_PATH); + PR_ERROR("Unable to write to %s", FSI_SCAN_PATH); close(fd); } @@ -124,7 +129,7 @@ int kernel_fsi_probe(struct pdbg_target *target) sleep(1); } if (fsi_fd < 0) { - err(errno, "Unable to open %s", FSI_CFAM_PATH); + PR_ERROR("Unable to open %s", FSI_CFAM_PATH); return -1; }