diff options
-rw-r--r-- | drivers/net/ppp_generic.c | 2 | ||||
-rw-r--r-- | drivers/s390/net/lcs.c | 6 | ||||
-rw-r--r-- | drivers/video/sa1100fb.h | 4 | ||||
-rw-r--r-- | include/linux/security.h | 2 | ||||
-rw-r--r-- | security/selinux/hooks.c | 2 |
5 files changed, 6 insertions, 10 deletions
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index c6de566188e4..0986f6c843e6 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c | |||
@@ -83,7 +83,7 @@ struct ppp_file { | |||
83 | int dead; /* unit/channel has been shut down */ | 83 | int dead; /* unit/channel has been shut down */ |
84 | }; | 84 | }; |
85 | 85 | ||
86 | #define PF_TO_X(pf, X) ((X *)((char *)(pf) - offsetof(X, file))) | 86 | #define PF_TO_X(pf, X) container_of(pf, X, file) |
87 | 87 | ||
88 | #define PF_TO_PPP(pf) PF_TO_X(pf, struct ppp) | 88 | #define PF_TO_PPP(pf) PF_TO_X(pf, struct ppp) |
89 | #define PF_TO_CHANNEL(pf) PF_TO_X(pf, struct channel) | 89 | #define PF_TO_CHANNEL(pf) PF_TO_X(pf, struct channel) |
diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c index b97dd15bdb9a..ecca1046714e 100644 --- a/drivers/s390/net/lcs.c +++ b/drivers/s390/net/lcs.c | |||
@@ -1511,8 +1511,7 @@ lcs_txbuffer_cb(struct lcs_channel *channel, struct lcs_buffer *buffer) | |||
1511 | LCS_DBF_TEXT(5, trace, "txbuffcb"); | 1511 | LCS_DBF_TEXT(5, trace, "txbuffcb"); |
1512 | /* Put buffer back to pool. */ | 1512 | /* Put buffer back to pool. */ |
1513 | lcs_release_buffer(channel, buffer); | 1513 | lcs_release_buffer(channel, buffer); |
1514 | card = (struct lcs_card *) | 1514 | card = container_of(channel, struct lcs_card, write); |
1515 | ((char *) channel - offsetof(struct lcs_card, write)); | ||
1516 | if (netif_queue_stopped(card->dev) && netif_carrier_ok(card->dev)) | 1515 | if (netif_queue_stopped(card->dev) && netif_carrier_ok(card->dev)) |
1517 | netif_wake_queue(card->dev); | 1516 | netif_wake_queue(card->dev); |
1518 | spin_lock(&card->lock); | 1517 | spin_lock(&card->lock); |
@@ -1810,8 +1809,7 @@ lcs_get_frames_cb(struct lcs_channel *channel, struct lcs_buffer *buffer) | |||
1810 | LCS_DBF_TEXT(4, trace, "-eiogpkt"); | 1809 | LCS_DBF_TEXT(4, trace, "-eiogpkt"); |
1811 | return; | 1810 | return; |
1812 | } | 1811 | } |
1813 | card = (struct lcs_card *) | 1812 | card = container_of(channel, struct lcs_card, read); |
1814 | ((char *) channel - offsetof(struct lcs_card, read)); | ||
1815 | offset = 0; | 1813 | offset = 0; |
1816 | while (lcs_hdr->offset != 0) { | 1814 | while (lcs_hdr->offset != 0) { |
1817 | if (lcs_hdr->offset <= 0 || | 1815 | if (lcs_hdr->offset <= 0 || |
diff --git a/drivers/video/sa1100fb.h b/drivers/video/sa1100fb.h index 0b07f6ae3367..48066ef3af05 100644 --- a/drivers/video/sa1100fb.h +++ b/drivers/video/sa1100fb.h | |||
@@ -110,9 +110,7 @@ struct sa1100fb_info { | |||
110 | #endif | 110 | #endif |
111 | }; | 111 | }; |
112 | 112 | ||
113 | #define __type_entry(ptr,type,member) ((type *)((char *)(ptr)-offsetof(type,member))) | 113 | #define TO_INF(ptr,member) container_of(ptr,struct sa1100fb_info,member) |
114 | |||
115 | #define TO_INF(ptr,member) __type_entry(ptr,struct sa1100fb_info,member) | ||
116 | 114 | ||
117 | #define SA1100_PALETTE_MODE_VAL(bpp) (((bpp) & 0x018) << 9) | 115 | #define SA1100_PALETTE_MODE_VAL(bpp) (((bpp) & 0x018) << 9) |
118 | 116 | ||
diff --git a/include/linux/security.h b/include/linux/security.h index 83cdefae9931..c554f60f18e4 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -492,7 +492,7 @@ struct request_sock; | |||
492 | * Note that the fown_struct, @fown, is never outside the context of a | 492 | * Note that the fown_struct, @fown, is never outside the context of a |
493 | * struct file, so the file structure (and associated security information) | 493 | * struct file, so the file structure (and associated security information) |
494 | * can always be obtained: | 494 | * can always be obtained: |
495 | * (struct file *)((long)fown - offsetof(struct file,f_owner)); | 495 | * container_of(fown, struct file, f_owner) |
496 | * @tsk contains the structure of task receiving signal. | 496 | * @tsk contains the structure of task receiving signal. |
497 | * @fown contains the file owner information. | 497 | * @fown contains the file owner information. |
498 | * @sig is the signal that will be sent. When 0, kernel sends SIGIO. | 498 | * @sig is the signal that will be sent. When 0, kernel sends SIGIO. |
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 9eeab82719a2..35eb8de892fc 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -2654,7 +2654,7 @@ static int selinux_file_send_sigiotask(struct task_struct *tsk, | |||
2654 | struct file_security_struct *fsec; | 2654 | struct file_security_struct *fsec; |
2655 | 2655 | ||
2656 | /* struct fown_struct is never outside the context of a struct file */ | 2656 | /* struct fown_struct is never outside the context of a struct file */ |
2657 | file = (struct file *)((long)fown - offsetof(struct file,f_owner)); | 2657 | file = container_of(fown, struct file, f_owner); |
2658 | 2658 | ||
2659 | tsec = tsk->security; | 2659 | tsec = tsk->security; |
2660 | fsec = file->f_security; | 2660 | fsec = file->f_security; |