All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] i2c: cht-wc: Use fwnode for the controller and IRQ domain
@ 2021-02-23 17:22 Andy Shevchenko
  2021-02-23 19:25 ` Hans de Goede
  0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2021-02-23 17:22 UTC (permalink / raw)
  To: Andy Shevchenko, linux-i2c, linux-kernel; +Cc: Hans de Goede

It's better to describe the I²C controller and associated IRQ domain with
fwnode, so they will find their place in the hierarchy in sysfs and also
make easier to debug.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---

Hans, unfortunately I have no device at hand with INT34D3. This is only compile
tested in that sense. Also I would like to hear if you like the idea in general.

 drivers/i2c/busses/i2c-cht-wc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-cht-wc.c b/drivers/i2c/busses/i2c-cht-wc.c
index f80d79e973cd..dbf55842b0dc 100644
--- a/drivers/i2c/busses/i2c-cht-wc.c
+++ b/drivers/i2c/busses/i2c-cht-wc.c
@@ -303,6 +303,7 @@ static struct bq24190_platform_data bq24190_pdata = {
 static int cht_wc_i2c_adap_i2c_probe(struct platform_device *pdev)
 {
 	struct intel_soc_pmic *pmic = dev_get_drvdata(pdev->dev.parent);
+	struct fwnode_handle *fwnode = dev_fwnode(&pdev->dev);
 	struct cht_wc_i2c_adap *adap;
 	struct i2c_board_info board_info = {
 		.type = "bq24190",
@@ -333,6 +334,7 @@ static int cht_wc_i2c_adap_i2c_probe(struct platform_device *pdev)
 	strlcpy(adap->adapter.name, "PMIC I2C Adapter",
 		sizeof(adap->adapter.name));
 	adap->adapter.dev.parent = &pdev->dev;
+	set_primary_fwnode(&adap->adapter.dev, fwnode);
 
 	/* Clear and activate i2c-adapter interrupts, disable client IRQ */
 	adap->old_irq_mask = adap->irq_mask = ~CHT_WC_EXTCHGRIRQ_ADAP_IRQMASK;
@@ -350,8 +352,8 @@ static int cht_wc_i2c_adap_i2c_probe(struct platform_device *pdev)
 		return ret;
 
 	/* Alloc and register client IRQ */
-	adap->irq_domain = irq_domain_add_linear(pdev->dev.of_node, 1,
-						 &irq_domain_simple_ops, NULL);
+	adap->irq_domain = irq_domain_create_linear(fwnode, 1,
+						    &irq_domain_simple_ops, NULL);
 	if (!adap->irq_domain)
 		return -ENOMEM;
 
-- 
2.30.0


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

end of thread, other threads:[~2021-04-23 17:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-23 17:22 [PATCH v1 1/1] i2c: cht-wc: Use fwnode for the controller and IRQ domain Andy Shevchenko
2021-02-23 19:25 ` Hans de Goede
2021-02-24 12:51   ` Andy Shevchenko
2021-02-24 19:12     ` Hans de Goede
2021-02-25 15:44       ` Andy Shevchenko
2021-04-23 17:33         ` Hans de Goede

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.