public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* type mismatch
@ 2015-05-10 13:20 Julia Lawall
  2015-05-10 19:57 ` Dan Carpenter
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Julia Lawall @ 2015-05-10 13:20 UTC (permalink / raw)
  To: kernel-janitors

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-05-11  8:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-10 13:20 type mismatch Julia Lawall
2015-05-10 19:57 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox