bcm27xx: update patches from RPi foundation
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.4 / 950-0620-i2c-brcmstb-The-interrupt-line-is-optional-so-use-pl.patch
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
6
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.
11
12 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
13 ---
14 drivers/i2c/busses/i2c-brcmstb.c | 20 +++++++++++---------
15 1 file changed, 11 insertions(+), 9 deletions(-)
16
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
20 int_name = NULL;
21
22 /* Get the interrupt number */
23 - dev->irq = platform_get_irq(pdev, 0);
24 + dev->irq = platform_get_irq_optional(pdev, 0);
25
26 /* disable the bsc interrupt line */
27 brcmstb_i2c_enable_disable_irq(dev, INT_DISABLE);
28
29 /* register the ISR handler */
30 - rc = devm_request_irq(&pdev->dev, dev->irq, brcmstb_i2c_isr,
31 - IRQF_SHARED,
32 - int_name ? int_name : pdev->name,
33 - dev);
34 + if (dev->irq >= 0) {
35 + rc = devm_request_irq(&pdev->dev, dev->irq, brcmstb_i2c_isr,
36 + IRQF_SHARED,
37 + int_name ? int_name : pdev->name,
38 + dev);
39
40 - if (rc) {
41 - dev_dbg(dev->device, "falling back to polling mode");
42 - dev->irq = -1;
43 + if (rc) {
44 + dev_dbg(dev->device, "falling back to polling mode");
45 + dev->irq = -1;
46 + }
47 }
48
49 if (of_property_read_u32(dev->device->of_node,