diff mbox series

ptp: mark symbols static where possible

Message ID 20200917022508.9732-1-hankinsea@gmail.com
State New
Headers show
Series ptp: mark symbols static where possible | expand

Commit Message

Herrington Sept. 17, 2020, 2:25 a.m. UTC
We get 1 warning when building kernel with W=1:
drivers/ptp/ptp_pch.c:182:5: warning: no previous prototype for ‘pch_ch_control_read’ [-Wmissing-prototypes]
 u32 pch_ch_control_read(struct pci_dev *pdev)
drivers/ptp/ptp_pch.c:193:6: warning: no previous prototype for ‘pch_ch_control_write’ [-Wmissing-prototypes]
 void pch_ch_control_write(struct pci_dev *pdev, u32 val)
drivers/ptp/ptp_pch.c:201:5: warning: no previous prototype for ‘pch_ch_event_read’ [-Wmissing-prototypes]
 u32 pch_ch_event_read(struct pci_dev *pdev)
drivers/ptp/ptp_pch.c:212:6: warning: no previous prototype for ‘pch_ch_event_write’ [-Wmissing-prototypes]
 void pch_ch_event_write(struct pci_dev *pdev, u32 val)
drivers/ptp/ptp_pch.c:220:5: warning: no previous prototype for ‘pch_src_uuid_lo_read’ [-Wmissing-prototypes]
 u32 pch_src_uuid_lo_read(struct pci_dev *pdev)
drivers/ptp/ptp_pch.c:231:5: warning: no previous prototype for ‘pch_src_uuid_hi_read’ [-Wmissing-prototypes]
 u32 pch_src_uuid_hi_read(struct pci_dev *pdev)
drivers/ptp/ptp_pch.c:242:5: warning: no previous prototype for ‘pch_rx_snap_read’ [-Wmissing-prototypes]
 u64 pch_rx_snap_read(struct pci_dev *pdev)
drivers/ptp/ptp_pch.c:259:5: warning: no previous prototype for ‘pch_tx_snap_read’ [-Wmissing-prototypes]
 u64 pch_tx_snap_read(struct pci_dev *pdev)
drivers/ptp/ptp_pch.c:300:5: warning: no previous prototype for ‘pch_set_station_address’ [-Wmissing-prototypes]
 int pch_set_station_address(u8 *addr, struct pci_dev *pdev)

Signed-off-by: Herrington <hankinsea@gmail.com>
---
 drivers/ptp/ptp_pch.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Comments

Leon Romanovsky Sept. 17, 2020, 7:16 a.m. UTC | #1
On Thu, Sep 17, 2020 at 10:25:08AM +0800, Herrington wrote:
> We get 1 warning when building kernel with W=1:
> drivers/ptp/ptp_pch.c:182:5: warning: no previous prototype for ‘pch_ch_control_read’ [-Wmissing-prototypes]
>  u32 pch_ch_control_read(struct pci_dev *pdev)
> drivers/ptp/ptp_pch.c:193:6: warning: no previous prototype for ‘pch_ch_control_write’ [-Wmissing-prototypes]
>  void pch_ch_control_write(struct pci_dev *pdev, u32 val)
> drivers/ptp/ptp_pch.c:201:5: warning: no previous prototype for ‘pch_ch_event_read’ [-Wmissing-prototypes]
>  u32 pch_ch_event_read(struct pci_dev *pdev)
> drivers/ptp/ptp_pch.c:212:6: warning: no previous prototype for ‘pch_ch_event_write’ [-Wmissing-prototypes]
>  void pch_ch_event_write(struct pci_dev *pdev, u32 val)
> drivers/ptp/ptp_pch.c:220:5: warning: no previous prototype for ‘pch_src_uuid_lo_read’ [-Wmissing-prototypes]
>  u32 pch_src_uuid_lo_read(struct pci_dev *pdev)
> drivers/ptp/ptp_pch.c:231:5: warning: no previous prototype for ‘pch_src_uuid_hi_read’ [-Wmissing-prototypes]
>  u32 pch_src_uuid_hi_read(struct pci_dev *pdev)
> drivers/ptp/ptp_pch.c:242:5: warning: no previous prototype for ‘pch_rx_snap_read’ [-Wmissing-prototypes]
>  u64 pch_rx_snap_read(struct pci_dev *pdev)
> drivers/ptp/ptp_pch.c:259:5: warning: no previous prototype for ‘pch_tx_snap_read’ [-Wmissing-prototypes]
>  u64 pch_tx_snap_read(struct pci_dev *pdev)
> drivers/ptp/ptp_pch.c:300:5: warning: no previous prototype for ‘pch_set_station_address’ [-Wmissing-prototypes]
>  int pch_set_station_address(u8 *addr, struct pci_dev *pdev)
>
> Signed-off-by: Herrington <hankinsea@gmail.com>
> ---
>  drivers/ptp/ptp_pch.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)

