Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1444183 > unrolled thread
| Started by | Johan Hovold <johan@kernel.org> |
|---|---|
| First post | 2016-07-15 13:00 +0200 |
| Last post | 2016-07-15 13:00 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH 04/36] usb: serial: ti_usb_3410_5052: Use inline functions rather than macro Johan Hovold <johan@kernel.org> - 2016-07-15 13:00 +0200
| From | Johan Hovold <johan@kernel.org> |
|---|---|
| Date | 2016-07-15 13:00 +0200 |
| Subject | Re: [PATCH 04/36] usb: serial: ti_usb_3410_5052: Use inline functions rather than macro |
| Message-ID | <rV90B-5RX-17@gated-at.bofh.it> |
On Thu, May 12, 2016 at 03:00:39PM +0300, Sergei Shtylyov wrote:
> 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@gmail.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.
Indeed. I dropped the inline keywords and also moved the functions above
the interrupt-in completion handler, which is the only place they are
used.
Thanks,
Johan
Back to top | Article view | linux.kernel
csiph-web