public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: tegra: Fix compile when !CONFIG_OF
@ 2011-07-13 20:36 Stephen Warren
       [not found] ` <1310589418-15821-1-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Warren @ 2011-07-13 20:36 UTC (permalink / raw)
  To: Grant Likely
  Cc: John Bonesio, Ben Dooks, Jean Delvare,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Stephen Warren

When !CONFIG_OF, <linux/of.h> doesn't prototype of_get_property(), which
causes i2c-tegra.c to fail to compile. Make the references to this
function conditional to solve this.

Signed-off-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
Grant, is this the correct way to solve this? Other solutions I can see are:
a) Make ARM or Tegra select CONFIG_OF, now that ARM is moving to Device Tree.
b) Make <linux/of.h> provide dummy inline versions of its functions when
   !CONFIG_OF.

 drivers/i2c/busses/i2c-tegra.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 2440b74..5a18d6d 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -610,12 +610,15 @@ static int tegra_i2c_probe(struct platform_device *pdev)
 	if (pdata) {
 		i2c_dev->bus_clk_rate = pdata->bus_clk_rate;
 
-	} else if (i2c_dev->dev->of_node) {    /* if there is a device tree node ... */
+	}
+#ifdef CONFIG_OF
+	else if (i2c_dev->dev->of_node) {    /* if there is a device tree node ... */
 		prop = of_get_property(i2c_dev->dev->of_node,
 				"clock-frequency", NULL);
 		if (prop)
 			i2c_dev->bus_clk_rate = be32_to_cpup(prop);
 	}
+#endif
 
 	if (pdev->id == 3)
 		i2c_dev->is_dvc = 1;
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] i2c: tegra: Fix compile when !CONFIG_OF
       [not found] ` <1310589418-15821-1-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2011-07-13 22:48   ` Grant Likely
       [not found]     ` <CACxGe6sVmpSTAxan3zRz-hQ=uoiVuekm-7r0L9_F5EWPPhS_3A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Grant Likely @ 2011-07-13 22:48 UTC (permalink / raw)
  To: Stephen Warren
  Cc: John Bonesio, Ben Dooks, Jean Delvare,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

On Thu, Jul 14, 2011 at 5:36 AM, Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> wrote:
> When !CONFIG_OF, <linux/of.h> doesn't prototype of_get_property(), which
> causes i2c-tegra.c to fail to compile. Make the references to this
> function conditional to solve this.
>
> Signed-off-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> ---
> Grant, is this the correct way to solve this? Other solutions I can see are:
> a) Make ARM or Tegra select CONFIG_OF, now that ARM is moving to Device Tree.
> b) Make <linux/of.h> provide dummy inline versions of its functions when
>   !CONFIG_OF.

The solution you chose is sufficient for now, but turning on CONFIG_OF
unconditionally for Tegra would be fine too since I hope to get the
tegra board-dt patch merged for 3.1 (I hope to have the patch cleaned
up and posted in the next 24 hrs).  I've been avoiding creating a
dummy inline of of_get_property(), but not for any particularly strong
reason other than to avoid bloating linux/of.h.  I probably would
accept a patch that added it.

Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>

g.

>
>  drivers/i2c/busses/i2c-tegra.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
> index 2440b74..5a18d6d 100644
> --- a/drivers/i2c/busses/i2c-tegra.c
> +++ b/drivers/i2c/busses/i2c-tegra.c
> @@ -610,12 +610,15 @@ static int tegra_i2c_probe(struct platform_device *pdev)
>        if (pdata) {
>                i2c_dev->bus_clk_rate = pdata->bus_clk_rate;
>
> -       } else if (i2c_dev->dev->of_node) {    /* if there is a device tree node ... */
> +       }
> +#ifdef CONFIG_OF
> +       else if (i2c_dev->dev->of_node) {    /* if there is a device tree node ... */
>                prop = of_get_property(i2c_dev->dev->of_node,
>                                "clock-frequency", NULL);
>                if (prop)
>                        i2c_dev->bus_clk_rate = be32_to_cpup(prop);
>        }
> +#endif
>
>        if (pdev->id == 3)
>                i2c_dev->is_dvc = 1;
> --
> 1.7.0.4
>
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] i2c: tegra: Fix compile when !CONFIG_OF
       [not found]     ` <CACxGe6sVmpSTAxan3zRz-hQ=uoiVuekm-7r0L9_F5EWPPhS_3A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2011-07-21 15:42       ` Stephen Warren
       [not found]         ` <74CDBE0F657A3D45AFBB94109FB122FF049EBDF141-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Warren @ 2011-07-21 15:42 UTC (permalink / raw)
  To: Ben Dooks
  Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	Jean Delvare, linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

Grant Likely wrote at Wednesday, July 13, 2011 4:48 PM:
> On Thu, Jul 14, 2011 at 5:36 AM, Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> wrote:
> > When !CONFIG_OF, <linux/of.h> doesn't prototype of_get_property(), which
> > causes i2c-tegra.c to fail to compile. Make the references to this
> > function conditional to solve this.
> >
> > Signed-off-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
...
> Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>

Ben, please can this patch be applied in time for 3.1? Currently, the
linux-next and next-i2c tree won't compile on Tegra without CONFIG_OF
enabled.

Also, the other patch I posted titled "i2c: Tegra: Add of_match_table"
is required for Tegra I2C Device Tree support to be useful. Can that go
into 3.1 as well?

Thanks very much!

-- 
nvpublic

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] i2c: tegra: Fix compile when !CONFIG_OF
       [not found]         ` <74CDBE0F657A3D45AFBB94109FB122FF049EBDF141-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
@ 2011-08-01  4:05           ` Stephen Warren
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Warren @ 2011-08-01  4:05 UTC (permalink / raw)
  To: Stephen Warren, Ben Dooks
  Cc: Grant Likely, John Bonesio, Jean Delvare,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org

Stephen Warren wrote at Thursday, July 21, 2011 9:42 AM:
> Grant Likely wrote at Wednesday, July 13, 2011 4:48 PM:
> > On Thu, Jul 14, 2011 at 5:36 AM, Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> wrote:
> > > When !CONFIG_OF, <linux/of.h> doesn't prototype of_get_property(), which
> > > causes i2c-tegra.c to fail to compile. Make the references to this
> > > function conditional to solve this.
> > >
> > > Signed-off-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> ...
> > Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
> 
> Ben, please can this patch be applied in time for 3.1? Currently, the
> linux-next and next-i2c tree won't compile on Tegra without CONFIG_OF
> enabled.

Ben, can this patch please be pushed for 3.1 to solve the compile problem?

> Also, the other patch I posted titled "i2c: Tegra: Add of_match_table"
> is required for Tegra I2C Device Tree support to be useful. Can that go
> into 3.1 as well?

Ben, can this patch please go into 3.1, since it's logically a missing
part of a patch that's already in 3.1, but got applied too early?

Thanks.

--
nvpublic

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-08-01  4:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-13 20:36 [PATCH] i2c: tegra: Fix compile when !CONFIG_OF Stephen Warren
     [not found] ` <1310589418-15821-1-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2011-07-13 22:48   ` Grant Likely
     [not found]     ` <CACxGe6sVmpSTAxan3zRz-hQ=uoiVuekm-7r0L9_F5EWPPhS_3A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-07-21 15:42       ` Stephen Warren
     [not found]         ` <74CDBE0F657A3D45AFBB94109FB122FF049EBDF141-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2011-08-01  4:05           ` Stephen Warren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox