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 <[email protected]>
---
drivers/ptp/ptp_pch.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/ptp/ptp_pch.c b/drivers/ptp/ptp_pch.c
index ce10ecd41ba0..70eee68e8dfc 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,6 +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);
void pch_ch_control_write(struct pci_dev *pdev, u32 val)
{
struct pch_dev *chip = pci_get_drvdata(pdev);
@@ -198,6 +199,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);
u32 pch_ch_event_read(struct pci_dev *pdev)
{
struct pch_dev *chip = pci_get_drvdata(pdev);
@@ -209,6 +211,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);
void pch_ch_event_write(struct pci_dev *pdev, u32 val)
{
struct pch_dev *chip = pci_get_drvdata(pdev);
@@ -217,6 +220,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);
u32 pch_src_uuid_lo_read(struct pci_dev *pdev)
{
struct pch_dev *chip = pci_get_drvdata(pdev);
@@ -228,6 +232,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);
u32 pch_src_uuid_hi_read(struct pci_dev *pdev)
{
struct pch_dev *chip = pci_get_drvdata(pdev);
@@ -239,6 +244,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);
u64 pch_rx_snap_read(struct pci_dev *pdev)
{
struct pch_dev *chip = pci_get_drvdata(pdev);
@@ -256,6 +262,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);
u64 pch_tx_snap_read(struct pci_dev *pdev)
{
struct pch_dev *chip = pci_get_drvdata(pdev);
@@ -297,6 +304,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);
int pch_set_station_address(u8 *addr, struct pci_dev *pdev)
{
s32 i;
--
2.18.1
On Fri, 18 Sep 2020 14:10:13 +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 <[email protected]>
The declarations are in:
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h
You need to split those out into a shared header and include them
appropriately.
From: Herrington <[email protected]>
Date: Fri, 18 Sep 2020 14:10:13 +0800
> +void pch_ch_control_write(struct pci_dev *pdev, u32 val);
> void pch_ch_control_write(struct pci_dev *pdev, u32 val)
Prototypes belong in a header file not in the C file where they
are defined.
If these functions are accessed in other foo.c files, they are
getting the prototype from some header file.
Otherwise they aren't, and the functions should be marked
static.