1 /* { dg-do compile } */
2 /* { dg-options "-Os" } */
3 
4 struct list_head {
5  struct list_head *next;
6 };
7 void __list_del (struct list_head *);
list_del_init(struct list_head * entry)8 static inline __attribute__((always_inline)) void list_del_init(struct
9 list_head *entry)
10 {
11  __list_del(entry->next);
12  (entry)->next = (entry);
13 };
14 struct dentry {
15  void *d_fsdata;
16 };
17 struct sysfs_dirent {
18  struct list_head s_sibling;
19  struct list_head s_children;
20 };
21 const char *sysfs_get_name(struct sysfs_dirent *);
sysfs_hash_and_remove(struct dentry * dir,const char * name)22 void sysfs_hash_and_remove(struct dentry * dir, const char * name)
23 {
24  struct sysfs_dirent * sd;
25  struct sysfs_dirent * parent_sd = dir->d_fsdata;
26  for (sd = (struct sysfs_dirent *)((&parent_sd->s_children)->next);
27      &sd->s_sibling != (&parent_sd->s_children);
28      sd  = (struct sysfs_dirent *)sd->s_sibling.next) {
29   if (!__builtin_strcmp(sysfs_get_name(sd), name))
30   {
31    list_del_init(&sd->s_sibling);
32    break;
33   }
34  }
35 }
36