lkml.org 
[lkml]   [2020]   [Nov]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 03/10] usb: cdns3: Moves reusable code to separate module
On Tue, Nov 10, 2020 at 11:21:22AM +0000, Peter Chen wrote:
> On 20-11-10 09:20:54, Pawel Laszczak wrote:
> > Hi,
> >
> > >>
> > >> int cdns3_hw_role_switch(struct cdns3 *cdns);
> > >> -int cdns3_init(struct cdns3 *cdns);
> > >> -int cdns3_remove(struct cdns3 *cdns);
> > >> +extern int cdns3_init(struct cdns3 *cdns);
> > >> +extern int cdns3_remove(struct cdns3 *cdns);
> > >
> > >Why add "extern" here and below?
> > >
> >
> > These functions are the API between cdnsp and cdns3 modules.
> > It's looks like a common approach in kernel.
> > Many or even most of API function in kernel has "extern".
> >
>
> Even you have not written "extern" keyword, the "extern" is
> added implicitly by compiler. Usually, we use "extern" for variable
> or the function is defined at assembly. You could see some
> "extern" keyword use cases at include/linux/device.h.

We are moving away from using this keyword for functions now, if at all
possible please. Only use it for variables, I think checkpatch now
catches it as well.

thanks,

greg k-h

\
 
 \ /
  Last update: 2020-11-10 12:39    [W:0.069 / U:0.504 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site