Skip to content

Commit 0ac4bd6

Browse files
Alexander Aringdavem330
authored andcommitted
net: sched: sch_api: fix code style issues
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 <[email protected]> Signed-off-by: Alexander Aring <[email protected]> Acked-by: Jamal Hadi Salim <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 045203e commit 0ac4bd6

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

include/net/sch_generic.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ struct Qdisc_class_ops {
161161
void (*walk)(struct Qdisc *, struct qdisc_walker * arg);
162162

163163
/* Filter manipulation */
164-
struct tcf_block * (*tcf_block)(struct Qdisc *, unsigned long);
164+
struct tcf_block * (*tcf_block)(struct Qdisc *sch,
165+
unsigned long arg);
165166
unsigned long (*bind_tcf)(struct Qdisc *, unsigned long,
166167
u32 classid);
167168
void (*unbind_tcf)(struct Qdisc *, unsigned long);
@@ -185,11 +186,12 @@ struct Qdisc_ops {
185186
struct sk_buff * (*dequeue)(struct Qdisc *);
186187
struct sk_buff * (*peek)(struct Qdisc *);
187188

188-
int (*init)(struct Qdisc *, struct nlattr *arg);
189+
int (*init)(struct Qdisc *sch, struct nlattr *arg);
189190
void (*reset)(struct Qdisc *);
190191
void (*destroy)(struct Qdisc *);
191-
int (*change)(struct Qdisc *, struct nlattr *arg);
192-
void (*attach)(struct Qdisc *);
192+
int (*change)(struct Qdisc *sch,
193+
struct nlattr *arg);
194+
void (*attach)(struct Qdisc *sch);
193195

194196
int (*dump)(struct Qdisc *, struct sk_buff *);
195197
int (*dump_stats)(struct Qdisc *, struct gnet_dump *);

net/sched/sch_api.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,7 @@ static struct Qdisc *qdisc_create(struct net_device *dev,
10201020
#endif
10211021

10221022
err = -ENOENT;
1023-
if (ops == NULL)
1023+
if (!ops)
10241024
goto err_out;
10251025

10261026
sch = qdisc_alloc(dev_queue, ops);
@@ -1087,7 +1087,7 @@ static struct Qdisc *qdisc_create(struct net_device *dev,
10871087
if (sch->flags & TCQ_F_MQROOT)
10881088
goto err_out4;
10891089

1090-
if ((sch->parent != TC_H_ROOT) &&
1090+
if (sch->parent != TC_H_ROOT &&
10911091
!(sch->flags & TCQ_F_INGRESS) &&
10921092
(!p || !(p->flags & TCQ_F_MQROOT)))
10931093
running = qdisc_root_sleeping_running(sch);
@@ -1139,7 +1139,7 @@ static int qdisc_change(struct Qdisc *sch, struct nlattr **tca)
11391139
int err = 0;
11401140

11411141
if (tca[TCA_OPTIONS]) {
1142-
if (sch->ops->change == NULL)
1142+
if (!sch->ops->change)
11431143
return -EINVAL;
11441144
err = sch->ops->change(sch, tca[TCA_OPTIONS]);
11451145
if (err)
@@ -1344,7 +1344,8 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n,
13441344
goto create_n_graft;
13451345
if (n->nlmsg_flags & NLM_F_EXCL)
13461346
return -EEXIST;
1347-
if (tca[TCA_KIND] && nla_strcmp(tca[TCA_KIND], q->ops->id))
1347+
if (tca[TCA_KIND] &&
1348+
nla_strcmp(tca[TCA_KIND], q->ops->id))
13481349
return -EINVAL;
13491350
if (q == p ||
13501351
(p && check_loop(q, p, 0)))
@@ -1389,7 +1390,7 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n,
13891390
}
13901391

13911392
/* Change qdisc parameters */
1392-
if (q == NULL)
1393+
if (!q)
13931394
return -ENOENT;
13941395
if (n->nlmsg_flags & NLM_F_EXCL)
13951396
return -EEXIST;

0 commit comments

Comments
 (0)