From: Daniel Vetter <daniel@ffwll.ch>
To: Fabian Frederick <fabf@skynet.be>
Cc: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
peter@hurleysoftware.com
Subject: Re: [PATCH 0/9 linux-next] drivers/gpu/drm: use container_of where possible
Date: Wed, 17 Sep 2014 12:01:26 +0200 [thread overview]
Message-ID: <20140917100126.GF31703@phenom.ffwll.local> (raw)
In-Reply-To: <1669797975.16695.1410804954304.open-xchange@webmail.nmp.skynet.be>
On Mon, Sep 15, 2014 at 08:15:54PM +0200, Fabian Frederick wrote:
>
>
> > On 15 September 2014 at 01:13 One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
> > wrote:
> >
> >
> > On Sun, 14 Sep 2014 18:40:13 +0200
> > Fabian Frederick <fabf@skynet.be> wrote:
> >
> > > Small patchset using container_of instead of casting on first structure
> > > member address.
> >
> > Why. Container_of is useful for random offsets but its just convoluting
> > and confusing code which is designed with the fields intentionally at the
> > start.
> >
> > Alan
>
> What if someone doesn't know about that intention one day and inserts
> some field in the structure at the "wrong place" ?
> This would need at least some comment in each declaration
> but once again it's hard to control.One other way is to
> commonly use container_of and get rid of every casting with
> some semantic script.
>
> Peter has been asking for container_of in the following:
>
> http://marc.info/?l=linux-arm-kernel&m=140838705729653&w=2
>
>
> struct uart_amba_port *uap = (struct uart_amba_port *)port
>
> (port/uart_port is the first field in uart_amba_port though)
fwiw I like this and I've picked it up into my topic/core-stuff branch. So
if driver writers don't outright nack this it'll all land in Dave's
drm-next (probably still for 3.18).
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
next prev parent reply other threads:[~2014-09-17 10:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-14 16:40 Fabian Frederick
2014-09-14 16:40 ` [PATCH 1/9 linux-next] drm/cirrus: use container_of to resolve cirrus_fbdev from drm_fb_helper Fabian Frederick
2014-09-14 16:40 ` [PATCH 2/9 linux-next] drm/mgag200: use container_of to resolve mga_fbdev " Fabian Frederick
2014-09-14 16:40 ` [PATCH 3/9 linux-next] drm/radeon: use container_of to resolve radeon_fbdev " Fabian Frederick
2014-09-14 16:40 ` [PATCH 4/9 linux-next] drm/nouveau: use container_of to resolve nouveau_fbdev " Fabian Frederick
2014-09-14 16:40 ` [PATCH 5/9 linux-next] drm/nouveau: use container_of to resolve nouveau_plane from drm_plane Fabian Frederick
2014-09-14 16:40 ` [PATCH 6/9 linux-next] drm/qxl: use container_of to resolve qxl_fbdev from drm_fb_helper Fabian Frederick
2014-09-14 16:40 ` [PATCH 7/9 linux-next] drm/gma500: use container_of to resolve psb_fbdev " Fabian Frederick
2014-09-14 16:40 ` [PATCH 8/9 linux-next] drm/ast: use container_of to resolve ast_fbdev " Fabian Frederick
2014-09-14 16:40 ` [PATCH 9/9 linux-next] drm/udl: use container_of to resolve udl_fbdev " Fabian Frederick
2014-09-14 23:13 ` [PATCH 0/9 linux-next] drivers/gpu/drm: use container_of where possible One Thousand Gnomes
2014-09-15 18:15 ` Fabian Frederick
2014-09-17 10:01 ` Daniel Vetter [this message]
2014-09-17 10:49 ` One Thousand Gnomes
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=20140917100126.GF31703@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=fabf@skynet.be \
--cc=gnomes@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=peter@hurleysoftware.com \
/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
all inboxes | Powered by JetHome®