From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753094AbcELMAo (ORCPT ); Thu, 12 May 2016 08:00:44 -0400 Received: from mail-lb0-f177.google.com ([209.85.217.177]:34809 "EHLO mail-lb0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752218AbcELMAm (ORCPT ); Thu, 12 May 2016 08:00:42 -0400 Subject: Re: [PATCH 04/36] usb: serial: ti_usb_3410_5052: Use inline functions rather than macro To: Mathieu OTHACEHE , johan@kernel.org References: <1463042948-12205-1-git-send-email-m.othacehe@gmail.com> <1463042948-12205-5-git-send-email-m.othacehe@gmail.com> Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org From: Sergei Shtylyov Message-ID: Date: Thu, 12 May 2016 15:00:39 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <1463042948-12205-5-git-send-email-m.othacehe@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello. On 5/12/2016 11:48 AM, Mathieu OTHACEHE wrote: > Inline functions are preferable to macros resembling functions. > > Signed-off-by: Mathieu OTHACEHE > --- > drivers/usb/serial/ti_usb_3410_5052.c | 16 ++++++++++++---- > 1 file changed, 12 insertions(+), 4 deletions(-) > > diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c > index 6002e8b..2fc3ea1 100644 > --- a/drivers/usb/serial/ti_usb_3410_5052.c > +++ b/drivers/usb/serial/ti_usb_3410_5052.c > @@ -248,8 +248,16 @@ struct ti_interrupt { > } __packed; > > /* Interrupt codes */ > -#define TI_GET_PORT_FROM_CODE(c) (((c) >> 4) - 3) > -#define TI_GET_FUNC_FROM_CODE(c) ((c) & 0x0f) > +static inline int ti_get_port_from_code(unsigned char code) > +{ > + return (code >> 4) - 3; > +} > + > +static inline int ti_get_func_from_code(unsigned char code) > +{ > + return code & 0x0f; > +} > + We don't specify *inline* in the .c files (only in .h), letting gcc figure it out. [...] MBR, Sergei