2012-02-08 11:18:33

by Luciano Coelho

[permalink] [raw]
Subject: [PATCH 3.3 v2] I2C: OMAP: fix build breakage when CONFIG_OF is not set

Since commit 6145197 (i2c: OMAP: Add DT support for i2c controller),
building i2c_omap.c breaks if CONFIG_OF is not set:

drivers/i2c/busses/i2c-omap.c: In function 'omap_i2c_probe':
drivers/i2c/busses/i2c-omap.c:1021: error: 'omap_i2c_of_match' undeclared (first use in this function)
drivers/i2c/busses/i2c-omap.c:1021: error: (Each undeclared identifier is reported only once
drivers/i2c/busses/i2c-omap.c:1021: error: for each function it appears in.)

This is because the definition of omap_i2c_of_match is #ifdef'd on
CONFIG_OF, but the usage of it is not.

Since the places where omap_ic2_of_match are prepared to get NULL
pointers if CONFIG_OF is not defined, we can simply define it to NULL.

Cc: Benoit Cousson <[email protected]>
Signed-off-by: Luciano Coelho <[email protected]>
Reviewed-by: Felipe Balbi <[email protected]>
---
v2: changed the commit log to use abbrev sha and include the commit subject

drivers/i2c/busses/i2c-omap.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index f713eac..fd200eb 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -979,6 +979,8 @@ static const struct of_device_id omap_i2c_of_match[] = {
{ },
};
MODULE_DEVICE_TABLE(of, omap_i2c_of_match);
+#else
+static const struct of_device_id *omap_i2c_of_match = NULL;
#endif

static int __devinit
--
1.7.5.4


2012-02-14 00:12:39

by Ben Dooks

[permalink] [raw]
Subject: Re: [PATCH 3.3 v2] I2C: OMAP: fix build breakage when CONFIG_OF is not set

On Wed, Feb 08, 2012 at 01:18:21PM +0200, Luciano Coelho wrote:
> Since commit 6145197 (i2c: OMAP: Add DT support for i2c controller),
> building i2c_omap.c breaks if CONFIG_OF is not set:
>
> drivers/i2c/busses/i2c-omap.c: In function 'omap_i2c_probe':
> drivers/i2c/busses/i2c-omap.c:1021: error: 'omap_i2c_of_match' undeclared (first use in this function)
> drivers/i2c/busses/i2c-omap.c:1021: error: (Each undeclared identifier is reported only once
> drivers/i2c/busses/i2c-omap.c:1021: error: for each function it appears in.)
>
> This is because the definition of omap_i2c_of_match is #ifdef'd on
> CONFIG_OF, but the usage of it is not.
>
> Since the places where omap_ic2_of_match are prepared to get NULL
> pointers if CONFIG_OF is not defined, we can simply define it to NULL.
>
> Cc: Benoit Cousson <[email protected]>
> Signed-off-by: Luciano Coelho <[email protected]>
> Reviewed-by: Felipe Balbi <[email protected]>
> ---
> v2: changed the commit log to use abbrev sha and include the commit subject
>
> drivers/i2c/busses/i2c-omap.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index f713eac..fd200eb 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -979,6 +979,8 @@ static const struct of_device_id omap_i2c_of_match[] = {
> { },
> };
> MODULE_DEVICE_TABLE(of, omap_i2c_of_match);
> +#else
> +static const struct of_device_id *omap_i2c_of_match = NULL;
> #endif

of_match_ptr(_ptr) will go to NULL if CONFIG_OF is not set, use that please.

2012-02-14 09:55:39

by Luciano Coelho

[permalink] [raw]
Subject: Re: [PATCH 3.3 v2] I2C: OMAP: fix build breakage when CONFIG_OF is not set

Hi Ben,

On Mon, 2012-02-13 at 23:27 +0000, Ben Dooks wrote:
> On Wed, Feb 08, 2012 at 01:18:21PM +0200, Luciano Coelho wrote:
> > diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> > index f713eac..fd200eb 100644
> > --- a/drivers/i2c/busses/i2c-omap.c
> > +++ b/drivers/i2c/busses/i2c-omap.c
> > @@ -979,6 +979,8 @@ static const struct of_device_id omap_i2c_of_match[] = {
> > { },
> > };
> > MODULE_DEVICE_TABLE(of, omap_i2c_of_match);
> > +#else
> > +static const struct of_device_id *omap_i2c_of_match = NULL;
> > #endif
>
> of_match_ptr(_ptr) will go to NULL if CONFIG_OF is not set, use that please.

Yes, you're right. But this patch can be ignored, since there was
already an equivalent one queued up (which I missed). And it uses
of_match_ptr() ;)

Thanks for your comment anyway!

--
Cheers,
Luca.