Skip to content

Commit

Permalink
Fix container_of() usage
Browse files Browse the repository at this point in the history
Using "attr" twice is not OK, because it effectively prohibits such
container_of() on variables not named "attr".

Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru>
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Alexey Dobriyan authored and Linus Torvalds committed Feb 8, 2008
1 parent 50e8a28 commit 2547844
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion arch/sh/kernel/cpu/sh4/sq.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ struct sq_sysfs_attr {
ssize_t (*store)(const char *buf, size_t count);
};

#define to_sq_sysfs_attr(attr) container_of(attr, struct sq_sysfs_attr, attr)
#define to_sq_sysfs_attr(a) container_of(a, struct sq_sysfs_attr, attr)

static ssize_t sq_sysfs_show(struct kobject *kobj, struct attribute *attr,
char *buf)
Expand Down
2 changes: 1 addition & 1 deletion drivers/lguest/lguest_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ struct lguest_device {
/* Since the virtio infrastructure hands us a pointer to the virtio_device all
* the time, it helps to have a curt macro to get a pointer to the struct
* lguest_device it's enclosed in. */
#define to_lgdev(vdev) container_of(vdev, struct lguest_device, vdev)
#define to_lgdev(vd) container_of(vd, struct lguest_device, vdev)

/*D:130
* Device configurations
Expand Down

0 comments on commit 2547844

Please sign in to comment.