linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 net-next 1/7] ptp_pch: use mac_pton()
@ 2021-08-13 12:29 Andy Shevchenko
  2021-08-13 12:29 ` [PATCH v1 net-next 2/7] ptp_pch: Use ioread64_lo_hi() / iowrite64_lo_hi() Andy Shevchenko
                   ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: Andy Shevchenko @ 2021-08-13 12:29 UTC (permalink / raw)
  To: Andy Shevchenko, netdev, linux-kernel; +Cc: Richard Cochran

Use mac_pton() instead of custom approach.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/ptp/ptp_pch.c | 41 ++++++++++-------------------------------
 1 file changed, 10 insertions(+), 31 deletions(-)

diff --git a/drivers/ptp/ptp_pch.c b/drivers/ptp/ptp_pch.c
index a17e8cc642c5..76ba94f419ff 100644
--- a/drivers/ptp/ptp_pch.c
+++ b/drivers/ptp/ptp_pch.c
@@ -100,7 +100,6 @@ struct pch_ts_regs {
 #define PCH_ECS_ETH		(1 << 0)
 
 #define PCH_ECS_CAN		(1 << 1)
-#define PCH_STATION_BYTES	6
 
 #define PCH_IEEE1588_ETH	(1 << 0)
 #define PCH_IEEE1588_CAN	(1 << 1)
@@ -292,8 +291,9 @@ static void pch_reset(struct pch_dev *chip)
  */
 int pch_set_station_address(u8 *addr, struct pci_dev *pdev)
 {
-	s32 i;
 	struct pch_dev *chip = pci_get_drvdata(pdev);
+	bool valid;
+	u64 mac;
 
 	/* Verify the parameter */
 	if ((chip->regs == NULL) || addr == (u8 *)NULL) {
@@ -301,37 +301,16 @@ int pch_set_station_address(u8 *addr, struct pci_dev *pdev)
 			"invalid params returning PCH_INVALIDPARAM\n");
 		return PCH_INVALIDPARAM;
 	}
-	/* For all station address bytes */
-	for (i = 0; i < PCH_STATION_BYTES; i++) {
-		u32 val;
-		s32 tmp;
 
-		tmp = hex_to_bin(addr[i * 3]);
-		if (tmp < 0) {
-			dev_err(&pdev->dev,
-				"invalid params returning PCH_INVALIDPARAM\n");
-			return PCH_INVALIDPARAM;
-		}
-		val = tmp * 16;
-		tmp = hex_to_bin(addr[(i * 3) + 1]);
-		if (tmp < 0) {
-			dev_err(&pdev->dev,
-				"invalid params returning PCH_INVALIDPARAM\n");
-			return PCH_INVALIDPARAM;
-		}
-		val += tmp;
-		/* Expects ':' separated addresses */
-		if ((i < 5) && (addr[(i * 3) + 2] != ':')) {
-			dev_err(&pdev->dev,
-				"invalid params returning PCH_INVALIDPARAM\n");
-			return PCH_INVALIDPARAM;
-		}
-
-		/* Ideally we should set the address only after validating
-							 entire string */
-		dev_dbg(&pdev->dev, "invoking pch_station_set\n");
-		iowrite32(val, &chip->regs->ts_st[i]);
+	valid = mac_pton(addr, (u8 *)&mac);
+	if (!valid) {
+		dev_err(&pdev->dev, "invalid params returning PCH_INVALIDPARAM\n");
+		return PCH_INVALIDPARAM;
 	}
+
+	dev_dbg(&pdev->dev, "invoking pch_station_set\n");
+	iowrite32(lower_32_bits(mac), &chip->regs->ts_st[0]);
+	iowrite32(upper_32_bits(mac), &chip->regs->ts_st[4]);
 	return 0;
 }
 EXPORT_SYMBOL(pch_set_station_address);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v1 net-next 2/7] ptp_pch: Use ioread64_lo_hi() / iowrite64_lo_hi()
  2021-08-13 12:29 [PATCH v1 net-next 1/7] ptp_pch: use mac_pton() Andy Shevchenko
@ 2021-08-13 12:29 ` Andy Shevchenko
  2021-08-17 16:54   ` kernel test robot
  2021-08-13 12:29 ` [PATCH v1 net-next 3/7] ptp_pch: Use ioread64_hi_lo() / iowrite64_hi_lo() Andy Shevchenko
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: Andy Shevchenko @ 2021-08-13 12:29 UTC (permalink / raw)
  To: Andy Shevchenko, netdev, linux-kernel; +Cc: Richard Cochran

There is already helper functions to do 64-bit I/O on 32-bit machines or
buses, thus we don't need to reinvent the wheel.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/ptp/ptp_pch.c | 46 ++++++++++---------------------------------
 1 file changed, 10 insertions(+), 36 deletions(-)

diff --git a/drivers/ptp/ptp_pch.c b/drivers/ptp/ptp_pch.c
index 76ba94f419ff..501155b72b12 100644
--- a/drivers/ptp/ptp_pch.c
+++ b/drivers/ptp/ptp_pch.c
@@ -13,6 +13,7 @@
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
+#include <linux/io-64-nonatomic-lo-hi.h>
 #include <linux/irq.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
@@ -147,28 +148,15 @@ static inline void pch_eth_enable_set(struct pch_dev *chip)
 static u64 pch_systime_read(struct pch_ts_regs __iomem *regs)
 {
 	u64 ns;
-	u32 lo, hi;
 
-	lo = ioread32(&regs->systime_lo);
-	hi = ioread32(&regs->systime_hi);
+	ns = ioread64_lo_hi(&regs->systime_lo);
 
-	ns = ((u64) hi) << 32;
-	ns |= lo;
-	ns <<= TICKS_NS_SHIFT;
-
-	return ns;
+	return ns << TICKS_NS_SHIFT;
 }
 
 static void pch_systime_write(struct pch_ts_regs __iomem *regs, u64 ns)
 {
-	u32 hi, lo;
-
-	ns >>= TICKS_NS_SHIFT;
-	hi = ns >> 32;
-	lo = ns & 0xffffffff;
-
-	iowrite32(lo, &regs->systime_lo);
-	iowrite32(hi, &regs->systime_hi);
+	iowrite64_lo_hi(ns >> TICKS_NS_SHIFT, &regs->systime_lo);
 }
 
 static inline void pch_block_reset(struct pch_dev *chip)
