Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp230767rwl; Tue, 4 Apr 2023 22:54:02 -0700 (PDT) X-Google-Smtp-Source: AKy350ZASF/CEuc2+DRxDclFljoGxojGkrCYGC4V2orjv3Ld1r9hG0aCx+EyvV6BbDbeywslvQad X-Received: by 2002:a17:906:1685:b0:93b:752:d2a9 with SMTP id s5-20020a170906168500b0093b0752d2a9mr1758687ejd.31.1680674042596; Tue, 04 Apr 2023 22:54:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680674042; cv=none; d=google.com; s=arc-20160816; b=dggUzaPEH0Vw0d5p2dZfL0mfKiLWqJE/jRT444KEMg+X+SaR9/Yv0P2OQdlAC8H649 +0gCPB7lj6pBolw1bLn0D1yQOBsGBjGj2IFHZmZJ8Qq4kurWwcOfEV/p0l0mfats1NM+ WP5wC1gsugAEDqFZjn/NUjo7T/kiT/nhNW3OVgDQWjAyDpUWMNK7pJYtHGeGCVfOhSQW gnuvSTAxUF/WRCp2U7omkEEZY/cmw1Ia9hQK+kLciL4EXb3I5tQ5T1+aHOGDtDBS5orI YLQOV0XHoH4PCFb2SGQiRK9kpNbi2I+2OEV9AgKT6lhe4V/WnSEbPsLxfwWjMjG3ghSc /UeQ== 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=1GS25vop8sxUpd2Jcu2/YctKoWgcop6YP071C0g8f7A=; b=dym3wvWfWFxhh/VSPbbzpGhK7fjP2P55BK5VgstZb6rkJ35wTQnpktwm846KXoxl5V jnw7BIXljkfShXFZjGD2R7NgoTQgFlvOFpm+u/numY4aM9smS950eR5D9FAqhdQbJgGe mjXthEBdf8L9kTtcccx/ZVfS37KlsM5lPqvuEpcIGZrVABKA5iWyDY93WglhvtnwXjm5 0icjaHXReA5YIl+WmcYTmCJKbzWk1aFx9WUM6ynPKrhR1+L34NcTNm/9fX9kDSHnmxu9 IDy79EPDMuR1hIHBWMB0UV82hyPBCJUFu0vv2Hvd+bXqNs2GszqlQiLCjZV1Yk2XyGM6 fAaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=p6+pVTkh; 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 fj14-20020a1709069c8e00b009492273178esi677816ejc.220.2023.04.04.22.53.37; Tue, 04 Apr 2023 22:54:02 -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=p6+pVTkh; 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 S236994AbjDEFuf (ORCPT + 99 others); Wed, 5 Apr 2023 01:50:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236973AbjDEFuZ (ORCPT ); Wed, 5 Apr 2023 01:50:25 -0400 X-Greylist: delayed 72 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 04 Apr 2023 22:49:56 PDT Received: from mta-64-225.siemens.flowmailer.net (mta-64-225.siemens.flowmailer.net [185.136.64.225]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1FD54EFD for ; Tue, 4 Apr 2023 22:49:56 -0700 (PDT) Received: by mta-64-225.siemens.flowmailer.net with ESMTPSA id 20230405054842a1eb5d27e0917391df for ; Wed, 05 Apr 2023 07:48:43 +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=1GS25vop8sxUpd2Jcu2/YctKoWgcop6YP071C0g8f7A=; b=p6+pVTkhM5dHMuDtxJ+UH1KIS+NvwW2qr4P8FNd+9AGfmKO28kGyEBq5/TmDeEiWqCnu4m O5rkj9Fe9FQWAWMW5I8aqd3auG9IzOWyRyWQLJ02CZoakX90NaVvKJ51z5tgXnF2S9c99myN XIndyBEAlHk73sljUrYeW/eSiD8yo=; From: "D. Starke" To: linux-serial@vger.kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, ilpo.jarvinen@linux.intel.com Cc: linux-kernel@vger.kernel.org, Daniel Starke Subject: [PATCH 9/9] tty: n_gsm: cleanup gsm_control_command and gsm_control_reply Date: Wed, 5 Apr 2023 07:47:30 +0200 Message-Id: <20230405054730.3850-9-daniel.starke@siemens.com> In-Reply-To: <20230405054730.3850-1-daniel.starke@siemens.com> References: <20230405054730.3850-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=-0.2 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS autolearn=unavailable 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 | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 61f9825fde3c..87720ebc38d7 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -1454,16 +1454,17 @@ 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->dlci[0]->tx += dlen; + gsm_data_queue(dlci, msg); + dlci->tx += dlen; return 0; } @@ -1482,15 +1483,16 @@ 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->dlci[0]->tx += dlen; + gsm_data_queue(dlci, msg); + dlci->tx += dlen; } /** -- 2.34.1