1 From 8aa48c2a3fa470d348104e8f8aa558a661b724e5 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Tue, 31 Mar 2020 16:23:11 +0100
4 Subject: [PATCH] i2c: brcmstb: The interrupt line is optional, so use
5 platform_get_irq_optional
7 If there is no interrupt defined then an error is logged due
8 to the use of platform_get_irq. The driver handles not having
9 the interrupt by falling back to polling, therefore make
10 the appropriate call when claiming it.
12 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
14 drivers/i2c/busses/i2c-brcmstb.c | 20 +++++++++++---------
15 1 file changed, 11 insertions(+), 9 deletions(-)
17 --- a/drivers/i2c/busses/i2c-brcmstb.c
18 +++ b/drivers/i2c/busses/i2c-brcmstb.c
19 @@ -647,20 +647,22 @@ static int brcmstb_i2c_probe(struct plat
22 /* Get the interrupt number */
23 - dev->irq = platform_get_irq(pdev, 0);
24 + dev->irq = platform_get_irq_optional(pdev, 0);
26 /* disable the bsc interrupt line */
27 brcmstb_i2c_enable_disable_irq(dev, INT_DISABLE);
29 /* register the ISR handler */
30 - rc = devm_request_irq(&pdev->dev, dev->irq, brcmstb_i2c_isr,
32 - int_name ? int_name : pdev->name,
34 + if (dev->irq >= 0) {
35 + rc = devm_request_irq(&pdev->dev, dev->irq, brcmstb_i2c_isr,
37 + int_name ? int_name : pdev->name,
41 - dev_dbg(dev->device, "falling back to polling mode");
44 + dev_dbg(dev->device, "falling back to polling mode");
49 if (of_property_read_u32(dev->device->of_node,