linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Juergen Beisert <jbe@pengutronix.de>
To: linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/2] video: Add i.MX23/28 framebuffer driver
Date: Thu, 10 Feb 2011 11:12:17 +0000	[thread overview]
Message-ID: <201102101212.17370.jbe@pengutronix.de> (raw)
In-Reply-To: <09EC74FE2C9E8444BF2FF67BD36E1D69167988@039-SN1MPN1-003.039d.mgd.msft.net>

Li Frank-B20596 wrote:
> > This kind of macro encryption _may_ help when you are coding the driver
> > the
> > first time. But after reading and reading it again (while testing and
> > debugging) all these prefixes and suffixes do not add any valuable
> > information. They only fill up your lines, enlarges your source code and
> > make
> > you blind for the real bug...
> >
> > Everyone who wants to see how source code looks that uses these longs
> > macros I
> > can recommend reading the so called 'bootlets' source code. :-))
>
> The complex of bootlets is not long macro, but the work around to make sure
> Chip PMU work safely. If there are not such macro, power_prep will become
> more difficult to understand.

Its your opinion...

> > > Developer needn't look up register header file when coding, just
> >
> > That's why I add these macros into the source file instead into a header
> > file.
> >
> > > write down Register name or bit name according to mx23/mx28 spec.
> >
> > And sometimes the spec is incomplete or just wrong and so on. Independent
> > of any macro naming policy.
>
> Not at all. Mx23/mx28 can keep spec, header file and RTL consistent just
> because using one source and multiple output. During Freescale mx28 BSP
> develop, never happen bit and register definition error.
>
> > > If you still think it is too long, I suggest keep HW_ and BM_ prefix to
> > > distinguish Which one is register name, which one is bit mask.
> >
> > The used macro in the address part of the writel() must be an offset,
> > while
> > the macro used in the value part must be a bit definition. Anything else
> > is
> > redundant.
>
> If name is too short, there are possible to cause name pollution.
> BM_, BP_, BF_ have their implication.

If you collect everything in header files: Yes. If you keep the macros where 
they are used, IMHO: No.
 
> VDCTRL4_SET_DOTCLK_DLY(x), according to our macro policy, it should be
> BF_VDCTRL4_SET_DOTCLK_DLY(x).
>
> Generally, you need
> Reg = readl(offset+VDCTRL4);
> Reg &=~ ((0x7)<<29);

What about?
> Reg &= ~VDCTRL4_SET_DOTCLK_DLY(0x7);
Or?
> Reg &= ~VDCTRL4_SET_DOTCLK_DLY_MASK;
Okay, the even get longer and longer.
> Reg |= VDCTRL4_SET_DOTCLK_DLY(value)
> Writel(reg, offset+VDCTRL4)
>
> Compared with our macro policy.
>
> Reg = readl(offset+HW_VDCTRL4);
> Reg &=~ BM_VDCTRL4_SET_DOTCLK_DLY;
> Reg |= BF_VDCTRL4_SET_DOTCLK_DLY(value)
> Writel(reg, offset+HW_VDCTRL4)

Anywhere else such naming policy in the kernel? I have to deal with all kind 
of CPUs, not only i.MX23/28.

Regards,
Juergen

-- 
Pengutronix e.K.                              | Juergen Beisert             |
Linux Solutions for Science and Industry      | Phone: +49-8766-939 228     |
Vertretung Sued/Muenchen, Germany             | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686              | http://www.pengutronix.de/  |

  reply	other threads:[~2011-02-10 11:12 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1297257651-8002-1-git-send-email-s.hauer@pengutronix.de>
2011-02-09 13:20 ` [PATCH 1/2] video: Add i.MX23/28 framebuffer driver Sascha Hauer
2011-02-09 13:35   ` Lothar Waßmann
2011-02-10  3:16   ` Li Frank-B20596
2011-02-10  8:51     ` Juergen Beisert
2011-02-10  9:15       ` Li Frank-B20596
2011-02-10  9:52         ` Juergen Beisert
2011-02-10 10:37           ` Li Frank-B20596
2011-02-10 11:12             ` Juergen Beisert [this message]
2011-02-10 12:23               ` Li Frank-B20596
2011-02-10  9:23   ` Li Frank-B20596
2011-02-10  9:46     ` Juergen Beisert
2011-02-10 10:08       ` Li Frank-B20596
2011-02-10 10:47       ` Wolfram Sang
2011-02-10 11:51         ` Sascha Hauer
2011-02-10 12:32           ` Li Frank-B20596
     [not found] ` <201102091547.12131.arnd@arndb.de>
     [not found]   ` <20110209153716.GN9041@pengutronix.de>
2011-02-09 16:31     ` [PATCH] " Arnd Bergmann
2011-02-10 17:09       ` Robert Schwebel
2011-02-15 14:13       ` Clark, Rob
2011-02-16 12:22         ` Arnd Bergmann
     [not found]           ` <AANLkTik+ounqcTJ6rhiUqKPGkwcCOKGXdsVADs6zHfPU@mail.gmail.com>
2011-02-17  1:08             ` Clark, Rob
     [not found]               ` <AANLkTim3iUNHsaCf7387H-X+XW0YDQsQVa1FwDvo0KvH@mail.gmail.com>
2011-02-17 15:25                 ` Clark, Rob
     [not found]                   ` <AANLkTimOUnaHNMg03cHAiNJLuGhGuMWSHt+kibxWfYMH@mail.gmail.com>
2011-02-18  4:34                     ` Clark, Rob
2011-02-17 16:14               ` James Simmons
     [not found]                 ` <AANLkTimcwr4vpycSQCH9vMaB+umh+yHD_+WD2MJNqMOB@mail.gmail.com>
     [not found]                   ` <AANLkTimcwr4vpycSQCH9vMaB+umh+yHD_+WD2MJNqMOB-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-02-18  4:32                     ` Clark, Rob
2011-02-21  3:12                 ` Dave Airlie
     [not found] <1297850199-1688-1-git-send-email-s.hauer@pengutronix.de>
2011-02-16  9:56 ` [PATCH 1/2] video: Add " Sascha Hauer
2011-02-18  5:24   ` Shawn Guo
2011-02-18  8:30     ` Sascha Hauer
2011-02-18  8:57       ` Shawn Guo
2011-02-18 12:29   ` Shawn Guo
2011-02-21 14:17     ` Sascha Hauer
     [not found] <1298880152-28913-1-git-send-email-s.hauer@pengutronix.de>
2011-02-28  8:02 ` 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=201102101212.17370.jbe@pengutronix.de \
    --to=jbe@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.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).