From patchwork Thu Oct 19 16:18:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 828260 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="ab1iv7E5"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yHw9h1gJSz9tX4 for ; Fri, 20 Oct 2017 03:58:32 +1100 (AEDT) Received: from localhost ([::1]:50260 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5E9O-0003TE-9J for incoming@patchwork.ozlabs.org; Thu, 19 Oct 2017 12:58:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56224) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5DaT-00068F-KL for qemu-devel@nongnu.org; Thu, 19 Oct 2017 12:22:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e5DaP-0002EK-NT for qemu-devel@nongnu.org; Thu, 19 Oct 2017 12:22:25 -0400 Received: from mail-cys01nam02on0056.outbound.protection.outlook.com ([104.47.37.56]:25883 helo=NAM02-CY1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e5DaP-0002Db-BG for qemu-devel@nongnu.org; Thu, 19 Oct 2017 12:22:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=aM0LYe3oP+Pw+2HiQcI/COLLCN7fdqHjJqDjyYbbgc8=; b=ab1iv7E5JJKJatp/d+u7K/DT46++NcSQ+NvxcdGaCKxpUqFSiCQwVqTXzFV2CMzKmfDdTVpe01w2VwQP3ws6jzq5HBHV3Jp+zjMe9VTUkwB1FWBOQyolF6usyMhVxofiaKjCGPzgUJsbxnjT3Spd5b/G1koliNutQkOJbJN3LrQ= Received: from BY2PR02CA0122.namprd02.prod.outlook.com (10.163.44.176) by MWHPR02MB3280.namprd02.prod.outlook.com (10.164.187.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.156.4; Thu, 19 Oct 2017 16:22:17 +0000 Received: from SN1NAM02FT033.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::200) by BY2PR02CA0122.outlook.office365.com (2a01:111:e400:5261::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.77.7 via Frontend Transport; Thu, 19 Oct 2017 16:22:16 +0000 Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by SN1NAM02FT033.mail.protection.outlook.com (10.152.72.133) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.77.10 via Frontend Transport; Thu, 19 Oct 2017 16:22:16 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1e5DaJ-00006X-F4; Thu, 19 Oct 2017 09:22:15 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1e5DaJ-0003J5-CC; Thu, 19 Oct 2017 09:22:15 -0700 Received: from xsj-pvapsmtp01 (mailhost.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id v9JGM1iE018274; Thu, 19 Oct 2017 09:22:01 -0700 Received: from [172.19.2.220] (helo=localhost.localdomain) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1e5Da5-0003EY-Gh; Thu, 19 Oct 2017 09:22:01 -0700 From: Alistair Francis To: Date: Thu, 19 Oct 2017 09:18:08 -0700 Message-ID: <9721c76be2faed85b0516b2e4184ab17e4690570.1508390588.git.alistair.francis@xilinx.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.1.0.1062-23404.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(39860400002)(346002)(376002)(2980300002)(438002)(189002)(199003)(2906002)(77096006)(305945005)(189998001)(81166006)(81156014)(8676002)(575784001)(4326008)(5003940100001)(39060400002)(106002)(36386004)(50466002)(8936002)(9786002)(2950100002)(6916009)(48376002)(50226002)(106466001)(551934003)(16586007)(2351001)(5660300001)(54906003)(63266004)(118296001)(356003)(76176999)(50986999)(47776003)(36756003)(33646002)(316002)(478600001)(6306002)(107986001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR02MB3280; H:xsj-pvapsmtpgw01; FPR:; SPF:Pass; PTR:unknown-60-83.xilinx.com; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; SN1NAM02FT033; 1:O7SIINNgsyfBDsTuQZPHnUtDx0CMziLmUouUX4kte6FfcnGQXWMkBuR0721DbVZEqAqQuNjcO47fB1WjHI6ZHKeeCMRkG24jXpm0hCJmCO5JKFMDcYKtSr9hBKHMHhLh MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 782d845b-7388-4261-7853-08d5170d9071 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254169)(8251501002)(4534017)(4602075)(4627075)(201703031133081)(201702281549075)(2017052603229)(201703131423092); SRVR:MWHPR02MB3280; X-Microsoft-Exchange-Diagnostics: 1; MWHPR02MB3280; 3:eeqbbOYJe8x30jexOREasVzE8xsqqsvbXnnUsdOs9JuU/jwpf+2H8o8StIq9ufC+UmfrSGfSLeI3f5b0jBXzk6TKgcalzmfAbd3nHjfng8UseisQwA+sOx4FkgpEFAJElP9xlfFA8YhgKLfmvRDzhs2Z0Mtpkt7XdEk6xesHMWJuWZgQrcffqO4rp6a+p3xeugx0ZyjuERplgFe5fB8T5vC1h0IwNokSDxwusWHa6Kht004q4axYfDPDLbwlxC38VNG9tBb95Qu8fwuZNTKYbFj2AfuWOBVNTbE3pjgsQ1HGhpQDEChMOp70Rqlnp+AMqCMAc75e4+3ttKONrgutvcWiOyNK9bQr0nleav8ItZ8=; 25:o+HUL4IERi331QS0Bztf/Ab8c4naKpyiqh91KRsz9DoA7eSznbF4BeDZEdBBczi1E4bh4c+BmJTdXKUEBIJU1dIWW93i7gnCkR5dumOtJLIDpKfVxU5Raw4k+7NVExAPbwbORkG4pJNJw7W5tIfl7CAIbvctdqV4In0CkbMnxMoRuaDRA8p0PJ1xgRGx7daOHPo5KxYU8p/MD2EwH7tfcqE4n7EecykIp6GtPNLDhdNIr1iAEYuA3IJBk411+3APn7d4ly9DpzGBBPm65RGQ/vvp2uL/PTtT20UFY18RSgmnFqsQ5QqbYmTFHhSPyn1f+M1wDCl7/3TiOSzY6s0CHg== X-MS-TrafficTypeDiagnostic: MWHPR02MB3280: X-Microsoft-Exchange-Diagnostics: 1; MWHPR02MB3280; 31:s2OCQ4mLNPxg4/y0SEmfAt4srUptECUAwqTQbKn08IV3E05G1wvTF9M2nywkv4ELbtMNcCyxKT6Kn+YghPbCwuAYB8FP0ANA/MJA9YH8M1SDdt9Gu7A43ybilKcVE/Jz8fRScclCX8Ym0/9+ovp/Ih76RAcvRjlcsWXHlPE3ZoF2uFyszbYUukloJaukbOkTRVKUmX/jcl2e9rwEI7tVkRYqa5gZ0p8WWOxBjXc1nMc=; 20:xiA4VkZ8rHJC2lGLmmVoXw9DOm+Lg7ra0KynaycKOQZEATMaF/1DwXaDBGnQioRgiTkMq2Q9jMIzExa5Rp5basgcW/mGITvms1nwbAaUf9inC58aMLYoDYreLr19V3P2vJFDswIu9DX/JTqpWqzHUbcKaXqBiMgfipr+wGYUqOO7xg97NFvPU7a53dd0BJUtZiJ/MeWuaNzMhKAPcXwHwPVHqLWUrCFOSC29VuzK9SgYTs/PwkHAB3I5LtMmapG1T+MJT3G+5PowUXPqeFKrtMg5jqN2LHxVP3+kIsH/fFhtDWS2mS/VeV6qp1N/nzpxZc11ISrVoG0clIkcKFqLSB0RZgUoMTCy0cPbUR/zSxMHyHrNUH4GgT5HFBQRyz1kS9yJlLX7IBfeKuOQkZD59zU+KloIu3YjX60I5xPZESno08NkYITuc6/BDKwxjdHY+2+s+p5UhuyWIxW9F3CKKsbcXX+i9POP+Zu8QME2jik+W1VBE26sYNZex03bcLJj X-Exchange-Antispam-Report-Test: UriScan:(250305191791016)(72170088055959)(22074186197030)(788757137089)(192813158149592); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(93006095)(93004095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123558100)(20161123564025)(20161123562025)(20161123555025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:MWHPR02MB3280; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:MWHPR02MB3280; X-Microsoft-Exchange-Diagnostics: 1; MWHPR02MB3280; 4:xTRk8gPYov/ra7v8X1Ajy4UnA4ukuWfyq0ACi1KMOcWJoBCTEBAJr3cRphuBiz1nqJVyUqtWVQ66iePbHZtcEW+wE3fZoeblYitoiKF+EvHcvj5HB9dq5wOqrVHobeuaBOkXt/DqZa0Xzym8q5pcE6N5Ujf9dhCj/pa39Bt3eZe+IzoktWCewXvNgzzNNpiuhAyKCEFMriDUh8WpxKUYqT5tlKJfBDHxZOo3hS7Rjr8YgaYyb1u8g2fcl4wia2iy/nD7A174N2ClUpCet2pVGaYS/sxXvJ3BM51KW8ZNQZrglzpl67Z1HASovI5ZefrvXJYku75bBHYqU8gQpbYPjDCDA5q6oablk0WPW6FpCydY+lZf/iibq9JOX6XFw3ae7V1BFIIaWHuQPwk9uurFWD9BUAMsf3Wex3+GEfC+E2c= X-Forefront-PRVS: 0465429B7F X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR02MB3280; 23:XfFp4gR4VpXBwTie105MUAMObnr4ecMAoPb5MRyEB?= Ts/IO3lwz0eW/7ZlgcmMn/6Fv1YclKVc7jp1MZ0yhSuUZXD+muQt3r3VnjeJgew/p1eS82SKnj84VI3fn7hVbC9/uj3MTVlWJBURM8gHyXs1trj/LyVP5xiDkyFpamkL3N97ZOhyOclC22AJNBut0PXz4DdVUGw/Aia70ICN1SmiQ5wE8axYGM+5rP53UQgtMEqQ8kNXGG8XUw8r805kRDkXypEkBHlFfax0gP68aZWfyxcSXvdZBAS4enkmNzEJn3qWzr436TsmLfgU9QdP/fyjqhjp7VBASkJdCjt4Xh5Er4XReXAMh5AuBC3+aBW2uPgqvafcexV9pJZSlaVLJSFgLbFK6nNQLHLn68rW6Zr7D0hR0zoeKQf+xXc8U4Y33YeHIxDGyXiqbph+DUiWk4hmX4vP0SK4QxyyP3SxmGkLDSxT77HWD8Jr7RCZrUtdMln0t/pGLGnfMA68S+Izph0w+3hRylCs+m11CES/P/JiVMIoujHzbyzI6VnIK6OMuZV24zbkGk9vPLzBUJeaP4m5193rsGy0mtOxYTY0YD2clAea6YMTVEBIxOT8QZLVGprM87H+BW6gZt56qAouGZX3B6QAvEZezMZXlcEJWEcjsKgDG6MMqZgFisTGac5XtqwgUcqKIy4AL8ocEESbWSl9Ryj3V0Hjn2FmJhuYor8aJd4ieaCv3YymMXgWq1KRz/AvKCsMvMkklRFrEc/dj5SrUjxcLaVoTOmQhh7q7S8kuO+CWjI7A8gD0VOWh0N6Tvg48mprpeQ+PsYUaCUF+JYNrur/L1tdS3ohTgF/k1QrSRD7c8PGi95W51ILOvNuegp/QjAAcd7RC9RyqO6EaFyEqfceA/1aNe8r9ceLRdsrVque4s0FPKvksBlLdiTYdzt3OnoAzmgC1CwYxWiyKlpyzNpPNdnjpsL2Q45ny7ThftxcfcIcXPRupubLi/o17njksCwimUIm5y/Il1EiO1rBvXlYmW3ygqmVPCh9u4EaJdFv1DbsMQRGZWCZ6i5wGF4koHustGS91SdWojL1IV4Poa3BEbB6srVHY0zsL5+Cg== X-Microsoft-Exchange-Diagnostics: 1; MWHPR02MB3280; 6:XxNxW117vAc/0mIfMPWCrJIO/JJgTTe5ZkBApq7ynjtbDaetbWxuzdH3HjjBDVFx3No/+7pnsk0BpTe7gs0L5c34qslyOHh+dmiNN+4+jw3MEqyFIesp9BSCxsPoAUg7Y1OZHw5pJ3l1g1H9Tf8vi19Z9dCjK5e0G5zU+VU3I5CBqH4Nfs+tORvdWTMNBQmdFn1S6Ouvpg9EYvHVxCWfYBE8IgvZs/NCJ24a4iz6sFfoi3fNuBii8I675ly60PIVKjKEanoByGB0KzM1nbB0jZOL5IGr8OlgXPl3q0Kd1J6eMIDNF3L6xWCQ/A9/u10FbwwWrx4Rkiirq0Ijb9dZEQ==; 5:8ePSDQhEVKstMERSTAWSIICX6mnU2uieqPVHgw5v2U8X9+UldnAHf2le2E7q0Vmpnbds7tJx0+HXRWwiDvXZoz0IlvTa8uWuniwk82DxK7lhqUjawscbfSpUokea0ycwwp809DuwTjqywmQyA5cMUw==; 24:yS4y2YRD+o6W/w8r/8JKeEPO1wwfZQeOXUP1L35PUlJtE+Al0KaXHcvtV9jd+mo84ATEwYFwX6CM8AF2hKMfiU/rKVXHNN4WpDOpocDN3VQ=; 7:YxJifjU9gnch/nFHPp7fmFwGK41AC1seY/c4gtRAXLxfXtDX9JIc9Dgr9VaSF9odMxkKLpGQJhDWY1Vhy3uVO8qAxO8GBjuXLNBXMIkXsXqHWKIcKwqRD0v/2klh2rj5EqxKpTrwnStnEvWPgZsmcBYFVgZXomG6X/F165QiVsR6/OaC3wRVBvugPLx57hk0O2XiYZ3BAvUhTWiQSZmPIcl7iNq8YA4p3fwyuAp3G5o= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2017 16:22:16.4724 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 782d845b-7388-4261-7853-08d5170d9071 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.83]; Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR02MB3280 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.37.56 Subject: [Qemu-devel] [PATCH v3 39/46] hw/usb: Replace fprintf(stderr, "*\n" with error_report() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alistair23@gmail.com, Gerd Hoffmann , armbru@redhat.com, alistair.francis@xilinx.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Replace a large number of the fprintf(stderr, "*\n" calls with error_report(). The functions were renamed with these commands and then compiler issues where manually fixed. find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + Some lines where then manually tweaked to pass checkpatch. The debug prints in usb_net_handle_control() where reverted to use fprintf(stderr, and usb_mtp_cancel_packet() now uses g_assert_not_reached(). Signed-off-by: Alistair Francis Cc: Gerd Hoffmann --- V3: - Use g_assert_not_reached() in usb_mtp_cancel_packet() - Leave the fprintf(stderr in usb_net_handle_control() V2: - Split hw patch into individual directories hw/usb/core.c | 15 ++++++++------- hw/usb/desc.c | 6 +++--- hw/usb/dev-audio.c | 39 ++++++++++++++++++++------------------- hw/usb/dev-bluetooth.c | 4 ++-- hw/usb/dev-mtp.c | 9 +++++---- hw/usb/dev-network.c | 14 +++++++------- hw/usb/hcd-ehci.c | 32 ++++++++++++++++---------------- hw/usb/hcd-musb.c | 4 ++-- hw/usb/hcd-xhci.c | 3 ++- hw/usb/host-legacy.c | 3 ++- 10 files changed, 67 insertions(+), 62 deletions(-) diff --git a/hw/usb/core.c b/hw/usb/core.c index 241ae66b15..9ffdef055c 100644 --- a/hw/usb/core.c +++ b/hw/usb/core.c @@ -24,6 +24,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "hw/usb.h" #include "qemu/iov.h" @@ -599,7 +600,7 @@ void usb_packet_copy(USBPacket *p, void *ptr, size_t bytes) iov_from_buf(iov->iov, iov->niov, p->actual_length, ptr, bytes); break; default: - fprintf(stderr, "%s: invalid pid: %x\n", __func__, p->pid); + error_report("%s: invalid pid: %x", __func__, p->pid); abort(); } p->actual_length += bytes; @@ -681,7 +682,7 @@ void usb_ep_dump(USBDevice *dev) }; int ifnum, ep, first; - fprintf(stderr, "Device \"%s\", config %d\n", + error_report("Device \"%s\", config %d", dev->product_desc, dev->configuration); for (ifnum = 0; ifnum < 16; ifnum++) { first = 1; @@ -690,10 +691,10 @@ void usb_ep_dump(USBDevice *dev) dev->ep_in[ep].ifnum == ifnum) { if (first) { first = 0; - fprintf(stderr, " Interface %d, alternative %d\n", + error_report(" Interface %d, alternative %d", ifnum, dev->altsetting[ifnum]); } - fprintf(stderr, " Endpoint %d, IN, %s, %d max\n", ep, + error_report(" Endpoint %d, IN, %s, %d max", ep, tname[dev->ep_in[ep].type], dev->ep_in[ep].max_packet_size); } @@ -701,16 +702,16 @@ void usb_ep_dump(USBDevice *dev) dev->ep_out[ep].ifnum == ifnum) { if (first) { first = 0; - fprintf(stderr, " Interface %d, alternative %d\n", + error_report(" Interface %d, alternative %d", ifnum, dev->altsetting[ifnum]); } - fprintf(stderr, " Endpoint %d, OUT, %s, %d max\n", ep, + error_report(" Endpoint %d, OUT, %s, %d max", ep, tname[dev->ep_out[ep].type], dev->ep_out[ep].max_packet_size); } } } - fprintf(stderr, "--\n"); + error_report("--"); } struct USBEndpoint *usb_ep_get(USBDevice *dev, int pid, int ep) diff --git a/hw/usb/desc.c b/hw/usb/desc.c index 85c15addc5..bde39e3903 100644 --- a/hw/usb/desc.c +++ b/hw/usb/desc.c @@ -1,5 +1,5 @@ #include "qemu/osdep.h" - +#include "qemu/error-report.h" #include "hw/usb.h" #include "hw/usb/desc.h" #include "trace.h" @@ -688,8 +688,8 @@ int usb_desc_get_descriptor(USBDevice *dev, USBPacket *p, break; default: - fprintf(stderr, "%s: %d unknown type %d (len %zd)\n", __func__, - dev->addr, type, len); + error_report("%s: %d unknown type %d (len %zd)", __func__, + dev->addr, type, len); break; } diff --git a/hw/usb/dev-audio.c b/hw/usb/dev-audio.c index 343345235c..a95e4cdbd9 100644 --- a/hw/usb/dev-audio.c +++ b/hw/usb/dev-audio.c @@ -30,6 +30,7 @@ */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "hw/usb.h" #include "hw/usb/desc.h" @@ -398,7 +399,7 @@ static int usb_audio_set_output_altset(USBAudioState *s, int altset) } if (s->debug) { - fprintf(stderr, "usb-audio: set interface %d\n", altset); + error_report("usb-audio: set interface %d", altset); } s->out.altset = altset; return 0; @@ -478,7 +479,7 @@ static int usb_audio_set_control(USBAudioState *s, uint8_t attrib, uint16_t vol = data[0] + (data[1] << 8); if (s->debug) { - fprintf(stderr, "usb-audio: vol %04x\n", (uint16_t)vol); + error_report("usb-audio: vol %04x", (uint16_t)vol); } vol -= 0x8000; @@ -496,8 +497,8 @@ static int usb_audio_set_control(USBAudioState *s, uint8_t attrib, if (set_vol) { if (s->debug) { - fprintf(stderr, "usb-audio: mute %d, lvol %3d, rvol %3d\n", - s->out.mute, s->out.vol[0], s->out.vol[1]); + error_report("usb-audio: mute %d, lvol %3d, rvol %3d", + s->out.mute, s->out.vol[0], s->out.vol[1]); } AUD_set_volume_out(s->out.voice, s->out.mute, s->out.vol[0], s->out.vol[1]); @@ -514,9 +515,9 @@ static void usb_audio_handle_control(USBDevice *dev, USBPacket *p, int ret = 0; if (s->debug) { - fprintf(stderr, "usb-audio: control transaction: " - "request 0x%04x value 0x%04x index 0x%04x length 0x%04x\n", - request, value, index, length); + error_report("usb-audio: control transaction: " + "request 0x%04x value 0x%04x index 0x%04x length 0x%04x", + request, value, index, length); } ret = usb_desc_handle_control(dev, p, request, value, index, length, data); @@ -533,7 +534,7 @@ static void usb_audio_handle_control(USBDevice *dev, USBPacket *p, length, data); if (ret < 0) { if (s->debug) { - fprintf(stderr, "usb-audio: fail: get control\n"); + error_report("usb-audio: fail: get control"); } goto fail; } @@ -548,7 +549,7 @@ static void usb_audio_handle_control(USBDevice *dev, USBPacket *p, length, data); if (ret < 0) { if (s->debug) { - fprintf(stderr, "usb-audio: fail: set control\n"); + error_report("usb-audio: fail: set control"); } goto fail; } @@ -557,9 +558,9 @@ static void usb_audio_handle_control(USBDevice *dev, USBPacket *p, default: fail: if (s->debug) { - fprintf(stderr, "usb-audio: failed control transaction: " - "request 0x%04x value 0x%04x index 0x%04x length 0x%04x\n", - request, value, index, length); + error_report("usb-audio: failed control transaction: " + "request 0x%04x value 0x%04x index 0x%04x length 0x%04x", + request, value, index, length); } p->status = USB_RET_STALL; break; @@ -581,7 +582,7 @@ static void usb_audio_handle_reset(USBDevice *dev) USBAudioState *s = USB_AUDIO(dev); if (s->debug) { - fprintf(stderr, "usb-audio: reset\n"); + error_report("usb-audio: reset"); } usb_audio_set_output_altset(s, ALTSET_OFF); } @@ -595,8 +596,8 @@ static void usb_audio_handle_dataout(USBAudioState *s, USBPacket *p) streambuf_put(&s->out.buf, p); if (p->actual_length < p->iov.size && s->debug > 1) { - fprintf(stderr, "usb-audio: output overrun (%zd bytes)\n", - p->iov.size - p->actual_length); + error_report("usb-audio: output overrun (%zd bytes)", + p->iov.size - p->actual_length); } } @@ -611,9 +612,9 @@ static void usb_audio_handle_data(USBDevice *dev, USBPacket *p) p->status = USB_RET_STALL; if (s->debug) { - fprintf(stderr, "usb-audio: failed data transaction: " - "pid 0x%x ep 0x%x len 0x%zx\n", - p->pid, p->ep->nr, p->iov.size); + error_report("usb-audio: failed data transaction: " + "pid 0x%x ep 0x%x len 0x%zx", + p->pid, p->ep->nr, p->iov.size); } } @@ -622,7 +623,7 @@ static void usb_audio_unrealize(USBDevice *dev, Error **errp) USBAudioState *s = USB_AUDIO(dev); if (s->debug) { - fprintf(stderr, "usb-audio: destroy\n"); + error_report("usb-audio: destroy"); } usb_audio_set_output_altset(s, ALTSET_OFF); diff --git a/hw/usb/dev-bluetooth.c b/hw/usb/dev-bluetooth.c index 0bbceaea0b..dfef258dca 100644 --- a/hw/usb/dev-bluetooth.c +++ b/hw/usb/dev-bluetooth.c @@ -274,13 +274,13 @@ static void usb_bt_fifo_enqueue(struct usb_hci_in_fifo_s *fifo, if (off <= DFIFO_LEN_MASK) { if (off + len > DFIFO_LEN_MASK + 1 && (fifo->dsize = off + len) > (DFIFO_LEN_MASK + 1) * 2) { - fprintf(stderr, "%s: can't alloc %i bytes\n", __func__, len); + error_report("%s: can't alloc %i bytes", __func__, len); exit(-1); } buf = fifo->data + off; } else { if (fifo->dlen > fifo->dsize) { - fprintf(stderr, "%s: can't alloc %i bytes\n", __func__, len); + error_report("%s: can't alloc %i bytes", __func__, len); exit(-1); } buf = fifo->data + off - fifo->dsize; diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c index 94c2e94f10..69e2eac259 100644 --- a/hw/usb/dev-mtp.c +++ b/hw/usb/dev-mtp.c @@ -10,6 +10,7 @@ */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include #include @@ -546,7 +547,7 @@ static void inotify_watchfn(void *arg) break; default: - fprintf(stderr, "usb-mtp: failed to parse inotify event\n"); + error_report("usb-mtp: failed to parse inotify event"); continue; } @@ -617,7 +618,7 @@ static void usb_mtp_object_readdir(MTPState *s, MTPObject *o) #ifdef CONFIG_INOTIFY1 int watchfd = usb_mtp_add_watch(s->inotifyfd, o->path); if (watchfd == -1) { - fprintf(stderr, "usb-mtp: failed to add watch for %s\n", o->path); + error_report("usb-mtp: failed to add watch for %s", o->path); } else { trace_usb_mtp_inotify_event(s->dev.addr, o->path, 0, "Watch Added"); @@ -1144,7 +1145,7 @@ static void usb_mtp_command(MTPState *s, MTPControl *c) usb_mtp_object_alloc(s, s->next_handle++, NULL, s->root); #ifdef CONFIG_INOTIFY1 if (usb_mtp_inotify_init(s)) { - fprintf(stderr, "usb-mtp: file monitoring init failed\n"); + error_report("usb-mtp: file monitoring init failed"); } #endif break; @@ -1348,7 +1349,7 @@ static void usb_mtp_handle_control(USBDevice *dev, USBPacket *p, static void usb_mtp_cancel_packet(USBDevice *dev, USBPacket *p) { /* we don't use async packets, so this should never be called */ - fprintf(stderr, "%s\n", __func__); + g_assert_not_reached(); } static void usb_mtp_handle_data(USBDevice *dev, USBPacket *p) diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c index 85fc81bf43..7245182467 100644 --- a/hw/usb/dev-network.c +++ b/hw/usb/dev-network.c @@ -815,7 +815,7 @@ static int ndis_query(USBNetState *s, uint32_t oid, return sizeof(le32); default: - fprintf(stderr, "usbnet: unknown OID 0x%08x\n", oid); + error_report("usbnet: unknown OID 0x%08x", oid); return 0; } return -1; @@ -1120,9 +1120,9 @@ static void usb_net_handle_control(USBDevice *dev, USBPacket *p, default: fail: - fprintf(stderr, "usbnet: failed control transaction: " - "request 0x%x value 0x%x index 0x%x length 0x%x\n", - request, value, index, length); + error_report("usbnet: failed control transaction: " + "request 0x%x value 0x%x index 0x%x length 0x%x", + request, value, index, length); p->status = USB_RET_STALL; break; } @@ -1190,7 +1190,7 @@ static void usb_net_handle_dataout(USBNetState *s, USBPacket *p) uint32_t len; #ifdef TRAFFIC_DEBUG - fprintf(stderr, "usbnet: data out len %zu\n", p->iov.size); + error_report("usbnet: data out len %zu", p->iov.size); iov_hexdump(p->iov.iov, p->iov.niov, stderr, "usbnet", p->iov.size); #endif @@ -1260,8 +1260,8 @@ static void usb_net_handle_data(USBDevice *dev, USBPacket *p) } if (p->status == USB_RET_STALL) { - fprintf(stderr, "usbnet: failed data transaction: " - "pid 0x%x ep 0x%x len 0x%zx\n", + error_report("usbnet: failed data transaction: " + "pid 0x%x ep 0x%x len 0x%zx", p->pid, p->ep->nr, p->iov.size); } } diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index 0134232627..e405b882fb 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -419,7 +419,7 @@ static int ehci_get_pid(EHCIqtd *qtd) case 2: return USB_TOKEN_SETUP; default: - fprintf(stderr, "bad token\n"); + error_report("bad token"); return 0; } } @@ -1033,7 +1033,7 @@ static void ehci_opreg_write(void *ptr, hwaddr addr, /* not supporting dynamic frame list size at the moment */ if ((val & USBCMD_FLS) && !(s->usbcmd & USBCMD_FLS)) { - fprintf(stderr, "attempt to set frame list size -- value %d\n", + error_report("attempt to set frame list size -- value %d", (int)val & USBCMD_FLS); val &= ~USBCMD_FLS; } @@ -1190,7 +1190,7 @@ static int ehci_init_transfer(EHCIPacket *p) while (bytes > 0) { if (cpage > 4) { - fprintf(stderr, "cpage out of range (%d)\n", cpage); + error_report("cpage out of range (%d)", cpage); qemu_sglist_destroy(&p->sgl); return -1; } @@ -1296,7 +1296,7 @@ static void ehci_execute_complete(EHCIQueue *q) break; default: /* should not be triggerable */ - fprintf(stderr, "USB invalid response %d\n", p->packet.status); + error_report("USB invalid response %d", p->packet.status); g_assert_not_reached(); break; } @@ -1345,7 +1345,7 @@ static int ehci_execute(EHCIPacket *p, const char *action) p->async == EHCI_ASYNC_INITIALIZED); if (!(p->qtd.token & QTD_TOKEN_ACTIVE)) { - fprintf(stderr, "Attempting to execute inactive qtd\n"); + error_report("Attempting to execute inactive qtd"); return -1; } @@ -1383,7 +1383,7 @@ static int ehci_execute(EHCIPacket *p, const char *action) p->packet.actual_length); if (p->packet.actual_length > BUFF_SIZE) { - fprintf(stderr, "ret from usb_handle_packet > BUFF_SIZE\n"); + error_report("ret from usb_handle_packet > BUFF_SIZE"); return -1; } @@ -1461,7 +1461,7 @@ static int ehci_process_itd(EHCIState *ehci, case USB_RET_SUCCESS: break; default: - fprintf(stderr, "Unexpected iso usb result: %d\n", + error_report("Unexpected iso usb result: %d", ehci->ipacket.status); /* Fall through */ case USB_RET_IOERROR: @@ -1564,7 +1564,7 @@ static int ehci_state_fetchentry(EHCIState *ehci, int async) /* section 4.8, only QH in async schedule */ if (async && (NLPTR_TYPE_GET(entry) != NLPTR_TYPE_QH)) { - fprintf(stderr, "non queue head request in async schedule\n"); + error_report("non queue head request in async schedule"); return -1; } @@ -1586,8 +1586,8 @@ static int ehci_state_fetchentry(EHCIState *ehci, int async) default: /* TODO: handle FSTN type */ - fprintf(stderr, "FETCHENTRY: entry at %X is of type %d " - "which is not supported yet\n", entry, NLPTR_TYPE_GET(entry)); + error_report("FETCHENTRY: entry at %X is of type %d " + "which is not supported yet", entry, NLPTR_TYPE_GET(entry)); return -1; } @@ -2086,7 +2086,7 @@ static void ehci_advance_state(EHCIState *ehci, int async) break; default: - fprintf(stderr, "Bad state!\n"); + error_report("Bad state!"); again = -1; g_assert_not_reached(); break; @@ -2094,7 +2094,7 @@ static void ehci_advance_state(EHCIState *ehci, int async) if (again < 0 || itd_count > 16) { /* TODO: notify guest (raise HSE irq?) */ - fprintf(stderr, "processing error - resetting ehci HC\n"); + error_report("processing error - resetting ehci HC"); ehci_reset(ehci); again = 0; } @@ -2151,8 +2151,8 @@ static void ehci_advance_async_state(EHCIState *ehci) default: /* this should only be due to a developer mistake */ - fprintf(stderr, "ehci: Bad asynchronous state %d. " - "Resetting to active\n", ehci->astate); + error_report("ehci: Bad asynchronous state %d. " + "Resetting to active", ehci->astate); g_assert_not_reached(); } } @@ -2201,8 +2201,8 @@ static void ehci_advance_periodic_state(EHCIState *ehci) default: /* this should only be due to a developer mistake */ - fprintf(stderr, "ehci: Bad periodic state %d. " - "Resetting to active\n", ehci->pstate); + error_report("ehci: Bad periodic state %d. " + "Resetting to active", ehci->pstate); g_assert_not_reached(); } } diff --git a/hw/usb/hcd-musb.c b/hw/usb/hcd-musb.c index d70a91a58c..4729926124 100644 --- a/hw/usb/hcd-musb.c +++ b/hw/usb/hcd-musb.c @@ -253,8 +253,8 @@ /* #define MUSB_DEBUG */ #ifdef MUSB_DEBUG -#define TRACE(fmt, ...) fprintf(stderr, "%s@%d: " fmt "\n", __func__, \ - __LINE__, ##__VA_ARGS__) +#define TRACE(fmt, ...) error_report("%s@%d: " fmt "", __func__, \ + __LINE__, ##__VA_ARGS__) #else #define TRACE(...) #endif diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index af3a9d88de..14f4f455a0 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -19,6 +19,7 @@ * License along with this library; if not, see . */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/hw.h" #include "qemu/timer.h" #include "qemu/queue.h" @@ -39,7 +40,7 @@ #else #define DPRINTF(...) do {} while (0) #endif -#define FIXME(_msg) do { fprintf(stderr, "FIXME %s:%d %s\n", \ +#define FIXME(_msg) do { error_report("FIXME %s:%d %s", \ __func__, __LINE__, _msg); abort(); } while (0) #define TRB_LINK_LIMIT 32 diff --git a/hw/usb/host-legacy.c b/hw/usb/host-legacy.c index 3b57e21b52..56865c40ed 100644 --- a/hw/usb/host-legacy.c +++ b/hw/usb/host-legacy.c @@ -34,6 +34,7 @@ #include "qemu-common.h" #include "hw/usb.h" #include "hw/usb/host.h" +#include "qemu/error-report.h" /* * Autoconnect filter @@ -86,7 +87,7 @@ static int parse_filter(const char *spec, struct USBAutoFilter *f) } if (i < DEV) { - fprintf(stderr, "husb: invalid auto filter spec %s\n", spec); + error_report("husb: invalid auto filter spec %s", spec); return -1; }