@@ -234,16 +222,10 @@ u64 pch_rx_snap_read(struct pci_dev *pdev)
 {
 	struct pch_dev *chip = pci_get_drvdata(pdev);
 	u64 ns;
-	u32 lo, hi;
 
-	lo = ioread32(&chip->regs->rx_snap_lo);
-	hi = ioread32(&chip->regs->rx_snap_hi);
+	ns = ioread64_lo_hi(&chip->regs->rx_snap_lo);
 
-	ns = ((u64) hi) << 32;
-	ns |= lo;
-	ns <<= TICKS_NS_SHIFT;
-
-	return ns;
+	return ns << TICKS_NS_SHIFT;
 }
 EXPORT_SYMBOL(pch_rx_snap_read);
 
@@ -251,16 +233,10 @@ u64 pch_tx_snap_read(struct pci_dev *pdev)
 {
 	struct pch_dev *chip = pci_get_drvdata(pdev);
 	u64 ns;
-	u32 lo, hi;
-
-	lo = ioread32(&chip->regs->tx_snap_lo);
-	hi = ioread32(&chip->regs->tx_snap_hi);
 
-	ns = ((u64) hi) << 32;
-	ns |= lo;
-	ns <<= TICKS_NS_SHIFT;
+	ns = ioread64_lo_hi(&chip->regs->tx_snap_lo);
 
-	return ns;
+	return ns << TICKS_NS_SHIFT;
 }
 EXPORT_SYMBOL(pch_tx_snap_read);
 
@@ -309,8 +285,7 @@ int pch_set_station_address(u8 *addr, struct pci_dev *pdev)
 	}
 
 	dev_dbg(&pdev->dev, "invoking pch_station_set\n");
-	iowrite32(lower_32_bits(mac), &chip->regs->ts_st[0]);
-	iowrite32(upper_32_bits(mac), &chip->regs->ts_st[4]);
+	iowrite64_lo_hi(mac, &chip->regs->ts_st);
 	return 0;
 }
 EXPORT_SYMBOL(pch_set_station_address);
@@ -577,8 +552,7 @@ pch_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	pch_reset(chip);
 
 	iowrite32(DEFAULT_ADDEND, &chip->regs->addend);
-	iowrite32(1, &chip->regs->trgt_lo);
-	iowrite32(0, &chip->regs->trgt_hi);
+	iowrite64_lo_hi(1, &chip->regs->trgt_lo);
 	iowrite32(PCH_TSE_TTIPEND, &chip->regs->event);
 
 	pch_eth_enable_set(chip);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v1 net-next 3/7] ptp_pch: Use ioread64_hi_lo() / iowrite64_hi_lo()
  2021-08-13 12:29 [PATCH v1 net-next 1/7] ptp_pch: use mac_pton() Andy Shevchenko
  2021-08-13 12:29 ` [PATCH v1 net-next 2/7] ptp_pch: Use ioread64_lo_hi() / iowrite64_lo_hi() Andy Shevchenko
@ 2021-08-13 12:29 ` Andy Shevchenko
  2021-08-13 12:29 ` [PATCH v1 net-next 4/7] ptp_pch: Switch to use module_pci_driver() macro Andy Shevchenko
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 16+ messages in thread
From: Andy Shevchenko @ 2021-08-13 12:29 UTC (permalink / raw)
  To: Andy Shevchenko, netdev, linux-kernel; +Cc: Richard Cochran

There is already helper functions to do 64-bit I/O on 32-bit machines or
buses, thus we don't need to reinvent the wheel.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/ptp/ptp_pch.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/ptp/ptp_pch.c b/drivers/ptp/ptp_pch.c
index 501155b72b12..e7e31d4357e7 100644
--- a/drivers/ptp/ptp_pch.c
+++ b/drivers/ptp/ptp_pch.c
@@ -14,6 +14,7 @@
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/io-64-nonatomic-lo-hi.h>
+#include <linux/io-64-nonatomic-hi-lo.h>
 #include <linux/irq.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
@@ -298,19 +299,16 @@ static irqreturn_t isr(int irq, void *priv)
 	struct pch_dev *pch_dev = priv;
 	struct pch_ts_regs __iomem *regs = pch_dev->regs;
 	struct ptp_clock_event event;
-	u32 ack = 0, lo, hi, val;
+	u32 ack = 0, val;
 
 	val = ioread32(&regs->event);
 
 	if (val & PCH_TSE_SNS) {
 		ack |= PCH_TSE_SNS;
 		if (pch_dev->exts0_enabled) {
-			hi = ioread32(&regs->asms_hi);
-			lo = ioread32(&regs->asms_lo);
 			event.type = PTP_CLOCK_EXTTS;
 			event.index = 0;
-			event.timestamp = ((u64) hi) << 32;
-			event.timestamp |= lo;
+			event.timestamp = ioread64_hi_lo(&regs->asms_hi);
 			event.timestamp <<= TICKS_NS_SHIFT;
 			ptp_clock_event(pch_dev->ptp_clock, &event);
 		}
@@ -319,12 +317,9 @@ static irqreturn_t isr(int irq, void *priv)
 	if (val & PCH_TSE_SNM) {
 		ack |= PCH_TSE_SNM;
 		if (pch_dev->exts1_enabled) {
-			hi = ioread32(&regs->amms_hi);
-			lo = ioread32(&regs->amms_lo);
 			event.type = PTP_CLOCK_EXTTS;
 			event.index = 1;
-			event.timestamp = ((u64) hi) << 32;
-			event.timestamp |= lo;
+			event.timestamp = ioread64_hi_lo(&regs->asms_hi);
 			event.timestamp <<= TICKS_NS_SHIFT;
 			ptp_clock_event(pch_dev->ptp_clock, &event);
 		}
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v1 net-next 4/7] ptp_pch: Switch to use module_pci_driver() macro
  2021-08-13 12:29 [PATCH v1 net-next 1/7] ptp_pch: use mac_pton() Andy Shevchenko
  2021-08-13 12:29 ` [PATCH v1 net-next 2/7] ptp_pch: Use ioread64_lo_hi() / iowrite64_lo_hi() Andy Shevchenko
  2021-08-13 12:29 ` [PATCH v1 net-next 3/7] ptp_pch: Use ioread64_hi_lo() / iowrite64_hi_lo() Andy Shevchenko
@ 2021-08-13 12:29 ` Andy Shevchenko
  2021-08-13 14:34   ` kernel test robot
  2021-08-13 16:19   ` kernel test robot
  2021-08-13 12:29 ` [PATCH v1 net-next 5/7] ptp_pch: Convert to use managed functions pcim_* and devm_* Andy Shevchenko
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 16+ messages in thread
From: Andy Shevchenko @ 2021-08-13 12:29 UTC (permalink / raw)
  To: Andy Shevchenko, netdev, linux-kernel; +Cc: Richard Cochran

Eliminate some boilerplate code by using module_pci_driver() instead of
init/exit, and, if needed, moving the salient bits from init into probe.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/ptp/ptp_pch.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)

diff --git a/drivers/ptp/ptp_pch.c b/drivers/ptp/ptp_pch.c
index e7e31d4357e7..f3aafe45e1a6 100644
--- a/drivers/ptp/ptp_pch.c
+++ b/drivers/ptp/ptp_pch.c
@@ -10,7 +10,6 @@
 
 #include <linux/device.h>
 #include <linux/err.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/io-64-nonatomic-lo-hi.h>
@@ -602,24 +601,7 @@ static struct pci_driver pch_driver = {
 	.remove = pch_remove,
 	.driver.pm = &pch_pm_ops,
 };
-
-static void __exit ptp_pch_exit(void)
-{
-	pci_unregister_driver(&pch_driver);
-}
-
-static s32 __init ptp_pch_init(void)
-{
-	s32 ret;
-
-	/* register the driver with the pci core */
-	ret = pci_register_driver(&pch_driver);
-
-	return ret;
-}
-
-module_init(ptp_pch_init);
-module_exit(ptp_pch_exit);
+module_pci_driver(pch_driver);
 
 module_param_string(station,
 		    pch_param.station, sizeof(pch_param.station), 0444);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v1 net-next 5/7] ptp_pch: Convert to use managed functions pcim_* and devm_*
  2021-08-13 12:29 [PATCH v1 net-next 1/7] ptp_pch: use mac_pton() Andy Shevchenko
                   ` (2 preceding siblings ...)
  2021-08-13 12:29 ` [PATCH v1 net-next 4/7] ptp_pch: Switch to use module_pci_driver() macro Andy Shevchenko
@ 2021-08-13 12:29 ` Andy Shevchenko
  2021-08-13 12:29 ` [PATCH v1 net-next 6/7] ptp_pch: Remove unused pch_pm_ops Andy Shevchenko
  2021-08-13 12:29 ` [PATCH v1 net-next 7/7] ptp_pch: Load module automatically if ID matches Andy Shevchenko
  5 siblings, 0 replies; 16+ messages in thread