This file is total mess.

>
> diff --git a/drivers/ptp/ptp_pch.c b/drivers/ptp/ptp_pch.c
> index ce10ecd41ba0..8db2d1893577 100644
> --- a/drivers/ptp/ptp_pch.c
> +++ b/drivers/ptp/ptp_pch.c
> @@ -179,7 +179,7 @@ static inline void pch_block_reset(struct pch_dev *chip)
>  	iowrite32(val, (&chip->regs->control));
>  }
>
> -u32 pch_ch_control_read(struct pci_dev *pdev)
> +static u32 pch_ch_control_read(struct pci_dev *pdev)
>  {
>  	struct pch_dev *chip = pci_get_drvdata(pdev);
>  	u32 val;
> @@ -190,7 +190,7 @@ u32 pch_ch_control_read(struct pci_dev *pdev)
>  }
>  EXPORT_SYMBOL(pch_ch_control_read);

This function is not used and can be deleted.

>
> -void pch_ch_control_write(struct pci_dev *pdev, u32 val)
> +static void pch_ch_control_write(struct pci_dev *pdev, u32 val)
>  {
>  	struct pch_dev *chip = pci_get_drvdata(pdev);
>
> @@ -198,7 +198,7 @@ void pch_ch_control_write(struct pci_dev *pdev, u32 val)
>  }
>  EXPORT_SYMBOL(pch_ch_control_write);


This function in use (incorrectly) by
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c

Your patch will break it.

I didn't check other functions, but assume they are broken too.

Thanks
kernel test robot Sept. 17, 2020, 9:24 a.m. UTC | #2
Hi Herrington,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net/master]
[also build test ERROR on net-next/master linus/master v5.9-rc5 next-20200916]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Herrington/ptp-mark-symbols-static-where-possible/20200917-103557
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git d5d325eae7823c85eedabf05f78f9cd574fe832b
config: riscv-allyesconfig (attached as .config)
compiler: riscv64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=riscv 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   riscv64-linux-ld: drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.o: in function `.L306':
>> pch_gbe_main.c:(.text+0x2a04): undefined reference to `pch_ch_control_write'
   riscv64-linux-ld: drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.o: in function `.L287':
   pch_gbe_main.c:(.text+0x2a3c): undefined reference to `pch_ch_control_write'
>> riscv64-linux-ld: pch_gbe_main.c:(.text+0x2a76): undefined reference to `pch_ch_control_write'
   riscv64-linux-ld: pch_gbe_main.c:(.text+0x2ab2): undefined reference to `pch_ch_control_write'
   riscv64-linux-ld: drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.o: in function `.L0 ':
>> pch_gbe_main.c:(.text+0x2ad6): undefined reference to `pch_set_station_address'
   riscv64-linux-ld: drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.o: in function `.L295':
>> pch_gbe_main.c:(.text+0x2b1c): undefined reference to `pch_ch_event_write'
   riscv64-linux-ld: drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.o: in function `.L0 ':
>> pch_gbe_main.c:(.text+0x44ea): undefined reference to `pch_ch_event_read'
   riscv64-linux-ld: drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.o: in function `.L447':
>> pch_gbe_main.c:(.text+0x468e): undefined reference to `pch_tx_snap_read'
   riscv64-linux-ld: drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.o: in function `.L450':
   pch_gbe_main.c:(.text+0x46ae): undefined reference to `pch_ch_event_write'
   riscv64-linux-ld: drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.o: in function `.L508':
   pch_gbe_main.c:(.text+0x522c): undefined reference to `pch_ch_event_read'
   riscv64-linux-ld: drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.o: in function `.L509':
>> pch_gbe_main.c:(.text+0x5254): undefined reference to `pch_src_uuid_lo_read'
>> riscv64-linux-ld: pch_gbe_main.c:(.text+0x5266): undefined reference to `pch_src_uuid_hi_read'
   riscv64-linux-ld: drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.o: in function `.L515':
>> pch_gbe_main.c:(.text+0x540e): undefined reference to `pch_rx_snap_read'
>> riscv64-linux-ld: pch_gbe_main.c:(.text+0x545c): undefined reference to `pch_ch_event_write'

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Jacob Keller Sept. 17, 2020, 7:38 p.m. UTC | #3
On 9/17/2020 12:16 AM, Leon Romanovsky wrote:
> On Thu, Sep 17, 2020 at 10:25:08AM +0800, Herrington wrote:
>> We get 1 warning when building kernel with W=1:
>> drivers/ptp/ptp_pch.c:182:5: warning: no previous prototype for ‘pch_ch_control_read’ [-Wmissing-prototypes]
>>  u32 pch_ch_control_read(struct pci_dev *pdev)
>> drivers/ptp/ptp_pch.c:193:6: warning: no previous prototype for ‘pch_ch_control_write’ [-Wmissing-prototypes]
>>  void pch_ch_control_write(struct pci_dev *pdev, u32 val)
>> drivers/ptp/ptp_pch.c:201:5: warning: no previous prototype for ‘pch_ch_event_read’ [-Wmissing-prototypes]
>>  u32 pch_ch_event_read(struct pci_dev *pdev)
>> drivers/ptp/ptp_pch.c:212:6: warning: no previous prototype for ‘pch_ch_event_write’ [-Wmissing-prototypes]
>>  void pch_ch_event_write(struct pci_dev *pdev, u32 val)
>> drivers/ptp/ptp_pch.c:220:5: warning: no previous prototype for ‘pch_src_uuid_lo_read’ [-Wmissing-prototypes]
>>  u32 pch_src_uuid_lo_read(struct pci_dev *pdev)
>> drivers/ptp/ptp_pch.c:231:5: warning: no previous prototype for ‘pch_src_uuid_hi_read’ [-Wmissing-prototypes]
>>  u32 pch_src_uuid_hi_read(struct pci_dev *pdev)
>> drivers/ptp/ptp_pch.c:242:5: warning: no previous prototype for ‘pch_rx_snap_read’ [-Wmissing-prototypes]
>>  u64 pch_rx_snap_read(struct pci_dev *pdev)
>> drivers/ptp/ptp_pch.c:259:5: warning: no previous prototype for ‘pch_tx_snap_read’ [-Wmissing-prototypes]
>>  u64 pch_tx_snap_read(struct pci_dev *pdev)
>> drivers/ptp/ptp_pch.c:300:5: warning: no previous prototype for ‘pch_set_station_address’ [-Wmissing-prototypes]
>>  int pch_set_station_address(u8 *addr, struct pci_dev *pdev)
>>
>> Signed-off-by: Herrington <hankinsea@gmail.com>
>> ---
>>  drivers/ptp/ptp_pch.c | 18 +++++++++---------
>>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> This file is total mess.
> 
>>
>> diff --git a/drivers/ptp/ptp_pch.c b/drivers/ptp/ptp_pch.c
>> index ce10ecd41ba0..8db2d1893577 100644
>> --- a/drivers/ptp/ptp_pch.c
>> +++ b/drivers/ptp/ptp_pch.c
>> @@ -179,7 +179,7 @@ static inline void pch_block_reset(struct pch_dev *chip)
>>  	iowrite32(val, (&chip->regs->control));
>>  }
>>
>> -u32 pch_ch_control_read(struct pci_dev *pdev)
>> +static u32 pch_ch_control_read(struct pci_dev *pdev)
>>  {
>>  	struct pch_dev *chip = pci_get_drvdata(pdev);
>>  	u32 val;
>> @@ -190,7 +190,7 @@ u32 pch_ch_control_read(struct pci_dev *pdev)
>>  }
>>  EXPORT_SYMBOL(pch_ch_control_read);
> 
> This function is not used and can be deleted.
> 
>>
>> -void pch_ch_control_write(struct pci_dev *pdev, u32 val)
>> +static void pch_ch_control_write(struct pci_dev *pdev, u32 val)
>>  {
>>  	struct pch_dev *chip = pci_get_drvdata(pdev);
>>
>> @@ -198,7 +198,7 @@ void pch_ch_control_write(struct pci_dev *pdev, u32 val)
>>  }
>>  EXPORT_SYMBOL(pch_ch_control_write);
> 
> 
> This function in use (incorrectly) by
> drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
> 
> Your patch will break it.
> 
> I didn't check other functions, but assume they are broken too.
> 
> Thanks
> 

