Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9118558ybi; Wed, 10 Jul 2019 05:03:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqz1xJhNGxm6j39SwDc8kmkS80x9picc3nngXvqim20/MRm9+rMrvD5Lmy+Vl7m1SChmm5aj X-Received: by 2002:a17:902:4201:: with SMTP id g1mr38636124pld.300.1562760213610; Wed, 10 Jul 2019 05:03:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562760213; cv=none; d=google.com; s=arc-20160816; b=GlOSW6/QAP1/iJuzHM3BA0D/SxangJsyljwSu4PfR8Z809WULvnno1f2PK6kUCEPQh AyimBzr+1hIaxG7VIZx9+pDiXHNAB6hWlcBDHONiQA60RKwcIV1JZ5pvmt8IdlBUebTU szmEOQ3rYDm/UNLQQOq23Qcs/U8w+Cr2dc4hTPbOBh0bgL+uxVCxU4yhfb/BbcpTSYkW lDX9vcaceKx3/1ekyxN8cZ/olLQUff8Tek7Rew816Lk1qY/LJQXktL9Y/6v+HMeX+Cey EAFxD9z4sxbiFA6XvJrez7FgdNnWIhVHM87rMBcX+6JS031aoJR8/lHFr0Nr2jf1W9vS dtog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=tMtrbQ9O9NLT+lCYPVw1R6yXWMAEFp/dvi5/lKL+DZI=; b=SbfAeC8utjea6Z1F4tYkhIReokG1l/rsbPefHzKc6EjLDKihWvcaojKWeRWIPjcsdm mzZ1Jq/FOlN8MEyWsYH23RWuwiIp9pjcrjRePd9aFjPj23T+W00BNlx78SfXuevZdkgb 3xLLn/fFrIDOj9McifTjH8abMnyxQEf0JRF6KUTaZjVd3pu4d7jhbXC44d1BV81gfSBp fqvgy7MADvLPSf05nEGVUBP1vLIdW56q55HoAx63z5XN0zHhJ6jiwSbx4us/qD2BX/Ua m1ayIuxBL+/+b4MGSYEMPLT4P0dXYNeLOzszXFr68ZTG3c36/25VDnO/jESS2dHbnRiL Z+ig== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g8si1882602plt.273.2019.07.10.05.02.50; Wed, 10 Jul 2019 05:03:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727136AbfGJLsr convert rfc822-to-8bit (ORCPT + 99 others); Wed, 10 Jul 2019 07:48:47 -0400 Received: from www.llwyncelyn.cymru ([82.70.14.225]:56004 "EHLO fuzix.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726043AbfGJLsr (ORCPT ); Wed, 10 Jul 2019 07:48:47 -0400 Received: from alans-desktop (82-70-14-226.dsl.in-addr.zen.co.uk [82.70.14.226]) by fuzix.org (8.15.2/8.15.2) with ESMTP id x6ABmWxS019986; Wed, 10 Jul 2019 12:48:33 +0100 Date: Wed, 10 Jul 2019 12:48:32 +0100 From: Alan Cox To: Martin =?UTF-8?B?SHVuZGViw7hsbA==?= Cc: Greg Kroah-Hartman , Jiri Slaby , linux-kernel@vger.kernel.org, Sean =?UTF-8?B?Tnlla2o=?= =?UTF-8?B?w6Zy?= , Esben Haabendal Subject: Re: [PATCHv2 3/4] tty: n_gsm: add helper to convert mux-num to/from tty-base Message-ID: <20190710124832.5a9a1daa@alans-desktop> In-Reply-To: <20190709064633.45411-3-martin@geanix.com> References: <20190709064633.45411-1-martin@geanix.com> <20190709064633.45411-3-martin@geanix.com> Organization: Intel Corporation X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 9 Jul 2019 08:46:32 +0200 Martin Hundebøll wrote: > Make it obvious how the gsm mux number relates to the virtual tty lines > by using helper function instead of shifting 6 bits. > > Signed-off-by: Martin Hundebøll > --- > drivers/tty/n_gsm.c | 16 +++++++++++++--- > 1 file changed, 13 insertions(+), 3 deletions(-) > > diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c > index c4e16b31f9ab..cba06063c44a 100644 > --- a/drivers/tty/n_gsm.c > +++ b/drivers/tty/n_gsm.c > @@ -2171,6 +2171,16 @@ static inline void mux_put(struct gsm_mux *gsm) > kref_put(&gsm->ref, gsm_free_muxr); > } > > +static inline int mux_num_to_base(struct gsm_mux *gsm) > +{ > + return gsm->num * NUM_DLCI; > +} > + > +static inline unsigned int mux_line_to_num(int line) > +{ > + return line / NUM_DLCI; If you are going to convert shifts to multiply and divide then used unsigned maths so the compiler can optimize it nicely on some of the low end processors. Alan