From patchwork Thu Apr 23 21:10:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 11506575 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 95A21112C for ; Thu, 23 Apr 2020 21:10:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7CA0F20857 for ; Thu, 23 Apr 2020 21:10:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lnyVafeX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727092AbgDWVKq (ORCPT ); Thu, 23 Apr 2020 17:10:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727065AbgDWVKq (ORCPT ); Thu, 23 Apr 2020 17:10:46 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11ABBC09B044 for ; Thu, 23 Apr 2020 14:10:46 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id a31so1135664pje.1 for ; Thu, 23 Apr 2020 14:10:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=WYxKCRpYcYJulfhpMhiVVDeFXV8YlPiKJygpdbe/abE=; b=lnyVafeXM3v8E0R4lop6SK7FRVEIdJZpMwyFF8Q61z+vbTzaxIlYbaZuAa9kD76aSC 34rwgTN+09JaQOBKH5U6YwfghXjclKA+1Xs37rG+HY3GA9uS4CJnNHgb9+Nb9kb6ijvQ mm/iIFvS87x+f9e+QtCGMl0nakWumLdLhW8SZ6jk5GeXxyczPit5unDlnunQNKuXA63v CQSHTJ6Do+QNyozaCzV3nGXH87NWmxIlTE6lQJ3Y0pmUjnioSoLP5bVihIbVCCn0jKin xdfg71faYWyXAz6RE7pp2rHTBLzNJZpSFQo09/slAcUjGBSQUinG+MwBXituwHQssHkS WYCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=WYxKCRpYcYJulfhpMhiVVDeFXV8YlPiKJygpdbe/abE=; b=G5oq7lp8BAK1JRDOgy2pPRd2p3B45Av//iuEvfl2kekQAIAF3O5ikKwU6VAebk+w7E 14qSJuMgpdyErwjSFUHMs66eJskkedv48V+PActZ73O7XUm9HteV8hKoJffitcITm9WW YV3e36zDEtvw5JBvlIb+2EXXxWhoI/VsMUpwMRaWfrtxNVn3kPtEw8gXVEPpT6x8KJta qsIgHeKoHnIX2gdLim2PMILq19xnfSjZ3lcKrUqeeHnungR20yTN1UIf2cDfHdaOznxE 1ybXha+GM7KrDjviBrYNA4vI3BPdW5HQZjcRGXF9CP2/WK9bpUr9pOpBMMW7jAP8ZO1B PSqw== X-Gm-Message-State: AGi0PuaNFaxA8Hzr1t3dLXPghfUSxa2vIpwP/pwv4Ni0e6huCktUvPwG woMitgVTHUJssjSFH1GWxVusYatA X-Google-Smtp-Source: APiQypLmuPT9/DCxj+uVPKOS3oWsfAJC82LjJaSQAsXykwwJKBlxMPRmqgqvspf65uD/lD8kYnj7ZA== X-Received: by 2002:a17:90a:589:: with SMTP id i9mr2656907pji.156.1587676245174; Thu, 23 Apr 2020 14:10:45 -0700 (PDT) Received: from localhost.localdomain (76-14-109-232.rk.wavecable.com. [76.14.109.232]) by smtp.gmail.com with ESMTPSA id f21sm3563630pfn.71.2020.04.23.14.10.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 14:10:44 -0700 (PDT) From: Rosen Penev To: linux-media@vger.kernel.org Subject: [PATCH 1/5] utils: fix compilation with C++98 Date: Thu, 23 Apr 2020 14:10:36 -0700 Message-Id: <20200423211040.14275-1-rosenp@gmail.com> X-Mailer: git-send-email 2.25.3 MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Signed-off-by: Rosen Penev --- utils/cec-compliance/cec-test.cpp | 4 ++-- utils/rds-ctl/rds-ctl.cpp | 2 +- utils/v4l2-ctl/v4l2-ctl-tuner.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/cec-compliance/cec-test.cpp b/utils/cec-compliance/cec-test.cpp index 032ff5ad..cc07998a 100644 --- a/utils/cec-compliance/cec-test.cpp +++ b/utils/cec-compliance/cec-test.cpp @@ -908,7 +908,7 @@ static int tuner_ctl_test(struct node *node, unsigned me, unsigned la, bool inte cec_msg_give_tuner_device_status(&msg, true, CEC_OP_STATUS_REQ_ONCE); fail_on_test(!transmit_timeout(node, &msg)); fail_on_test(timed_out_or_abort(&msg)); - info = {}; + memset(&info, 0, sizeof(info)); cec_ops_tuner_device_status(&msg, &info); if (!memcmp(&info, &info_vec[0], sizeof(info))) break; @@ -935,7 +935,7 @@ static int tuner_ctl_test(struct node *node, unsigned me, unsigned la, bool inte cec_msg_give_tuner_device_status(&msg, true, CEC_OP_STATUS_REQ_ONCE); fail_on_test(!transmit_timeout(node, &msg)); fail_on_test(timed_out_or_abort(&msg)); - info = {}; + memset(&info, 0, sizeof(info)); cec_ops_tuner_device_status(&msg, &info); if (memcmp(&info, &(*iter), sizeof(info))) { log_tuner_service(info); diff --git a/utils/rds-ctl/rds-ctl.cpp b/utils/rds-ctl/rds-ctl.cpp index 0511fe5d..0e497b2a 100644 --- a/utils/rds-ctl/rds-ctl.cpp +++ b/utils/rds-ctl/rds-ctl.cpp @@ -918,7 +918,7 @@ static void get_options(const int fd, const int capabilities, struct v4l2_freque printf("\tFrequency range : %.1f MHz - %.1f MHz\n", vt.rangelow / 16.0, vt.rangehigh / 16.0); printf("\tSignal strength/AFC : %ld%%/%d\n", - std::lround(vt.signal / 655.35), vt.afc); + lround(vt.signal / 655.25), vt.afc); printf("\tCurrent audio mode : %s\n", audmode2s(vt.audmode)); printf("\tAvailable subchannels: %s\n", rxsubchans2s(vt.rxsubchans).c_str()); diff --git a/utils/v4l2-ctl/v4l2-ctl-tuner.cpp b/utils/v4l2-ctl/v4l2-ctl-tuner.cpp index bc397ec2..73dc323c 100644 --- a/utils/v4l2-ctl/v4l2-ctl-tuner.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-tuner.cpp @@ -423,7 +423,7 @@ void tuner_get(cv4l_fd &_fd) if (vt.type != V4L2_TUNER_SDR && vt.type != V4L2_TUNER_RF) { printf("\tSignal strength/AFC : %ld%%/%d\n", - std::lround(vt.signal / 655.35), vt.afc); + lround(vt.signal / 655.35), vt.afc); printf("\tCurrent audio mode : %s\n", audmode2s(vt.audmode)); printf("\tAvailable subchannels: %s\n", rxsubchans2s(vt.rxsubchans).c_str()); } From patchwork Thu Apr 23 21:10:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 11506577 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DE2C892C for ; Thu, 23 Apr 2020 21:10:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C66EA2084D for ; Thu, 23 Apr 2020 21:10:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TLBKjNX9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727772AbgDWVKt (ORCPT ); Thu, 23 Apr 2020 17:10:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727125AbgDWVKs (ORCPT ); Thu, 23 Apr 2020 17:10:48 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21C37C09B042 for ; Thu, 23 Apr 2020 14:10:47 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id fu13so2426582pjb.5 for ; Thu, 23 Apr 2020 14:10:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=odzY2H9MOg6XnqWqH3v4/StHWBLH4+8YutE666x3msg=; b=TLBKjNX9AbFhEZefKEvLa/tPyDAUfY2dMDu0CacKPYtnkRJof+yoM9oZ+yO5Wwa74k eYC2i4OeOURIUEX4sTtBder8LAs9W0AG4bCgi53kA5gFHy/UUD73dTY50i+ANj5fLjn4 p664rRG46pgi0mG16QtbPTg3O/7yGAUVdD3YcVoAqBmGzDpWXmXODMLlFfi7mIUYW8T1 dc+Z3Gh2C790So1mgCp+1wstnCCjkkUkrAfw6ZNfWATmF7Ez6XHjcFS7YorqPNs8K1QZ 9VByE6OVSn2G4dwxDOf1C6M7qa4Jxxbn4Jhb/cxzRQ7HLPomycZ+D8BoxRWaBqF6koKe TO+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=odzY2H9MOg6XnqWqH3v4/StHWBLH4+8YutE666x3msg=; b=P6XlAu0HD2OHjN3Y3VAxwxnmEiMnQUVEf3N47FDsERQTMbbd0dipWdG45gTGasHhMO Y+Sg6tkSIe5ANePkTaUAQpz0/OIDvZKp90N/GFtJFbz5bk7RHByPl7lpXVN8+JOv0j78 etnDyaoRX1xeox93Oio/Ry/FI1cPXqN0qX2lwh6rF1iqjMXzKF9S+AbRLVk5pCEr9Jah sYGawcFql//gq9eyKbIGZMKygRUgPVquz7gn50UsqLZdDM0Xe5TID7cRdxnsBAA8zt0t 72yaFVI5GF922/qE1gfVf5Ml0qsqWmTpAu1fOdSeXprKPLVPk8vBttycj/x1us2uFmTl 7Krg== X-Gm-Message-State: AGi0PuateK401Rg3s0xsXwAh9j5GBpACirVgRLO25vPR7nw/g7oMkARW YXp4KKVSAoS9LlAb9AmWt6sTSn3v X-Google-Smtp-Source: APiQypK2Ky/H+eIc5LwOXyx4RRMvDDK4iarTk9d/2BK16WbXRSMtPyasziIamHVz7jdpTqAXg4VVmw== X-Received: by 2002:a17:902:ac87:: with SMTP id h7mr5452209plr.119.1587676246175; Thu, 23 Apr 2020 14:10:46 -0700 (PDT) Received: from localhost.localdomain (76-14-109-232.rk.wavecable.com. [76.14.109.232]) by smtp.gmail.com with ESMTPSA id f21sm3563630pfn.71.2020.04.23.14.10.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 14:10:45 -0700 (PDT) From: Rosen Penev To: linux-media@vger.kernel.org Subject: [PATCH 2/5] utils: add noreturn attribute and remove dead code Date: Thu, 23 Apr 2020 14:10:37 -0700 Message-Id: <20200423211040.14275-2-rosenp@gmail.com> X-Mailer: git-send-email 2.25.3 In-Reply-To: <20200423211040.14275-1-rosenp@gmail.com> References: <20200423211040.14275-1-rosenp@gmail.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Found with -Wmissing-noreturn and -Wunreachable-code-return Signed-off-by: Rosen Penev --- utils/v4l2-compliance/v4l2-compliance.cpp | 10 +++++----- utils/v4l2-dbg/v4l2-dbg.cpp | 5 ++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp index b3a18492..a312f54d 100644 --- a/utils/v4l2-compliance/v4l2-compliance.cpp +++ b/utils/v4l2-compliance/v4l2-compliance.cpp @@ -247,7 +247,6 @@ static void usage() printf(" -w, --wrapper Use the libv4l2 wrapper library.\n"); #endif printf(" -W, --exit-on-warn Exit on the first warning.\n"); - exit(0); } const char *ok(int res) @@ -482,6 +481,7 @@ static void restoreState() node->reopen(); } +__attribute__((noreturn)) static void signal_handler_interrupt(int signum) { restoreState(); @@ -1544,7 +1544,7 @@ int main(int argc, char **argv) switch (ch) { case OptHelp: usage(); - return 0; + exit(0); case OptSetDevice: device = make_devname(optarg, "video", media_bus_info); break; @@ -1669,13 +1669,13 @@ int main(int argc, char **argv) fprintf(stderr, "Option `%s' requires a value\n", argv[optind]); usage(); - return 1; + exit(1); case '?': if (argv[optind]) fprintf(stderr, "Unknown argument `%s'\n", argv[optind]); usage(); - return 1; + exit(1); } } if (optind < argc) { @@ -1684,7 +1684,7 @@ int main(int argc, char **argv) fprintf(stderr, "%s ", argv[optind++]); fprintf(stderr, "\n"); usage(); - return 1; + exit(1); } bool direct = !options[OptUseWrapper]; int fd; diff --git a/utils/v4l2-dbg/v4l2-dbg.cpp b/utils/v4l2-dbg/v4l2-dbg.cpp index cd387d1d..99c5a726 100644 --- a/utils/v4l2-dbg/v4l2-dbg.cpp +++ b/utils/v4l2-dbg/v4l2-dbg.cpp @@ -187,7 +187,6 @@ static void usage() " Sets step between two registers\n" " --list-symbols List the symbolic register names you can use, if any\n" " --log-status Log the board status in the kernel log [VIDIOC_LOG_STATUS]\n"); - exit(0); } static std::string cap2s(unsigned cap) @@ -429,7 +428,7 @@ int main(int argc, char **argv) if (argc == 1) { usage(); - return 0; + exit(0); } for (i = 0; long_options[i].name; i++) { if (!isalpha(long_options[i].val)) @@ -467,7 +466,7 @@ int main(int argc, char **argv) switch (ch) { case OptHelp: usage(); - return 0; + exit(0); case OptSetDevice: device = optarg; From patchwork Thu Apr 23 21:10:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 11506581 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0C336112C for ; Thu, 23 Apr 2020 21:10:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E93232084D for ; Thu, 23 Apr 2020 21:10:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hbR451ZI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727125AbgDWVKu (ORCPT ); Thu, 23 Apr 2020 17:10:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727121AbgDWVKs (ORCPT ); Thu, 23 Apr 2020 17:10:48 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10632C09B043 for ; Thu, 23 Apr 2020 14:10:48 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id a32so3004720pje.5 for ; Thu, 23 Apr 2020 14:10:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=zhPgvRrAqicIPz6pRORMT9ANciXinEc+85EuomZ8teM=; b=hbR451ZIcciIcZIIZm1i4aun2XaTNXc4RIsBmDicT2cIbRzdZZsz7WT+jVpOX7S2EI lIgC8l4vga1JO2z37j+AQkUovcSM19gQqzw8gy/30jAzHQOaLqWtnsSPpvbvcIeNH+h9 74rQhOWY2u263fTTOiANpFrjwpSSvhwmL9CNOSo+lEtFGo8gO8fmu7Rm3hRJ+zzwbBVT ayE7sjkvvBerokbrw0Ix/OQbhFLGIbW7s8/Rl0LPjpB14qnUhmemLAN5FJhVyszIhXIU 0YXVziOt455Ri//cMsO5eS0cSO+llhe3ew33UoqmkQZqpDE/WfvhgXt927hXTkft28Mo t2qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zhPgvRrAqicIPz6pRORMT9ANciXinEc+85EuomZ8teM=; b=Ozl4mSFNTc8Ie4H0M7+6p5lYxAso8mCJLYjjNhiALeZsWS3MmPer/9PTlSWEOUt6+v 7wLs4hGcGjolLz6BYKSIHkIHH+rr4VoE+JdhTsiUD0JU/sQU0IgG9dQlBmbiKXxvKyLa q8sMbM3BNKj7AJvg5ZnUmnmRvq2KwgPa/SomGpJGJTW8xeg9+xlrkf2nDOp/CG3QystV xaJ8xEQDUIhcyTX8Tq3lH/287of6/I6CuO0y32GFaBb+LB4EVsFHcCXpAWukL257TzEe EUZoFv4q9iT40wXCHszE5kGXkH+9HOo8Zfk+TUPOTimwZy1tnE6w3JVBP8XYDxp76KIS 5YwA== X-Gm-Message-State: AGi0PuZOyJkkWEvzfuWJyi/GEuq6s1GiIMHLqtLwy3v+rjgAWGF5McEJ L5T4pF53tqRuI+XoxEiNoLmwcrVQ X-Google-Smtp-Source: APiQypJ2TojcKTlrxqWyVPZJQqZzl0cKgfnTO4LSVCN7/1GAjCU5q7Ieo8ZJIkhVO7xrIbKTZvf/MQ== X-Received: by 2002:a17:90a:ca8f:: with SMTP id y15mr2692629pjt.88.1587676247204; Thu, 23 Apr 2020 14:10:47 -0700 (PDT) Received: from localhost.localdomain (76-14-109-232.rk.wavecable.com. [76.14.109.232]) by smtp.gmail.com with ESMTPSA id f21sm3563630pfn.71.2020.04.23.14.10.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 14:10:46 -0700 (PDT) From: Rosen Penev To: linux-media@vger.kernel.org Subject: [PATCH 3/5] utils: fix implicit float conversions Date: Thu, 23 Apr 2020 14:10:38 -0700 Message-Id: <20200423211040.14275-3-rosenp@gmail.com> X-Mailer: git-send-email 2.25.3 In-Reply-To: <20200423211040.14275-1-rosenp@gmail.com> References: <20200423211040.14275-1-rosenp@gmail.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Found with -Wfloat-conversion Signed-off-by: Rosen Penev --- utils/cec-ctl/cec-ctl.cpp | 4 ++-- utils/cec-ctl/cec-pin.cpp | 2 +- utils/v4l2-compliance/v4l2-test-buffers.cpp | 2 +- utils/v4l2-ctl/v4l2-ctl-misc.cpp | 4 ++-- utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 2 +- utils/v4l2-ctl/v4l2-ctl-subdev.cpp | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp index f4133494..ae7b2dba 100644 --- a/utils/cec-ctl/cec-ctl.cpp +++ b/utils/cec-ctl/cec-ctl.cpp @@ -1507,8 +1507,8 @@ static void stress_test_power_cycle(struct node &node, unsigned cnt, srandom(seed); for (;;) { - unsigned usecs1 = mod_usleep ? random() % mod_usleep : sleep_before_on * 1000000; - unsigned usecs2 = mod_usleep ? random() % mod_usleep : sleep_before_off * 1000000; + unsigned usecs1 = mod_usleep ? random() % mod_usleep : static_cast(sleep_before_on * 1000000); + unsigned usecs2 = mod_usleep ? random() % mod_usleep : static_cast(sleep_before_off * 1000000); usecs1 += min_usleep; usecs2 += min_usleep; diff --git a/utils/cec-ctl/cec-pin.cpp b/utils/cec-ctl/cec-pin.cpp index 0322ad5e..c09d6bbd 100644 --- a/utils/cec-ctl/cec-pin.cpp +++ b/utils/cec-ctl/cec-pin.cpp @@ -261,7 +261,7 @@ static void cec_pin_rx_data_bit_was_low(__u64 ev_ts, __u64 usecs, __u64 usecs_mi * If the low drive starts at the end of a 0 bit, then the actual * maximum time that the bus can be low is the two summed. */ - const unsigned max_low_drive = CEC_TIM_LOW_DRIVE_ERROR_MAX + + const unsigned max_low_drive = static_cast(CEC_TIM_LOW_DRIVE_ERROR_MAX) + CEC_TIM_DATA_BIT_0_LOW_MAX + CEC_TIM_MARGIN; low_usecs = usecs; diff --git a/utils/v4l2-compliance/v4l2-test-buffers.cpp b/utils/v4l2-compliance/v4l2-test-buffers.cpp index 93df7034..561a3376 100644 --- a/utils/v4l2-compliance/v4l2-test-buffers.cpp +++ b/utils/v4l2-compliance/v4l2-test-buffers.cpp @@ -2597,7 +2597,7 @@ static void streamFmt(struct node *node, __u32 pixelformat, __u32 w, __u32 h, char hz[32] = ""; if (!frame_count) - frame_count = f ? 1.0 / fract2f(f) : 10; + frame_count = f ? static_cast(1.0f / fract2f(f)) : 10; node->g_fmt(fmt); fmt.s_pixelformat(pixelformat); fmt.s_width(w); diff --git a/utils/v4l2-ctl/v4l2-ctl-misc.cpp b/utils/v4l2-ctl/v4l2-ctl-misc.cpp index cb933217..b038cfe9 100644 --- a/utils/v4l2-ctl/v4l2-ctl-misc.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-misc.cpp @@ -320,7 +320,7 @@ void misc_set(cv4l_fd &_fd) parm.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; parm.parm.capture.timeperframe.numerator = 1000; parm.parm.capture.timeperframe.denominator = - fps * parm.parm.capture.timeperframe.numerator; + static_cast(fps * parm.parm.capture.timeperframe.numerator); if (doioctl(fd, VIDIOC_S_PARM, &parm) == 0) { struct v4l2_fract *tf = &parm.parm.capture.timeperframe; @@ -338,7 +338,7 @@ void misc_set(cv4l_fd &_fd) parm.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; parm.parm.output.timeperframe.numerator = 1000; parm.parm.output.timeperframe.denominator = - output_fps * parm.parm.output.timeperframe.numerator; + static_cast(output_fps * parm.parm.output.timeperframe.numerator); if (doioctl(fd, VIDIOC_S_PARM, &parm) == 0) { struct v4l2_fract *tf = &parm.parm.output.timeperframe; diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp index 066a336a..6981a3cc 100644 --- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp @@ -569,7 +569,7 @@ static void print_concise_buffer(FILE *f, cv4l_buffer &buf, cv4l_fmt &fmt, if (!skip_ts && (buf.g_flags() & V4L2_BUF_FLAG_TIMESTAMP_MASK) != V4L2_BUF_FLAG_TIMESTAMP_COPY) { double ts = buf.g_timestamp().tv_sec + buf.g_timestamp().tv_usec / 1000000.0; fprintf(f, " ts: %.06f", ts); - if (last_ts) + if (last_ts <= 0.0) fprintf(f, " delta: %.03f ms", (ts - last_ts) * 1000.0); last_ts = ts; diff --git a/utils/v4l2-ctl/v4l2-ctl-subdev.cpp b/utils/v4l2-ctl/v4l2-ctl-subdev.cpp index 747f1699..5bd5f57e 100644 --- a/utils/v4l2-ctl/v4l2-ctl-subdev.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-subdev.cpp @@ -487,7 +487,7 @@ void subdev_set(cv4l_fd &_fd) exit(1); } fival.interval.numerator = 1000; - fival.interval.denominator = set_fps * fival.interval.numerator; + fival.interval.denominator = static_cast(set_fps * fival.interval.numerator); printf("Note: --set-subdev-fps is only for testing.\n" "Normally media-ctl is used to configure the video pipeline.\n"); printf("ioctl: VIDIOC_SUBDEV_S_FRAME_INTERVAL (pad=%u)\n", fival.pad); From patchwork Thu Apr 23 21:10:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 11506591 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6C45E92C for ; Thu, 23 Apr 2020 21:11:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 492B720784 for ; Thu, 23 Apr 2020 21:11:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gvzzkJ2X" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727853AbgDWVLE (ORCPT ); Thu, 23 Apr 2020 17:11:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727121AbgDWVKv (ORCPT ); Thu, 23 Apr 2020 17:10:51 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BCD0C09B042 for ; Thu, 23 Apr 2020 14:10:50 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id y6so3007781pjc.4 for ; Thu, 23 Apr 2020 14:10:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=eIyMycrq9mzQHu+Ig70I3epWcxbOkWwUJ7sLbAB9DU0=; b=gvzzkJ2X58i4BgWCuxF3lqbF4G/aiZCtb7Fq6IOLJOSud/p593a9AsLVcRR0d+EpQV JoKujumjh5H/jQxIh7t9k4d2uyEHOTUD4TS+rHo7zrVRjmIAkNCjo4l15cQBcG28g1wy 7Ju1HEdnSrucbpu6afcvWAJROmRiVcH4aapADN+C8lTTiwQwoIlLhgZ5xYJCK3uqtM8/ R0kpOGhEATjHe700HaJHhNwSan/LHJ/5rDhk9VhoznQHdvdvWCykIZMuBUSqyffnBxka d29oIdIMoJspXWnptxLgTIwmQ65a1DQz7I1wtvNUqi8BcA5wXzWcWVOBleegLU6QcjsK UFQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eIyMycrq9mzQHu+Ig70I3epWcxbOkWwUJ7sLbAB9DU0=; b=hLvjUO1RB1eMdrV8bwzgX0NcucmVzWQsSAY2WKtb9ab+7yrVnKUmKXmhm28S59BjH9 5rXVhxJV9kItTHhW63fMCZRc0qhl1Eo1moiFWF3D5/MTZj5eGK7pxwXO67l+J+IAkMJS 7Kqn71TQJjzWUE0Y2mKjj5hoMsMmrZs1hVQZWenz2j/eh9i3WlLg/6cbV8WmjohrJwbL FJ8BVDI6BnHCwBOPEvjgL8aNXeDGbnSXQkByNputWadxFFV5nkLgnD/StNqW7V0tgB+J yGyCoAhaDf6kwe+4XCS97Pd/JZq8hVec6IDOVtMWzn7qPklSZtJWhza8pHv3IQPYHH6U GPdQ== X-Gm-Message-State: AGi0PuY/reNDOm6hb56vRhwO3mmWQMqrER0+q5zlg44DIvwT6y0VrE7q G98ZY4LaVJnO2NUCQKxIMsvbjapo X-Google-Smtp-Source: APiQypInbN4smKZr4pG3KYvPHJfILWRpgKT6GEqyklCuWFPCDBD4rJD6rTanlwpDSK140y0IAvdE2w== X-Received: by 2002:a17:902:ab95:: with SMTP id f21mr5169875plr.188.1587676248785; Thu, 23 Apr 2020 14:10:48 -0700 (PDT) Received: from localhost.localdomain (76-14-109-232.rk.wavecable.com. [76.14.109.232]) by smtp.gmail.com with ESMTPSA id f21sm3563630pfn.71.2020.04.23.14.10.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 14:10:48 -0700 (PDT) From: Rosen Penev To: linux-media@vger.kernel.org Subject: [PATCH 4/5] utils: fix fallthrough warnings Date: Thu, 23 Apr 2020 14:10:39 -0700 Message-Id: <20200423211040.14275-4-rosenp@gmail.com> X-Mailer: git-send-email 2.25.3 In-Reply-To: <20200423211040.14275-1-rosenp@gmail.com> References: <20200423211040.14275-1-rosenp@gmail.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Comments are not enough for clang. Changed to use the C++ attribute. Found with -Wimplicit-fallthrough Signed-off-by: Rosen Penev --- include/compiler.h | 9 +++++++++ utils/cec-compliance/cec-compliance.cpp | 2 ++ utils/cec-ctl/cec-ctl.cpp | 3 ++- utils/cec-follower/cec-follower.cpp | 2 ++ utils/cec-follower/cec-processing.cpp | 4 +++- utils/cec-follower/cec-tuner.cpp | 7 ++++--- utils/libcecutil/cec-log.cpp | 3 ++- utils/v4l2-compliance/v4l2-test-colors.cpp | 12 +++++++----- utils/v4l2-compliance/v4l2-test-controls.cpp | 12 +++++++----- utils/v4l2-compliance/v4l2-test-formats.cpp | 6 ++++-- utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 5 +++-- utils/v4l2-ctl/v4l2-ctl-vbi.cpp | 5 +++-- 12 files changed, 48 insertions(+), 22 deletions(-) create mode 100644 include/compiler.h diff --git a/include/compiler.h b/include/compiler.h new file mode 100644 index 00000000..22fa660b --- /dev/null +++ b/include/compiler.h @@ -0,0 +1,9 @@ +#ifdef __cplusplus + +#ifdef __clang__ +#define fallthrough [[clang::fallthrough]] +#else +#define fallthrough [[gnu::fallthrough]] +#endif + +#endif diff --git a/utils/cec-compliance/cec-compliance.cpp b/utils/cec-compliance/cec-compliance.cpp index 1c62b5c9..99f4e098 100644 --- a/utils/cec-compliance/cec-compliance.cpp +++ b/utils/cec-compliance/cec-compliance.cpp @@ -20,6 +20,7 @@ #include #include "cec-compliance.h" +#include "compiler.h" #ifndef ANDROID #include "version.h" #endif @@ -486,6 +487,7 @@ void sad_decode(struct short_audio_desc *sad, __u32 descriptor) case SAD_EXT_TYPE_MPEG_H_3D_AUDIO: case SAD_EXT_TYPE_AC_4: sad->format_dependent = b3 & 0x07; + fallthrough; case SAD_EXT_TYPE_LPCM_3D_AUDIO: sad->bit_depth_mask = b3 & 0x07; break; diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp index ae7b2dba..1e6d7ed9 100644 --- a/utils/cec-ctl/cec-ctl.cpp +++ b/utils/cec-ctl/cec-ctl.cpp @@ -36,6 +36,7 @@ #endif #include "cec-ctl.h" +#include "compiler.h" static struct timespec start_monotonic; static struct timeval start_timeofday; @@ -1967,7 +1968,7 @@ int main(int argc, char **argv) break; case OptPhysAddrFromEDIDPoll: edid_path = optarg; - /* fall-through */ + fallthrough; case OptPhysAddrFromEDID: phys_addr = parse_phys_addr_from_edid(optarg); break; diff --git a/utils/cec-follower/cec-follower.cpp b/utils/cec-follower/cec-follower.cpp index 1eeae2d4..f4842a99 100644 --- a/utils/cec-follower/cec-follower.cpp +++ b/utils/cec-follower/cec-follower.cpp @@ -19,6 +19,7 @@ #include #include "cec-follower.h" +#include "compiler.h" #ifndef ANDROID #include "version.h" #endif @@ -142,6 +143,7 @@ void sad_encode(const struct short_audio_desc *sad, __u32 *descriptor) case SAD_EXT_TYPE_MPEG_H_3D_AUDIO: case SAD_EXT_TYPE_AC_4: b3 |= sad->format_dependent & 0x07; + fallthrough; case SAD_EXT_TYPE_LPCM_3D_AUDIO: b3 |= sad->bit_depth_mask & 0x07; break; diff --git a/utils/cec-follower/cec-processing.cpp b/utils/cec-follower/cec-processing.cpp index 8e3a33a2..bc8c9c09 100644 --- a/utils/cec-follower/cec-processing.cpp +++ b/utils/cec-follower/cec-processing.cpp @@ -18,6 +18,7 @@ #include #include "cec-follower.h" +#include "compiler.h" #define VOLUME_MAX 0x64 #define VOLUME_MIN 0 @@ -352,7 +353,7 @@ static void processMsg(struct node *node, struct cec_msg &msg, unsigned me) if (cec_has_tv(1 << la) && la_info[la].phys_addr == 0) warn("TV (0) at 0.0.0.0 sent Routing Information."); } - + fallthrough; /* System Information */ @@ -708,6 +709,7 @@ static void processMsg(struct node *node, struct cec_msg &msg, unsigned me) cec_msg_system_audio_mode_status(&msg, node->state.sac_active ? CEC_OP_SYS_AUD_STATUS_ON : CEC_OP_SYS_AUD_STATUS_OFF); transmit(node, &msg); + fallthrough; case CEC_MSG_GIVE_AUDIO_STATUS: if (!cec_has_audiosystem(1 << me)) break; diff --git a/utils/cec-follower/cec-tuner.cpp b/utils/cec-follower/cec-tuner.cpp index aa19f55d..4aecebce 100644 --- a/utils/cec-follower/cec-tuner.cpp +++ b/utils/cec-follower/cec-tuner.cpp @@ -7,6 +7,7 @@ #include #include "cec-follower.h" +#include "compiler.h" #define NUM_ANALOG_FREQS 3 #define NUM_DIGITAL_CHANS 3 @@ -303,21 +304,21 @@ static int digital_get_service_idx(struct cec_op_digital_service_id *digital) switch (digital->dig_bcast_system) { case CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ARIB_T: is_terrestrial = true; - /* fall through */ + fallthrough; case CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ARIB_BS: info = &digital_arib_data[is_terrestrial][0]; offset = is_terrestrial * NUM_DIGITAL_CHANS; break; case CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ATSC_T: is_terrestrial = true; - /* fall through */ + fallthrough; case CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ATSC_SAT: info = &digital_atsc_data[is_terrestrial][0]; offset = (2 + is_terrestrial) * NUM_DIGITAL_CHANS; break; case CEC_OP_DIG_SERVICE_BCAST_SYSTEM_DVB_T: is_terrestrial = true; - /* fall through */ + fallthrough; case CEC_OP_DIG_SERVICE_BCAST_SYSTEM_DVB_S2: info = &digital_dvb_data[is_terrestrial][0]; offset = (4 + is_terrestrial) * NUM_DIGITAL_CHANS; diff --git a/utils/libcecutil/cec-log.cpp b/utils/libcecutil/cec-log.cpp index 28a1ecac..9410c071 100644 --- a/utils/libcecutil/cec-log.cpp +++ b/utils/libcecutil/cec-log.cpp @@ -14,6 +14,7 @@ #include "cec-htng-funcs.h" #include "cec-info.h" #include "cec-log.h" +#include "compiler.h" static const struct cec_arg arg_u8 = { CEC_ARG_TYPE_U8, @@ -44,7 +45,7 @@ static void log_arg(const struct cec_arg *arg, const char *arg_name, __u32 val) return; } } - /* fall through */ + fallthrough; case CEC_ARG_TYPE_U8: if (!strcmp(arg_name, "video-latency") || !strcmp(arg_name, "audio-out-delay")) { diff --git a/utils/v4l2-compliance/v4l2-test-colors.cpp b/utils/v4l2-compliance/v4l2-test-colors.cpp index 887b198b..09d29a3e 100644 --- a/utils/v4l2-compliance/v4l2-test-colors.cpp +++ b/utils/v4l2-compliance/v4l2-test-colors.cpp @@ -28,6 +28,8 @@ #include #include #include + +#include "compiler.h" #include "v4l2-compliance.h" static void setupPlanes(const cv4l_fmt &fmt, __u8 *planes[3]) @@ -328,7 +330,7 @@ static void getColor(const cv4l_fmt &fmt, __u8 * const planes[3], case V4L2_PIX_FMT_RGBA444: case V4L2_PIX_FMT_BGRA444: c.a = (v16 >> 12) / 15.0; - /* fall through */ + fallthrough; case V4L2_PIX_FMT_RGB444: case V4L2_PIX_FMT_XRGB444: case V4L2_PIX_FMT_XBGR444: @@ -345,7 +347,7 @@ static void getColor(const cv4l_fmt &fmt, __u8 * const planes[3], case V4L2_PIX_FMT_ABGR555: case V4L2_PIX_FMT_BGRA555: c.a = v16 >> 15; - /* fall through */ + fallthrough; case V4L2_PIX_FMT_YUV555: case V4L2_PIX_FMT_RGB555: case V4L2_PIX_FMT_XRGB555: @@ -376,7 +378,7 @@ static void getColor(const cv4l_fmt &fmt, __u8 * const planes[3], case V4L2_PIX_FMT_RGBA32: case V4L2_PIX_FMT_BGRA32: c.a = ((v32 >> 24) & 0xff) / 255.0; - /* fall through */ + fallthrough; default: c.r = ((v32 >> 16) & 0xff) / 255.0; c.g = ((v32 >> 8) & 0xff) / 255.0; @@ -444,7 +446,7 @@ static void getColor(const cv4l_fmt &fmt, __u8 * const planes[3], Y = (Y - 16.0 / 255.0) * 255.0 / 219.0; cb *= 255.0 / 224.0; cr *= 255.0 / 224.0; - /* fall through */ + fallthrough; case V4L2_YCBCR_ENC_601: default: ycbcr2rgb(bt601, Y, cb, cr, c); @@ -453,7 +455,7 @@ static void getColor(const cv4l_fmt &fmt, __u8 * const planes[3], Y = (Y - 16.0 / 255.0) * 255.0 / 219.0; cb *= 255.0 / 224.0; cr *= 255.0 / 224.0; - /* fall through */ + fallthrough; case V4L2_YCBCR_ENC_709: ycbcr2rgb(rec709, Y, cb, cr, c); break; diff --git a/utils/v4l2-compliance/v4l2-test-controls.cpp b/utils/v4l2-compliance/v4l2-test-controls.cpp index 4184c4fa..d81dddb2 100644 --- a/utils/v4l2-compliance/v4l2-test-controls.cpp +++ b/utils/v4l2-compliance/v4l2-test-controls.cpp @@ -30,6 +30,8 @@ #include #include #include + +#include "compiler.h" #include "v4l2-compliance.h" #define V4L2_CTRL_CLASS_VIVID 0x00f00000 @@ -61,20 +63,20 @@ static int checkQCtrl(struct node *node, struct test_query_ext_ctrl &qctrl) case V4L2_CTRL_TYPE_BOOLEAN: if (qctrl.maximum > 1) return fail("invalid boolean max value\n"); - /* fall through */ + fallthrough; case V4L2_CTRL_TYPE_MENU: case V4L2_CTRL_TYPE_INTEGER_MENU: if (qctrl.step != 1) return fail("invalid step value %lld\n", qctrl.step); if (qctrl.minimum < 0) return fail("min < 0\n"); - /* fall through */ + fallthrough; case V4L2_CTRL_TYPE_INTEGER: case V4L2_CTRL_TYPE_INTEGER64: if (qctrl.default_value < qctrl.minimum || qctrl.default_value > qctrl.maximum) return fail("def < min || def > max\n"); - /* fall through */ + fallthrough; case V4L2_CTRL_TYPE_STRING: if (qctrl.minimum > qctrl.maximum) return fail("min > max\n"); @@ -116,7 +118,7 @@ static int checkQCtrl(struct node *node, struct test_query_ext_ctrl &qctrl) case V4L2_CTRL_TYPE_BUTTON: if ((fl & rw_mask) != V4L2_CTRL_FLAG_WRITE_ONLY) return fail("button control not write only\n"); - /* fall through */ + fallthrough; case V4L2_CTRL_TYPE_BOOLEAN: case V4L2_CTRL_TYPE_MENU: case V4L2_CTRL_TYPE_INTEGER_MENU: @@ -124,7 +126,7 @@ static int checkQCtrl(struct node *node, struct test_query_ext_ctrl &qctrl) case V4L2_CTRL_TYPE_BITMASK: if (fl & V4L2_CTRL_FLAG_SLIDER) return fail("slider makes only sense for integer controls\n"); - /* fall through */ + fallthrough; case V4L2_CTRL_TYPE_INTEGER64: case V4L2_CTRL_TYPE_INTEGER: if ((fl & rw_mask) == rw_mask) diff --git a/utils/v4l2-compliance/v4l2-test-formats.cpp b/utils/v4l2-compliance/v4l2-test-formats.cpp index 824769b3..4ea97ee7 100644 --- a/utils/v4l2-compliance/v4l2-test-formats.cpp +++ b/utils/v4l2-compliance/v4l2-test-formats.cpp @@ -30,6 +30,8 @@ #include #include #include + +#include "compiler.h" #include "v4l2-compliance.h" static const __u32 buftype2cap[] = { @@ -97,7 +99,7 @@ static int testEnumFrameIntervals(struct node *node, __u32 pixfmt, case V4L2_FRMIVAL_TYPE_CONTINUOUS: if (sw->step.numerator != 1 || sw->step.denominator != 1) return fail("invalid step for continuous frameinterval\n"); - /* fallthrough */ + fallthrough; case V4L2_FRMIVAL_TYPE_STEPWISE: if (frmival.index) return fail("index must be 0 for stepwise/continuous frameintervals\n"); @@ -183,7 +185,7 @@ static int testEnumFrameSizes(struct node *node, __u32 pixfmt) case V4L2_FRMSIZE_TYPE_CONTINUOUS: if (frmsize.stepwise.step_width != 1 || frmsize.stepwise.step_height != 1) return fail("invalid step_width/height for continuous framesize\n"); - /* fallthrough */ + fallthrough; case V4L2_FRMSIZE_TYPE_STEPWISE: if (frmsize.index) return fail("index must be 0 for stepwise/continuous framesizes\n"); diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp index 6981a3cc..a4cdc4bd 100644 --- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp @@ -19,6 +19,7 @@ #include #include +#include "compiler.h" #include "v4l2-ctl.h" #include "v4l-stream.h" #include @@ -763,7 +764,7 @@ void streaming_cmd(int ch, char *optarg) break; case OptStreamUser: memory = V4L2_MEMORY_USERPTR; - /* fall through */ + fallthrough; case OptStreamMmap: if (optarg) { reqbufs_count_cap = strtoul(optarg, 0L, 0); @@ -776,7 +777,7 @@ void streaming_cmd(int ch, char *optarg) break; case OptStreamOutUser: out_memory = V4L2_MEMORY_USERPTR; - /* fall through */ + fallthrough; case OptStreamOutMmap: if (optarg) { reqbufs_count_out = strtoul(optarg, 0L, 0); diff --git a/utils/v4l2-ctl/v4l2-ctl-vbi.cpp b/utils/v4l2-ctl/v4l2-ctl-vbi.cpp index c5960f78..987fae25 100644 --- a/utils/v4l2-ctl/v4l2-ctl-vbi.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-vbi.cpp @@ -14,6 +14,7 @@ #include #include +#include "compiler.h" #include "v4l2-ctl.h" static struct v4l2_format sliced_fmt; /* set_format/get_format for sliced VBI */ @@ -87,7 +88,7 @@ void vbi_cmd(int ch, char *optarg) case OptSetSlicedVbiOutFormat: case OptTrySlicedVbiOutFormat: sliced = &sliced_fmt_out; - /* fall through */ + fallthrough; case OptSetSlicedVbiFormat: case OptTrySlicedVbiFormat: sliced->fmt.sliced.service_set = 0; @@ -130,7 +131,7 @@ void vbi_cmd(int ch, char *optarg) case OptSetVbiOutFormat: case OptTryVbiOutFormat: raw = &raw_fmt_out; - /* fall through */ + fallthrough; case OptSetVbiFormat: case OptTryVbiFormat: subs = optarg; From patchwork Thu Apr 23 21:10:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 11506583 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EB916112C for ; Thu, 23 Apr 2020 21:10:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CF29A208E4 for ; Thu, 23 Apr 2020 21:10:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ap8Wkfne" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727814AbgDWVKz (ORCPT ); Thu, 23 Apr 2020 17:10:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727778AbgDWVKy (ORCPT ); Thu, 23 Apr 2020 17:10:54 -0400 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49DD3C09B042 for ; Thu, 23 Apr 2020 14:10:53 -0700 (PDT) Received: by mail-pf1-x429.google.com with SMTP id z1so1918943pfn.3 for ; Thu, 23 Apr 2020 14:10:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=mao265vqR3DSfNevTKL5tM2C8pyH2zCIE1IOHDhO9sY=; b=ap8WkfneMwYDbwaLUrB+PKEEQhK9MJRCSXn5c/EyFGJwhBgY+kYKFYor50/ae85HgG 6yO4qFFUnW9Xg8M8bNb8Sw4LsYBiKiTNSrZ3MRHQd4AFllASxuHWrxkE8+XMiK3lnbLP 2nC9whcAJyHrKv/OYNdJk4AU6IR+hL7CUga1/pwPTIV6snCeqKKzC8OcnsM1KFRP6u9e h/+G2zT1OcDzXBK+Qm7GuTU+78K91rFNA+ejlC7bVCkodz40h34y5+uRLMipYlaZdr+v +C1cnmlRfDSkRiG+1nzaVWUkEpc+vw2juM279GpQlTV9GHn7Cv3FisYN7CIu5J1bXwlA gJxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mao265vqR3DSfNevTKL5tM2C8pyH2zCIE1IOHDhO9sY=; b=jWkVKYBkizDfygqI03hxBMVfl5nW/gcmG0DPfTrjNwZz454Y9sYAtOHHl7n02FlxBp pdpdXZbOoBMr8Noc3PuHrpHjmHUUN981JjLlLw72cpvGvIPNyRLukfsHV38ApLnmJXd/ 2mklvmVp1VISasCbUMMw7rcz0/4KvXxgwhs1wmnRDi7NYZEj0tEnoihYQ9iJpKx9rI81 j1bx4A0ZQ56XAQecf2y3TMxIVgTMHa8jHT9yDgm0YLsu+bXvmB3r/6RuNRWQUnnDeVVc KdB0Ik1mDc8QhM2/ZQHbx3vE8zQycth5plCA9OkxaPrpkJeBnaS6K8a9NgXq9V2Ta8nV reww== X-Gm-Message-State: AGi0PubxdBGMMfMsW3axrQY/vvjhUV6gYEROO6XPrtGM8nxwsIL+wc6U 6kfRy3yR6/FNsYft5gtVWmgvHRhZ X-Google-Smtp-Source: APiQypKOrUnbtkuXnCCrAOzLyn5KVi6SQYaxF4U0inyJFffxjOv9u6Q055BGVc1ig0xDySWz53XZpQ== X-Received: by 2002:a63:b954:: with SMTP id v20mr5503697pgo.100.1587676252620; Thu, 23 Apr 2020 14:10:52 -0700 (PDT) Received: from localhost.localdomain (76-14-109-232.rk.wavecable.com. [76.14.109.232]) by smtp.gmail.com with ESMTPSA id f21sm3563630pfn.71.2020.04.23.14.10.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 14:10:52 -0700 (PDT) From: Rosen Penev To: linux-media@vger.kernel.org Subject: [PATCH 5/5] utils: fix double promotions Date: Thu, 23 Apr 2020 14:10:40 -0700 Message-Id: <20200423211040.14275-5-rosenp@gmail.com> X-Mailer: git-send-email 2.25.3 In-Reply-To: <20200423211040.14275-1-rosenp@gmail.com> References: <20200423211040.14275-1-rosenp@gmail.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Found with -Wdouble-promotion Signed-off-by: Rosen Penev --- utils/rds-ctl/rds-ctl.cpp | 4 ++-- utils/v4l2-compliance/v4l2-test-buffers.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/rds-ctl/rds-ctl.cpp b/utils/rds-ctl/rds-ctl.cpp index 0e497b2a..558f5d76 100644 --- a/utils/rds-ctl/rds-ctl.cpp +++ b/utils/rds-ctl/rds-ctl.cpp @@ -521,7 +521,7 @@ static void print_rds_statistics(const struct v4l2_rds_statistics *statistics) printf("received blocks / received groups: %u / %u\n", statistics->block_cnt, statistics->group_cnt); - float block_error_percentage = 0; + double block_error_percentage = 0; if (statistics->block_cnt) block_error_percentage = @@ -530,7 +530,7 @@ static void print_rds_statistics(const struct v4l2_rds_statistics *statistics) statistics->block_error_cnt, block_error_percentage, statistics->group_error_cnt); - float block_corrected_percentage = 0; + double block_corrected_percentage = 0; if (statistics->block_cnt) block_corrected_percentage = ( diff --git a/utils/v4l2-compliance/v4l2-test-buffers.cpp b/utils/v4l2-compliance/v4l2-test-buffers.cpp index 561a3376..26947724 100644 --- a/utils/v4l2-compliance/v4l2-test-buffers.cpp +++ b/utils/v4l2-compliance/v4l2-test-buffers.cpp @@ -2597,7 +2597,7 @@ static void streamFmt(struct node *node, __u32 pixelformat, __u32 w, __u32 h, char hz[32] = ""; if (!frame_count) - frame_count = f ? static_cast(1.0f / fract2f(f)) : 10; + frame_count = f ? static_cast(1.0 / fract2f(f)) : 10; node->g_fmt(fmt); fmt.s_pixelformat(pixelformat); fmt.s_width(w);