Seems like the more appropriate fix is to include the right header so
that these functions do have prototypes.
diff mbox series

Patch

diff --git a/drivers/ptp/ptp_pch.c b/drivers/ptp/ptp_pch.c
index ce10ecd41ba0..8db2d1893577 100644
--- a/drivers/ptp/ptp_pch.c
+++ b/drivers/ptp/ptp_pch.c
@@ -179,7 +179,7 @@  static inline void pch_block_reset(struct pch_dev *chip)
 	iowrite32(val, (&chip->regs->control));
 }
 
-u32 pch_ch_control_read(struct pci_dev *pdev)
+static u32 pch_ch_control_read(struct pci_dev *pdev)
 {
 	struct pch_dev *chip = pci_get_drvdata(pdev);
 	u32 val;
@@ -190,7 +190,7 @@  u32 pch_ch_control_read(struct pci_dev *pdev)
 }
 EXPORT_SYMBOL(pch_ch_control_read);
 
-void pch_ch_control_write(struct pci_dev *pdev, u32 val)
+static void pch_ch_control_write(struct pci_dev *pdev, u32 val)
 {
 	struct pch_dev *chip = pci_get_drvdata(pdev);
 
@@ -198,7 +198,7 @@  void pch_ch_control_write(struct pci_dev *pdev, u32 val)
 }
 EXPORT_SYMBOL(pch_ch_control_write);
 
-u32 pch_ch_event_read(struct pci_dev *pdev)
+static u32 pch_ch_event_read(struct pci_dev *pdev)
 {
 	struct pch_dev *chip = pci_get_drvdata(pdev);
 	u32 val;
@@ -209,7 +209,7 @@  u32 pch_ch_event_read(struct pci_dev *pdev)
 }
 EXPORT_SYMBOL(pch_ch_event_read);
 
-void pch_ch_event_write(struct pci_dev *pdev, u32 val)
+static void pch_ch_event_write(struct pci_dev *pdev, u32 val)
 {
 	struct pch_dev *chip = pci_get_drvdata(pdev);
 
@@ -217,7 +217,7 @@  void pch_ch_event_write(struct pci_dev *pdev, u32 val)
 }
 EXPORT_SYMBOL(pch_ch_event_write);
 
-u32 pch_src_uuid_lo_read(struct pci_dev *pdev)
+static u32 pch_src_uuid_lo_read(struct pci_dev *pdev)
 {
 	struct pch_dev *chip = pci_get_drvdata(pdev);
 	u32 val;
@@ -228,7 +228,7 @@  u32 pch_src_uuid_lo_read(struct pci_dev *pdev)
 }
 EXPORT_SYMBOL(pch_src_uuid_lo_read);
 
-u32 pch_src_uuid_hi_read(struct pci_dev *pdev)
+static u32 pch_src_uuid_hi_read(struct pci_dev *pdev)
 {
 	struct pch_dev *chip = pci_get_drvdata(pdev);
 	u32 val;
@@ -239,7 +239,7 @@  u32 pch_src_uuid_hi_read(struct pci_dev *pdev)
 }
 EXPORT_SYMBOL(pch_src_uuid_hi_read);
 
-u64 pch_rx_snap_read(struct pci_dev *pdev)
+static u64 pch_rx_snap_read(struct pci_dev *pdev)
 {
 	struct pch_dev *chip = pci_get_drvdata(pdev);
 	u64 ns;
@@ -256,7 +256,7 @@  u64 pch_rx_snap_read(struct pci_dev *pdev)
 }
 EXPORT_SYMBOL(pch_rx_snap_read);
 
-u64 pch_tx_snap_read(struct pci_dev *pdev)
+static u64 pch_tx_snap_read(struct pci_dev *pdev)
 {
 	struct pch_dev *chip = pci_get_drvdata(pdev);
 	u64 ns;
@@ -297,7 +297,7 @@  static void pch_reset(struct pch_dev *chip)
  *				    traffic on the  ethernet interface
  * @addr:	dress which contain the column separated address to be used.
  */
-int pch_set_station_address(u8 *addr, struct pci_dev *pdev)
+static int pch_set_station_address(u8 *addr, struct pci_dev *pdev)
 {
 	s32 i;
 	struct pch_dev *chip = pci_get_drvdata(pdev);