Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2366191rwd; Wed, 17 May 2023 09:02:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ79dTZA9fXgr9VZ/EmNLbDLMIZl7vua7wk7A8HdRF/SnsXBS9DOT+LstyDcvBWlVpCWgV6h X-Received: by 2002:a05:6a21:329d:b0:103:e05f:c6d2 with SMTP id yt29-20020a056a21329d00b00103e05fc6d2mr29362443pzb.1.1684339369487; Wed, 17 May 2023 09:02:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684339369; cv=none; d=google.com; s=arc-20160816; b=RG70YVrMjX37WlbL9Vsl55BGSRORxi02RKjxAmLeZhWDBE0ItAuu95wEpzDv+RYcme fH2EF5r2k6EMUpjWpoDPYAnOzsVNHy67TondD/8cb9NjGOo6VzvR5JfgB47V+vaCYuVW h+m6lnvwU03rl/tMg7wj/J2liNB1cyEduzss9w85TQLTflilp/G+ye7ZOReXlHm1nB7i 32nx1ITmh6B8W0EsnceMRrSbcsguHvgxHGbmPwWzuv0kLUIda5RfmxxatE6ZoDA6vzV9 IJ33K93Hv3TK/WOTgtZeiWTsIF1dLfdpxTzLxF/bK5E3OU+kVoNiZoX5CDiibNKi0hlf rOFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8JZ3aNj2YfHl3YwKHBbNEj8X9wcN9oM57BAa2nlT+Po=; b=sCMGJ7cXU4LMU54M+A+ol8jF7oSKyGGVb8REXZBrallynBz8yh56Q/KUTJmZ56ZY5p +fAzODrDByQdjT7r2NOI0m+LUpC/Tq1PGq1Z+qK5cLaZJqMWOvAx5GoMqL+UekKy96/P BUHpb1fZ5iEij7zKFVCexTC5rzPNJmyc1D/Jmx9jt0aWTA6dH6Mfkw5bMpxkFuOlzkNI CalLLrIF6xrx85M7nseco5UYgF1Ssh7xzbYPLJJOIRKxekm849oaMxwXZVZGSPMEn44S 2mEDk+sCBrrYwqR/Xb5/lgKH/So7w9xFLB/peoIXWToK5zuv6+78aGhCzRCjKFEZ7Mg+ UeYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=ABTv8j70; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w18-20020a63af12000000b0053076a4da8asi16444617pge.770.2023.05.17.09.02.27; Wed, 17 May 2023 09:02:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=ABTv8j70; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232134AbjEQP7K (ORCPT + 99 others); Wed, 17 May 2023 11:59:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231968AbjEQP6z (ORCPT ); Wed, 17 May 2023 11:58:55 -0400 Received: from mta-65-225.siemens.flowmailer.net (mta-65-225.siemens.flowmailer.net [185.136.65.225]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 363447289 for ; Wed, 17 May 2023 08:58:34 -0700 (PDT) Received: by mta-65-225.siemens.flowmailer.net with ESMTPSA id 202305171558304f57da4f8f42d0ab55 for ; Wed, 17 May 2023 17:58:30 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=daniel.starke@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=8JZ3aNj2YfHl3YwKHBbNEj8X9wcN9oM57BAa2nlT+Po=; b=ABTv8j70Np0JRokN+q2Jfx+1JhRLSh7J7PBOYernGtJzjh9JrozrFbXSB8JOIX29YvhnwD dE4QNPFJUV03D8FpAuYyTXbLPlkgCG50l+RouAdDcMAyIkmK8oenN3gnN7aMJ2ZzhV/FD/lX TgwG3yiwuvWSoMfXqo5rwXqbVqg3c=; From: "D. Starke" To: linux-serial@vger.kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, ilpo.jarvinen@linux.intel.com, felix-haase@siemens.com Cc: linux-kernel@vger.kernel.org, Daniel Starke Subject: [PATCH v5 07/10] tty: n_gsm: cleanup gsm_control_command and gsm_control_reply Date: Wed, 17 May 2023 17:57:01 +0200 Message-Id: <20230517155704.5701-7-daniel.starke@siemens.com> In-Reply-To: <20230517155704.5701-1-daniel.starke@siemens.com> References: <20230517155704.5701-1-daniel.starke@siemens.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-314044:519-21489:flowmailer X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Daniel Starke There are multiple places in gsm_control_command and gsm_control_reply that derive the specific DLCI handle directly out of the DLCI table in gsm. Add a local variable which holds this handle and use it instead to improve code readability. Signed-off-by: Daniel Starke --- drivers/tty/n_gsm.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) v4 -> v5: No changes. Please note that I cannot response to emails until August 7th. Felix Haase will take over from our side for questions regarding this patch series or the n_gsm. Link: https://lore.kernel.org/all/20230426080315.7595-7-daniel.starke@siemens.com/ diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 42a8507aae4a..62bff4474b57 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -1451,15 +1451,16 @@ static int gsm_control_command(struct gsm_mux *gsm, int cmd, const u8 *data, int dlen) { struct gsm_msg *msg; + struct gsm_dlci *dlci = gsm->dlci[0]; - msg = gsm_data_alloc(gsm, 0, dlen + 2, gsm->dlci[0]->ftype); + msg = gsm_data_alloc(gsm, 0, dlen + 2, dlci->ftype); if (msg == NULL) return -ENOMEM; msg->data[0] = (cmd << 1) | CR | EA; /* Set C/R */ msg->data[1] = (dlen << 1) | EA; memcpy(msg->data + 2, data, dlen); - gsm_data_queue(gsm->dlci[0], msg); + gsm_data_queue(dlci, msg); return 0; } @@ -1478,14 +1479,15 @@ static void gsm_control_reply(struct gsm_mux *gsm, int cmd, const u8 *data, int dlen) { struct gsm_msg *msg; + struct gsm_dlci *dlci = gsm->dlci[0]; - msg = gsm_data_alloc(gsm, 0, dlen + 2, gsm->dlci[0]->ftype); + msg = gsm_data_alloc(gsm, 0, dlen + 2, dlci->ftype); if (msg == NULL) return; msg->data[0] = (cmd & 0xFE) << 1 | EA; /* Clear C/R */ msg->data[1] = (dlen << 1) | EA; memcpy(msg->data + 2, data, dlen); - gsm_data_queue(gsm->dlci[0], msg); + gsm_data_queue(dlci, msg); } /** -- 2.34.1