svn commit: r240539 - in head/sys: dev/drm2 dev/drm2/i915 fs/devfs
mips/mips
Ed Schouten
ed at FreeBSD.org
Sat Sep 15 19:28:55 UTC 2012
Author: ed
Date: Sat Sep 15 19:28:54 2012
New Revision: 240539
URL: http://svn.freebsd.org/changeset/base/240539
Log:
Prefer __containerof() above member2struct().
The first does proper checking of the argument types, while the latter
does not.
Modified:
head/sys/dev/drm2/drm_gem.c
head/sys/dev/drm2/i915/i915_drv.h
head/sys/fs/devfs/devfs_int.h
head/sys/mips/mips/pmap.c
Modified: head/sys/dev/drm2/drm_gem.c
==============================================================================
--- head/sys/dev/drm2/drm_gem.c Sat Sep 15 19:17:19 2012 (r240538)
+++ head/sys/dev/drm2/drm_gem.c Sat Sep 15 19:28:54 2012 (r240539)
@@ -396,7 +396,7 @@ drm_gem_object_from_offset(struct drm_de
(uintmax_t)offset);
return (NULL);
}
- obj = member2struct(drm_gem_object, map_list, map_list);
+ obj = __containerof(map_list, struct drm_gem_object, map_list);
return (obj);
}
Modified: head/sys/dev/drm2/i915/i915_drv.h
==============================================================================
--- head/sys/dev/drm2/i915/i915_drv.h Sat Sep 15 19:17:19 2012 (r240538)
+++ head/sys/dev/drm2/i915/i915_drv.h Sat Sep 15 19:28:54 2012 (r240539)
@@ -889,7 +889,7 @@ struct drm_i915_gem_object {
int pending_flip;
};
-#define to_intel_bo(x) member2struct(drm_i915_gem_object, base, (x))
+#define to_intel_bo(x) __containerof(x, struct drm_i915_gem_object, base)
/**
* Request queue structure.
Modified: head/sys/fs/devfs/devfs_int.h
==============================================================================
--- head/sys/fs/devfs/devfs_int.h Sat Sep 15 19:17:19 2012 (r240538)
+++ head/sys/fs/devfs/devfs_int.h Sat Sep 15 19:28:54 2012 (r240539)
@@ -69,7 +69,7 @@ struct cdev_priv {
LIST_HEAD(, cdev_privdata) cdp_fdpriv;
};
-#define cdev2priv(c) member2struct(cdev_priv, cdp_c, c)
+#define cdev2priv(c) __containerof(c, struct cdev_priv, cdp_c)
struct cdev *devfs_alloc(int);
int devfs_dev_exists(const char *);
Modified: head/sys/mips/mips/pmap.c
==============================================================================
--- head/sys/mips/mips/pmap.c Sat Sep 15 19:17:19 2012 (r240538)
+++ head/sys/mips/mips/pmap.c Sat Sep 15 19:28:54 2012 (r240539)
@@ -1629,7 +1629,7 @@ pmap_pvh_free(struct md_page *pvh, pmap_
pv = pmap_pvh_remove(pvh, pmap, va);
KASSERT(pv != NULL, ("pmap_pvh_free: pv not found, pa %lx va %lx",
- (u_long)VM_PAGE_TO_PHYS(member2struct(vm_page, md, pvh)),
+ (u_long)VM_PAGE_TO_PHYS(__containerof(pvh, struct vm_page, md)),
(u_long)va));
free_pv_entry(pmap, pv);
}
More information about the svn-src-all
mailing list