lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 12 May 2016 15:00:39 +0300
From:	Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To:	Mathieu OTHACEHE <m.othacehe@...il.com>, johan@...nel.org
Cc:	gregkh@...uxfoundation.org, linux-usb@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 04/36] usb: serial: ti_usb_3410_5052: Use inline functions
 rather than macro

Hello.

On 5/12/2016 11:48 AM, Mathieu OTHACEHE wrote:

> Inline functions are preferable to macros resembling functions.
>
> Signed-off-by: Mathieu OTHACEHE <m.othacehe@...il.com>
> ---
>  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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