From: Andy Shevchenko @ 2021-08-13 12:29 UTC (permalink / raw)
  To: Andy Shevchenko, netdev, linux-kernel; +Cc: Richard Cochran

This makes the error handling much more simpler than open-coding everything
and in addition makes the probe function smaller an tidier.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/ptp/ptp_pch.c | 73 ++++++-------------------------------------
 1 file changed, 10 insertions(+), 63 deletions(-)

diff --git a/drivers/ptp/ptp_pch.c b/drivers/ptp/ptp_pch.c
index f3aafe45e1a6..29f793b04f2f 100644
--- a/drivers/ptp/ptp_pch.c
+++ b/drivers/ptp/ptp_pch.c
@@ -115,8 +115,6 @@ struct pch_dev {
 	int exts0_enabled;
 	int exts1_enabled;
 
-	u32 mem_base;
-	u32 mem_size;
 	u32 irq;
 	struct pci_dev *pdev;
 	spinlock_t register_lock;
@@ -456,24 +454,8 @@ static void pch_remove(struct pci_dev *pdev)
 {
 	struct pch_dev *chip = pci_get_drvdata(pdev);
 
+	free_irq(pdev->irq, chip);
 	ptp_clock_unregister(chip->ptp_clock);
-	/* free the interrupt */
-	if (pdev->irq != 0)
-		free_irq(pdev->irq, chip);
-
-	/* unmap the virtual IO memory space */
-	if (chip->regs != NULL) {
-		iounmap(chip->regs);
-		chip->regs = NULL;
-	}
-	/* release the reserved IO memory space */
-	if (chip->mem_base != 0) {
-		release_mem_region(chip->mem_base, chip->mem_size);
-		chip->mem_base = 0;
-	}
-	pci_disable_device(pdev);
-	kfree(chip);
-	dev_info(&pdev->dev, "complete\n");
 }
 
 static s32
@@ -483,50 +465,29 @@ pch_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	unsigned long flags;
 	struct pch_dev *chip;
 
-	chip = kzalloc(sizeof(struct pch_dev), GFP_KERNEL);
+	chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL);
 	if (chip == NULL)
 		return -ENOMEM;
 
 	/* enable the 1588 pci device */
-	ret = pci_enable_device(pdev);
+	ret = pcim_enable_device(pdev);
 	if (ret != 0) {
 		dev_err(&pdev->dev, "could not enable the pci device\n");
-		goto err_pci_en;
+		return ret;
 	}
 
