diff for duplicates of <20151021155057.20687.14055@quantum> diff --git a/a/1.txt b/N1/1.txt index 4c1652c..7208317 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -1,40 +1,32 @@ Quoting Russell King - ARM Linux (2015-10-21 03:59:32) > On Wed, Oct 21, 2015 at 11:50:07AM +0200, Geert Uytterhoeven wrote: > > Hi Mike, Russell, -> > = - +> > > > On Tue, Oct 20, 2015 at 2:40 PM, Michael Turquette > > <mturquette@baylibre.com> wrote: -> > > Why not keep the reference to the struct clk after get'ing it the fir= -st +> > > Why not keep the reference to the struct clk after get'ing it the first > > > time? -> > = - +> > > > And store it where? -> = - +> > Not my problem :) -> = - +> > Users are supposed to hold on to the reference obtained via clk_get() > while they're making use of the clock: in some implementations, this > increments the module use count if the clock driver is a module, and > may have other effects too. -> = - +> > Dropping that while you're still requiring the clock to be enabled is > unsafe: if it is provided by a module, then removing and reinserting > the module may very well change the enabled state of the clock, it > most certainly will disrupt the enable count. -> = - +> > It's always been this way, right from the outset, and when I've seen > people doing this bollocks, I've always pointed out that it's wrong. > Generally, people will fix it once they become aware of it, so it's > really that people just don't like reading and conforming to published > API requirements. -> = - +> > I think the root cause is that people just don't like reading what > other people write in terms of documentation, and they prefer to go > off and do their own thing, provided it works for them. @@ -59,47 +51,41 @@ Mike -diff --git a/arch/arm/mach-davinci/pm_domain.c b/arch/arm/mach-davinci/pm_d= -omain.c +diff --git a/arch/arm/mach-davinci/pm_domain.c b/arch/arm/mach-davinci/pm_domain.c index 78eac2c..b46e5ce 100644 --- a/arch/arm/mach-davinci/pm_domain.c +++ b/arch/arm/mach-davinci/pm_domain.c -@@ -24,6 +24,7 @@ static struct dev_pm_domain davinci_pm_domain =3D { - static struct pm_clk_notifier_block platform_bus_notifier =3D { - .pm_domain =3D &davinci_pm_domain, - .con_ids =3D { "fck", "master", "slave", NULL }, -+ .clks =3D { ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN) }, +@@ -24,6 +24,7 @@ static struct dev_pm_domain davinci_pm_domain = { + static struct pm_clk_notifier_block platform_bus_notifier = { + .pm_domain = &davinci_pm_domain, + .con_ids = { "fck", "master", "slave", NULL }, ++ .clks = { ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN) }, }; - = - + static int __init davinci_pm_runtime_init(void) -diff --git a/arch/arm/mach-keystone/pm_domain.c b/arch/arm/mach-keystone/pm= -_domain.c +diff --git a/arch/arm/mach-keystone/pm_domain.c b/arch/arm/mach-keystone/pm_domain.c index e283939..d21c18b 100644 --- a/arch/arm/mach-keystone/pm_domain.c +++ b/arch/arm/mach-keystone/pm_domain.c -@@ -27,6 +27,7 @@ static struct dev_pm_domain keystone_pm_domain =3D { - = - - static struct pm_clk_notifier_block platform_domain_notifier =3D { - .pm_domain =3D &keystone_pm_domain, -+ .clks =3D { ERR_PTR(-EAGAIN) }, +@@ -27,6 +27,7 @@ static struct dev_pm_domain keystone_pm_domain = { + + static struct pm_clk_notifier_block platform_domain_notifier = { + .pm_domain = &keystone_pm_domain, ++ .clks = { ERR_PTR(-EAGAIN) }, }; - = - - static const struct of_device_id of_keystone_table[] =3D { + + static const struct of_device_id of_keystone_table[] = { diff --git a/arch/arm/mach-omap1/pm_bus.c b/arch/arm/mach-omap1/pm_bus.c index 667c163..5506453 100644 --- a/arch/arm/mach-omap1/pm_bus.c +++ b/arch/arm/mach-omap1/pm_bus.c -@@ -31,6 +31,7 @@ static struct dev_pm_domain default_pm_domain =3D { - static struct pm_clk_notifier_block platform_bus_notifier =3D { - .pm_domain =3D &default_pm_domain, - .con_ids =3D { "ick", "fck", NULL, }, -+ .clks =3D { ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN) }, +@@ -31,6 +31,7 @@ static struct dev_pm_domain default_pm_domain = { + static struct pm_clk_notifier_block platform_bus_notifier = { + .pm_domain = &default_pm_domain, + .con_ids = { "ick", "fck", NULL, }, ++ .clks = { ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN) }, }; - = - + static int __init omap1_pm_runtime_init(void) diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c index 652b5a3..26f0dcf 100644 @@ -107,8 +93,7 @@ index 652b5a3..26f0dcf 100644 +++ b/drivers/base/power/clock_ops.c @@ -407,40 +407,6 @@ int pm_clk_runtime_resume(struct device *dev) #else /* !CONFIG_PM */ - = - + /** - * enable_clock - Enable a device clock. - * @dev: Device whose clock is to be enabled. @@ -118,7 +103,7 @@ index 652b5a3..26f0dcf 100644 -{ - struct clk *clk; - -- clk =3D clk_get(dev, con_id); +- clk = clk_get(dev, con_id); - if (!IS_ERR(clk)) { - clk_prepare_enable(clk); - clk_put(clk); @@ -135,7 +120,7 @@ index 652b5a3..26f0dcf 100644 -{ - struct clk *clk; - -- clk =3D clk_get(dev, con_id); +- clk = clk_get(dev, con_id); - if (!IS_ERR(clk)) { - clk_disable_unprepare(clk); - clk_put(clk); @@ -151,21 +136,21 @@ index 652b5a3..26f0dcf 100644 switch (action) { case BUS_NOTIFY_BIND_DRIVER: if (clknb->con_ids[0]) { -- for (con_id =3D clknb->con_ids; *con_id; con_id++) +- for (con_id = clknb->con_ids; *con_id; con_id++) - enable_clock(dev, *con_id); + int i; -+ for (con_id =3D clknb->con_ids, i =3D 0; *con_id; ++ for (con_id = clknb->con_ids, i = 0; *con_id; + con_id++, i++) { -+ if (clknb->clks[i] =3D=3D ERR_PTR(-EAGAIN)) -+ clks[i] =3D clk_get(dev, *con_id); ++ if (clknb->clks[i] == ERR_PTR(-EAGAIN)) ++ clks[i] = clk_get(dev, *con_id); + if (!IS_ERR(clknb->clks[i])) { + clk_prepare_enable(clk); + dev_info(dev, "Runtime PM disabled, clock forced on.\n"); + } } else { - enable_clock(dev, NULL); -+ if (clknb->clks[0] =3D=3D ERR_PTR(-EAGAIN)) -+ clks[0] =3D clk_get(dev, NULL); ++ if (clknb->clks[0] == ERR_PTR(-EAGAIN)) ++ clks[0] = clk_get(dev, NULL); + if (!IS_ERR(clknb->clks[0])) { + clk_prepare_enable(clk); + dev_info(dev, "Runtime PM disabled, clock forced on.\n"); @@ -180,10 +165,10 @@ index 652b5a3..26f0dcf 100644 + * should + */ if (clknb->con_ids[0]) { -- for (con_id =3D clknb->con_ids; *con_id; con_id++) +- for (con_id = clknb->con_ids; *con_id; con_id++) - disable_clock(dev, *con_id); + int i; -+ for (con_id =3D clknb->con_ids, i =3D 0; *con_id; ++ for (con_id = clknb->con_ids, i = 0; *con_id; + con_id++, i++) { + if (!IS_ERR(clknb->clks[i])) { + clk_disable_unprepare(clknb->clks[i]); @@ -203,14 +188,13 @@ diff --git a/drivers/sh/pm_runtime.c b/drivers/sh/pm_runtime.c index 25abd4e..08754a4 100644 --- a/drivers/sh/pm_runtime.c +++ b/drivers/sh/pm_runtime.c -@@ -30,6 +30,7 @@ static struct dev_pm_domain default_pm_domain =3D { - static struct pm_clk_notifier_block platform_bus_notifier =3D { - .pm_domain =3D &default_pm_domain, - .con_ids =3D { NULL, }, -+ .clks =3D { ERR_PTR(-EAGAIN) }, +@@ -30,6 +30,7 @@ static struct dev_pm_domain default_pm_domain = { + static struct pm_clk_notifier_block platform_bus_notifier = { + .pm_domain = &default_pm_domain, + .con_ids = { NULL, }, ++ .clks = { ERR_PTR(-EAGAIN) }, }; - = - + static int __init sh_pm_runtime_init(void) diff --git a/include/linux/pm_clock.h b/include/linux/pm_clock.h index 25266c6..45e58fe 100644 @@ -222,6 +206,5 @@ index 25266c6..45e58fe 100644 char *con_ids[]; + struct clk *clks[]; }; - = - + struct clk; diff --git a/a/content_digest b/N1/content_digest index 66c4be7..f1321c1 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -28,40 +28,32 @@ "Quoting Russell King - ARM Linux (2015-10-21 03:59:32)\n" "> On Wed, Oct 21, 2015 at 11:50:07AM +0200, Geert Uytterhoeven wrote:\n" "> > Hi Mike, Russell,\n" - "> > =\n" - "\n" + "> > \n" "> > On Tue, Oct 20, 2015 at 2:40 PM, Michael Turquette\n" "> > <mturquette@baylibre.com> wrote:\n" - "> > > Why not keep the reference to the struct clk after get'ing it the fir=\n" - "st\n" + "> > > Why not keep the reference to the struct clk after get'ing it the first\n" "> > > time?\n" - "> > =\n" - "\n" + "> > \n" "> > And store it where?\n" - "> =\n" - "\n" + "> \n" "> Not my problem :)\n" - "> =\n" - "\n" + "> \n" "> Users are supposed to hold on to the reference obtained via clk_get()\n" "> while they're making use of the clock: in some implementations, this\n" "> increments the module use count if the clock driver is a module, and\n" "> may have other effects too.\n" - "> =\n" - "\n" + "> \n" "> Dropping that while you're still requiring the clock to be enabled is\n" "> unsafe: if it is provided by a module, then removing and reinserting\n" "> the module may very well change the enabled state of the clock, it\n" "> most certainly will disrupt the enable count.\n" - "> =\n" - "\n" + "> \n" "> It's always been this way, right from the outset, and when I've seen\n" "> people doing this bollocks, I've always pointed out that it's wrong.\n" "> Generally, people will fix it once they become aware of it, so it's\n" "> really that people just don't like reading and conforming to published\n" "> API requirements.\n" - "> =\n" - "\n" + "> \n" "> I think the root cause is that people just don't like reading what\n" "> other people write in terms of documentation, and they prefer to go\n" "> off and do their own thing, provided it works for them.\n" @@ -86,47 +78,41 @@ "\n" "\n" "\n" - "diff --git a/arch/arm/mach-davinci/pm_domain.c b/arch/arm/mach-davinci/pm_d=\n" - "omain.c\n" + "diff --git a/arch/arm/mach-davinci/pm_domain.c b/arch/arm/mach-davinci/pm_domain.c\n" "index 78eac2c..b46e5ce 100644\n" "--- a/arch/arm/mach-davinci/pm_domain.c\n" "+++ b/arch/arm/mach-davinci/pm_domain.c\n" - "@@ -24,6 +24,7 @@ static struct dev_pm_domain davinci_pm_domain =3D {\n" - " static struct pm_clk_notifier_block platform_bus_notifier =3D {\n" - " \t.pm_domain =3D &davinci_pm_domain,\n" - " \t.con_ids =3D { \"fck\", \"master\", \"slave\", NULL },\n" - "+\t.clks =3D { ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN) },\n" + "@@ -24,6 +24,7 @@ static struct dev_pm_domain davinci_pm_domain = {\n" + " static struct pm_clk_notifier_block platform_bus_notifier = {\n" + " \t.pm_domain = &davinci_pm_domain,\n" + " \t.con_ids = { \"fck\", \"master\", \"slave\", NULL },\n" + "+\t.clks = { ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN) },\n" " };\n" - " =\n" - "\n" + " \n" " static int __init davinci_pm_runtime_init(void)\n" - "diff --git a/arch/arm/mach-keystone/pm_domain.c b/arch/arm/mach-keystone/pm=\n" - "_domain.c\n" + "diff --git a/arch/arm/mach-keystone/pm_domain.c b/arch/arm/mach-keystone/pm_domain.c\n" "index e283939..d21c18b 100644\n" "--- a/arch/arm/mach-keystone/pm_domain.c\n" "+++ b/arch/arm/mach-keystone/pm_domain.c\n" - "@@ -27,6 +27,7 @@ static struct dev_pm_domain keystone_pm_domain =3D {\n" - " =\n" - "\n" - " static struct pm_clk_notifier_block platform_domain_notifier =3D {\n" - " \t.pm_domain =3D &keystone_pm_domain,\n" - "+\t.clks =3D { ERR_PTR(-EAGAIN) },\n" + "@@ -27,6 +27,7 @@ static struct dev_pm_domain keystone_pm_domain = {\n" + " \n" + " static struct pm_clk_notifier_block platform_domain_notifier = {\n" + " \t.pm_domain = &keystone_pm_domain,\n" + "+\t.clks = { ERR_PTR(-EAGAIN) },\n" " };\n" - " =\n" - "\n" - " static const struct of_device_id of_keystone_table[] =3D {\n" + " \n" + " static const struct of_device_id of_keystone_table[] = {\n" "diff --git a/arch/arm/mach-omap1/pm_bus.c b/arch/arm/mach-omap1/pm_bus.c\n" "index 667c163..5506453 100644\n" "--- a/arch/arm/mach-omap1/pm_bus.c\n" "+++ b/arch/arm/mach-omap1/pm_bus.c\n" - "@@ -31,6 +31,7 @@ static struct dev_pm_domain default_pm_domain =3D {\n" - " static struct pm_clk_notifier_block platform_bus_notifier =3D {\n" - " \t.pm_domain =3D &default_pm_domain,\n" - " \t.con_ids =3D { \"ick\", \"fck\", NULL, },\n" - "+\t.clks =3D { ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN) },\n" + "@@ -31,6 +31,7 @@ static struct dev_pm_domain default_pm_domain = {\n" + " static struct pm_clk_notifier_block platform_bus_notifier = {\n" + " \t.pm_domain = &default_pm_domain,\n" + " \t.con_ids = { \"ick\", \"fck\", NULL, },\n" + "+\t.clks = { ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN) },\n" " };\n" - " =\n" - "\n" + " \n" " static int __init omap1_pm_runtime_init(void)\n" "diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c\n" "index 652b5a3..26f0dcf 100644\n" @@ -134,8 +120,7 @@ "+++ b/drivers/base/power/clock_ops.c\n" "@@ -407,40 +407,6 @@ int pm_clk_runtime_resume(struct device *dev)\n" " #else /* !CONFIG_PM */\n" - " =\n" - "\n" + " \n" " /**\n" "- * enable_clock - Enable a device clock.\n" "- * @dev: Device whose clock is to be enabled.\n" @@ -145,7 +130,7 @@ "-{\n" "-\tstruct clk *clk;\n" "-\n" - "-\tclk =3D clk_get(dev, con_id);\n" + "-\tclk = clk_get(dev, con_id);\n" "-\tif (!IS_ERR(clk)) {\n" "-\t\tclk_prepare_enable(clk);\n" "-\t\tclk_put(clk);\n" @@ -162,7 +147,7 @@ "-{\n" "-\tstruct clk *clk;\n" "-\n" - "-\tclk =3D clk_get(dev, con_id);\n" + "-\tclk = clk_get(dev, con_id);\n" "-\tif (!IS_ERR(clk)) {\n" "-\t\tclk_disable_unprepare(clk);\n" "-\t\tclk_put(clk);\n" @@ -178,21 +163,21 @@ " \tswitch (action) {\n" " \tcase BUS_NOTIFY_BIND_DRIVER:\n" " \t\tif (clknb->con_ids[0]) {\n" - "-\t\t\tfor (con_id =3D clknb->con_ids; *con_id; con_id++)\n" + "-\t\t\tfor (con_id = clknb->con_ids; *con_id; con_id++)\n" "-\t\t\t\tenable_clock(dev, *con_id);\n" "+\t\t\tint i;\n" - "+\t\t\tfor (con_id =3D clknb->con_ids, i =3D 0; *con_id;\n" + "+\t\t\tfor (con_id = clknb->con_ids, i = 0; *con_id;\n" "+\t\t\t\t\t\tcon_id++, i++) {\n" - "+\t\t\t\tif (clknb->clks[i] =3D=3D ERR_PTR(-EAGAIN))\n" - "+\t\t\t\t\tclks[i] =3D clk_get(dev, *con_id);\n" + "+\t\t\t\tif (clknb->clks[i] == ERR_PTR(-EAGAIN))\n" + "+\t\t\t\t\tclks[i] = clk_get(dev, *con_id);\n" "+\t\t\t\tif (!IS_ERR(clknb->clks[i])) {\n" "+\t\t\t\t\tclk_prepare_enable(clk);\n" "+\t\t\t\t\tdev_info(dev, \"Runtime PM disabled, clock forced on.\\n\");\n" "+\t\t\t\t}\n" " \t\t} else {\n" "-\t\t\tenable_clock(dev, NULL);\n" - "+\t\t\tif (clknb->clks[0] =3D=3D ERR_PTR(-EAGAIN))\n" - "+\t\t\t\tclks[0] =3D clk_get(dev, NULL);\n" + "+\t\t\tif (clknb->clks[0] == ERR_PTR(-EAGAIN))\n" + "+\t\t\t\tclks[0] = clk_get(dev, NULL);\n" "+\t\t\tif (!IS_ERR(clknb->clks[0])) {\n" "+\t\t\t\tclk_prepare_enable(clk);\n" "+\t\t\t\tdev_info(dev, \"Runtime PM disabled, clock forced on.\\n\");\n" @@ -207,10 +192,10 @@ "+\t\t * should\n" "+\t\t */\n" " \t\tif (clknb->con_ids[0]) {\n" - "-\t\t\tfor (con_id =3D clknb->con_ids; *con_id; con_id++)\n" + "-\t\t\tfor (con_id = clknb->con_ids; *con_id; con_id++)\n" "-\t\t\t\tdisable_clock(dev, *con_id);\n" "+\t\t\tint i;\n" - "+\t\t\tfor (con_id =3D clknb->con_ids, i =3D 0; *con_id;\n" + "+\t\t\tfor (con_id = clknb->con_ids, i = 0; *con_id;\n" "+\t\t\t\t\tcon_id++, i++) {\n" "+\t\t\t\tif (!IS_ERR(clknb->clks[i])) {\n" "+\t\t\t\t\tclk_disable_unprepare(clknb->clks[i]);\n" @@ -230,14 +215,13 @@ "index 25abd4e..08754a4 100644\n" "--- a/drivers/sh/pm_runtime.c\n" "+++ b/drivers/sh/pm_runtime.c\n" - "@@ -30,6 +30,7 @@ static struct dev_pm_domain default_pm_domain =3D {\n" - " static struct pm_clk_notifier_block platform_bus_notifier =3D {\n" - " \t.pm_domain =3D &default_pm_domain,\n" - " \t.con_ids =3D { NULL, },\n" - "+\t.clks =3D { ERR_PTR(-EAGAIN) },\n" + "@@ -30,6 +30,7 @@ static struct dev_pm_domain default_pm_domain = {\n" + " static struct pm_clk_notifier_block platform_bus_notifier = {\n" + " \t.pm_domain = &default_pm_domain,\n" + " \t.con_ids = { NULL, },\n" + "+\t.clks = { ERR_PTR(-EAGAIN) },\n" " };\n" - " =\n" - "\n" + " \n" " static int __init sh_pm_runtime_init(void)\n" "diff --git a/include/linux/pm_clock.h b/include/linux/pm_clock.h\n" "index 25266c6..45e58fe 100644\n" @@ -249,8 +233,7 @@ " \tchar *con_ids[];\n" "+\tstruct clk *clks[];\n" " };\n" - " =\n" - "\n" + " \n" struct clk; -dbc6aa183511aa946a3405abc3f905ad945f13759d4215900cb95f99a4a34b7c +2351f84f1127a6ac5f047898fc941bd792d41a8e2bab4fb9f0c6883067877d27
diff --git a/a/1.txt b/N2/1.txt index 4c1652c..257390a 100644 --- a/a/1.txt +++ b/N2/1.txt @@ -1,40 +1,32 @@ Quoting Russell King - ARM Linux (2015-10-21 03:59:32) > On Wed, Oct 21, 2015 at 11:50:07AM +0200, Geert Uytterhoeven wrote: > > Hi Mike, Russell, -> > = - +> > > > On Tue, Oct 20, 2015 at 2:40 PM, Michael Turquette > > <mturquette@baylibre.com> wrote: -> > > Why not keep the reference to the struct clk after get'ing it the fir= -st +> > > Why not keep the reference to the struct clk after get'ing it the first > > > time? -> > = - +> > > > And store it where? -> = - +> > Not my problem :) -> = - +> > Users are supposed to hold on to the reference obtained via clk_get() > while they're making use of the clock: in some implementations, this > increments the module use count if the clock driver is a module, and > may have other effects too. -> = - +> > Dropping that while you're still requiring the clock to be enabled is > unsafe: if it is provided by a module, then removing and reinserting > the module may very well change the enabled state of the clock, it > most certainly will disrupt the enable count. -> = - +> > It's always been this way, right from the outset, and when I've seen > people doing this bollocks, I've always pointed out that it's wrong. > Generally, people will fix it once they become aware of it, so it's > really that people just don't like reading and conforming to published > API requirements. -> = - +> > I think the root cause is that people just don't like reading what > other people write in terms of documentation, and they prefer to go > off and do their own thing, provided it works for them. @@ -59,47 +51,41 @@ Mike -diff --git a/arch/arm/mach-davinci/pm_domain.c b/arch/arm/mach-davinci/pm_d= -omain.c +diff --git a/arch/arm/mach-davinci/pm_domain.c b/arch/arm/mach-davinci/pm_domain.c index 78eac2c..b46e5ce 100644 --- a/arch/arm/mach-davinci/pm_domain.c +++ b/arch/arm/mach-davinci/pm_domain.c -@@ -24,6 +24,7 @@ static struct dev_pm_domain davinci_pm_domain =3D { - static struct pm_clk_notifier_block platform_bus_notifier =3D { - .pm_domain =3D &davinci_pm_domain, - .con_ids =3D { "fck", "master", "slave", NULL }, -+ .clks =3D { ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN) }, +@@ -24,6 +24,7 @@ static struct dev_pm_domain davinci_pm_domain = { + static struct pm_clk_notifier_block platform_bus_notifier = { + .pm_domain = &davinci_pm_domain, + .con_ids = { "fck", "master", "slave", NULL }, ++ .clks = { ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN) }, }; - = - + static int __init davinci_pm_runtime_init(void) -diff --git a/arch/arm/mach-keystone/pm_domain.c b/arch/arm/mach-keystone/pm= -_domain.c +diff --git a/arch/arm/mach-keystone/pm_domain.c b/arch/arm/mach-keystone/pm_domain.c index e283939..d21c18b 100644 --- a/arch/arm/mach-keystone/pm_domain.c +++ b/arch/arm/mach-keystone/pm_domain.c -@@ -27,6 +27,7 @@ static struct dev_pm_domain keystone_pm_domain =3D { - = - - static struct pm_clk_notifier_block platform_domain_notifier =3D { - .pm_domain =3D &keystone_pm_domain, -+ .clks =3D { ERR_PTR(-EAGAIN) }, +@@ -27,6 +27,7 @@ static struct dev_pm_domain keystone_pm_domain = { + + static struct pm_clk_notifier_block platform_domain_notifier = { + .pm_domain = &keystone_pm_domain, ++ .clks = { ERR_PTR(-EAGAIN) }, }; - = - - static const struct of_device_id of_keystone_table[] =3D { + + static const struct of_device_id of_keystone_table[] = { diff --git a/arch/arm/mach-omap1/pm_bus.c b/arch/arm/mach-omap1/pm_bus.c index 667c163..5506453 100644 --- a/arch/arm/mach-omap1/pm_bus.c +++ b/arch/arm/mach-omap1/pm_bus.c -@@ -31,6 +31,7 @@ static struct dev_pm_domain default_pm_domain =3D { - static struct pm_clk_notifier_block platform_bus_notifier =3D { - .pm_domain =3D &default_pm_domain, - .con_ids =3D { "ick", "fck", NULL, }, -+ .clks =3D { ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN) }, +@@ -31,6 +31,7 @@ static struct dev_pm_domain default_pm_domain = { + static struct pm_clk_notifier_block platform_bus_notifier = { + .pm_domain = &default_pm_domain, + .con_ids = { "ick", "fck", NULL, }, ++ .clks = { ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN) }, }; - = - + static int __init omap1_pm_runtime_init(void) diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c index 652b5a3..26f0dcf 100644 @@ -107,8 +93,7 @@ index 652b5a3..26f0dcf 100644 +++ b/drivers/base/power/clock_ops.c @@ -407,40 +407,6 @@ int pm_clk_runtime_resume(struct device *dev) #else /* !CONFIG_PM */ - = - + /** - * enable_clock - Enable a device clock. - * @dev: Device whose clock is to be enabled. @@ -118,7 +103,7 @@ index 652b5a3..26f0dcf 100644 -{ - struct clk *clk; - -- clk =3D clk_get(dev, con_id); +- clk = clk_get(dev, con_id); - if (!IS_ERR(clk)) { - clk_prepare_enable(clk); - clk_put(clk); @@ -135,7 +120,7 @@ index 652b5a3..26f0dcf 100644 -{ - struct clk *clk; - -- clk =3D clk_get(dev, con_id); +- clk = clk_get(dev, con_id); - if (!IS_ERR(clk)) { - clk_disable_unprepare(clk); - clk_put(clk); @@ -151,21 +136,21 @@ index 652b5a3..26f0dcf 100644 switch (action) { case BUS_NOTIFY_BIND_DRIVER: if (clknb->con_ids[0]) { -- for (con_id =3D clknb->con_ids; *con_id; con_id++) +- for (con_id = clknb->con_ids; *con_id; con_id++) - enable_clock(dev, *con_id); + int i; -+ for (con_id =3D clknb->con_ids, i =3D 0; *con_id; ++ for (con_id = clknb->con_ids, i = 0; *con_id; + con_id++, i++) { -+ if (clknb->clks[i] =3D=3D ERR_PTR(-EAGAIN)) -+ clks[i] =3D clk_get(dev, *con_id); ++ if (clknb->clks[i] = ERR_PTR(-EAGAIN)) ++ clks[i] = clk_get(dev, *con_id); + if (!IS_ERR(clknb->clks[i])) { + clk_prepare_enable(clk); + dev_info(dev, "Runtime PM disabled, clock forced on.\n"); + } } else { - enable_clock(dev, NULL); -+ if (clknb->clks[0] =3D=3D ERR_PTR(-EAGAIN)) -+ clks[0] =3D clk_get(dev, NULL); ++ if (clknb->clks[0] = ERR_PTR(-EAGAIN)) ++ clks[0] = clk_get(dev, NULL); + if (!IS_ERR(clknb->clks[0])) { + clk_prepare_enable(clk); + dev_info(dev, "Runtime PM disabled, clock forced on.\n"); @@ -180,10 +165,10 @@ index 652b5a3..26f0dcf 100644 + * should + */ if (clknb->con_ids[0]) { -- for (con_id =3D clknb->con_ids; *con_id; con_id++) +- for (con_id = clknb->con_ids; *con_id; con_id++) - disable_clock(dev, *con_id); + int i; -+ for (con_id =3D clknb->con_ids, i =3D 0; *con_id; ++ for (con_id = clknb->con_ids, i = 0; *con_id; + con_id++, i++) { + if (!IS_ERR(clknb->clks[i])) { + clk_disable_unprepare(clknb->clks[i]); @@ -203,14 +188,13 @@ diff --git a/drivers/sh/pm_runtime.c b/drivers/sh/pm_runtime.c index 25abd4e..08754a4 100644 --- a/drivers/sh/pm_runtime.c +++ b/drivers/sh/pm_runtime.c -@@ -30,6 +30,7 @@ static struct dev_pm_domain default_pm_domain =3D { - static struct pm_clk_notifier_block platform_bus_notifier =3D { - .pm_domain =3D &default_pm_domain, - .con_ids =3D { NULL, }, -+ .clks =3D { ERR_PTR(-EAGAIN) }, +@@ -30,6 +30,7 @@ static struct dev_pm_domain default_pm_domain = { + static struct pm_clk_notifier_block platform_bus_notifier = { + .pm_domain = &default_pm_domain, + .con_ids = { NULL, }, ++ .clks = { ERR_PTR(-EAGAIN) }, }; - = - + static int __init sh_pm_runtime_init(void) diff --git a/include/linux/pm_clock.h b/include/linux/pm_clock.h index 25266c6..45e58fe 100644 @@ -222,6 +206,5 @@ index 25266c6..45e58fe 100644 char *con_ids[]; + struct clk *clks[]; }; - = - + struct clk; diff --git a/a/content_digest b/N2/content_digest index 66c4be7..a1a7641 100644 --- a/a/content_digest +++ b/N2/content_digest @@ -6,62 +6,39 @@ "ref\020151021105932.GP32536@n2100.arm.linux.org.uk\0" "From\0Michael Turquette <mturquette@baylibre.com>\0" "Subject\0Re: [PATCH RFC RFT 2/3] clk: clk_put WARNs if user has not disabled clk\0" - "Date\0Wed, 21 Oct 2015 08:50:57 -0700\0" - "To\0Russell King - ARM Linux <linux@arm.linux.org.uk>" - " Geert Uytterhoeven <geert@linux-m68k.org>\0" - "Cc\0linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org>" - linux-clk <linux-clk@vger.kernel.org> - Stephen Boyd <sboyd@codeaurora.org> - Lee Jones <lee.jones@linaro.org> - Maxime Ripard <maxime.ripard@free-electrons.com> - Sascha Hauer <s.hauer@pengutronix.de> - Sekhar Nori <nsekhar@ti.com> - Kevin Hilman <khilman@kernel.org> - Santosh Shilimkar <ssantosh@kernel.org> - Tony Lindgren <tony@atomide.com> - linux-omap@vger.kernel.org <linux-omap@vger.kernel.org> - linux-arm-kernel@lists.infradead.org <linux-arm-kernel@lists.infradead.org> - Linux-sh list <linux-sh@vger.kernel.org> - " Linux PM list <linux-pm@vger.kernel.org>\0" + "Date\0Wed, 21 Oct 2015 15:50:57 +0000\0" + "To\0linux-arm-kernel@lists.infradead.org\0" "\00:1\0" "b\0" "Quoting Russell King - ARM Linux (2015-10-21 03:59:32)\n" "> On Wed, Oct 21, 2015 at 11:50:07AM +0200, Geert Uytterhoeven wrote:\n" "> > Hi Mike, Russell,\n" - "> > =\n" - "\n" + "> > \n" "> > On Tue, Oct 20, 2015 at 2:40 PM, Michael Turquette\n" "> > <mturquette@baylibre.com> wrote:\n" - "> > > Why not keep the reference to the struct clk after get'ing it the fir=\n" - "st\n" + "> > > Why not keep the reference to the struct clk after get'ing it the first\n" "> > > time?\n" - "> > =\n" - "\n" + "> > \n" "> > And store it where?\n" - "> =\n" - "\n" + "> \n" "> Not my problem :)\n" - "> =\n" - "\n" + "> \n" "> Users are supposed to hold on to the reference obtained via clk_get()\n" "> while they're making use of the clock: in some implementations, this\n" "> increments the module use count if the clock driver is a module, and\n" "> may have other effects too.\n" - "> =\n" - "\n" + "> \n" "> Dropping that while you're still requiring the clock to be enabled is\n" "> unsafe: if it is provided by a module, then removing and reinserting\n" "> the module may very well change the enabled state of the clock, it\n" "> most certainly will disrupt the enable count.\n" - "> =\n" - "\n" + "> \n" "> It's always been this way, right from the outset, and when I've seen\n" "> people doing this bollocks, I've always pointed out that it's wrong.\n" "> Generally, people will fix it once they become aware of it, so it's\n" "> really that people just don't like reading and conforming to published\n" "> API requirements.\n" - "> =\n" - "\n" + "> \n" "> I think the root cause is that people just don't like reading what\n" "> other people write in terms of documentation, and they prefer to go\n" "> off and do their own thing, provided it works for them.\n" @@ -86,47 +63,41 @@ "\n" "\n" "\n" - "diff --git a/arch/arm/mach-davinci/pm_domain.c b/arch/arm/mach-davinci/pm_d=\n" - "omain.c\n" + "diff --git a/arch/arm/mach-davinci/pm_domain.c b/arch/arm/mach-davinci/pm_domain.c\n" "index 78eac2c..b46e5ce 100644\n" "--- a/arch/arm/mach-davinci/pm_domain.c\n" "+++ b/arch/arm/mach-davinci/pm_domain.c\n" - "@@ -24,6 +24,7 @@ static struct dev_pm_domain davinci_pm_domain =3D {\n" - " static struct pm_clk_notifier_block platform_bus_notifier =3D {\n" - " \t.pm_domain =3D &davinci_pm_domain,\n" - " \t.con_ids =3D { \"fck\", \"master\", \"slave\", NULL },\n" - "+\t.clks =3D { ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN) },\n" + "@@ -24,6 +24,7 @@ static struct dev_pm_domain davinci_pm_domain = {\n" + " static struct pm_clk_notifier_block platform_bus_notifier = {\n" + " \t.pm_domain = &davinci_pm_domain,\n" + " \t.con_ids = { \"fck\", \"master\", \"slave\", NULL },\n" + "+\t.clks = { ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN) },\n" " };\n" - " =\n" - "\n" + " \n" " static int __init davinci_pm_runtime_init(void)\n" - "diff --git a/arch/arm/mach-keystone/pm_domain.c b/arch/arm/mach-keystone/pm=\n" - "_domain.c\n" + "diff --git a/arch/arm/mach-keystone/pm_domain.c b/arch/arm/mach-keystone/pm_domain.c\n" "index e283939..d21c18b 100644\n" "--- a/arch/arm/mach-keystone/pm_domain.c\n" "+++ b/arch/arm/mach-keystone/pm_domain.c\n" - "@@ -27,6 +27,7 @@ static struct dev_pm_domain keystone_pm_domain =3D {\n" - " =\n" - "\n" - " static struct pm_clk_notifier_block platform_domain_notifier =3D {\n" - " \t.pm_domain =3D &keystone_pm_domain,\n" - "+\t.clks =3D { ERR_PTR(-EAGAIN) },\n" + "@@ -27,6 +27,7 @@ static struct dev_pm_domain keystone_pm_domain = {\n" + " \n" + " static struct pm_clk_notifier_block platform_domain_notifier = {\n" + " \t.pm_domain = &keystone_pm_domain,\n" + "+\t.clks = { ERR_PTR(-EAGAIN) },\n" " };\n" - " =\n" - "\n" - " static const struct of_device_id of_keystone_table[] =3D {\n" + " \n" + " static const struct of_device_id of_keystone_table[] = {\n" "diff --git a/arch/arm/mach-omap1/pm_bus.c b/arch/arm/mach-omap1/pm_bus.c\n" "index 667c163..5506453 100644\n" "--- a/arch/arm/mach-omap1/pm_bus.c\n" "+++ b/arch/arm/mach-omap1/pm_bus.c\n" - "@@ -31,6 +31,7 @@ static struct dev_pm_domain default_pm_domain =3D {\n" - " static struct pm_clk_notifier_block platform_bus_notifier =3D {\n" - " \t.pm_domain =3D &default_pm_domain,\n" - " \t.con_ids =3D { \"ick\", \"fck\", NULL, },\n" - "+\t.clks =3D { ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN) },\n" + "@@ -31,6 +31,7 @@ static struct dev_pm_domain default_pm_domain = {\n" + " static struct pm_clk_notifier_block platform_bus_notifier = {\n" + " \t.pm_domain = &default_pm_domain,\n" + " \t.con_ids = { \"ick\", \"fck\", NULL, },\n" + "+\t.clks = { ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN) },\n" " };\n" - " =\n" - "\n" + " \n" " static int __init omap1_pm_runtime_init(void)\n" "diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c\n" "index 652b5a3..26f0dcf 100644\n" @@ -134,8 +105,7 @@ "+++ b/drivers/base/power/clock_ops.c\n" "@@ -407,40 +407,6 @@ int pm_clk_runtime_resume(struct device *dev)\n" " #else /* !CONFIG_PM */\n" - " =\n" - "\n" + " \n" " /**\n" "- * enable_clock - Enable a device clock.\n" "- * @dev: Device whose clock is to be enabled.\n" @@ -145,7 +115,7 @@ "-{\n" "-\tstruct clk *clk;\n" "-\n" - "-\tclk =3D clk_get(dev, con_id);\n" + "-\tclk = clk_get(dev, con_id);\n" "-\tif (!IS_ERR(clk)) {\n" "-\t\tclk_prepare_enable(clk);\n" "-\t\tclk_put(clk);\n" @@ -162,7 +132,7 @@ "-{\n" "-\tstruct clk *clk;\n" "-\n" - "-\tclk =3D clk_get(dev, con_id);\n" + "-\tclk = clk_get(dev, con_id);\n" "-\tif (!IS_ERR(clk)) {\n" "-\t\tclk_disable_unprepare(clk);\n" "-\t\tclk_put(clk);\n" @@ -178,21 +148,21 @@ " \tswitch (action) {\n" " \tcase BUS_NOTIFY_BIND_DRIVER:\n" " \t\tif (clknb->con_ids[0]) {\n" - "-\t\t\tfor (con_id =3D clknb->con_ids; *con_id; con_id++)\n" + "-\t\t\tfor (con_id = clknb->con_ids; *con_id; con_id++)\n" "-\t\t\t\tenable_clock(dev, *con_id);\n" "+\t\t\tint i;\n" - "+\t\t\tfor (con_id =3D clknb->con_ids, i =3D 0; *con_id;\n" + "+\t\t\tfor (con_id = clknb->con_ids, i = 0; *con_id;\n" "+\t\t\t\t\t\tcon_id++, i++) {\n" - "+\t\t\t\tif (clknb->clks[i] =3D=3D ERR_PTR(-EAGAIN))\n" - "+\t\t\t\t\tclks[i] =3D clk_get(dev, *con_id);\n" + "+\t\t\t\tif (clknb->clks[i] = ERR_PTR(-EAGAIN))\n" + "+\t\t\t\t\tclks[i] = clk_get(dev, *con_id);\n" "+\t\t\t\tif (!IS_ERR(clknb->clks[i])) {\n" "+\t\t\t\t\tclk_prepare_enable(clk);\n" "+\t\t\t\t\tdev_info(dev, \"Runtime PM disabled, clock forced on.\\n\");\n" "+\t\t\t\t}\n" " \t\t} else {\n" "-\t\t\tenable_clock(dev, NULL);\n" - "+\t\t\tif (clknb->clks[0] =3D=3D ERR_PTR(-EAGAIN))\n" - "+\t\t\t\tclks[0] =3D clk_get(dev, NULL);\n" + "+\t\t\tif (clknb->clks[0] = ERR_PTR(-EAGAIN))\n" + "+\t\t\t\tclks[0] = clk_get(dev, NULL);\n" "+\t\t\tif (!IS_ERR(clknb->clks[0])) {\n" "+\t\t\t\tclk_prepare_enable(clk);\n" "+\t\t\t\tdev_info(dev, \"Runtime PM disabled, clock forced on.\\n\");\n" @@ -207,10 +177,10 @@ "+\t\t * should\n" "+\t\t */\n" " \t\tif (clknb->con_ids[0]) {\n" - "-\t\t\tfor (con_id =3D clknb->con_ids; *con_id; con_id++)\n" + "-\t\t\tfor (con_id = clknb->con_ids; *con_id; con_id++)\n" "-\t\t\t\tdisable_clock(dev, *con_id);\n" "+\t\t\tint i;\n" - "+\t\t\tfor (con_id =3D clknb->con_ids, i =3D 0; *con_id;\n" + "+\t\t\tfor (con_id = clknb->con_ids, i = 0; *con_id;\n" "+\t\t\t\t\tcon_id++, i++) {\n" "+\t\t\t\tif (!IS_ERR(clknb->clks[i])) {\n" "+\t\t\t\t\tclk_disable_unprepare(clknb->clks[i]);\n" @@ -230,14 +200,13 @@ "index 25abd4e..08754a4 100644\n" "--- a/drivers/sh/pm_runtime.c\n" "+++ b/drivers/sh/pm_runtime.c\n" - "@@ -30,6 +30,7 @@ static struct dev_pm_domain default_pm_domain =3D {\n" - " static struct pm_clk_notifier_block platform_bus_notifier =3D {\n" - " \t.pm_domain =3D &default_pm_domain,\n" - " \t.con_ids =3D { NULL, },\n" - "+\t.clks =3D { ERR_PTR(-EAGAIN) },\n" + "@@ -30,6 +30,7 @@ static struct dev_pm_domain default_pm_domain = {\n" + " static struct pm_clk_notifier_block platform_bus_notifier = {\n" + " \t.pm_domain = &default_pm_domain,\n" + " \t.con_ids = { NULL, },\n" + "+\t.clks = { ERR_PTR(-EAGAIN) },\n" " };\n" - " =\n" - "\n" + " \n" " static int __init sh_pm_runtime_init(void)\n" "diff --git a/include/linux/pm_clock.h b/include/linux/pm_clock.h\n" "index 25266c6..45e58fe 100644\n" @@ -249,8 +218,7 @@ " \tchar *con_ids[];\n" "+\tstruct clk *clks[];\n" " };\n" - " =\n" - "\n" + " \n" struct clk; -dbc6aa183511aa946a3405abc3f905ad945f13759d4215900cb95f99a4a34b7c +5cbc02b16c6ccef63fc3b8384385019be47b8e13e33fcacf8746f74a7ded7ff7
diff --git a/a/1.txt b/N3/1.txt index 4c1652c..7208317 100644 --- a/a/1.txt +++ b/N3/1.txt @@ -1,40 +1,32 @@ Quoting Russell King - ARM Linux (2015-10-21 03:59:32) > On Wed, Oct 21, 2015 at 11:50:07AM +0200, Geert Uytterhoeven wrote: > > Hi Mike, Russell, -> > = - +> > > > On Tue, Oct 20, 2015 at 2:40 PM, Michael Turquette > > <mturquette@baylibre.com> wrote: -> > > Why not keep the reference to the struct clk after get'ing it the fir= -st +> > > Why not keep the reference to the struct clk after get'ing it the first > > > time? -> > = - +> > > > And store it where? -> = - +> > Not my problem :) -> = - +> > Users are supposed to hold on to the reference obtained via clk_get() > while they're making use of the clock: in some implementations, this > increments the module use count if the clock driver is a module, and > may have other effects too. -> = - +> > Dropping that while you're still requiring the clock to be enabled is > unsafe: if it is provided by a module, then removing and reinserting > the module may very well change the enabled state of the clock, it > most certainly will disrupt the enable count. -> = - +> > It's always been this way, right from the outset, and when I've seen > people doing this bollocks, I've always pointed out that it's wrong. > Generally, people will fix it once they become aware of it, so it's > really that people just don't like reading and conforming to published > API requirements. -> = - +> > I think the root cause is that people just don't like reading what > other people write in terms of documentation, and they prefer to go > off and do their own thing, provided it works for them. @@ -59,47 +51,41 @@ Mike -diff --git a/arch/arm/mach-davinci/pm_domain.c b/arch/arm/mach-davinci/pm_d= -omain.c +diff --git a/arch/arm/mach-davinci/pm_domain.c b/arch/arm/mach-davinci/pm_domain.c index 78eac2c..b46e5ce 100644 --- a/arch/arm/mach-davinci/pm_domain.c +++ b/arch/arm/mach-davinci/pm_domain.c -@@ -24,6 +24,7 @@ static struct dev_pm_domain davinci_pm_domain =3D { - static struct pm_clk_notifier_block platform_bus_notifier =3D { - .pm_domain =3D &davinci_pm_domain, - .con_ids =3D { "fck", "master", "slave", NULL }, -+ .clks =3D { ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN) }, +@@ -24,6 +24,7 @@ static struct dev_pm_domain davinci_pm_domain = { + static struct pm_clk_notifier_block platform_bus_notifier = { + .pm_domain = &davinci_pm_domain, + .con_ids = { "fck", "master", "slave", NULL }, ++ .clks = { ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN) }, }; - = - + static int __init davinci_pm_runtime_init(void) -diff --git a/arch/arm/mach-keystone/pm_domain.c b/arch/arm/mach-keystone/pm= -_domain.c +diff --git a/arch/arm/mach-keystone/pm_domain.c b/arch/arm/mach-keystone/pm_domain.c index e283939..d21c18b 100644 --- a/arch/arm/mach-keystone/pm_domain.c +++ b/arch/arm/mach-keystone/pm_domain.c -@@ -27,6 +27,7 @@ static struct dev_pm_domain keystone_pm_domain =3D { - = - - static struct pm_clk_notifier_block platform_domain_notifier =3D { - .pm_domain =3D &keystone_pm_domain, -+ .clks =3D { ERR_PTR(-EAGAIN) }, +@@ -27,6 +27,7 @@ static struct dev_pm_domain keystone_pm_domain = { + + static struct pm_clk_notifier_block platform_domain_notifier = { + .pm_domain = &keystone_pm_domain, ++ .clks = { ERR_PTR(-EAGAIN) }, }; - = - - static const struct of_device_id of_keystone_table[] =3D { + + static const struct of_device_id of_keystone_table[] = { diff --git a/arch/arm/mach-omap1/pm_bus.c b/arch/arm/mach-omap1/pm_bus.c index 667c163..5506453 100644 --- a/arch/arm/mach-omap1/pm_bus.c +++ b/arch/arm/mach-omap1/pm_bus.c -@@ -31,6 +31,7 @@ static struct dev_pm_domain default_pm_domain =3D { - static struct pm_clk_notifier_block platform_bus_notifier =3D { - .pm_domain =3D &default_pm_domain, - .con_ids =3D { "ick", "fck", NULL, }, -+ .clks =3D { ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN) }, +@@ -31,6 +31,7 @@ static struct dev_pm_domain default_pm_domain = { + static struct pm_clk_notifier_block platform_bus_notifier = { + .pm_domain = &default_pm_domain, + .con_ids = { "ick", "fck", NULL, }, ++ .clks = { ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN) }, }; - = - + static int __init omap1_pm_runtime_init(void) diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c index 652b5a3..26f0dcf 100644 @@ -107,8 +93,7 @@ index 652b5a3..26f0dcf 100644 +++ b/drivers/base/power/clock_ops.c @@ -407,40 +407,6 @@ int pm_clk_runtime_resume(struct device *dev) #else /* !CONFIG_PM */ - = - + /** - * enable_clock - Enable a device clock. - * @dev: Device whose clock is to be enabled. @@ -118,7 +103,7 @@ index 652b5a3..26f0dcf 100644 -{ - struct clk *clk; - -- clk =3D clk_get(dev, con_id); +- clk = clk_get(dev, con_id); - if (!IS_ERR(clk)) { - clk_prepare_enable(clk); - clk_put(clk); @@ -135,7 +120,7 @@ index 652b5a3..26f0dcf 100644 -{ - struct clk *clk; - -- clk =3D clk_get(dev, con_id); +- clk = clk_get(dev, con_id); - if (!IS_ERR(clk)) { - clk_disable_unprepare(clk); - clk_put(clk); @@ -151,21 +136,21 @@ index 652b5a3..26f0dcf 100644 switch (action) { case BUS_NOTIFY_BIND_DRIVER: if (clknb->con_ids[0]) { -- for (con_id =3D clknb->con_ids; *con_id; con_id++) +- for (con_id = clknb->con_ids; *con_id; con_id++) - enable_clock(dev, *con_id); + int i; -+ for (con_id =3D clknb->con_ids, i =3D 0; *con_id; ++ for (con_id = clknb->con_ids, i = 0; *con_id; + con_id++, i++) { -+ if (clknb->clks[i] =3D=3D ERR_PTR(-EAGAIN)) -+ clks[i] =3D clk_get(dev, *con_id); ++ if (clknb->clks[i] == ERR_PTR(-EAGAIN)) ++ clks[i] = clk_get(dev, *con_id); + if (!IS_ERR(clknb->clks[i])) { + clk_prepare_enable(clk); + dev_info(dev, "Runtime PM disabled, clock forced on.\n"); + } } else { - enable_clock(dev, NULL); -+ if (clknb->clks[0] =3D=3D ERR_PTR(-EAGAIN)) -+ clks[0] =3D clk_get(dev, NULL); ++ if (clknb->clks[0] == ERR_PTR(-EAGAIN)) ++ clks[0] = clk_get(dev, NULL); + if (!IS_ERR(clknb->clks[0])) { + clk_prepare_enable(clk); + dev_info(dev, "Runtime PM disabled, clock forced on.\n"); @@ -180,10 +165,10 @@ index 652b5a3..26f0dcf 100644 + * should + */ if (clknb->con_ids[0]) { -- for (con_id =3D clknb->con_ids; *con_id; con_id++) +- for (con_id = clknb->con_ids; *con_id; con_id++) - disable_clock(dev, *con_id); + int i; -+ for (con_id =3D clknb->con_ids, i =3D 0; *con_id; ++ for (con_id = clknb->con_ids, i = 0; *con_id; + con_id++, i++) { + if (!IS_ERR(clknb->clks[i])) { + clk_disable_unprepare(clknb->clks[i]); @@ -203,14 +188,13 @@ diff --git a/drivers/sh/pm_runtime.c b/drivers/sh/pm_runtime.c index 25abd4e..08754a4 100644 --- a/drivers/sh/pm_runtime.c +++ b/drivers/sh/pm_runtime.c -@@ -30,6 +30,7 @@ static struct dev_pm_domain default_pm_domain =3D { - static struct pm_clk_notifier_block platform_bus_notifier =3D { - .pm_domain =3D &default_pm_domain, - .con_ids =3D { NULL, }, -+ .clks =3D { ERR_PTR(-EAGAIN) }, +@@ -30,6 +30,7 @@ static struct dev_pm_domain default_pm_domain = { + static struct pm_clk_notifier_block platform_bus_notifier = { + .pm_domain = &default_pm_domain, + .con_ids = { NULL, }, ++ .clks = { ERR_PTR(-EAGAIN) }, }; - = - + static int __init sh_pm_runtime_init(void) diff --git a/include/linux/pm_clock.h b/include/linux/pm_clock.h index 25266c6..45e58fe 100644 @@ -222,6 +206,5 @@ index 25266c6..45e58fe 100644 char *con_ids[]; + struct clk *clks[]; }; - = - + struct clk; diff --git a/a/content_digest b/N3/content_digest index 66c4be7..adf6082 100644 --- a/a/content_digest +++ b/N3/content_digest @@ -4,64 +4,41 @@ "ref\020151020124000.20687.60752@quantum\0" "ref\0CAMuHMdWd9LxrSWO5snriW+fb_d8FtMeXUBjp3M-Oeahh+FzJcw@mail.gmail.com\0" "ref\020151021105932.GP32536@n2100.arm.linux.org.uk\0" - "From\0Michael Turquette <mturquette@baylibre.com>\0" - "Subject\0Re: [PATCH RFC RFT 2/3] clk: clk_put WARNs if user has not disabled clk\0" + "From\0mturquette@baylibre.com (Michael Turquette)\0" + "Subject\0[PATCH RFC RFT 2/3] clk: clk_put WARNs if user has not disabled clk\0" "Date\0Wed, 21 Oct 2015 08:50:57 -0700\0" - "To\0Russell King - ARM Linux <linux@arm.linux.org.uk>" - " Geert Uytterhoeven <geert@linux-m68k.org>\0" - "Cc\0linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org>" - linux-clk <linux-clk@vger.kernel.org> - Stephen Boyd <sboyd@codeaurora.org> - Lee Jones <lee.jones@linaro.org> - Maxime Ripard <maxime.ripard@free-electrons.com> - Sascha Hauer <s.hauer@pengutronix.de> - Sekhar Nori <nsekhar@ti.com> - Kevin Hilman <khilman@kernel.org> - Santosh Shilimkar <ssantosh@kernel.org> - Tony Lindgren <tony@atomide.com> - linux-omap@vger.kernel.org <linux-omap@vger.kernel.org> - linux-arm-kernel@lists.infradead.org <linux-arm-kernel@lists.infradead.org> - Linux-sh list <linux-sh@vger.kernel.org> - " Linux PM list <linux-pm@vger.kernel.org>\0" + "To\0linux-arm-kernel@lists.infradead.org\0" "\00:1\0" "b\0" "Quoting Russell King - ARM Linux (2015-10-21 03:59:32)\n" "> On Wed, Oct 21, 2015 at 11:50:07AM +0200, Geert Uytterhoeven wrote:\n" "> > Hi Mike, Russell,\n" - "> > =\n" - "\n" + "> > \n" "> > On Tue, Oct 20, 2015 at 2:40 PM, Michael Turquette\n" "> > <mturquette@baylibre.com> wrote:\n" - "> > > Why not keep the reference to the struct clk after get'ing it the fir=\n" - "st\n" + "> > > Why not keep the reference to the struct clk after get'ing it the first\n" "> > > time?\n" - "> > =\n" - "\n" + "> > \n" "> > And store it where?\n" - "> =\n" - "\n" + "> \n" "> Not my problem :)\n" - "> =\n" - "\n" + "> \n" "> Users are supposed to hold on to the reference obtained via clk_get()\n" "> while they're making use of the clock: in some implementations, this\n" "> increments the module use count if the clock driver is a module, and\n" "> may have other effects too.\n" - "> =\n" - "\n" + "> \n" "> Dropping that while you're still requiring the clock to be enabled is\n" "> unsafe: if it is provided by a module, then removing and reinserting\n" "> the module may very well change the enabled state of the clock, it\n" "> most certainly will disrupt the enable count.\n" - "> =\n" - "\n" + "> \n" "> It's always been this way, right from the outset, and when I've seen\n" "> people doing this bollocks, I've always pointed out that it's wrong.\n" "> Generally, people will fix it once they become aware of it, so it's\n" "> really that people just don't like reading and conforming to published\n" "> API requirements.\n" - "> =\n" - "\n" + "> \n" "> I think the root cause is that people just don't like reading what\n" "> other people write in terms of documentation, and they prefer to go\n" "> off and do their own thing, provided it works for them.\n" @@ -86,47 +63,41 @@ "\n" "\n" "\n" - "diff --git a/arch/arm/mach-davinci/pm_domain.c b/arch/arm/mach-davinci/pm_d=\n" - "omain.c\n" + "diff --git a/arch/arm/mach-davinci/pm_domain.c b/arch/arm/mach-davinci/pm_domain.c\n" "index 78eac2c..b46e5ce 100644\n" "--- a/arch/arm/mach-davinci/pm_domain.c\n" "+++ b/arch/arm/mach-davinci/pm_domain.c\n" - "@@ -24,6 +24,7 @@ static struct dev_pm_domain davinci_pm_domain =3D {\n" - " static struct pm_clk_notifier_block platform_bus_notifier =3D {\n" - " \t.pm_domain =3D &davinci_pm_domain,\n" - " \t.con_ids =3D { \"fck\", \"master\", \"slave\", NULL },\n" - "+\t.clks =3D { ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN) },\n" + "@@ -24,6 +24,7 @@ static struct dev_pm_domain davinci_pm_domain = {\n" + " static struct pm_clk_notifier_block platform_bus_notifier = {\n" + " \t.pm_domain = &davinci_pm_domain,\n" + " \t.con_ids = { \"fck\", \"master\", \"slave\", NULL },\n" + "+\t.clks = { ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN) },\n" " };\n" - " =\n" - "\n" + " \n" " static int __init davinci_pm_runtime_init(void)\n" - "diff --git a/arch/arm/mach-keystone/pm_domain.c b/arch/arm/mach-keystone/pm=\n" - "_domain.c\n" + "diff --git a/arch/arm/mach-keystone/pm_domain.c b/arch/arm/mach-keystone/pm_domain.c\n" "index e283939..d21c18b 100644\n" "--- a/arch/arm/mach-keystone/pm_domain.c\n" "+++ b/arch/arm/mach-keystone/pm_domain.c\n" - "@@ -27,6 +27,7 @@ static struct dev_pm_domain keystone_pm_domain =3D {\n" - " =\n" - "\n" - " static struct pm_clk_notifier_block platform_domain_notifier =3D {\n" - " \t.pm_domain =3D &keystone_pm_domain,\n" - "+\t.clks =3D { ERR_PTR(-EAGAIN) },\n" + "@@ -27,6 +27,7 @@ static struct dev_pm_domain keystone_pm_domain = {\n" + " \n" + " static struct pm_clk_notifier_block platform_domain_notifier = {\n" + " \t.pm_domain = &keystone_pm_domain,\n" + "+\t.clks = { ERR_PTR(-EAGAIN) },\n" " };\n" - " =\n" - "\n" - " static const struct of_device_id of_keystone_table[] =3D {\n" + " \n" + " static const struct of_device_id of_keystone_table[] = {\n" "diff --git a/arch/arm/mach-omap1/pm_bus.c b/arch/arm/mach-omap1/pm_bus.c\n" "index 667c163..5506453 100644\n" "--- a/arch/arm/mach-omap1/pm_bus.c\n" "+++ b/arch/arm/mach-omap1/pm_bus.c\n" - "@@ -31,6 +31,7 @@ static struct dev_pm_domain default_pm_domain =3D {\n" - " static struct pm_clk_notifier_block platform_bus_notifier =3D {\n" - " \t.pm_domain =3D &default_pm_domain,\n" - " \t.con_ids =3D { \"ick\", \"fck\", NULL, },\n" - "+\t.clks =3D { ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN) },\n" + "@@ -31,6 +31,7 @@ static struct dev_pm_domain default_pm_domain = {\n" + " static struct pm_clk_notifier_block platform_bus_notifier = {\n" + " \t.pm_domain = &default_pm_domain,\n" + " \t.con_ids = { \"ick\", \"fck\", NULL, },\n" + "+\t.clks = { ERR_PTR(-EAGAIN), ERR_PTR(-EAGAIN) },\n" " };\n" - " =\n" - "\n" + " \n" " static int __init omap1_pm_runtime_init(void)\n" "diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c\n" "index 652b5a3..26f0dcf 100644\n" @@ -134,8 +105,7 @@ "+++ b/drivers/base/power/clock_ops.c\n" "@@ -407,40 +407,6 @@ int pm_clk_runtime_resume(struct device *dev)\n" " #else /* !CONFIG_PM */\n" - " =\n" - "\n" + " \n" " /**\n" "- * enable_clock - Enable a device clock.\n" "- * @dev: Device whose clock is to be enabled.\n" @@ -145,7 +115,7 @@ "-{\n" "-\tstruct clk *clk;\n" "-\n" - "-\tclk =3D clk_get(dev, con_id);\n" + "-\tclk = clk_get(dev, con_id);\n" "-\tif (!IS_ERR(clk)) {\n" "-\t\tclk_prepare_enable(clk);\n" "-\t\tclk_put(clk);\n" @@ -162,7 +132,7 @@ "-{\n" "-\tstruct clk *clk;\n" "-\n" - "-\tclk =3D clk_get(dev, con_id);\n" + "-\tclk = clk_get(dev, con_id);\n" "-\tif (!IS_ERR(clk)) {\n" "-\t\tclk_disable_unprepare(clk);\n" "-\t\tclk_put(clk);\n" @@ -178,21 +148,21 @@ " \tswitch (action) {\n" " \tcase BUS_NOTIFY_BIND_DRIVER:\n" " \t\tif (clknb->con_ids[0]) {\n" - "-\t\t\tfor (con_id =3D clknb->con_ids; *con_id; con_id++)\n" + "-\t\t\tfor (con_id = clknb->con_ids; *con_id; con_id++)\n" "-\t\t\t\tenable_clock(dev, *con_id);\n" "+\t\t\tint i;\n" - "+\t\t\tfor (con_id =3D clknb->con_ids, i =3D 0; *con_id;\n" + "+\t\t\tfor (con_id = clknb->con_ids, i = 0; *con_id;\n" "+\t\t\t\t\t\tcon_id++, i++) {\n" - "+\t\t\t\tif (clknb->clks[i] =3D=3D ERR_PTR(-EAGAIN))\n" - "+\t\t\t\t\tclks[i] =3D clk_get(dev, *con_id);\n" + "+\t\t\t\tif (clknb->clks[i] == ERR_PTR(-EAGAIN))\n" + "+\t\t\t\t\tclks[i] = clk_get(dev, *con_id);\n" "+\t\t\t\tif (!IS_ERR(clknb->clks[i])) {\n" "+\t\t\t\t\tclk_prepare_enable(clk);\n" "+\t\t\t\t\tdev_info(dev, \"Runtime PM disabled, clock forced on.\\n\");\n" "+\t\t\t\t}\n" " \t\t} else {\n" "-\t\t\tenable_clock(dev, NULL);\n" - "+\t\t\tif (clknb->clks[0] =3D=3D ERR_PTR(-EAGAIN))\n" - "+\t\t\t\tclks[0] =3D clk_get(dev, NULL);\n" + "+\t\t\tif (clknb->clks[0] == ERR_PTR(-EAGAIN))\n" + "+\t\t\t\tclks[0] = clk_get(dev, NULL);\n" "+\t\t\tif (!IS_ERR(clknb->clks[0])) {\n" "+\t\t\t\tclk_prepare_enable(clk);\n" "+\t\t\t\tdev_info(dev, \"Runtime PM disabled, clock forced on.\\n\");\n" @@ -207,10 +177,10 @@ "+\t\t * should\n" "+\t\t */\n" " \t\tif (clknb->con_ids[0]) {\n" - "-\t\t\tfor (con_id =3D clknb->con_ids; *con_id; con_id++)\n" + "-\t\t\tfor (con_id = clknb->con_ids; *con_id; con_id++)\n" "-\t\t\t\tdisable_clock(dev, *con_id);\n" "+\t\t\tint i;\n" - "+\t\t\tfor (con_id =3D clknb->con_ids, i =3D 0; *con_id;\n" + "+\t\t\tfor (con_id = clknb->con_ids, i = 0; *con_id;\n" "+\t\t\t\t\tcon_id++, i++) {\n" "+\t\t\t\tif (!IS_ERR(clknb->clks[i])) {\n" "+\t\t\t\t\tclk_disable_unprepare(clknb->clks[i]);\n" @@ -230,14 +200,13 @@ "index 25abd4e..08754a4 100644\n" "--- a/drivers/sh/pm_runtime.c\n" "+++ b/drivers/sh/pm_runtime.c\n" - "@@ -30,6 +30,7 @@ static struct dev_pm_domain default_pm_domain =3D {\n" - " static struct pm_clk_notifier_block platform_bus_notifier =3D {\n" - " \t.pm_domain =3D &default_pm_domain,\n" - " \t.con_ids =3D { NULL, },\n" - "+\t.clks =3D { ERR_PTR(-EAGAIN) },\n" + "@@ -30,6 +30,7 @@ static struct dev_pm_domain default_pm_domain = {\n" + " static struct pm_clk_notifier_block platform_bus_notifier = {\n" + " \t.pm_domain = &default_pm_domain,\n" + " \t.con_ids = { NULL, },\n" + "+\t.clks = { ERR_PTR(-EAGAIN) },\n" " };\n" - " =\n" - "\n" + " \n" " static int __init sh_pm_runtime_init(void)\n" "diff --git a/include/linux/pm_clock.h b/include/linux/pm_clock.h\n" "index 25266c6..45e58fe 100644\n" @@ -249,8 +218,7 @@ " \tchar *con_ids[];\n" "+\tstruct clk *clks[];\n" " };\n" - " =\n" - "\n" + " \n" struct clk; -dbc6aa183511aa946a3405abc3f905ad945f13759d4215900cb95f99a4a34b7c +738e56a215623d9e5f457de0937afdd289b742318dd1442fe012259952af7418
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.