From: simon.brand@postadigitale.de (Simon Brand)
To: kernelnewbies@lists.kernelnewbies.org
Subject: container_of
Date: Sat, 17 Jan 2015 20:45:06 +0100 [thread overview]
Message-ID: <20150117204506.2c8fd4a3@fx> (raw)
In-Reply-To: <CAE0An6cRL2j18-gH_-CTFfmhg7wsjyjhnyRMwAGUsM-dYiiGfg@mail.gmail.com>
Am Sat, 17 Jan 2015 08:58:13 -0800
schrieb Manish Katiyar <mkatiyar@gmail.com>:
> Have you searched through archives. Exactly 7 years ago, I had the
> same question.
>
> http://comments.gmane.org/gmane.linux.kernel.kernelnewbies/24141
>
No, sorry, I missed that :-x
Thank you.
To get this straight: it is only to produce a warning at compile time,
when it is misused?
I compiled the kernel two times, one time with the original code and
one time with
#define container_of(ptr, type, member) ({ \
(type *)( (char *)ptr - offsetof(type,member) );})
The secound kernel does not work proberly.
First there is a kernel BUG at include/drm/drm_mm.h:145 at every boot:
http://sprunge.us/MdDa
Secound the kernel hangs on reboot and poweroff:
reboot:
http://picpaste.de/pics/8a041c11f3f5e24faebc1abb41b1db3f.1421523345.png
poweroff:
http://picpaste.de/pics/b1ab5225f37572a31b43e2fb8526e890.1421523472.png
Third for example startx only produces the output:
waiting for X server to begin accepting connections
There is no further output in dmesg.
The X server starts correctly with the first/original kernel.
I compiled both kernels with following config:
https://projects.archlinux.org/svntogit/packages.git/plain/trunk/config.x86_64?h=packages/linux
and following patches:
https://projects.archlinux.org/svntogit/packages.git/plain/trunk/0001-drm-i915-Disallow-pin-ioctl-completely-for-kms-drive.patch?h=packages/linux
https://projects.archlinux.org/svntogit/packages.git/plain/trunk/change-default-console-loglevel.patch?h=packages/linux
I compiled a little c code with both defines and gcc is producing
another binary, but both are working as they should.
Thank you for your reply.
Simon
next prev parent reply other threads:[~2015-01-17 19:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-17 16:32 container_of Simon Brand
2015-01-17 16:58 ` container_of Manish Katiyar
2015-01-17 19:45 ` Simon Brand [this message]
2015-01-17 19:53 ` container_of Mike Krinkin
2015-01-19 15:18 ` container_of Simon Brand
2015-01-17 19:13 ` container_of Anish Kumar
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=20150117204506.2c8fd4a3@fx \
--to=simon.brand@postadigitale.de \
--cc=kernelnewbies@lists.kernelnewbies.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).