-	chip->mem_base = pci_resource_start(pdev, IO_MEM_BAR);
-	if (!chip->mem_base) {
+	ret = pcim_iomap_regions(pdev, BIT(IO_MEM_BAR), "1588_regs");
+	if (ret) {
 		dev_err(&pdev->dev, "could not locate IO memory address\n");
-		ret = -ENODEV;
-		goto err_pci_start;
-	}
-
-	/* retrieve the available length of the IO memory space */
-	chip->mem_size = pci_resource_len(pdev, IO_MEM_BAR);
-
-	/* allocate the memory for the device registers */
-	if (!request_mem_region(chip->mem_base, chip->mem_size, "1588_regs")) {
-		dev_err(&pdev->dev,
-			"could not allocate register memory space\n");
-		ret = -EBUSY;
-		goto err_req_mem_region;
+		return ret;
 	}
 
 	/* get the virtual address to the 1588 registers */
-	chip->regs = ioremap(chip->mem_base, chip->mem_size);
-
-	if (!chip->regs) {
-		dev_err(&pdev->dev, "Could not get virtual address\n");
-		ret = -ENOMEM;
-		goto err_ioremap;
-	}
-
+	chip->regs = pcim_iomap_table(pdev)[IO_MEM_BAR];
 	chip->caps = ptp_pch_caps;
 	chip->ptp_clock = ptp_clock_register(&chip->caps, &pdev->dev);
-	if (IS_ERR(chip->ptp_clock)) {
-		ret = PTR_ERR(chip->ptp_clock);
-		goto err_ptp_clock_reg;
-	}
+	if (IS_ERR(chip->ptp_clock))
+		return PTR_ERR(chip->ptp_clock);
 
 	spin_lock_init(&chip->register_lock);
 
@@ -564,21 +525,7 @@ pch_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
 err_req_irq:
 	ptp_clock_unregister(chip->ptp_clock);
-err_ptp_clock_reg:
-	iounmap(chip->regs);
-	chip->regs = NULL;
-
-err_ioremap:
-	release_mem_region(chip->mem_base, chip->mem_size);
-
-err_req_mem_region:
-	chip->mem_base = 0;
-
-err_pci_start:
-	pci_disable_device(pdev);
 
-err_pci_en:
-	kfree(chip);
 	dev_err(&pdev->dev, "probe failed(ret=0x%x)\n", ret);
 
 	return ret;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v1 net-next 6/7] ptp_pch: Remove unused pch_pm_ops
  2021-08-13 12:29 [PATCH v1 net-next 1/7] ptp_pch: use mac_pton() Andy Shevchenko
                   ` (3 preceding siblings ...)
  2021-08-13 12:29 ` [PATCH v1 net-next 5/7] ptp_pch: Convert to use managed functions pcim_* and devm_* Andy Shevchenko
@ 2021-08-13 12:29 ` Andy Shevchenko
  2021-08-13 12:29 ` [PATCH v1 net-next 7/7] ptp_pch: Load module automatically if ID matches Andy Shevchenko
  5 siblings, 0 replies; 16+ messages in thread
From: Andy Shevchenko @ 2021-08-13 12:29 UTC (permalink / raw)
  To: Andy Shevchenko, netdev, linux-kernel; +Cc: Richard Cochran

The default values for hooks in the driver.pm are NULLs.
Hence drop unused pch_pm_ops.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/ptp/ptp_pch.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/ptp/ptp_pch.c b/drivers/ptp/ptp_pch.c
index 29f793b04f2f..13c3fb7e1fbe 100644
--- a/drivers/ptp/ptp_pch.c
+++ b/drivers/ptp/ptp_pch.c
@@ -447,9 +447,6 @@ static const struct ptp_clock_info ptp_pch_caps = {
 	.enable		= ptp_pch_enable,
 };
 
-#define pch_suspend NULL
-#define pch_resume NULL
-
 static void pch_remove(struct pci_dev *pdev)
 {
 	struct pch_dev *chip = pci_get_drvdata(pdev);
@@ -539,14 +536,11 @@ static const struct pci_device_id pch_ieee1588_pcidev_id[] = {
 	{0}
 };
 
-static SIMPLE_DEV_PM_OPS(pch_pm_ops, pch_suspend, pch_resume);
-
 static struct pci_driver pch_driver = {
 	.name = KBUILD_MODNAME,
 	.id_table = pch_ieee1588_pcidev_id,
 	.probe = pch_probe,
 	.remove = pch_remove,
-	.driver.pm = &pch_pm_ops,
 };
 module_pci_driver(pch_driver);
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v1 net-next 7/7] ptp_pch: Load module automatically if ID matches
  2021-08-13 12:29 [PATCH v1 net-next 1/7] ptp_pch: use mac_pton() Andy Shevchenko
                   ` (4 preceding siblings ...)
  2021-08-13 12:29 ` [PATCH v1 net-next 6/7] ptp_pch: Remove unused pch_pm_ops Andy Shevchenko
@ 2021-08-13 12:29 ` Andy Shevchenko
  5 siblings, 0 replies; 16+ messages in thread
From: Andy Shevchenko @ 2021-08-13 12:29 UTC (permalink / raw)
  To: Andy Shevchenko, netdev, linux-kernel; +Cc: Richard Cochran

The driver can't be loaded automatically because it misses
module alias to be provided. Add corresponding MODULE_DEVICE_TABLE()
call to the driver.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/ptp/ptp_pch.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/ptp/ptp_pch.c b/drivers/ptp/ptp_pch.c
index 13c3fb7e1fbe..7d4da9e605ef 100644
--- a/drivers/ptp/ptp_pch.c
+++ b/drivers/ptp/ptp_pch.c
@@ -535,6 +535,7 @@ static const struct pci_device_id pch_ieee1588_pcidev_id[] = {
 	 },
 	{0}
 };
+MODULE_DEVICE_TABLE(pci, pch_ieee1588_pcidev_id);
 
 static struct pci_driver pch_driver = {
 	.name = KBUILD_MODNAME,
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH v1 net-next 4/7] ptp_pch: Switch to use module_pci_driver() macro
  2021-08-13 12:29 ` [PATCH v1 net-next 4/7] ptp_pch: Switch to use module_pci_driver() macro Andy Shevchenko
