2013-09-30 08:57:32

by Sachin Kamat

[permalink] [raw]
Subject: [PATCH 1/2] regulator: ti-abb: Remove redundant of_match_ptr

The data structure of_match_ptr() protects is always compiled in.
Hence of_match_ptr() is not needed.

Signed-off-by: Sachin Kamat <[email protected]>
---
drivers/regulator/ti-abb-regulator.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/ti-abb-regulator.c b/drivers/regulator/ti-abb-regulator.c
index 8c2a819..64d6322 100644
--- a/drivers/regulator/ti-abb-regulator.c
+++ b/drivers/regulator/ti-abb-regulator.c
@@ -855,7 +855,7 @@ static struct platform_driver ti_abb_driver = {
.driver = {
.name = "ti_abb",
.owner = THIS_MODULE,
- .of_match_table = of_match_ptr(ti_abb_of_match),
+ .of_match_table = ti_abb_of_match,
},
};
module_platform_driver(ti_abb_driver);
--
1.7.9.5


2013-09-30 08:57:33

by Sachin Kamat

[permalink] [raw]
Subject: [PATCH 2/2] regulator: twl: Remove redundant of_match_ptr

The data structure of_match_ptr() protects is always compiled in.
Hence of_match_ptr() is not needed.

Signed-off-by: Sachin Kamat <[email protected]>
---
drivers/regulator/twl-regulator.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c
index 78aae4c..b764311 100644
--- a/drivers/regulator/twl-regulator.c
+++ b/drivers/regulator/twl-regulator.c
@@ -1233,7 +1233,7 @@ static struct platform_driver twlreg_driver = {
.driver = {
.name = "twl_reg",
.owner = THIS_MODULE,
- .of_match_table = of_match_ptr(twl_of_match),
+ .of_match_table = twl_of_match,
},
};

--
1.7.9.5

2013-09-30 11:01:29

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 1/2] regulator: ti-abb: Remove redundant of_match_ptr

On Mon, Sep 30, 2013 at 02:27:13PM +0530, Sachin Kamat wrote:
> The data structure of_match_ptr() protects is always compiled in.
> Hence of_match_ptr() is not needed.

It seems like good practice to include these even if they're not
currently doing anything - for example, if ACPI support were added to
the driver then you could get an ACPI kernel OF disabled.

Note that one of the things these macros are supposed to do (but don't
yet IIRC) is allow for dead code elimination to discard references to
things automatically even without the being ifdefed out.


Attachments:
(No filename) (561.00 B)
signature.asc (836.00 B)
Digital signature
Download all attachments

2013-09-30 11:52:21

by Sachin Kamat

[permalink] [raw]
Subject: Re: [PATCH 1/2] regulator: ti-abb: Remove redundant of_match_ptr

On 30 September 2013 16:31, Mark Brown <[email protected]> wrote:
> On Mon, Sep 30, 2013 at 02:27:13PM +0530, Sachin Kamat wrote:
>
> Note that one of the things these macros are supposed to do (but don't
> yet IIRC) is allow for dead code elimination to discard references to
> things automatically even without the being ifdefed out.

Yes that is correct. However, in this particular case all that
of_match_ptr() does
is make the pointer NULL if CONFIG_OF is disabled else assign it as
is. Since CONFIG_OF
is not used in these files, I thought it would be an appropriate cleanup.

--
With warm regards,
Sachin

2013-09-30 16:09:09

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 1/2] regulator: ti-abb: Remove redundant of_match_ptr

On Mon, Sep 30, 2013 at 05:22:19PM +0530, Sachin Kamat wrote:
> On 30 September 2013 16:31, Mark Brown <[email protected]> wrote:

> > Note that one of the things these macros are supposed to do (but don't
> > yet IIRC) is allow for dead code elimination to discard references to
> > things automatically even without the being ifdefed out.

> Yes that is correct. However, in this particular case all that
> of_match_ptr() does
> is make the pointer NULL if CONFIG_OF is disabled else assign it as
> is. Since CONFIG_OF
> is not used in these files, I thought it would be an appropriate cleanup.

Yes, it's not a completely silly idea but unlike something like removing
totally empty functions it's something that doesn't cost us anything and
which we might want in future. Right now the drivers only run on OF
systems though.


Attachments:
(No filename) (830.00 B)
signature.asc (836.00 B)
Digital signature
Download all attachments