brcm2708: update to v3.18
[openwrt/svn-archive/archive.git] / target / linux / brcm2708 / patches-3.18 / 0107-i2c_bcm2708-Fix-clock-reference-counting.patch
1 From cf1b789e1a6873d9680156fac9f675a0f1cdd17b Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Thu, 5 Feb 2015 16:01:44 +0000
4 Subject: [PATCH 107/114] i2c_bcm2708: Fix clock reference counting
5
6 ---
7 drivers/i2c/busses/i2c-bcm2708.c | 12 ++++++++++--
8 1 file changed, 10 insertions(+), 2 deletions(-)
9
10 diff --git a/drivers/i2c/busses/i2c-bcm2708.c b/drivers/i2c/busses/i2c-bcm2708.c
11 index 526129b..fda59ba 100644
12 --- a/drivers/i2c/busses/i2c-bcm2708.c
13 +++ b/drivers/i2c/busses/i2c-bcm2708.c
14 @@ -337,11 +337,17 @@ static int bcm2708_i2c_probe(struct platform_device *pdev)
15 return PTR_ERR(clk);
16 }
17
18 + err = clk_prepare_enable(clk);
19 + if (err) {
20 + dev_err(&pdev->dev, "could not enable clk: %d\n", err);
21 + goto out_clk_put;
22 + }
23 +
24 bcm2708_i2c_init_pinmode(pdev->id);
25
26 bi = kzalloc(sizeof(*bi), GFP_KERNEL);
27 if (!bi)
28 - goto out_clk_put;
29 + goto out_clk_disable;
30
31 platform_set_drvdata(pdev, bi);
32
33 @@ -412,6 +418,8 @@ out_iounmap:
34 iounmap(bi->base);
35 out_free_bi:
36 kfree(bi);
37 +out_clk_disable:
38 + clk_disable_unprepare(clk);
39 out_clk_put:
40 clk_put(clk);
41 return err;
42 @@ -426,7 +434,7 @@ static int bcm2708_i2c_remove(struct platform_device *pdev)
43 i2c_del_adapter(&bi->adapter);
44 free_irq(bi->irq, bi);
45 iounmap(bi->base);
46 - clk_disable(bi->clk);
47 + clk_disable_unprepare(bi->clk);
48 clk_put(bi->clk);
49 kfree(bi);
50
51 --
52 1.8.3.2
53