All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: kernel-janitors@vger.kernel.org
Subject: type mismatch
Date: Sun, 10 May 2015 13:20:14 +0000	[thread overview]
Message-ID: <alpine.DEB.2.10.1505101517100.2645@hadrien> (raw)

I came across the following code
(drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.h):

struct nvkm_i2c_pad {
        struct nvkm_object base;
        int index;
        struct nvkm_i2c_port *port;
        struct nvkm_i2c_port *next;
};

static inline struct nvkm_i2c_pad *
nvkm_i2c_pad(struct nvkm_i2c_port *port)
{
 	struct nvkm_object *pad = nv_object(port);
	while (!nv_iclass(pad->parent, NV_SUBDEV_CLASS))
		pad = pad->parent;
	return (void *)pad;
}

Would it be better for the return to use container_of, rather than a cast
that happens to work because of the position of the nvkm_object field?

julia

             reply	other threads:[~2015-05-10 13:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-10 13:20 Julia Lawall [this message]
2015-05-10 19:57 ` type mismatch Dan Carpenter
2015-05-10 20:03 ` Julia Lawall
2015-05-11  7:18 ` Nicholas Mc Guire
2015-05-11  7:32 ` Julia Lawall
2015-05-11  8:14 ` Dan Carpenter
2015-05-11  8:29 ` Nicholas Mc Guire

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=alpine.DEB.2.10.1505101517100.2645@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=kernel-janitors@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.