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]
Message-ID: <20201110112054.GC22481@b29397-desktop>
Date:   Tue, 10 Nov 2020 11:21:22 +0000
From:   Peter Chen <peter.chen@....com>
To:     Pawel Laszczak <pawell@...ence.com>
CC:     "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
        "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "balbi@...nel.org" <balbi@...nel.org>,
        "colin.king@...onical.com" <colin.king@...onical.com>,
        "rogerq@...com" <rogerq@...com>, Rahul Kumar <kurahul@...ence.com>,
        "nsekhar@...com" <nsekhar@...com>
Subject: Re: [PATCH v2 03/10] usb: cdns3: Moves reusable code to separate
 module

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.

Never mind, it is not a issue.

Peter
> Of course, here we have little different situation because these API functions
> are limited only to cdns3 directory. 
> 
>  was not sure about that, but I think that this extern is the
> information that these functions are used, or can be used
>  by other modules.
> 
> Am I right ?
> 
> >>
> >>  #ifdef CONFIG_PM_SLEEP
> >> -int cdns3_resume(struct cdns3 *cdns, u8 set_active);
> >> -int cdns3_suspend(struct cdns3 *cdns);
> >> +extern int cdns3_resume(struct cdns3 *cdns, u8 set_active);
> >> +extern int cdns3_suspend(struct cdns3 *cdns);
> >>  #endif /* CONFIG_PM_SLEEP */
> >>  #endif /* __LINUX_CDNS3_CORE_H */
> >> diff --git a/drivers/usb/cdns3/drd.c b/drivers/usb/cdns3/drd.c
> >> index ed8cde91a02c..1874dc6018f0 100644
> >> --- a/drivers/usb/cdns3/drd.c
> >> +++ b/drivers/usb/cdns3/drd.c
> >> @@ -15,7 +15,6 @@
> >>  #include <linux/iopoll.h>
> >>  #include <linux/usb/otg.h>
> >>
> >> -#include "gadget.h"
> >>  #include "drd.h"
> >>  #include "core.h"
> >>
> >> @@ -226,6 +225,7 @@ int cdns3_drd_gadget_on(struct cdns3 *cdns)
> >>  	phy_set_mode(cdns->usb3_phy, PHY_MODE_USB_DEVICE);
> >>  	return 0;
> >>  }
> >> +EXPORT_SYMBOL_GPL(cdns3_drd_gadget_on);
> >>
> >>  /**
> >>   * cdns3_drd_gadget_off - stop gadget.
> >> @@ -249,6 +249,7 @@ void cdns3_drd_gadget_off(struct cdns3 *cdns)
> >>  				  1, 2000000);
> >>  	phy_set_mode(cdns->usb3_phy, PHY_MODE_INVALID);
> >>  }
> >> +EXPORT_SYMBOL_GPL(cdns3_drd_gadget_off);
> >>
> >>  /**
> >>   * cdns3_init_otg_mode - initialize drd controller
> >> diff --git a/drivers/usb/cdns3/drd.h b/drivers/usb/cdns3/drd.h
> >> index d752d8806a38..972aba8a40b6 100644
> >> --- a/drivers/usb/cdns3/drd.h
> >> +++ b/drivers/usb/cdns3/drd.h
> >> @@ -209,8 +209,8 @@ int cdns3_get_vbus(struct cdns3 *cdns);
> >>  int cdns3_drd_init(struct cdns3 *cdns);
> >>  int cdns3_drd_exit(struct cdns3 *cdns);
> >>  int cdns3_drd_update_mode(struct cdns3 *cdns);
> >> -int cdns3_drd_gadget_on(struct cdns3 *cdns);
> >> -void cdns3_drd_gadget_off(struct cdns3 *cdns);
> >> +extern int cdns3_drd_gadget_on(struct cdns3 *cdns);
> >> +extern void cdns3_drd_gadget_off(struct cdns3 *cdns);
> >>  int cdns3_drd_host_on(struct cdns3 *cdns);
> >>  void cdns3_drd_host_off(struct cdns3 *cdns);
> >>
> >> --
> >> 2.17.1
> >>
> 
> --
> Thanks
> Pawel Laszczak

-- 

Thanks,
Peter Chen

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