mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
hlist: drop the node parameter from iterators
I'm not sure why, but the hlist for each entry iterators were conceived
list_for_each_entry(pos, head, member)
The hlist ones were greedy and wanted an extra parameter:
hlist_for_each_entry(tpos, pos, head, member)
Why did they need an extra pos parameter? I'm not quite sure. Not only
they don't really need it, it also prevents the iterator from looking
exactly like the list iterator, which is unfortunate.
Besides the semantic patch, there was some manual work required:
- Fix up the actual hlist iterators in linux/list.h
- Fix up the declaration of other iterators based on the hlist ones.
- A very small amount of places were using the 'node' parameter, this
was modified to use 'obj->member' instead.
- Coccinelle didn't handle the hlist_for_each_entry_safe iterator
properly, so those had to be fixed up manually.
The semantic patch which is mostly the work of Peter Senna Tschudin is here:
@@
iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host;
type T;
expression a,c,d,e;
identifier b;
statement S;
@@
-T b;
<+... when != b
(
hlist_for_each_entry(a,
- b,
c, d) S
|
hlist_for_each_entry_continue(a,
- b,
c) S
|
hlist_for_each_entry_from(a,
- b,
c) S
|
hlist_for_each_entry_rcu(a,
- b,
c, d) S
|
hlist_for_each_entry_rcu_bh(a,
- b,
c, d) S
|
hlist_for_each_entry_continue_rcu_bh(a,
- b,
c) S
|
for_each_busy_worker(a, c,
- b,
d) S
|
ax25_uid_for_each(a,
- b,
c) S
|
ax25_for_each(a,
- b,
c) S
|
inet_bind_bucket_for_each(a,
- b,
c) S
|
sctp_for_each_hentry(a,
- b,
c) S
|
sk_for_each(a,
- b,
c) S
|
sk_for_each_rcu(a,
- b,
c) S
|
sk_for_each_from
-(a, b)
+(a)
S
+ sk_for_each_from(a) S
|
sk_for_each_safe(a,
- b,
c, d) S
|
sk_for_each_bound(a,
- b,
c) S
|
hlist_for_each_entry_safe(a,
- b,
c, d, e) S
|
hlist_for_each_entry_continue_rcu(a,
- b,
c) S
|
nr_neigh_for_each(a,
- b,
c) S
|
nr_neigh_for_each_safe(a,
- b,
c, d) S
|
nr_node_for_each(a,
- b,
c) S
|
nr_node_for_each_safe(a,
- b,
c, d) S
|
- for_each_gfn_sp(a, c, d, b) S
+ for_each_gfn_sp(a, c, d) S
|
- for_each_gfn_indirect_valid_sp(a, c, d, b) S
+ for_each_gfn_indirect_valid_sp(a, c, d) S
|
for_each_host(a,
- b,
c) S
|
for_each_host_safe(a,
- b,
c, d) S
|
for_each_mesh_entry(a,
- b,
c, d) S
)
...+>
[[email protected]: drop bogus change from net/ipv4/raw.c]
[[email protected]: drop bogus hunk from net/ipv6/raw.c]
[[email protected]: checkpatch fixes]
[[email protected]: fix warnings]
[[email protected]: redo intrusive kvm changes]
Tested-by: Peter Senna Tschudin <[email protected]>
Acked-by: Paul E. McKenney <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
Cc: Wu Fengguang <[email protected]>
Cc: Marcelo Tosatti <[email protected]>
Cc: Gleb Natapov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
1e142b29e2
commit
b67bfe0d42
218 changed files with 987 additions and 1494 deletions
|
|
@ -357,7 +357,6 @@ static int blkcg_reset_stats(struct cgroup *cgroup, struct cftype *cftype,
|
|||
{
|
||||
struct blkcg *blkcg = cgroup_to_blkcg(cgroup);
|
||||
struct blkcg_gq *blkg;
|
||||
struct hlist_node *n;
|
||||
int i;
|
||||
|
||||
mutex_lock(&blkcg_pol_mutex);
|
||||
|
|
@ -368,7 +367,7 @@ static int blkcg_reset_stats(struct cgroup *cgroup, struct cftype *cftype,
|
|||
* stat updates. This is a debug feature which shouldn't exist
|
||||
* anyway. If you get hit by a race, retry.
|
||||
*/
|
||||
hlist_for_each_entry(blkg, n, &blkcg->blkg_list, blkcg_node) {
|
||||
hlist_for_each_entry(blkg, &blkcg->blkg_list, blkcg_node) {
|
||||
for (i = 0; i < BLKCG_MAX_POLS; i++) {
|
||||
struct blkcg_policy *pol = blkcg_policy[i];
|
||||
|
||||
|
|
@ -415,11 +414,10 @@ void blkcg_print_blkgs(struct seq_file *sf, struct blkcg *blkcg,
|
|||
bool show_total)
|
||||
{
|
||||
struct blkcg_gq *blkg;
|
||||
struct hlist_node *n;
|
||||
u64 total = 0;
|
||||
|
||||
spin_lock_irq(&blkcg->lock);
|
||||
hlist_for_each_entry(blkg, n, &blkcg->blkg_list, blkcg_node)
|
||||
hlist_for_each_entry(blkg, &blkcg->blkg_list, blkcg_node)
|
||||
if (blkcg_policy_enabled(blkg->q, pol))
|
||||
total += prfill(sf, blkg->pd[pol->plid], data);
|
||||
spin_unlock_irq(&blkcg->lock);
|
||||
|
|
|
|||
|
|
@ -164,7 +164,6 @@ EXPORT_SYMBOL(put_io_context);
|
|||
*/
|
||||
void put_io_context_active(struct io_context *ioc)
|
||||
{
|
||||
struct hlist_node *n;
|
||||
unsigned long flags;
|
||||
struct io_cq *icq;
|
||||
|
||||
|
|
@ -180,7 +179,7 @@ void put_io_context_active(struct io_context *ioc)
|
|||
*/
|
||||
retry:
|
||||
spin_lock_irqsave_nested(&ioc->lock, flags, 1);
|
||||
hlist_for_each_entry(icq, n, &ioc->icq_list, ioc_node) {
|
||||
hlist_for_each_entry(icq, &ioc->icq_list, ioc_node) {
|
||||
if (icq->flags & ICQ_EXITED)
|
||||
continue;
|
||||
if (spin_trylock(icq->q->queue_lock)) {
|
||||
|
|
|
|||
|
|
@ -800,11 +800,10 @@ static struct bsg_device *bsg_add_device(struct inode *inode,
|
|||
static struct bsg_device *__bsg_get_device(int minor, struct request_queue *q)
|
||||
{
|
||||
struct bsg_device *bd;
|
||||
struct hlist_node *entry;
|
||||
|
||||
mutex_lock(&bsg_mutex);
|
||||
|
||||
hlist_for_each_entry(bd, entry, bsg_dev_idx_hash(minor), dev_list) {
|
||||
hlist_for_each_entry(bd, bsg_dev_idx_hash(minor), dev_list) {
|
||||
if (bd->queue == q) {
|
||||
atomic_inc(&bd->ref_count);
|
||||
goto found;
|
||||
|
|
|
|||
|
|
@ -1435,7 +1435,6 @@ static int cfq_set_weight(struct cgroup *cgrp, struct cftype *cft, u64 val)
|
|||
{
|
||||
struct blkcg *blkcg = cgroup_to_blkcg(cgrp);
|
||||
struct blkcg_gq *blkg;
|
||||
struct hlist_node *n;
|
||||
|
||||
if (val < CFQ_WEIGHT_MIN || val > CFQ_WEIGHT_MAX)
|
||||
return -EINVAL;
|
||||
|
|
@ -1443,7 +1442,7 @@ static int cfq_set_weight(struct cgroup *cgrp, struct cftype *cft, u64 val)
|
|||
spin_lock_irq(&blkcg->lock);
|
||||
blkcg->cfq_weight = (unsigned int)val;
|
||||
|
||||
hlist_for_each_entry(blkg, n, &blkcg->blkg_list, blkcg_node) {
|
||||
hlist_for_each_entry(blkg, &blkcg->blkg_list, blkcg_node) {
|
||||
struct cfq_group *cfqg = blkg_to_cfqg(blkg);
|
||||
|
||||
if (cfqg && !cfqg->dev_weight)
|
||||
|
|
|
|||
|
|
@ -288,10 +288,10 @@ static struct request *elv_rqhash_find(struct request_queue *q, sector_t offset)
|
|||
{
|
||||
struct elevator_queue *e = q->elevator;
|
||||
struct hlist_head *hash_list = &e->hash[ELV_HASH_FN(offset)];
|
||||
struct hlist_node *entry, *next;
|
||||
struct hlist_node *next;
|
||||
struct request *rq;
|
||||
|
||||
hlist_for_each_entry_safe(rq, entry, next, hash_list, hash) {
|
||||
hlist_for_each_entry_safe(rq, next, hash_list, hash) {
|
||||
BUG_ON(!ELV_ON_HASH(rq));
|
||||
|
||||
if (unlikely(!rq_mergeable(rq))) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue