linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jingoo Han <jg1.han@samsung.com>
To: linux-fbdev@vger.kernel.org
Subject: Re: [PATCH] video: mmp: add device tree support
Date: Thu, 09 Jan 2014 07:43:58 +0000	[thread overview]
Message-ID: <000301cf0d0e$91f29090$b5d7b1b0$%han@samsung.com> (raw)
In-Reply-To: <1389244394-10779-1-git-send-email-zzhu3@marvell.com>

On Thursday, January 09, 2014 4:32 PM, Sascha Hauer wrote:
> On Thu, Jan 09, 2014 at 01:13:14PM +0800, Zhou Zhu wrote:
> > add device tree support for mmp fb/controller
> > the description at Documentation/devicetree/bindings/fb/mmp-disp.txt
> >
> > Signed-off-by: Zhou Zhu <zzhu3@marvell.com>
> > ---
> >  Documentation/devicetree/bindings/fb/mmp-disp.txt |   71 ++++++++++++
> >  drivers/video/mmp/fb/mmpfb.c                      |   71 ++++++++----
> >  drivers/video/mmp/hw/mmp_ctrl.c                   |  120 ++++++++++++++++-----
> >  3 files changed, 217 insertions(+), 45 deletions(-)
> >  create mode 100644 Documentation/devicetree/bindings/fb/mmp-disp.txt
> >
> > diff --git a/Documentation/devicetree/bindings/fb/mmp-disp.txt
> b/Documentation/devicetree/bindings/fb/mmp-disp.txt
> > new file mode 100644
> > index 0000000..3cf2903
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/fb/mmp-disp.txt

[.....]

> 
> > +#ifdef CONFIG_OF
> > +	struct device_node *np;
> > +#else
> >  	struct mmp_buffer_driver_mach_info *mi;
> > +#endif
> >  	struct fb_info *info = 0;
> >  	struct mmpfb_info *fbi = 0;
> > -	int ret, modes_num;
> > -
> > -	mi = pdev->dev.platform_data;
> > -	if (mi = NULL) {
> > -		dev_err(&pdev->dev, "no platform data defined\n");
> > -		return -EINVAL;
> > -	}
> > +	int ret = -EINVAL, modes_num;
> > +	int overlay_id, dmafetch_id;
> > +	const char *path_name;
> >
> >  	/* initialize fb */
> >  	info = framebuffer_alloc(sizeof(struct mmpfb_info), &pdev->dev);
> >  	if (info = NULL)
> >  		return -ENOMEM;
> >  	fbi = info->par;
> > -	if (!fbi) {
> > -		ret = -EINVAL;
> > +	if (!fbi)
> > +		goto failed;
> > +
> > +#ifdef CONFIG_OF
> 
> Just because your kernel build does have CONFIG_OF enabled doesn't mean
> it's actually started with a devicetree. You need to make a runtime
> decision, not compile time.

Yes, right.
As Sascha Hauer said, you need to make a runtime decision,
instead of compile time. Please keep the same binary for
both cases (CONFIG_OF is 'enabled' and 'disabled').

For example,

	if (pdev->dev.of_node) {
		// DT code
	} else {
		// Non-DT code
	}

Best regards,
Jingoo Han


  parent reply	other threads:[~2014-01-09  7:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-09  5:13 [PATCH] video: mmp: add device tree support Zhou Zhu
     [not found] ` <1389244394-10779-1-git-send-email-zzhu3-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2014-01-09  6:05   ` Zhou Zhu
2014-01-09  7:31 ` Sascha Hauer
2014-01-09  7:43 ` Jingoo Han [this message]
     [not found]   ` <000301cf0d0e$91f29090$b5d7b1b0$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-01-09 12:09     ` Zhou Zhu
     [not found]       ` <52CE9165.7050002-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2014-01-10  9:07         ` 'Sascha Hauer'

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000301cf0d0e$91f29090$b5d7b1b0$%han@samsung.com' \
    --to=jg1.han@samsung.com \
    --cc=linux-fbdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).