From patchwork Tue Nov 12 17:27:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Mailhol X-Patchwork-Id: 13872652 X-Patchwork-Delegate: dsahern@gmail.com Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41AAE2141AD; Tue, 12 Nov 2024 17:28:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731432504; cv=none; b=myhpvTo5idBq5ItWR9lSinqWFVzJrPmmHTWIFaPzwFv5hMx/KlU/2AImPooaqfk2AQbEbzf3SjeYXmab5mk4bIkfxhm8ATYzbW1BxAJxXA1TQKcydZLKSSoyo8Y+2Lt7jqXNfEDzHjnphMsplhFwKXccRisBrVHVZL/Kvj59Thc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731432504; c=relaxed/simple; bh=xbgk5hAoqieohPCSfNFhSlP8wiXGZ1l1vbeJYgtQU6I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sud2cYKN9j/qISLEDz1CCz8cuuAnTxPnlydUds7YoJezOtCOxx6u1PueJJaRJvOq17FBWf29v8NarYSRAoonxemRWlp7SOEz0BLf4S7umQEAVCcyGXX/ubbzTaJTrXNkwZ6Y9wCly0f3bNPpM4tMtVLjwM/76OiH1+q9g6zdznc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-72041ff06a0so4836745b3a.2; Tue, 12 Nov 2024 09:28:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731432502; x=1732037302; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5dn6D2PvAkkjUh/aBGO5vR9KleF05rgJT7heCtBroHA=; b=NEMFV3R7AraiomzguFA8CfvXcLQjTKvbPpr1CVQUcOfSGfAFk11uI+4QTxCsV2MG2K e73i/1IIcQKXIRY4eFK/fE6RpXpxQNO8To7D9e1s4OoViclvbCXNoe+ok+iWxHFMVMJu nwFj3itnlix07J0425UlFtkB5bDupDDVpWwpi4mlASl/XdsPYdup8xsO7hXC1FaFMPd4 npB2QKFMG+jYQYLpaUghqegs/Ry93CBvtcMn2j4zVXvpZ9brooXo99R4xkuW5Rl5jejp x2510u92UjXxXj5eVIhTzNejiSgLlqwZm+YExwbHzr0qETs4Knf5i7nK9MwL/wQUtrlj lK+A== X-Forwarded-Encrypted: i=1; AJvYcCWMg6kpZQyxSOYfYy4XK/Uiv86HZl0snRdnj+80D3vU613rtDR+rDS5Q79416lRU93lQj6wmR4YJmpwuNRN@vger.kernel.org, AJvYcCXow8hr63VBI5WprS3PNA4dpkt3SFj59u1GyU3i6g3H37dJG3oWAT7OpY9gUw6NO33M2rUcqSQEiXU=@vger.kernel.org X-Gm-Message-State: AOJu0YywZR1BCNlKXpxWY2H6jYYlxd/QzJt1s/AndoFx3/x2FHT3uhnt SoBMBrLjwfvaaHdoKcjoGtExzCqiwbgSaC4PpZKSa8Pcscsgo+0QQLDXAiEL X-Google-Smtp-Source: AGHT+IFSNsjE/iTfFwkGzc2xjx4LVmXz4eNCEmZ61WTfvXpPt6p/no7XzV4AWwvmr4PomUrYufaubg== X-Received: by 2002:a05:6a00:3d56:b0:71e:410:4764 with SMTP id d2e1a72fcca58-7241329bb4cmr24364304b3a.8.1731432502126; Tue, 12 Nov 2024 09:28:22 -0800 (PST) Received: from localhost.localdomain (124x33x176x97.ap124.ftth.ucom.ne.jp. [124.33.176.97]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72407864f78sm11481439b3a.33.2024.11.12.09.28.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2024 09:28:21 -0800 (PST) From: Vincent Mailhol To: netdev@vger.kernel.org, Stephen Hemminger , David Ahern , linux-can@vger.kernel.org, Marc Kleine-Budde , Oliver Hartkopp Cc: Robert Nawrath , linux-kernel@vger.kernel.org, Vincent Mailhol Subject: [PATCH iproute2-next v1 1/6] iplink_can: remove unused FILE *f parameter in three functions Date: Wed, 13 Nov 2024 02:27:51 +0900 Message-ID: <20241112172812.590665-9-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241112172812.590665-8-mailhol.vincent@wanadoo.fr> References: <20241112172812.590665-8-mailhol.vincent@wanadoo.fr> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2361; i=mailhol.vincent@wanadoo.fr; h=from:subject; bh=xbgk5hAoqieohPCSfNFhSlP8wiXGZ1l1vbeJYgtQU6I=; b=owGbwMvMwCV2McXO4Xp97WbG02pJDOnGE3RObqroWpB8kSmcL5ex9J8l62a3lEsb0ufZPq0y8 r+/+YhWRykLgxgXg6yYIsuyck5uhY5C77BDfy1h5rAygQxh4OIUgInE9DAyTNjseGdhnN28ybuO P25bKTVNtGXe75vCfsyqjQ9Cld5Ous3IcG25YoONMyuDH7P+P4XGYy0LmhL9trnfCX3y83f4/Fo BPgA= X-Developer-Key: i=mailhol.vincent@wanadoo.fr; a=openpgp; fpr=ED8F700574E67F20E574E8E2AB5FEB886DBB99C2 X-Patchwork-Delegate: dsahern@gmail.com FILE *f, the first parameter of below functions: * can_print_tdc_opt() * can_print_tdc_const_opt() * void can_print_ctrlmode_ext() is unused. Remove it. Signed-off-by: Vincent Mailhol --- ip/iplink_can.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ip/iplink_can.c b/ip/iplink_can.c index f2967db5..01d977fa 100644 --- a/ip/iplink_can.c +++ b/ip/iplink_can.c @@ -337,7 +337,7 @@ can_print_timing_min_max(const char *json_attr, const char *fp_attr, close_json_object(); } -static void can_print_tdc_opt(FILE *f, struct rtattr *tdc_attr) +static void can_print_tdc_opt(struct rtattr *tdc_attr) { struct rtattr *tb[IFLA_CAN_TDC_MAX + 1]; @@ -365,7 +365,7 @@ static void can_print_tdc_opt(FILE *f, struct rtattr *tdc_attr) } } -static void can_print_tdc_const_opt(FILE *f, struct rtattr *tdc_attr) +static void can_print_tdc_const_opt(struct rtattr *tdc_attr) { struct rtattr *tb[IFLA_CAN_TDC_MAX + 1]; @@ -393,7 +393,7 @@ static void can_print_tdc_const_opt(FILE *f, struct rtattr *tdc_attr) close_json_object(); } -static void can_print_ctrlmode_ext(FILE *f, struct rtattr *ctrlmode_ext_attr, +static void can_print_ctrlmode_ext(struct rtattr *ctrlmode_ext_attr, __u32 cm_flags) { struct rtattr *tb[IFLA_CAN_CTRLMODE_MAX + 1]; @@ -417,7 +417,7 @@ static void can_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) print_ctrlmode(PRINT_ANY, cm->flags, "ctrlmode"); if (tb[IFLA_CAN_CTRLMODE_EXT]) - can_print_ctrlmode_ext(f, tb[IFLA_CAN_CTRLMODE_EXT], + can_print_ctrlmode_ext(tb[IFLA_CAN_CTRLMODE_EXT], cm->flags); } @@ -542,7 +542,7 @@ static void can_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) print_uint(PRINT_ANY, "brp", " dbrp %u", dbt->brp); if (tb[IFLA_CAN_TDC]) - can_print_tdc_opt(f, tb[IFLA_CAN_TDC]); + can_print_tdc_opt(tb[IFLA_CAN_TDC]); close_json_object(); } @@ -566,7 +566,7 @@ static void can_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) print_uint(PRINT_ANY, "brp_inc", " dbrp_inc %u", dbtc->brp_inc); if (tb[IFLA_CAN_TDC]) - can_print_tdc_const_opt(f, tb[IFLA_CAN_TDC]); + can_print_tdc_const_opt(tb[IFLA_CAN_TDC]); close_json_object(); } From patchwork Tue Nov 12 17:27:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Mailhol X-Patchwork-Id: 13872653 X-Patchwork-Delegate: dsahern@gmail.com Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2EDB21500F; Tue, 12 Nov 2024 17:28:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731432507; cv=none; b=XLMyaAlySepdSNWZBDphnN0t3kGH7N2h2ldG1zN/JqinO7qL9079wsCxILsQFTwaG8h2N1bFVrM/vBJixlfxH7H0BhoM130PdJMbdqc5NAjQaChWPvPi5MlgV5Iy961rj64AKsS2Jthi/DVDCD6/jRxcGHztTeYZIelLkNA6ffc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731432507; c=relaxed/simple; bh=p2ZJs9LEo4UC1JUgCX9uDAJ3fbxuZzju2aIA1KDx55g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=h35X4quCkOflhP8FiZMfxWWN6jZZojS8J6d2Up8m93AhUWGBK2EY/wmlEN+ysSkjLw8oxFROpIYXJYjOpuKELcjuT8zOdU7CwrE/8LV5aNDPYDepoFnGtSyHXkTosvFPbchgTgT9Xdh9yqdweaduGxC+oSSqxFKLflykeSOktGw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.215.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-7ee11ff7210so4448788a12.1; Tue, 12 Nov 2024 09:28:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731432505; x=1732037305; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kHzuB2QQz9MeIpBdKnCySArAOpMo77+xEhghKdzSO1Y=; b=PCqVCZ/LIfKm7ox0hHj93myUpiELP26xcgByqbHB33hfqPVzTyRYsFMvZ3rnb7uBBi bc1+okII7lHxBWHkbG+RtltlvpFEyq++h9p2cxshryWDWdFWTydnJOOR6O7sXXivnIoo ynLSPQ9UILBzrXdKYN1tfZbjisL5kcFmDcbtam/WjmqyLH5w5bOWzL5LhY4sHta2+5l6 BwILuyKlRbqj9TTQPAQHedaOAAJb26DDPYe02lclgFj/82wzCfK6s2t4m3Mv0yJGcDzz 2sZtJTuUjSW3/OnjMmh17PcJ4/n+am1zIkfNrwJnkNW42UIzs8ZG0HbYZeSqyBBkQwPv no1g== X-Forwarded-Encrypted: i=1; AJvYcCUSTDRYbw8FU/ZYL1U57T43Ce3bgjJ4ruXlgbqUtJgpvEmydrZuGuPgHnCQYTUmwrSIaN8bZofhHQrW7g9Q@vger.kernel.org, AJvYcCWtVzxSSpAo2xWmltQjkvDnEkmpvCH+NzzMoypwrnONcdcAeNG/9BESJmvp5bIZvbUiL84yj/Hy4e4=@vger.kernel.org X-Gm-Message-State: AOJu0YwOIc29ae7Y/Sh3a5x/q7UVpSsZlHi4iEbjrgV+B5QA8gB4pBGb CiXc6mf7g0/JBq3tagAiH5o0cve5xrF2Ulq9dN6QIB6Fkha5C8S2IPwavMdS X-Google-Smtp-Source: AGHT+IGnvo5ho6OokHcy0r/KhEHzroMBM2h/2L08BzuMHZPPpP37gXPXQn52T02MeQ/6LbQ682LMVA== X-Received: by 2002:a05:6a20:7492:b0:1d9:a62a:b8d4 with SMTP id adf61e73a8af0-1dc22a60b8amr26843388637.27.1731432504688; Tue, 12 Nov 2024 09:28:24 -0800 (PST) Received: from localhost.localdomain (124x33x176x97.ap124.ftth.ucom.ne.jp. [124.33.176.97]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72407864f78sm11481439b3a.33.2024.11.12.09.28.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2024 09:28:24 -0800 (PST) From: Vincent Mailhol To: netdev@vger.kernel.org, Stephen Hemminger , David Ahern , linux-can@vger.kernel.org, Marc Kleine-Budde , Oliver Hartkopp Cc: Robert Nawrath , linux-kernel@vger.kernel.org, Vincent Mailhol Subject: [PATCH iproute2-next v1 2/6] iplink_can: reduce the visibility of tdc in can_parse_opt() Date: Wed, 13 Nov 2024 02:27:52 +0900 Message-ID: <20241112172812.590665-10-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241112172812.590665-8-mailhol.vincent@wanadoo.fr> References: <20241112172812.590665-8-mailhol.vincent@wanadoo.fr> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1113; i=mailhol.vincent@wanadoo.fr; h=from:subject; bh=p2ZJs9LEo4UC1JUgCX9uDAJ3fbxuZzju2aIA1KDx55g=; b=owGbwMvMwCV2McXO4Xp97WbG02pJDOnGE3SyeL73ivssrD45W6Th7I5dCeZrp2mcKnER1Eh83 rH+3BXFjlIWBjEuBlkxRZZl5ZzcCh2F3mGH/lrCzGFlAhnCwMUpABO5s5+R4dSZP1McHaebBzub X72+drYnUzyrqsSL67u3N3jXXlyiJcfwzyJm/oovIV0PD/QIsomK7P10/UWrtb/cFkU73tWf34c wcwIA X-Developer-Key: i=mailhol.vincent@wanadoo.fr; a=openpgp; fpr=ED8F700574E67F20E574E8E2AB5FEB886DBB99C2 X-Patchwork-Delegate: dsahern@gmail.com tdc is only used in a single if block. Move its declaration to the top of the compound statement where it is used. Signed-off-by: Vincent Mailhol --- ip/iplink_can.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ip/iplink_can.c b/ip/iplink_can.c index 01d977fa..3414d6c3 100644 --- a/ip/iplink_can.c +++ b/ip/iplink_can.c @@ -128,7 +128,6 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv, { struct can_bittiming bt = {}, dbt = {}; struct can_ctrlmode cm = { 0 }; - struct rtattr *tdc; __u32 tdcv = -1, tdco = -1, tdcf = -1; while (argc > 0) { @@ -298,7 +297,9 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv, addattr_l(n, 1024, IFLA_CAN_CTRLMODE, &cm, sizeof(cm)); if (tdcv != -1 || tdco != -1 || tdcf != -1) { - tdc = addattr_nest(n, 1024, IFLA_CAN_TDC | NLA_F_NESTED); + struct rtattr *tdc = addattr_nest(n, 1024, + IFLA_CAN_TDC | NLA_F_NESTED); + if (tdcv != -1) addattr32(n, 1024, IFLA_CAN_TDC_TDCV, tdcv); if (tdco != -1) From patchwork Tue Nov 12 17:27:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Mailhol X-Patchwork-Id: 13872654 X-Patchwork-Delegate: dsahern@gmail.com Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E163215C5A; Tue, 12 Nov 2024 17:28:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731432510; cv=none; b=HMOpeKwSO7nCXOrUlfy/x8OcOsnGpj2sQs9JrGNGy6lb2E28dG8ZDxD//6v05aEeZrjs7OHhzJfEdytml5BTk31WwZawFlsOrXR2z+QLzqQ9Bgl7T6CTONsrwKoqGvNUyUomgMRpEnIP6VbIk9N2z5HhbaLuta5ULSpldW/oxpg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731432510; c=relaxed/simple; bh=NxGx5LvNaB+W1MatwU+Reu1ZyoVRJisImSs03EU7MXI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=flJ7xnOoc58MD4Ty4c6xgjfAeNWq5WFztsKIbgQCeDPWXMcJ9HfBBYQKkaE/1HhuEepdsuaeImTBZFJunQ8r4Puze0p8e4YIOM5MqFWFfFS0DvYXI0QrETn6PlLhUBAHq/TCojYxri6T6/r/Gqk4Ju2buH0wMUuwUGHEG6lGXMc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-72041ff06a0so4836824b3a.2; Tue, 12 Nov 2024 09:28:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731432507; x=1732037307; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=s8KoOpwkyhRS3PqVqIRjg2hxzpyfF+mN3WNLkLLDJ/8=; b=L8leaynAHWCSVrHCV1Oz86mAoWHoHRYDvzN7++6CGL8wdX15EpSYUUoBeo8qX2YfIA JCjJw/naWqWeYBum5UeXMMU66gvmqB2BarybTVgV68S7lHonVXGi8o35rbYBD25X7omx B4qtEftyp5ueDj/e8lOEmL4/uhW+OfTGYybTxefhryh2HtnrX8tZbLe3wiUYFNDEBfJw TGMDHBF3FnKS2sx2NKd8HRc/oKvcJ0P6QyqOBjiM1eWWO8E5B5sNrYYSgGlaJ/jk/seq k8EpjpfzRwyY4jBL7Jayz9vN8PrqmVK1OiTDXJTFiE6jLzhx5+53zwbV7uHYhowKUMK6 xCIA== X-Forwarded-Encrypted: i=1; AJvYcCX62QztVYMp2R1AjJuMcPRWEhTY3mF5BnDEHbTCpS8Uj4BEpOMHUjIw45qKCWVi4OGEmVsdatt2nbQ=@vger.kernel.org, AJvYcCXHnzqoUACY2enxM+K3w5E4lTghRs869jZ/HuwyYLeZu+3Bzs4uLtcOtQ14wKLyRDLsqG9BQSC7Dt6t4dtH@vger.kernel.org X-Gm-Message-State: AOJu0Yw97STGRKy5LkehQp2VSjNz1lVxLcCVigvxmLBMjVsglhT53JS+ K41TItZ3xYPr9zrAWRnYvf83BzMIGgwM2pVLOE0m5YO7U+OUx0vOScTXagcC X-Google-Smtp-Source: AGHT+IFmQVmWnEvel4LsYHGUNSnQ/WgSxfj3tIuYyobWcVyRdNqd+nzUtfDFoEvK5VEo6wP0CfJnlQ== X-Received: by 2002:a05:6a00:139f:b0:71e:b1dc:f255 with SMTP id d2e1a72fcca58-7241329a391mr23153863b3a.9.1731432507276; Tue, 12 Nov 2024 09:28:27 -0800 (PST) Received: from localhost.localdomain (124x33x176x97.ap124.ftth.ucom.ne.jp. [124.33.176.97]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72407864f78sm11481439b3a.33.2024.11.12.09.28.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2024 09:28:26 -0800 (PST) From: Vincent Mailhol To: netdev@vger.kernel.org, Stephen Hemminger , David Ahern , linux-can@vger.kernel.org, Marc Kleine-Budde , Oliver Hartkopp Cc: Robert Nawrath , linux-kernel@vger.kernel.org, Vincent Mailhol Subject: [PATCH iproute2-next v1 3/6] iplink_can: remove newline at the end of invarg()'s messages Date: Wed, 13 Nov 2024 02:27:53 +0900 Message-ID: <20241112172812.590665-11-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241112172812.590665-8-mailhol.vincent@wanadoo.fr> References: <20241112172812.590665-8-mailhol.vincent@wanadoo.fr> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5013; i=mailhol.vincent@wanadoo.fr; h=from:subject; bh=NxGx5LvNaB+W1MatwU+Reu1ZyoVRJisImSs03EU7MXI=; b=owGbwMvMwCV2McXO4Xp97WbG02pJDOnGE3Ta8yYkLbwp7j/z3A/zLU+2u4dPytyhuXPZX/eoc /s+fmbK6ShhYRDjYpAVU2RZVs7JrdBR6B126K8lzBxWJpAhDFycAjCRDSYM/x2bkzgMxUPXPd0v M1vX+4/tuYd8GnqH7wX3chy5WCS8/CjDZ7acxDkX52nPUXR5l/5Rhb3iaWJUSKp7VuexmE98162 ZAA== X-Developer-Key: i=mailhol.vincent@wanadoo.fr; a=openpgp; fpr=ED8F700574E67F20E574E8E2AB5FEB886DBB99C2 X-Patchwork-Delegate: dsahern@gmail.com invarg() already prints a new line by default. Adding an explicit "\n" at the end of the message results in two lines being printed. Remove all newlines at the end of the invarg() messages. Signed-off-by: Vincent Mailhol --- ip/iplink_can.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/ip/iplink_can.c b/ip/iplink_can.c index 3414d6c3..6c6fcf61 100644 --- a/ip/iplink_can.c +++ b/ip/iplink_can.c @@ -134,78 +134,78 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv, if (matches(*argv, "bitrate") == 0) { NEXT_ARG(); if (get_u32(&bt.bitrate, *argv, 0)) - invarg("invalid \"bitrate\" value\n", *argv); + invarg("invalid \"bitrate\" value", *argv); } else if (matches(*argv, "sample-point") == 0) { float sp; NEXT_ARG(); if (get_float(&sp, *argv)) - invarg("invalid \"sample-point\" value\n", + invarg("invalid \"sample-point\" value", *argv); bt.sample_point = (__u32)(sp * 1000); } else if (matches(*argv, "tq") == 0) { NEXT_ARG(); if (get_u32(&bt.tq, *argv, 0)) - invarg("invalid \"tq\" value\n", *argv); + invarg("invalid \"tq\" value", *argv); } else if (matches(*argv, "prop-seg") == 0) { NEXT_ARG(); if (get_u32(&bt.prop_seg, *argv, 0)) - invarg("invalid \"prop-seg\" value\n", *argv); + invarg("invalid \"prop-seg\" value", *argv); } else if (matches(*argv, "phase-seg1") == 0) { NEXT_ARG(); if (get_u32(&bt.phase_seg1, *argv, 0)) - invarg("invalid \"phase-seg1\" value\n", *argv); + invarg("invalid \"phase-seg1\" value", *argv); } else if (matches(*argv, "phase-seg2") == 0) { NEXT_ARG(); if (get_u32(&bt.phase_seg2, *argv, 0)) - invarg("invalid \"phase-seg2\" value\n", *argv); + invarg("invalid \"phase-seg2\" value", *argv); } else if (matches(*argv, "sjw") == 0) { NEXT_ARG(); if (get_u32(&bt.sjw, *argv, 0)) - invarg("invalid \"sjw\" value\n", *argv); + invarg("invalid \"sjw\" value", *argv); } else if (matches(*argv, "dbitrate") == 0) { NEXT_ARG(); if (get_u32(&dbt.bitrate, *argv, 0)) - invarg("invalid \"dbitrate\" value\n", *argv); + invarg("invalid \"dbitrate\" value", *argv); } else if (matches(*argv, "dsample-point") == 0) { float sp; NEXT_ARG(); if (get_float(&sp, *argv)) - invarg("invalid \"dsample-point\" value\n", *argv); + invarg("invalid \"dsample-point\" value", *argv); dbt.sample_point = (__u32)(sp * 1000); } else if (matches(*argv, "dtq") == 0) { NEXT_ARG(); if (get_u32(&dbt.tq, *argv, 0)) - invarg("invalid \"dtq\" value\n", *argv); + invarg("invalid \"dtq\" value", *argv); } else if (matches(*argv, "dprop-seg") == 0) { NEXT_ARG(); if (get_u32(&dbt.prop_seg, *argv, 0)) - invarg("invalid \"dprop-seg\" value\n", *argv); + invarg("invalid \"dprop-seg\" value", *argv); } else if (matches(*argv, "dphase-seg1") == 0) { NEXT_ARG(); if (get_u32(&dbt.phase_seg1, *argv, 0)) - invarg("invalid \"dphase-seg1\" value\n", *argv); + invarg("invalid \"dphase-seg1\" value", *argv); } else if (matches(*argv, "dphase-seg2") == 0) { NEXT_ARG(); if (get_u32(&dbt.phase_seg2, *argv, 0)) - invarg("invalid \"dphase-seg2\" value\n", *argv); + invarg("invalid \"dphase-seg2\" value", *argv); } else if (matches(*argv, "dsjw") == 0) { NEXT_ARG(); if (get_u32(&dbt.sjw, *argv, 0)) - invarg("invalid \"dsjw\" value\n", *argv); + invarg("invalid \"dsjw\" value", *argv); } else if (matches(*argv, "tdcv") == 0) { NEXT_ARG(); if (get_u32(&tdcv, *argv, 0)) - invarg("invalid \"tdcv\" value\n", *argv); + invarg("invalid \"tdcv\" value", *argv); } else if (matches(*argv, "tdco") == 0) { NEXT_ARG(); if (get_u32(&tdco, *argv, 0)) - invarg("invalid \"tdco\" value\n", *argv); + invarg("invalid \"tdco\" value", *argv); } else if (matches(*argv, "tdcf") == 0) { NEXT_ARG(); if (get_u32(&tdcf, *argv, 0)) - invarg("invalid \"tdcf\" value\n", *argv); + invarg("invalid \"tdcf\" value", *argv); } else if (matches(*argv, "loopback") == 0) { NEXT_ARG(); set_ctrlmode("loopback", *argv, &cm, @@ -268,14 +268,14 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv, NEXT_ARG(); if (get_u32(&val, *argv, 0)) - invarg("invalid \"restart-ms\" value\n", *argv); + invarg("invalid \"restart-ms\" value", *argv); addattr32(n, 1024, IFLA_CAN_RESTART_MS, val); } else if (matches(*argv, "termination") == 0) { __u16 val; NEXT_ARG(); if (get_u16(&val, *argv, 0)) - invarg("invalid \"termination\" value\n", + invarg("invalid \"termination\" value", *argv); addattr16(n, 1024, IFLA_CAN_TERMINATION, val); } else if (matches(*argv, "help") == 0) { From patchwork Tue Nov 12 17:27:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Mailhol X-Patchwork-Id: 13872655 X-Patchwork-Delegate: dsahern@gmail.com Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D84D3216A21; Tue, 12 Nov 2024 17:28:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731432512; cv=none; b=HNIBqj0dHuljXpWlg/9tbjoWMIK1WhCY01fHoFxHa2vO116u5YiJZxoVcWtWB1IRkOOnJG//v9Vu7f6ChMj7on7ClWcGbDkF+ZDSFF79V3GFRcz110jjsuysdGBkMlPmFD/KKl95Hul7Ye1qgezxP1eo1/DooQSq8/GI4K1CEYg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731432512; c=relaxed/simple; bh=VRj8ayRFTUjZHnQUKvEZevbO2uAVhkR+BhHZIaXxWGc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cfyH6R7bqyAeq4tHn3Tp4fmYZHZqpn3qi6P6ha1Lx0d+fRRM/waDCpNXC7TeIZdeSUyeLp1LmrGB/72Mf5gIEZ4+VSmde5kUa26HIEzQ32lQkNVtxm5M0rskV8gbzdMi7KenuSjU3FY6/ox5rx4vKjJnqlvFfpIIjT7keFePhDA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-7240fa50694so4575259b3a.1; Tue, 12 Nov 2024 09:28:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731432510; x=1732037310; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XC8D1Pz8tMytQDN68Bru7WV7nL9afanIdOXjzLOpnm0=; b=VZlyFclUOYRRxikf2lGqgPlawNmzjqxJRXUpVWenqGq3zN7ub8R5nDNjiTo1ORNtrA Qi+WFUrcwCVxuf8gUW9DJ/Njc331jnI5ANmpqSLMN+fxwTP6vCryy05KVaFEXDxGVuWK XOY53mY8b3T+HYdOxc651BcGGvaoxl9MximmXNheYKXlhNTdeUn6Khsku71W32wkRKMT D9rm4DqJHk4cafAZ1ZNu2r45+0O79fXDNe1EecWva1qsKSoAd5v4RJH2mCY7uuUNouy5 W62T0l5O4xECQDfgxYIiMM0g770rS5q2P/caGCtmKO4ml2VLiUGXdlhumgtHAHyJCroK Jtbg== X-Forwarded-Encrypted: i=1; AJvYcCV61MhrUXkdSq58BGM22tWKr2X2PMtnLZHGsmploXrXxhyvIO5iAXRNJ2cqzzpi8HFRuXFG2tqpvUA=@vger.kernel.org, AJvYcCVKtC+Y7lCoq9o7hxtXly12sa9L05bRcd0dpu9bNcxoxHDoPfN9pGVsW0l1+KcT2szNnCuI1+3xRgQEFv3f@vger.kernel.org X-Gm-Message-State: AOJu0YxCInzBkms6prMGORFRhZfXLsZ4P6qQXxLtxARusNn9ZHGCJkow ssm+KWBi/COCymwyQGMh0w0uwdnik7xUJ9MR+ra89YGTT/C/GEmD0g0E9uqy X-Google-Smtp-Source: AGHT+IG6fIF2mOiBWqz0HhnMM5UtyJ15ZpNQPcWVg8qCiW/FxVaJ2W22x6AKPTqspZM7rBl4VgEqwg== X-Received: by 2002:a05:6a00:1399:b0:71e:6743:7599 with SMTP id d2e1a72fcca58-7241329f565mr23747475b3a.7.1731432509872; Tue, 12 Nov 2024 09:28:29 -0800 (PST) Received: from localhost.localdomain (124x33x176x97.ap124.ftth.ucom.ne.jp. [124.33.176.97]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72407864f78sm11481439b3a.33.2024.11.12.09.28.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2024 09:28:29 -0800 (PST) From: Vincent Mailhol To: netdev@vger.kernel.org, Stephen Hemminger , David Ahern , linux-can@vger.kernel.org, Marc Kleine-Budde , Oliver Hartkopp Cc: Robert Nawrath , linux-kernel@vger.kernel.org, Vincent Mailhol Subject: [PATCH iproute2-next v1 4/6] iplink_can: use invarg() instead of fprintf() Date: Wed, 13 Nov 2024 02:27:54 +0900 Message-ID: <20241112172812.590665-12-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241112172812.590665-8-mailhol.vincent@wanadoo.fr> References: <20241112172812.590665-8-mailhol.vincent@wanadoo.fr> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=934; i=mailhol.vincent@wanadoo.fr; h=from:subject; bh=VRj8ayRFTUjZHnQUKvEZevbO2uAVhkR+BhHZIaXxWGc=; b=owGbwMvMwCV2McXO4Xp97WbG02pJDOnGE3QvT2kqenx7/nGVjjnxlt/kzV18tEs1G9inKc/6O e323Z8BHaUsDGJcDLJiiizLyjm5FToKvcMO/bWEmcPKBDKEgYtTACay1I/hv1OM4Lyw213zSv7Z VRxvs436uPJmKOttH3Wb4I1Rd5wVhBkZHmioyfxKb+q/fGV3kPiazpOlJ2+7//5Vo+72g+0dn/V HPgA= X-Developer-Key: i=mailhol.vincent@wanadoo.fr; a=openpgp; fpr=ED8F700574E67F20E574E8E2AB5FEB886DBB99C2 X-Patchwork-Delegate: dsahern@gmail.com invarg() is specifically designed to print error messages when an invalid argument is provided. Replace the generic fprintf() by invarg() in can_parse_opt(). Signed-off-by: Vincent Mailhol --- ip/iplink_can.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ip/iplink_can.c b/ip/iplink_can.c index 6c6fcf61..928d5d79 100644 --- a/ip/iplink_can.c +++ b/ip/iplink_can.c @@ -254,10 +254,8 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv, cm.mask |= CAN_CTRLMODE_TDC_AUTO | CAN_CTRLMODE_TDC_MANUAL; } else { - fprintf(stderr, - "Error: argument of \"tdc-mode\" must be \"auto\", \"manual\" or \"off\", not \"%s\"\n", + invarg("\"tdc-mode\" must be either of \"auto\", \"manual\" or \"off\"", *argv); - exit (-1); } } else if (matches(*argv, "restart") == 0) { __u32 val = 1; From patchwork Tue Nov 12 17:27:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Mailhol X-Patchwork-Id: 13872656 X-Patchwork-Delegate: dsahern@gmail.com Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8557E21764E; Tue, 12 Nov 2024 17:28:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731432514; cv=none; b=aovoQN/8nF8f5apx2CKFXg3S8mPOhbPfncIAhm6D9qucB/smBZhqXAdKDcjyzYPyzANMLzwo1W9dyK3ACCzGMS1fFCGdp5jsuwbd4QzIK6GRwbzEJSKKy/BQsUau4DDZolIR6clK/byIuSX65hGrrngYbGD75msdnVCEgrgS1Yk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731432514; c=relaxed/simple; bh=l+6NUzOXYhXtEryxl5pt51gE9c/WX6SBeH0CzzxTXNU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LFQsofPZFsf5eciRMXG7qIZI48vbE8xjbnATHJ1SHGZgphKOhwULWpxcV61tlUebJ5Ay+roIs/XZGROs77i0JIA5qT60C4y+ImYvBJJCf7La4byUevS8mwk5ptYf332wM/1tRau0HlsgaHifshVNbMfqVJxp3p72bowvvuzVu50= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-71e625b00bcso4852266b3a.3; Tue, 12 Nov 2024 09:28:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731432512; x=1732037312; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=i+lY6YW9eHHlxzUfS6J7/cug/odMVhqea2GaG9YKUyA=; b=cdmLoXho1irdUwN0izN2xzJhfpaC2OnywVLqZ7A5c/yczxg09LIn9i4dgGT1HVX8vQ 6hdyU4IvzYGA0kdhrzmxe60/j3Th2EnsH8rrMmoCpS3Z/Nomc0PvDd11FHVDxYfRKmml +g8I6e7L8z22mghfiFN0L9NluUJ/FNOn8/XPcH1p4E8QJsGx9frKLSsgd6CxQXJ9Gao6 3KAcF1vhcr8U5QdN7a9czApMUiD/BEJmjWiFdOTts2xleTvz/ZfBjuRg/pKzLWug5jYv sCo/6Zup7NR1kG26A1iQQsMoX0dWbwoe2ZwAnzYE7Q10wQwJLf8iDHeeWf1P6QL8uzF3 UUgQ== X-Forwarded-Encrypted: i=1; AJvYcCUboy/cYaJXJZ+/K9wQTboY6QtIQ21+6D3CC04BBAexFhsy1EykGlVBSlahOnfbZAm8B3qx0pShhJE=@vger.kernel.org, AJvYcCW/vXA5z9udUKzq8W2/+Vmy+M3BtSyYPgpasnsx91PC6szXMSEh8iVJ3z3Un1ok3w5N15m+b2Fd8I7/cR80@vger.kernel.org X-Gm-Message-State: AOJu0Yx7JTvQPe4MyiCyrL1xlUnUKxKrMlgOUG5VP2ZipKAfQ5gDTvx1 l3iTzJlqy2VZQTveQDdfmpx/oSK/YhXtQKLS4o0zp6Kz0/rKqnkVx35HAfDo X-Google-Smtp-Source: AGHT+IEoaGNUn7E6rHbBCgKGntSxBnx2XYOaiuFqW3EEuI0mNxeIukhYSG9NjXjwgkAOeBvID84bIQ== X-Received: by 2002:a05:6a00:4fd0:b0:71e:4c01:b3da with SMTP id d2e1a72fcca58-724132618c6mr21601770b3a.5.1731432512419; Tue, 12 Nov 2024 09:28:32 -0800 (PST) Received: from localhost.localdomain (124x33x176x97.ap124.ftth.ucom.ne.jp. [124.33.176.97]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72407864f78sm11481439b3a.33.2024.11.12.09.28.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2024 09:28:32 -0800 (PST) From: Vincent Mailhol To: netdev@vger.kernel.org, Stephen Hemminger , David Ahern , linux-can@vger.kernel.org, Marc Kleine-Budde , Oliver Hartkopp Cc: Robert Nawrath , linux-kernel@vger.kernel.org, Vincent Mailhol Subject: [PATCH iproute2-next v1 5/6] iplink_can: add struct can_tdc Date: Wed, 13 Nov 2024 02:27:55 +0900 Message-ID: <20241112172812.590665-13-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241112172812.590665-8-mailhol.vincent@wanadoo.fr> References: <20241112172812.590665-8-mailhol.vincent@wanadoo.fr> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2743; i=mailhol.vincent@wanadoo.fr; h=from:subject; bh=l+6NUzOXYhXtEryxl5pt51gE9c/WX6SBeH0CzzxTXNU=; b=owGbwMvMwCV2McXO4Xp97WbG02pJDOnGE3TLxRRuKd76466ZPaWmUVT0jK/mCdavGv4T7ObpZ HwMz/HqKGVhEONikBVTZFlWzsmt0FHoHXboryXMHFYmkCEMXJwCMJGjqYwM/T8/n196Y/a2J85v 0ybyp+828pxbcuWw95TyNc6NjkVSuxgZOqytJobsUNZZXM4i8Ouxy+6Nxne3/WirjblRcMLsqhc 3NwA= X-Developer-Key: i=mailhol.vincent@wanadoo.fr; a=openpgp; fpr=ED8F700574E67F20E574E8E2AB5FEB886DBB99C2 X-Patchwork-Delegate: dsahern@gmail.com Add the struct can_tdc to group the tdcv, tdco and tdvf variables together. The structure is borrowed from linux/can/bittiming.h [1]. This refactor is a preparation for the introduction of CAN XL. [1] https://elixir.bootlin.com/linux/v6.11/source/include/linux/can/bittiming.h#L78 Signed-off-by: Vincent Mailhol --- ip/iplink_can.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/ip/iplink_can.c b/ip/iplink_can.c index 928d5d79..325a4007 100644 --- a/ip/iplink_can.c +++ b/ip/iplink_can.c @@ -15,6 +15,12 @@ #include "utils.h" #include "ip_common.h" +struct can_tdc { + __u32 tdcv; + __u32 tdco; + __u32 tdcf; +}; + static void print_usage(FILE *f) { fprintf(f, @@ -128,7 +134,7 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv, { struct can_bittiming bt = {}, dbt = {}; struct can_ctrlmode cm = { 0 }; - __u32 tdcv = -1, tdco = -1, tdcf = -1; + struct can_tdc fd = { .tdcv = -1, .tdco = -1, .tdcf = -1 }; while (argc > 0) { if (matches(*argv, "bitrate") == 0) { @@ -196,15 +202,15 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv, invarg("invalid \"dsjw\" value", *argv); } else if (matches(*argv, "tdcv") == 0) { NEXT_ARG(); - if (get_u32(&tdcv, *argv, 0)) + if (get_u32(&fd.tdcv, *argv, 0)) invarg("invalid \"tdcv\" value", *argv); } else if (matches(*argv, "tdco") == 0) { NEXT_ARG(); - if (get_u32(&tdco, *argv, 0)) + if (get_u32(&fd.tdco, *argv, 0)) invarg("invalid \"tdco\" value", *argv); } else if (matches(*argv, "tdcf") == 0) { NEXT_ARG(); - if (get_u32(&tdcf, *argv, 0)) + if (get_u32(&fd.tdcf, *argv, 0)) invarg("invalid \"tdcf\" value", *argv); } else if (matches(*argv, "loopback") == 0) { NEXT_ARG(); @@ -294,16 +300,16 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv, if (cm.mask) addattr_l(n, 1024, IFLA_CAN_CTRLMODE, &cm, sizeof(cm)); - if (tdcv != -1 || tdco != -1 || tdcf != -1) { + if (fd.tdcv != -1 || fd.tdco != -1 || fd.tdcf != -1) { struct rtattr *tdc = addattr_nest(n, 1024, IFLA_CAN_TDC | NLA_F_NESTED); - if (tdcv != -1) - addattr32(n, 1024, IFLA_CAN_TDC_TDCV, tdcv); - if (tdco != -1) - addattr32(n, 1024, IFLA_CAN_TDC_TDCO, tdco); - if (tdcf != -1) - addattr32(n, 1024, IFLA_CAN_TDC_TDCF, tdcf); + if (fd.tdcv != -1) + addattr32(n, 1024, IFLA_CAN_TDC_TDCV, fd.tdcv); + if (fd.tdco != -1) + addattr32(n, 1024, IFLA_CAN_TDC_TDCO, fd.tdco); + if (fd.tdcf != -1) + addattr32(n, 1024, IFLA_CAN_TDC_TDCF, fd.tdcf); addattr_nest_end(n, tdc); } From patchwork Tue Nov 12 17:27:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Mailhol X-Patchwork-Id: 13872657 X-Patchwork-Delegate: dsahern@gmail.com Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0F557217910; Tue, 12 Nov 2024 17:28:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731432517; cv=none; b=aHfXzbp+IKUzpGPUS5o3PnRwe4nG/n0qXWZsCjPia2QJQFAAS5ffwDlYltv8uDsfRG9hNrBJgT2ruex35KfHWzaaL4JqeLJ9XTH8PFEHqM3wgNEkoUDF1zdFxArGthYP9h+d0ikgHFNCS/6txK2HfKo6ArfENS/fuxHc876IYCc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731432517; c=relaxed/simple; bh=h+bda6qIP39CBqtuxgK5KdbY/2wZmLIxOqGtJzn4hVs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L9YBY5alnQsBRo5K2XvEjISCgxadxXZgWXXRIV7Mdhd36C/azs+DIb1E5LbqHR68r2l9mBtN7oZc2dJJqbGQs4VHN2nQx1LLlrqA4W5ltRsLBEx6LBXa08BwEh3rBQHmVWKnSz4I0sgYF3ZRahIVVoHumQ2baCSns8blvewKkMU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-720d01caa66so5673340b3a.2; Tue, 12 Nov 2024 09:28:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731432515; x=1732037315; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qVVQAfQPrTYvBQm2LkvJxBcSdk/2T5k2ovRJfFBvGfY=; b=tZlkJ++CcbiGBM2eMNXkMUtfIgDAs0FPU/oe2glZ8J94QursnsBmeZc0BvRoZUmWt6 OxaXmL5Jg21ByeiaPDsMdDLkc7sKV9/g7a9MpYw+apRuitnZfaGogMEge0Q3LY12REdc e1iy2Zc/Ewbp3elM9XNvFUm58Nc8rzIat1mm/zlasihZMWXCdP9y62BQCiaiwP/whWEZ HP0JH3xHpC7uBH+rXNZ0OOrO5wapkNPsWwoP5H6Nye99pSeaSbUkHM95SqBlxNBmDdr6 29Deir+GU44epnNO37MnsljOoGvjub41bu4wilzVGGzS7o8OCZF36roPAcK5W5YuMkxm lAbQ== X-Forwarded-Encrypted: i=1; AJvYcCUrCuocFCHJgcEzyDHHJPr/tly5LSE21rQlPG3ImlrJEOy8bNaAIMbeVC5EG7NBmh0ohcXUynJvo0+qLI8d@vger.kernel.org, AJvYcCVAKGwnvIX5XbGZU9HjojYOOrhUGg/tf7pXolMXLsy4akOHuvhQbUW5IxNPKvwEB7OgATFvPiPA2u0=@vger.kernel.org X-Gm-Message-State: AOJu0Yz5Anb6O6TMfGd+rhvMwUI6UROCXfH84DYWhxGSs7bmsYP6xkiH wU0/tpEEZ4q6IA/j3pbDjkzKu3zFEZ1dZWSNIqjTo/xEUa+Zo7xeLdzppvfh X-Google-Smtp-Source: AGHT+IGsunV8IoVHOLTnCENkEOhjcs0K5xAnvHSjbazIFKYovYw7YrsA6wXC+V1+suzlDgMEFM7vUQ== X-Received: by 2002:a05:6a20:3952:b0:1db:d9fe:c442 with SMTP id adf61e73a8af0-1dc703a0740mr31898637.23.1731432514937; Tue, 12 Nov 2024 09:28:34 -0800 (PST) Received: from localhost.localdomain (124x33x176x97.ap124.ftth.ucom.ne.jp. [124.33.176.97]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72407864f78sm11481439b3a.33.2024.11.12.09.28.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2024 09:28:34 -0800 (PST) From: Vincent Mailhol To: netdev@vger.kernel.org, Stephen Hemminger , David Ahern , linux-can@vger.kernel.org, Marc Kleine-Budde , Oliver Hartkopp Cc: Robert Nawrath , linux-kernel@vger.kernel.org, Vincent Mailhol Subject: [PATCH iproute2-next v1 6/6] iplink_can: rename dbt into fd_dbt in can_parse_opt() Date: Wed, 13 Nov 2024 02:27:56 +0900 Message-ID: <20241112172812.590665-14-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241112172812.590665-8-mailhol.vincent@wanadoo.fr> References: <20241112172812.590665-8-mailhol.vincent@wanadoo.fr> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3136; i=mailhol.vincent@wanadoo.fr; h=from:subject; bh=h+bda6qIP39CBqtuxgK5KdbY/2wZmLIxOqGtJzn4hVs=; b=owGbwMvMwCV2McXO4Xp97WbG02pJDOnGE3Qv1u6U54zfNfFpfl/dRIZfVW47V83fOu3KT9FFD LLh25TqOkpZGMS4GGTFFFmWlXNyK3QUeocd+msJM4eVCWQIAxenAEzk7hyG/37Bpe3r233En3CJ 3bqyIOPGkg9vY1aKfvrbubJkaumfl+8ZGY5avy75Jz6js2/27AnuEYl2gSvmfRJa9u3Sy5szApI edvEAAA== X-Developer-Key: i=mailhol.vincent@wanadoo.fr; a=openpgp; fpr=ED8F700574E67F20E574E8E2AB5FEB886DBB99C2 X-Patchwork-Delegate: dsahern@gmail.com The CAN XL support will introduce another dbt variable. Rename the current dbt variable into fd_dbt to avoid future confusion. When introduced, the CAN XL variable will be named xl_dbt. Signed-off-by: Vincent Mailhol --- ip/iplink_can.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ip/iplink_can.c b/ip/iplink_can.c index 325a4007..fcffa852 100644 --- a/ip/iplink_can.c +++ b/ip/iplink_can.c @@ -132,7 +132,7 @@ static void print_ctrlmode(enum output_type t, __u32 flags, const char* key) static int can_parse_opt(struct link_util *lu, int argc, char **argv, struct nlmsghdr *n) { - struct can_bittiming bt = {}, dbt = {}; + struct can_bittiming bt = {}, fd_dbt = {}; struct can_ctrlmode cm = { 0 }; struct can_tdc fd = { .tdcv = -1, .tdco = -1, .tdcf = -1 }; @@ -171,7 +171,7 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv, invarg("invalid \"sjw\" value", *argv); } else if (matches(*argv, "dbitrate") == 0) { NEXT_ARG(); - if (get_u32(&dbt.bitrate, *argv, 0)) + if (get_u32(&fd_dbt.bitrate, *argv, 0)) invarg("invalid \"dbitrate\" value", *argv); } else if (matches(*argv, "dsample-point") == 0) { float sp; @@ -179,26 +179,26 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv, NEXT_ARG(); if (get_float(&sp, *argv)) invarg("invalid \"dsample-point\" value", *argv); - dbt.sample_point = (__u32)(sp * 1000); + fd_dbt.sample_point = (__u32)(sp * 1000); } else if (matches(*argv, "dtq") == 0) { NEXT_ARG(); - if (get_u32(&dbt.tq, *argv, 0)) + if (get_u32(&fd_dbt.tq, *argv, 0)) invarg("invalid \"dtq\" value", *argv); } else if (matches(*argv, "dprop-seg") == 0) { NEXT_ARG(); - if (get_u32(&dbt.prop_seg, *argv, 0)) + if (get_u32(&fd_dbt.prop_seg, *argv, 0)) invarg("invalid \"dprop-seg\" value", *argv); } else if (matches(*argv, "dphase-seg1") == 0) { NEXT_ARG(); - if (get_u32(&dbt.phase_seg1, *argv, 0)) + if (get_u32(&fd_dbt.phase_seg1, *argv, 0)) invarg("invalid \"dphase-seg1\" value", *argv); } else if (matches(*argv, "dphase-seg2") == 0) { NEXT_ARG(); - if (get_u32(&dbt.phase_seg2, *argv, 0)) + if (get_u32(&fd_dbt.phase_seg2, *argv, 0)) invarg("invalid \"dphase-seg2\" value", *argv); } else if (matches(*argv, "dsjw") == 0) { NEXT_ARG(); - if (get_u32(&dbt.sjw, *argv, 0)) + if (get_u32(&fd_dbt.sjw, *argv, 0)) invarg("invalid \"dsjw\" value", *argv); } else if (matches(*argv, "tdcv") == 0) { NEXT_ARG(); @@ -295,8 +295,8 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv, if (bt.bitrate || bt.tq) addattr_l(n, 1024, IFLA_CAN_BITTIMING, &bt, sizeof(bt)); - if (dbt.bitrate || dbt.tq) - addattr_l(n, 1024, IFLA_CAN_DATA_BITTIMING, &dbt, sizeof(dbt)); + if (fd_dbt.bitrate || fd_dbt.tq) + addattr_l(n, 1024, IFLA_CAN_DATA_BITTIMING, &fd_dbt, sizeof(fd_dbt)); if (cm.mask) addattr_l(n, 1024, IFLA_CAN_CTRLMODE, &cm, sizeof(cm));