Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1190836pxb; Wed, 10 Feb 2021 02:19:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJx1iynDp7E6/hvvFzOX1hkVYcwLwsbPkvn40V3ZOhIzeJxuKUVIgjcL4KiWCajEdimhtZ3T X-Received: by 2002:a17:906:ecfb:: with SMTP id qt27mr2198936ejb.123.1612952352931; Wed, 10 Feb 2021 02:19:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612952352; cv=none; d=google.com; s=arc-20160816; b=MbO37gzSAB3CO6mdes+G8eY8FGVlMaGao7fdQ6sNssXV9jTZ//P/n2ISlyVYhZqLAy puzG5rGVZ3WYU9kroOsQ++Hx7SuvNucdzPOz75JX5NKs2zjngRTmNLQvvu62c2z1xvk6 sRVlkXkm7bXtqJm6fxZxF/6QzHhzyiKmIFuiy84B8f5L/dlCzn/YVS3tCUcMzhtrZAcm Ms8ABhNk4cPVnB3c2nzfhnNLU0J1gTzHNw3Ek1Aa2UYgIDdTBH2Fn/QU8PHbeDGBMN/c 10qg7zY3KLAziJj+idVmwvkLfxZcWo6IYVBX7I2bboDLGRdG0jgwCTHGPvnZ8QZeOciX 7sFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=KTeDOgbgKLBZgwS6dDLpW3s/Igwt47e0gZkjxr0+fqk=; b=jwZkNpiYTEcLQwGsX9tNj3x8uLpGZRZkA+deTofwjFA93w6OgC+bKAacx4toEzsfjO RecfMhBJ6G0P3z2JfkG4nJpVjk3cqCdT5lrOwoLGvlEH4kQClNOOPupYJPP0ipPXsEGt P4QVb/Q3RL20InIyggSeo3MGptSLM6vHskV0rivZiNjboFbmtR0bX3YUB4/hOl5CAmsE IYuIDgiSpFy7suLPIlFyUkzb5enfiQA8+W+6neAJZj3ud0G57hEYLKmR27Q8mHDDEK+U 63l+jhSiarLzoi2kFZSPYMJPahTekx6Fdz9ljhKgokPV0vXBAVh1xNOQ83WBRX8DXRff uAHw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=analog.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gs5si1073318ejb.491.2021.02.10.02.18.49; Wed, 10 Feb 2021 02:19:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=analog.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229766AbhBJKQK (ORCPT + 99 others); Wed, 10 Feb 2021 05:16:10 -0500 Received: from mx0a-00128a01.pphosted.com ([148.163.135.77]:65472 "EHLO mx0a-00128a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229666AbhBJKH0 (ORCPT ); Wed, 10 Feb 2021 05:07:26 -0500 Received: from pps.filterd (m0167089.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 11AA3CxZ017518; Wed, 10 Feb 2021 05:06:35 -0500 Received: from nwd2mta3.analog.com ([137.71.173.56]) by mx0a-00128a01.pphosted.com with ESMTP id 36hrw8v4bg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 Feb 2021 05:06:34 -0500 Received: from SCSQMBX10.ad.analog.com (SCSQMBX10.ad.analog.com [10.77.17.5]) by nwd2mta3.analog.com (8.14.7/8.14.7) with ESMTP id 11AA6X3s025938 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 10 Feb 2021 05:06:33 -0500 Received: from SCSQMBX10.ad.analog.com (10.77.17.5) by SCSQMBX10.ad.analog.com (10.77.17.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.721.2; Wed, 10 Feb 2021 02:06:31 -0800 Received: from zeus.spd.analog.com (10.66.68.11) by scsqmbx10.ad.analog.com (10.77.17.5) with Microsoft SMTP Server id 15.2.721.2 via Frontend Transport; Wed, 10 Feb 2021 02:06:31 -0800 Received: from localhost.localdomain ([10.48.65.12]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 11AA5x0M018045; Wed, 10 Feb 2021 05:06:28 -0500 From: Alexandru Ardelean To: , CC: , , , , , , , Alexandru Ardelean Subject: [PATCH v4 16/17] tools: iio: privatize globals and functions in iio_generic_buffer.c file Date: Wed, 10 Feb 2021 12:08:22 +0200 Message-ID: <20210210100823.46780-17-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210210100823.46780-1-alexandru.ardelean@analog.com> References: <20210210100823.46780-1-alexandru.ardelean@analog.com> MIME-Version: 1.0 Content-Type: text/plain X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.737 definitions=2021-02-10_03:2021-02-10,2021-02-10 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 malwarescore=0 spamscore=0 mlxlogscore=946 clxscore=1015 adultscore=0 priorityscore=1501 bulkscore=0 mlxscore=0 phishscore=0 suspectscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102100097 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Mostly a tidy-up. But also helps to understand the limits of scope of these functions and globals. Signed-off-by: Alexandru Ardelean --- tools/iio/iio_generic_buffer.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/tools/iio/iio_generic_buffer.c b/tools/iio/iio_generic_buffer.c index 34d63bcebcd2..7c7240553777 100644 --- a/tools/iio/iio_generic_buffer.c +++ b/tools/iio/iio_generic_buffer.c @@ -49,7 +49,7 @@ enum autochan { * Has the side effect of filling the channels[i].location values used * in processing the buffer output. **/ -int size_from_channelarray(struct iio_channel_info *channels, int num_channels) +static int size_from_channelarray(struct iio_channel_info *channels, int num_channels) { int bytes = 0; int i = 0; @@ -68,7 +68,7 @@ int size_from_channelarray(struct iio_channel_info *channels, int num_channels) return bytes; } -void print1byte(uint8_t input, struct iio_channel_info *info) +static void print1byte(uint8_t input, struct iio_channel_info *info) { /* * Shift before conversion to avoid sign extension @@ -85,7 +85,7 @@ void print1byte(uint8_t input, struct iio_channel_info *info) } } -void print2byte(uint16_t input, struct iio_channel_info *info) +static void print2byte(uint16_t input, struct iio_channel_info *info) { /* First swap if incorrect endian */ if (info->be) @@ -108,7 +108,7 @@ void print2byte(uint16_t input, struct iio_channel_info *info) } } -void print4byte(uint32_t input, struct iio_channel_info *info) +static void print4byte(uint32_t input, struct iio_channel_info *info) { /* First swap if incorrect endian */ if (info->be) @@ -131,7 +131,7 @@ void print4byte(uint32_t input, struct iio_channel_info *info) } } -void print8byte(uint64_t input, struct iio_channel_info *info) +static void print8byte(uint64_t input, struct iio_channel_info *info) { /* First swap if incorrect endian */ if (info->be) @@ -167,9 +167,8 @@ void print8byte(uint64_t input, struct iio_channel_info *info) * to fill the location offsets. * @num_channels: number of channels **/ -void process_scan(char *data, - struct iio_channel_info *channels, - int num_channels) +static void process_scan(char *data, struct iio_channel_info *channels, + int num_channels) { int k; @@ -238,7 +237,7 @@ static int enable_disable_all_channels(char *dev_dir_name, int enable) return 0; } -void print_usage(void) +static void print_usage(void) { fprintf(stderr, "Usage: generic_buffer [options]...\n" "Capture, convert and output data from IIO device buffer\n" @@ -257,12 +256,12 @@ void print_usage(void) " -w Set delay between reads in us (event-less mode)\n"); } -enum autochan autochannels = AUTOCHANNELS_DISABLED; -char *dev_dir_name = NULL; -char *buf_dir_name = NULL; -bool current_trigger_set = false; +static enum autochan autochannels = AUTOCHANNELS_DISABLED; +static char *dev_dir_name = NULL; +static char *buf_dir_name = NULL; +static bool current_trigger_set = false; -void cleanup(void) +static void cleanup(void) { int ret; @@ -294,14 +293,14 @@ void cleanup(void) } } -void sig_handler(int signum) +static void sig_handler(int signum) { fprintf(stderr, "Caught signal %d\n", signum); cleanup(); exit(-signum); } -void register_cleanup(void) +static void register_cleanup(void) { struct sigaction sa = { .sa_handler = sig_handler }; const int signums[] = { SIGINT, SIGTERM, SIGABRT }; -- 2.17.1