diff mbox series

i2c:thunderx:Add disabled node check

Message ID 20230711054147.506437-1-aryan.srivastava@alliedtelesis.co.nz
State New
Headers show
Series i2c:thunderx:Add disabled node check | expand

Commit Message

Aryan Srivastava July 11, 2023, 5:41 a.m. UTC
Add check for disabled nodes. These nodes should not be probed. Can
result in logging for HW which is not present.

Signed-off-by: Aryan Srivastava <aryan.srivastava@alliedtelesis.co.nz>
---
 drivers/i2c/busses/i2c-thunderx-pcidrv.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Wolfram Sang Oct. 29, 2023, 5:11 p.m. UTC | #1
On Tue, Jul 11, 2023 at 05:41:46PM +1200, Aryan Srivastava wrote:
> Add check for disabled nodes. These nodes should not be probed. Can
> result in logging for HW which is not present.
> 
> Signed-off-by: Aryan Srivastava <aryan.srivastava@alliedtelesis.co.nz>

I am confused. This is a PCI driver, no? Why should we deal with DT
settings here?
Chris Packham Oct. 29, 2023, 9:47 p.m. UTC | #2
On 30/10/23 06:11, Wolfram Sang wrote:
> On Tue, Jul 11, 2023 at 05:41:46PM +1200, Aryan Srivastava wrote:
>> Add check for disabled nodes. These nodes should not be probed. Can
>> result in logging for HW which is not present.
>>
>> Signed-off-by: Aryan Srivastava<aryan.srivastava@alliedtelesis.co.nz>
> I am confused. This is a PCI driver, no? Why should we deal with DT
> settings here?

It is a PCI driver but the IP block is included on SoCs like the CN9670 
and not all hardware designs make use of all the I2C interfaces that the 
IP block supports.
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-thunderx-pcidrv.c b/drivers/i2c/busses/i2c-thunderx-pcidrv.c
index a77cd86fe75e..7fcdb237076a 100644
--- a/drivers/i2c/busses/i2c-thunderx-pcidrv.c
+++ b/drivers/i2c/busses/i2c-thunderx-pcidrv.c
@@ -158,6 +158,10 @@  static int thunder_i2c_probe_pci(struct pci_dev *pdev,
 	struct octeon_i2c *i2c;
 	int ret;
 
+	/* Ignore disabled nodes. */
+	if (!of_device_is_available(pdev->dev.of_node))
+		return 0;
+
 	i2c = devm_kzalloc(dev, sizeof(*i2c), GFP_KERNEL);
 	if (!i2c)
 		return -ENOMEM;