[PATCH linux] i2c: aspeed: Request irq with bus name
OpenBMC Patches
openbmc-patches at stwcx.xyz
Wed Feb 10 12:10:24 AEDT 2016
From: "Milton D. Miller II" <miltonm at us.ibm.com>
Request each irq with the unique bus name not a constant string.
The aspeed i2c controller has an irq per bus and this has been
exposed as an irq domain. However, each irq is requested the same
device name, leaving one to guess which irq in /proc/interrupts
corresponds to which device. While the controller irq number
is unique and happens to match, it is not obvious that there is
no offset.
The driver registers the bus with the numbered bus api, so the
global bus number is known an we can predict it before registering.
The information that this is from an ast-i2c bus is in the irq
controller name or could be found from the matching i2c bus device
in sysfs.
Excerpt of /proc/interrupts before this patch:
220: 1094 ast-i2c 0 Edge ast-i2c-bus
221: 0 ast-i2c 1 Edge ast-i2c-bus
222: 9438 ast-i2c 2 Edge ast-i2c-bus
223: 26480 ast-i2c 3 Edge ast-i2c-bus
New excerpt from /proc/interrupts:
220: 1094 ast-i2c 0 Edge i2c-0
221: 0 ast-i2c 1 Edge i2c-1
222: 9438 ast-i2c 2 Edge i2c-2
223: 26480 ast-i2c 3 Edge i2c-3
224: 0 ast-i2c 4 Edge i2c-4
New example proc/irq/ directory:
/proc/irq/222:
i2c-2 spurious
Signed-off-by: Milton Miller <miltonm at us.ibm.com>
---
drivers/i2c/busses/i2c-aspeed.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c
index e4bf88a3..6aad22a 100644
--- a/drivers/i2c/busses/i2c-aspeed.c
+++ b/drivers/i2c/busses/i2c-aspeed.c
@@ -684,6 +684,7 @@ static int ast_i2c_probe_bus(struct platform_device *pdev)
struct ast_i2c_bus *bus;
struct resource res;
int ret, bus_num;
+ char *irq_name;
bus = devm_kzalloc(&pdev->dev, sizeof(*bus), GFP_KERNEL);
if (!bus)
@@ -713,8 +714,9 @@ static int ast_i2c_probe_bus(struct platform_device *pdev)
return -ENXIO;
}
+ irq_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "i2c-%d", bus_num);
ret = devm_request_irq(&pdev->dev, bus->irq, ast_i2c_bus_irq,
- 0, "ast-i2c-bus", bus);
+ 0, irq_name, bus);
if (ret) {
dev_err(&pdev->dev, "devm_request_irq failed\n");
return -ENXIO;
--
2.7.1
More information about the openbmc
mailing list