net: sched: sch_api: fix code style issues
authorAlexander Aring <aring@mojatatu.com>
Mon, 4 Dec 2017 23:39:59 +0000 (18:39 -0500)
committerDavid S. Miller <davem@davemloft.net>
Tue, 5 Dec 2017 20:04:27 +0000 (15:04 -0500)
This patch fix checkpatch issues for upcomming patches according to the
sched api file. It changes checking on null pointer, remove unnecessary
brackets, add variable names for parameters and adjust 80 char width.

Cc: David Ahern <dsahern@gmail.com>
Signed-off-by: Alexander Aring <aring@mojatatu.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/sch_generic.h
net/sched/sch_api.c

index 02e7ad8b8dad85bb8e83eaeeac977658323764de..7dd8b0b0d244c62d337cd5f2a66ab67d75ae5471 100644 (file)
@@ -161,7 +161,8 @@ struct Qdisc_class_ops {
        void                    (*walk)(struct Qdisc *, struct qdisc_walker * arg);
 
        /* Filter manipulation */
-       struct tcf_block *      (*tcf_block)(struct Qdisc *, unsigned long);
+       struct tcf_block *      (*tcf_block)(struct Qdisc *sch,
+                                            unsigned long arg);
        unsigned long           (*bind_tcf)(struct Qdisc *, unsigned long,
                                        u32 classid);
        void                    (*unbind_tcf)(struct Qdisc *, unsigned long);
@@ -185,11 +186,12 @@ struct Qdisc_ops {
        struct sk_buff *        (*dequeue)(struct Qdisc *);
        struct sk_buff *        (*peek)(struct Qdisc *);
 
-       int                     (*init)(struct Qdisc *, struct nlattr *arg);
+       int                     (*init)(struct Qdisc *sch, struct nlattr *arg);
        void                    (*reset)(struct Qdisc *);
        void                    (*destroy)(struct Qdisc *);
-       int                     (*change)(struct Qdisc *, struct nlattr *arg);
-       void                    (*attach)(struct Qdisc *);
+       int                     (*change)(struct Qdisc *sch,
+                                         struct nlattr *arg);
+       void                    (*attach)(struct Qdisc *sch);
 
        int                     (*dump)(struct Qdisc *, struct sk_buff *);
        int                     (*dump_stats)(struct Qdisc *, struct gnet_dump *);
index b6c4f536876b70b0ad24fee686129a396e07f573..8f7f5378cc33652d9f017cc20d409e3cfd6c31af 100644 (file)
@@ -1020,7 +1020,7 @@ static struct Qdisc *qdisc_create(struct net_device *dev,
 #endif
 
        err = -ENOENT;
-       if (ops == NULL)
+       if (!ops)
                goto err_out;
 
        sch = qdisc_alloc(dev_queue, ops);
@@ -1087,7 +1087,7 @@ static struct Qdisc *qdisc_create(struct net_device *dev,
                        if (sch->flags & TCQ_F_MQROOT)
                                goto err_out4;
 
-                       if ((sch->parent != TC_H_ROOT) &&
+                       if (sch->parent != TC_H_ROOT &&
                            !(sch->flags & TCQ_F_INGRESS) &&
                            (!p || !(p->flags & TCQ_F_MQROOT)))
                                running = qdisc_root_sleeping_running(sch);
@@ -1139,7 +1139,7 @@ static int qdisc_change(struct Qdisc *sch, struct nlattr **tca)
        int err = 0;
 
        if (tca[TCA_OPTIONS]) {
-               if (sch->ops->change == NULL)
+               if (!sch->ops->change)
                        return -EINVAL;
                err = sch->ops->change(sch, tca[TCA_OPTIONS]);
                if (err)
@@ -1344,7 +1344,8 @@ replay:
                                        goto create_n_graft;
                                if (n->nlmsg_flags & NLM_F_EXCL)
                                        return -EEXIST;
-                               if (tca[TCA_KIND] && nla_strcmp(tca[TCA_KIND], q->ops->id))
+                               if (tca[TCA_KIND] &&
+                                   nla_strcmp(tca[TCA_KIND], q->ops->id))
                                        return -EINVAL;
                                if (q == p ||
                                    (p && check_loop(q, p, 0)))
@@ -1389,7 +1390,7 @@ replay:
        }
 
        /* Change qdisc parameters */
-       if (q == NULL)
+       if (!q)
                return -ENOENT;
        if (n->nlmsg_flags & NLM_F_EXCL)
                return -EEXIST;