The patch titled Simplify some code to use the container_of() macro has been removed from the -mm tree. Its filename was simplify-some-code-to-use-the-container_of-macro.patch This patch was dropped because an updated version will be merged ------------------------------------------------------ Subject: Simplify some code to use the container_of() macro From: "Robert P. J. Day" <rpjday@xxxxxxxxxxxxxx> Simplify a number of code snippets in source and header files to use the kernel.h "container_of()" macro. Signed-off-by: Robert P. J. Day <rpjday@xxxxxxxxxxxxxx> Cc: Paul Mackerras <paulus@xxxxxxxxx> Cc: Martin Schwidefsky <schwidefsky@xxxxxxxxxx> Cc: Heiko Carstens <heiko.carstens@xxxxxxxxxx> Cc: Mauro Carvalho Chehab <mchehab@xxxxxxxxxxxxx> Cc: Patrick McHardy <kaber@xxxxxxxxx> Cc: "David S. Miller" <davem@xxxxxxxxxxxxx> Cc: Stephen Smalley <sds@xxxxxxxxxxxxx> Cc: James Morris <jmorris@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- drivers/net/ppp_generic.c | 2 +- drivers/s390/net/lcs.c | 6 ++---- drivers/video/sa1100fb.h | 4 +--- include/linux/security.h | 2 +- security/selinux/hooks.c | 2 +- 5 files changed, 6 insertions(+), 10 deletions(-) diff -puN drivers/net/ppp_generic.c~simplify-some-code-to-use-the-container_of-macro drivers/net/ppp_generic.c --- a/drivers/net/ppp_generic.c~simplify-some-code-to-use-the-container_of-macro +++ a/drivers/net/ppp_generic.c @@ -83,7 +83,7 @@ struct ppp_file { int dead; /* unit/channel has been shut down */ }; -#define PF_TO_X(pf, X) ((X *)((char *)(pf) - offsetof(X, file))) +#define PF_TO_X(pf, X) container_of(pf, X, file) #define PF_TO_PPP(pf) PF_TO_X(pf, struct ppp) #define PF_TO_CHANNEL(pf) PF_TO_X(pf, struct channel) diff -puN drivers/s390/net/lcs.c~simplify-some-code-to-use-the-container_of-macro drivers/s390/net/lcs.c --- a/drivers/s390/net/lcs.c~simplify-some-code-to-use-the-container_of-macro +++ a/drivers/s390/net/lcs.c @@ -1511,8 +1511,7 @@ lcs_txbuffer_cb(struct lcs_channel *chan LCS_DBF_TEXT(5, trace, "txbuffcb"); /* Put buffer back to pool. */ lcs_release_buffer(channel, buffer); - card = (struct lcs_card *) - ((char *) channel - offsetof(struct lcs_card, write)); + card = container_of(channel, struct lcs_card, write); if (netif_queue_stopped(card->dev) && netif_carrier_ok(card->dev)) netif_wake_queue(card->dev); spin_lock(&card->lock); @@ -1810,8 +1809,7 @@ lcs_get_frames_cb(struct lcs_channel *ch LCS_DBF_TEXT(4, trace, "-eiogpkt"); return; } - card = (struct lcs_card *) - ((char *) channel - offsetof(struct lcs_card, read)); + card = container_of(channel, struct lcs_card, write); offset = 0; while (lcs_hdr->offset != 0) { if (lcs_hdr->offset <= 0 || diff -puN drivers/video/sa1100fb.h~simplify-some-code-to-use-the-container_of-macro drivers/video/sa1100fb.h --- a/drivers/video/sa1100fb.h~simplify-some-code-to-use-the-container_of-macro +++ a/drivers/video/sa1100fb.h @@ -110,9 +110,7 @@ struct sa1100fb_info { #endif }; -#define __type_entry(ptr,type,member) ((type *)((char *)(ptr)-offsetof(type,member))) - -#define TO_INF(ptr,member) __type_entry(ptr,struct sa1100fb_info,member) +#define TO_INF(ptr,member) container_of(ptr,struct sa1100fb_info,member) #define SA1100_PALETTE_MODE_VAL(bpp) (((bpp) & 0x018) << 9) diff -puN include/linux/security.h~simplify-some-code-to-use-the-container_of-macro include/linux/security.h --- a/include/linux/security.h~simplify-some-code-to-use-the-container_of-macro +++ a/include/linux/security.h @@ -496,7 +496,7 @@ struct request_sock; * Note that the fown_struct, @fown, is never outside the context of a * struct file, so the file structure (and associated security information) * can always be obtained: - * (struct file *)((long)fown - offsetof(struct file,f_owner)); + * container_of(fown, struct file, f_owner) * @tsk contains the structure of task receiving signal. * @fown contains the file owner information. * @sig is the signal that will be sent. When 0, kernel sends SIGIO. diff -puN security/selinux/hooks.c~simplify-some-code-to-use-the-container_of-macro security/selinux/hooks.c --- a/security/selinux/hooks.c~simplify-some-code-to-use-the-container_of-macro +++ a/security/selinux/hooks.c @@ -2654,7 +2654,7 @@ static int selinux_file_send_sigiotask(s struct file_security_struct *fsec; /* struct fown_struct is never outside the context of a struct file */ - file = (struct file *)((long)fown - offsetof(struct file,f_owner)); + file = container_of(fown, struct file, f_owner); tsec = tsk->security; fsec = file->f_security; _ Patches currently in -mm which might be from rpjday@xxxxxxxxxxxxxx are git-alsa.patch ppc-use-syslog-macro-for-the-printk-log-level.patch rewrite-unnecessary-duplicated-code-to-use-field_sizeof.patch transform-kmem_cache_allocmemset0-kmem_cache_zalloc.patch simplify-some-code-to-use-the-container_of-macro.patch get-rid-of-double-zeroing-of-allocated-pages.patch oss-replace-kmallocmemset-combos-with-kzalloc.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html