@ 2021-08-13 14:34   ` kernel test robot
  2021-08-13 15:13     ` Andy Shevchenko
  2021-08-13 16:19   ` kernel test robot
  1 sibling, 1 reply; 16+ messages in thread
From: kernel test robot @ 2021-08-13 14:34 UTC (permalink / raw)
  To: Andy Shevchenko, netdev, linux-kernel; +Cc: kbuild-all, Richard Cochran

[-- Attachment #1: Type: text/plain, Size: 2249 bytes --]

Hi Andy,

I love your patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Andy-Shevchenko/ptp_pch-use-mac_pton/20210813-203135
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git b769cf44ed55f4b277b89cf53df6092f0c9082d0
config: nios2-randconfig-r023-20210813 (attached as .config)
compiler: nios2-linux-gcc (GCC) 11.2.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
        # https://github.com/0day-ci/linux/commit/6c1fff5c80fe8f1a12c20bac2d28ebfa5960bde7
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Andy-Shevchenko/ptp_pch-use-mac_pton/20210813-203135
        git checkout 6c1fff5c80fe8f1a12c20bac2d28ebfa5960bde7
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=nios2 

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

All error/warnings (new ones prefixed by >>):

>> drivers/ptp/ptp_pch.c:604:1: warning: data definition has no type or storage class
     604 | module_pci_driver(pch_driver);
         | ^~~~~~~~~~~~~~~~~
>> drivers/ptp/ptp_pch.c:604:1: error: type defaults to 'int' in declaration of 'module_pci_driver' [-Werror=implicit-int]
>> drivers/ptp/ptp_pch.c:604:1: warning: parameter names (without types) in function declaration
   drivers/ptp/ptp_pch.c:597:26: warning: 'pch_driver' defined but not used [-Wunused-variable]
     597 | static struct pci_driver pch_driver = {
         |                          ^~~~~~~~~~
   cc1: some warnings being treated as errors


vim +604 drivers/ptp/ptp_pch.c

   596	
   597	static struct pci_driver pch_driver = {
   598		.name = KBUILD_MODNAME,
   599		.id_table = pch_ieee1588_pcidev_id,
   600		.probe = pch_probe,
   601		.remove = pch_remove,
   602		.driver.pm = &pch_pm_ops,
   603	};
 > 604	module_pci_driver(pch_driver);
   605	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 38989 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v1 net-next 4/7] ptp_pch: Switch to use module_pci_driver() macro
  2021-08-13 14:34   ` kernel test robot
@ 2021-08-13 15:13     ` Andy Shevchenko
  2021-08-13 15:39       ` Andy Shevchenko
  0 siblings, 1 reply; 16+ messages in thread
From: Andy Shevchenko @ 2021-08-13 15:13 UTC (permalink / raw)
  To: kernel test robot; +Cc: netdev, linux-kernel, kbuild-all, Richard Cochran

On Fri, Aug 13, 2021 at 10:34:17PM +0800, kernel test robot wrote:
> Hi Andy,
> 
> I love your patch! Yet something to improve:
> 
> [auto build test ERROR on net-next/master]
> 
> url:    https://github.com/0day-ci/linux/commits/Andy-Shevchenko/ptp_pch-use-mac_pton/20210813-203135
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git b769cf44ed55f4b277b89cf53df6092f0c9082d0
> config: nios2-randconfig-r023-20210813 (attached as .config)
> compiler: nios2-linux-gcc (GCC) 11.2.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
>         # https://github.com/0day-ci/linux/commit/6c1fff5c80fe8f1a12c20bac2d28ebfa5960bde7
>         git remote add linux-review https://github.com/0day-ci/linux
>         git fetch --no-tags linux-review Andy-Shevchenko/ptp_pch-use-mac_pton/20210813-203135
>         git checkout 6c1fff5c80fe8f1a12c20bac2d28ebfa5960bde7
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=nios2 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>

Thanks!

Definitely I have compiled it in my local branch. I'll check what is the root
cause of this.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v1 net-next 4/7] ptp_pch: Switch to use module_pci_driver() macro
  2021-08-13 15:13     ` Andy Shevchenko
@ 2021-08-13 15:39       ` Andy Shevchenko
  2021-08-13 18:23         ` Jakub Kicinski
  0 siblings, 1 reply; 16+ messages in thread
From: Andy Shevchenko @ 2021-08-13 15:39 UTC (permalink / raw)
  To: kernel test robot; +Cc: netdev, linux-kernel, kbuild-all, Richard Cochran

On Fri, Aug 13, 2021 at 06:13:21PM +0300, Andy Shevchenko wrote:
> On Fri, Aug 13, 2021 at 10:34:17PM +0800, kernel test robot wrote:
> > Hi Andy,
> > 
> > I love your patch! Yet something to improve:
> > 
> > [auto build test ERROR on net-next/master]
> > 
> > url:    https://github.com/0day-ci/linux/commits/Andy-Shevchenko/ptp_pch-use-mac_pton/20210813-203135
> > base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git b769cf44ed55f4b277b89cf53df6092f0c9082d0
> > config: nios2-randconfig-r023-20210813 (attached as .config)
> > compiler: nios2-linux-gcc (GCC) 11.2.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
> >         # https://github.com/0day-ci/linux/commit/6c1fff5c80fe8f1a12c20bac2d28ebfa5960bde7
> >         git remote add linux-review https://github.com/0day-ci/linux
> >         git fetch --no-tags linux-review Andy-Shevchenko/ptp_pch-use-mac_pton/20210813-203135
> >         git checkout 6c1fff5c80fe8f1a12c20bac2d28ebfa5960bde7
> >         # save the attached .config to linux build tree
> >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=nios2 
> > 
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> 
> Thanks!
> 
> Definitely I have compiled it in my local branch. I'll check what is the root
> cause of this.

Kconfig misses PCI dependency. I will send a separate patch, there is nothing
to do here.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v1 net-next 4/7] ptp_pch: Switch to use module_pci_driver() macro
  2021-08-13 12:29 ` [PATCH v1 net-next 4/7] ptp_pch: Switch to use module_pci_driver() macro Andy Shevchenko
  2021-08-13 14:34   ` kernel test robot
@ 2021-08-13 16:19   ` kernel test robot
  1 sibling, 0 replies; 16+ messages in thread
From: kernel test robot @ 2021-08-13 16:19 UTC (permalink / raw)
  To: Andy Shevchenko, netdev, linux-kernel
  Cc: clang-built-linux, kbuild-all, Richard Cochran

[-- Attachment #1: Type: text/plain, Size: 8286 bytes --]

Hi Andy,

I love your patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Andy-Shevchenko/ptp_pch-use-mac_pton/20210813-203135
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git b769cf44ed55f4b277b89cf53df6092f0c9082d0
config: powerpc64-randconfig-r034-20210813 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 62df4df41c939205b2dc0a2a3bfb75b8c1ed74fa)
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
        # install powerpc64 cross compiling tool for clang build
        # apt-get install binutils-powerpc-linux-gnu
        # https://github.com/0day-ci/linux/commit/6c1fff5c80fe8f1a12c20bac2d28ebfa5960bde7
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Andy-Shevchenko/ptp_pch-use-mac_pton/20210813-203135
        git checkout 6c1fff5c80fe8f1a12c20bac2d28ebfa5960bde7
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross O=build_dir ARCH=powerpc SHELL=/bin/bash drivers/ptp/

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

All error/warnings (new ones prefixed by >>):

   __do_insb
   ^
   arch/powerpc/include/asm/io.h:556:56: note: expanded from macro '__do_insb'
   #define __do_insb(p, b, n)      readsb((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
                                          ~~~~~~~~~~~~~~~~~~~~~^
   In file included from drivers/ptp/ptp_pch.c:13:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:45:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(insw, (unsigned long p, void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:174:1: note: expanded from here
   __do_insw
   ^
   arch/powerpc/include/asm/io.h:557:56: note: expanded from macro '__do_insw'
   #define __do_insw(p, b, n)      readsw((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
                                          ~~~~~~~~~~~~~~~~~~~~~^
   In file included from drivers/ptp/ptp_pch.c:13:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:47:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(insl, (unsigned long p, void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:176:1: note: expanded from here
   __do_insl
   ^
   arch/powerpc/include/asm/io.h:558:56: note: expanded from macro '__do_insl'
   #define __do_insl(p, b, n)      readsl((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
                                          ~~~~~~~~~~~~~~~~~~~~~^
   In file included from drivers/ptp/ptp_pch.c:13:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:49:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(outsb, (unsigned long p, const void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:178:1: note: expanded from here
   __do_outsb
   ^
   arch/powerpc/include/asm/io.h:559:58: note: expanded from macro '__do_outsb'
   #define __do_outsb(p, b, n)     writesb((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
                                           ~~~~~~~~~~~~~~~~~~~~~^
   In file included from drivers/ptp/ptp_pch.c:13:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:51:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(outsw, (unsigned long p, const void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:180:1: note: expanded from here
   __do_outsw
   ^
   arch/powerpc/include/asm/io.h:560:58: note: expanded from macro '__do_outsw'
   #define __do_outsw(p, b, n)     writesw((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
                                           ~~~~~~~~~~~~~~~~~~~~~^
   In file included from drivers/ptp/ptp_pch.c:13:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:53:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(outsl, (unsigned long p, const void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:182:1: note: expanded from here
   __do_outsl
   ^
   arch/powerpc/include/asm/io.h:561:58: note: expanded from macro '__do_outsl'
   #define __do_outsl(p, b, n)     writesl((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
                                           ~~~~~~~~~~~~~~~~~~~~~^
>> drivers/ptp/ptp_pch.c:604:1: warning: declaration specifier missing, defaulting to 'int'
   module_pci_driver(pch_driver);
   ^
   int
>> drivers/ptp/ptp_pch.c:604:19: error: a parameter list without types is only allowed in a function definition
   module_pci_driver(pch_driver);
                     ^
   13 warnings and 1 error generated.


vim +604 drivers/ptp/ptp_pch.c

   596	
   597	static struct pci_driver pch_driver = {
   598		.name = KBUILD_MODNAME,
   599		.id_table = pch_ieee1588_pcidev_id,
   600		.probe = pch_probe,
   601		.remove = pch_remove,
   602		.driver.pm = &pch_pm_ops,
   603	};
 > 604	module_pci_driver(pch_driver);
   605	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 35479 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v1 net-next 4/7] ptp_pch: Switch to use module_pci_driver() macro
  2021-08-13 15:39       ` Andy Shevchenko
@ 2021-08-13 18:23         ` Jakub Kicinski
  2021-08-13 19:26           ` Andy Shevchenko
  2021-08-23  8:29           ` Andy Shevchenko
  0 siblings, 2 replies; 16+ messages in thread
From: Jakub Kicinski @ 2021-08-13 18:23 UTC (permalink / raw)
  To: Andy Shevchenko, Bjorn Helgaas
  Cc: kernel test robot, netdev, linux-kernel, kbuild-all, Richard Cochran

On Fri, 13 Aug 2021 18:39:14 +0300 Andy Shevchenko wrote:
> On Fri, Aug 13, 2021 at 06:13:21PM +0300, Andy Shevchenko wrote:
> > On Fri, Aug 13, 2021 at 10:34:17PM +0800, kernel test robot wrote:  
> > > Hi Andy,
> > > 
> > > I love your patch! Yet something to improve:
> > > 
> > > [auto build test ERROR on net-next/master]
> > > 
> > > url:    https://github.com/0day-ci/linux/commits/Andy-Shevchenko/ptp_pch-use-mac_pton/20210813-203135
> > > base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git b769cf44ed55f4b277b89cf53df6092f0c9082d0
> > > config: nios2-randconfig-r023-20210813 (attached as .config)
> > > compiler: nios2-linux-gcc (GCC) 11.2.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
> > >         # https://github.com/0day-ci/linux/commit/6c1fff5c80fe8f1a12c20bac2d28ebfa5960bde7
> > >         git remote add linux-review https://github.com/0day-ci/linux
> > >         git fetch --no-tags linux-review Andy-Shevchenko/ptp_pch-use-mac_pton/20210813-203135
> > >         git checkout 6c1fff5c80fe8f1a12c20bac2d28ebfa5960bde7
> > >         # save the attached .config to linux build tree
> > >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=nios2 
> > > 
> > > If you fix the issue, kindly add following tag as appropriate
> > > Reported-by: kernel test robot <lkp@intel.com>  
> > 
> > Thanks!
> > 
> > Definitely I have compiled it in my local branch. I'll check what is the root
> > cause of this.  
> 
> Kconfig misses PCI dependency. I will send a separate patch, there is nothing
> to do here.

That patch has to be before this one, tho. There is a static inline
stub for pci_register_driver() etc. if !PCI, but there isn't for
module_pci_driver(), meaning in builds without PCI this driver used 
to be harmlessly pointless, now it's breaking build.

Am I missing something?

Adding Bjorn in case he has a preference on adding the dependency vs
stubbing out module_pci_driver().

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v1 net-next 4/7] ptp_pch: Switch to use module_pci_driver() macro
  2021-08-13 18:23         ` Jakub Kicinski
@ 2021-08-13 19:26           ` Andy Shevchenko
  2021-08-13 19:38             ` Andy Shevchenko
  2021-08-23  8:29           ` Andy Shevchenko
  1 sibling, 1 reply; 16+ messages in thread
From: Andy Shevchenko @ 2021-08-13 19:26 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Andy Shevchenko, Bjorn Helgaas, kernel test robot, netdev,
	Linux Kernel Mailing List, kbuild-all, Richard Cochran

On Fri, Aug 13, 2021 at 9:23 PM Jakub Kicinski <kuba@kernel.org> wrote:
> On Fri, 13 Aug 2021 18:39:14 +0300 Andy Shevchenko wrote:
> > On Fri, Aug 13, 2021 at 06:13:21PM +0300, Andy Shevchenko wrote:
> > > On Fri, Aug 13, 2021 at 10:34:17PM +0800, kernel test robot wrote:
> > > > Hi Andy,
> > > >
> > > > I love your patch! Yet something to improve:
> > > >
> > > > [auto build test ERROR on net-next/master]
> > > >
> > > > url:    https://github.com/0day-ci/linux/commits/Andy-Shevchenko/ptp_pch-use-mac_pton/20210813-203135
> > > > base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git b769cf44ed55f4b277b89cf53df6092f0c9082d0
> > > > config: nios2-randconfig-r023-20210813 (attached as .config)
> > > > compiler: nios2-linux-gcc (GCC) 11.2.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
> > > >         # https://github.com/0day-ci/linux/commit/6c1fff5c80fe8f1a12c20bac2d28ebfa5960bde7
> > > >         git remote add linux-review https://github.com/0day-ci/linux
> > > >         git fetch --no-tags linux-review Andy-Shevchenko/ptp_pch-use-mac_pton/20210813-203135
> > > >         git checkout 6c1fff5c80fe8f1a12c20bac2d28ebfa5960bde7
> > > >         # save the attached .config to linux build tree
> > > >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=nios2
> > > >
> > > > If you fix the issue, kindly add following tag as appropriate
> > > > Reported-by: kernel test robot <lkp@intel.com>
> > >
> > > Thanks!
> > >
> > > Definitely I have compiled it in my local branch. I'll check what is the root
> > > cause of this.
> >
> > Kconfig misses PCI dependency. I will send a separate patch, there is nothing
> > to do here.
>
> That patch has to be before this one, tho.

Yes, I have sent it as a fix to the net, this series is to the
net-next. Am I missing something in the process here? Because I have
been told a few times that I mustn't collect net and net-next patches
in one series in the usual cases.

> There is a static inline
> stub for pci_register_driver() etc. if !PCI, but there isn't for
> module_pci_driver(), meaning in builds without PCI this driver used
> to be harmlessly pointless, now it's breaking build.

> Am I missing something?
>
> Adding Bjorn in case he has a preference on adding the dependency vs
> stubbing out module_pci_driver().

I went all the same way but I have checked SPI and I²C how they are
doing. It seems the common practice is to use direct dependency.
Nevertheless, the stubs in PCI puzzled me a bit, why do we have them
in the first place?


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v1 net-next 4/7] ptp_pch: Switch to use module_pci_driver() macro
  2021-08-13 19:26           ` Andy Shevchenko
@ 2021-08-13 19:38             ` Andy Shevchenko
  0 siblings, 0 replies; 16+ messages in thread
From: Andy Shevchenko @ 2021-08-13 19:38 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Andy Shevchenko, Bjorn Helgaas, kernel test robot, netdev,
	Linux Kernel Mailing List, kbuild-all, Richard Cochran

On Fri, Aug 13, 2021 at 10:26 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Fri, Aug 13, 2021 at 9:23 PM Jakub Kicinski <kuba@kernel.org> wrote:
> > On Fri, 13 Aug 2021 18:39:14 +0300 Andy Shevchenko wrote:
> > > On Fri, Aug 13, 2021 at 06:13:21PM +0300, Andy Shevchenko wrote:

...

> > > Kconfig misses PCI dependency. I will send a separate patch, there is nothing
> > > to do here.
> >
> > That patch has to be before this one, tho.
>
> Yes, I have sent it as a fix to the net, this series is to the
> net-next.

For the sake of reference:
https://lore.kernel.org/netdev/20210813173328.16512-1-andriy.shevchenko@linux.intel.com/T/#u

And by the way, dependency (although implicit) was there, see above
commit message.

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v1 net-next 2/7] ptp_pch: Use ioread64_lo_hi() / iowrite64_lo_hi()
  2021-08-13 12:29 ` [PATCH v1 net-next 2/7] ptp_pch: Use ioread64_lo_hi() / iowrite64_lo_hi() Andy Shevchenko
@ 2021-08-17 16:54   ` kernel test robot
  0 siblings, 0 replies; 16+ messages in thread
From: kernel test robot @ 2021-08-17 16:54 UTC (permalink / raw)
  To: Andy Shevchenko, netdev, linux-kernel; +Cc: kbuild-all, Richard Cochran

[-- Attachment #1: Type: text/plain, Size: 2392 bytes --]

Hi Andy,

I love your patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Andy-Shevchenko/ptp_pch-use-mac_pton/20210813-203135
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git b769cf44ed55f4b277b89cf53df6092f0c9082d0
config: parisc-allyesconfig (attached as .config)
compiler: hppa-linux-gcc (GCC) 11.2.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
        # https://github.com/0day-ci/linux/commit/c854fdc883f2a8f074021cbae3becb5a9eae5199
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Andy-Shevchenko/ptp_pch-use-mac_pton/20210813-203135
        git checkout c854fdc883f2a8f074021cbae3becb5a9eae5199
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=parisc SHELL=/bin/bash

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 >>):

   hppa-linux-ld: drivers/ptp/ptp_pch.o: in function `pch_rx_snap_read':
>> (.text+0x32c): undefined reference to `ioread64_lo_hi'
   hppa-linux-ld: drivers/ptp/ptp_pch.o: in function `pch_tx_snap_read':
   (.text+0x3ac): undefined reference to `ioread64_lo_hi'
   hppa-linux-ld: drivers/ptp/ptp_pch.o: in function `pch_set_station_address':
>> (.text+0x4a0): undefined reference to `iowrite64_lo_hi'
   hppa-linux-ld: drivers/ptp/ptp_pch.o: in function `ptp_pch_settime':
>> ptp_pch.o:(.text+0x61c): undefined reference to `iowrite64_lo_hi'
   hppa-linux-ld: drivers/ptp/ptp_pch.o: in function `ptp_pch_adjtime':
>> ptp_pch.o:(.text+0x6d8): undefined reference to `ioread64_lo_hi'
>> hppa-linux-ld: ptp_pch.o:(.text+0x6fc): undefined reference to `iowrite64_lo_hi'
   hppa-linux-ld: drivers/ptp/ptp_pch.o: in function `ptp_pch_gettime':
   ptp_pch.o:(.text+0x9d0): undefined reference to `ioread64_lo_hi'
   hppa-linux-ld: drivers/ptp/ptp_pch.o: in function `pch_probe':
   ptp_pch.o:(.text+0xd60): undefined reference to `iowrite64_lo_hi'

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 68620 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v1 net-next 4/7] ptp_pch: Switch to use module_pci_driver() macro
  2021-08-13 18:23         ` Jakub Kicinski
  2021-08-13 19:26           ` Andy Shevchenko
@ 2021-08-23  8:29           ` Andy Shevchenko
  1 sibling, 0 replies; 16+ messages in thread
From: Andy Shevchenko @ 2021-08-23  8:29 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Bjorn Helgaas, kernel test robot, netdev, linux-kernel,
	kbuild-all, Richard Cochran

On Fri, Aug 13, 2021 at 11:23:12AM -0700, Jakub Kicinski wrote:
> On Fri, 13 Aug 2021 18:39:14 +0300 Andy Shevchenko wrote:
> > On Fri, Aug 13, 2021 at 06:13:21PM +0300, Andy Shevchenko wrote:
> > > On Fri, Aug 13, 2021 at 10:34:17PM +0800, kernel test robot wrote:

> > > > If you fix the issue, kindly add following tag as appropriate
> > > > Reported-by: kernel test robot <lkp@intel.com>
> > > 
> > > Thanks!
> > > 
> > > Definitely I have compiled it in my local branch. I'll check what is the root
> > > cause of this.
> > 
> > Kconfig misses PCI dependency. I will send a separate patch, there is nothing
> > to do here.
> 
> That patch has to be before this one, tho. There is a static inline
> stub for pci_register_driver() etc. if !PCI, but there isn't for
> module_pci_driver(), meaning in builds without PCI this driver used
> to be harmlessly pointless, now it's breaking build.
> 
> Am I missing something?

Because the PCI dependency has been restored, can we now apply this series?

FYI, It was also reported that without PCI dependency and even w/o this path
the build can be broken on some architectures due to other reasons (PCI_IOBASE
is one of them IIRC).

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-08-23  8:29 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-13 12:29 [PATCH v1 net-next 1/7] ptp_pch: use mac_pton() Andy Shevchenko
2021-08-13 12:29 ` [PATCH v1 net-next 2/7] ptp_pch: Use ioread64_lo_hi() / iowrite64_lo_hi() Andy Shevchenko
2021-08-17 16:54   ` kernel test robot
2021-08-13 12:29 ` [PATCH v1 net-next 3/7] ptp_pch: Use ioread64_hi_lo() / iowrite64_hi_lo() Andy Shevchenko
2021-08-13 12:29 ` [PATCH v1 net-next 4/7] ptp_pch: Switch to use module_pci_driver() macro Andy Shevchenko
2021-08-13 14:34   ` kernel test robot
2021-08-13 15:13     ` Andy Shevchenko
2021-08-13 15:39       ` Andy Shevchenko
2021-08-13 18:23         ` Jakub Kicinski
2021-08-13 19:26           ` Andy Shevchenko
2021-08-13 19:38             ` Andy Shevchenko
2021-08-23  8:29           ` Andy Shevchenko
2021-08-13 16:19   ` kernel test robot
2021-08-13 12:29 ` [PATCH v1 net-next 5/7] ptp_pch: Convert to use managed functions pcim_* and devm_* Andy Shevchenko
2021-08-13 12:29 ` [PATCH v1 net-next 6/7] ptp_pch: Remove unused pch_pm_ops Andy Shevchenko
2021-08-13 12:29 ` [PATCH v1 net-next 7/7] ptp_pch: Load module automatically if ID matches Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).