linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Zhang, Ning A" <ning.a.zhang@intel.com>
To: "pombredanne@nexb.com" <pombredanne@nexb.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"kstewart@linuxfoundation.org" <kstewart@linuxfoundation.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: 3 version of MKDEV: kernel, uapi, libc, why?
Date: Wed, 11 Apr 2018 08:51:03 +0000	[thread overview]
Message-ID: <1523436662.1414.12.camel@intel.com> (raw)

Hi, Greg, Thomas

I find 3 version of MKDEV (actually 2 + makedev)

in include/linux/kdev_t.h

    #define MINORBITS    	    20
    #define MKDEV(ma,mi)    	    (((ma) << MINORBITS) | (mi))

in inlcude/uapi/linux/kdev_t.h

    #define MKDEV(ma,mi)    	    ((ma)<<8 | (mi))

in Android bionic

    #define makedev(__major, __minor) \
      ( \
        (((__major) & 0xfffff000ULL) << 32) | (((__major) & 0xfffULL) <<
    8) | \
        (((__minor) & 0xffffff00ULL) << 12) | (((__minor) & 0xffULL)) \
      )

if I use mknod("renderD128", S_IFCHR|0666, MKDEV(226, 128));
I get wrong device:
crw-rw-rw- 1 root graphics 0, 57984 2011-11-11 11:20 renderD128


if I use ("renderD128",S_IFCHR|0666, makedev(226, 128));
I get right device.

but, when I use: mknod("card0", S_IFCHR|0666, MKDEV(226, 0));
I can get right device.

BR.
Ning.

             reply	other threads:[~2018-04-11  8:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-11  8:51 Zhang, Ning A [this message]
2018-04-11 10:04 ` 3 version of MKDEV: kernel, uapi, libc, why? gregkh
2018-04-12  1:45   ` Zhang, Ning A

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=1523436662.1414.12.camel@intel.com \
    --to=ning.a.zhang@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kstewart@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pombredanne@nexb.com \
    --cc=tglx@linutronix.de \
    /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).