From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756672AbdJKKo4 (ORCPT ); Wed, 11 Oct 2017 06:44:56 -0400 Received: from smtprelay0037.hostedemail.com ([216.40.44.37]:38743 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751462AbdJKKoy (ORCPT ); Wed, 11 Oct 2017 06:44:54 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::,RULES_HIT:2:41:334:355:368:369:379:541:599:800:960:966:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1535:1593:1594:1605:1606:1730:1747:1777:1792:2196:2199:2393:2559:2562:2828:3138:3139:3140:3141:3142:3622:3865:3866:3867:3868:3870:3871:3872:4117:4321:4385:5007:6119:7576:10004:10848:11026:11232:11473:11657:11658:11783:11914:12043:12048:12296:12438:12555:12740:12895:12986:13439:13894:14659:21080:21433:21627:30054:30089:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: noise06_64ac805f83429 X-Filterd-Recvd-Size: 6668 Message-ID: <1507718690.3552.50.camel@perches.com> Subject: Re: [PATCH][next] sctp: make array sctp_sched_ops static From: Joe Perches To: Colin King , Vlad Yasevich , Neil Horman , "David S . Miller" , linux-sctp@vger.kernel.org, netdev@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Date: Wed, 11 Oct 2017 03:44:50 -0700 In-Reply-To: <20171011101757.18825-1-colin.king@canonical.com> References: <20171011101757.18825-1-colin.king@canonical.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.6-1ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2017-10-11 at 11:17 +0100, Colin King wrote: > From: Colin Ian King > > The array sctp_sched_ops is local to the source and > does not need to be in global scope, so make it static. > > Cleans up sparse warning: > symbol 'sctp_sched_ops' was not declared. Should it be static? > > Signed-off-by: Colin Ian King > --- > net/sctp/stream_sched.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/sctp/stream_sched.c b/net/sctp/stream_sched.c > index 03513a9fa110..0b83ec51e43b 100644 > --- a/net/sctp/stream_sched.c > +++ b/net/sctp/stream_sched.c > @@ -124,7 +124,7 @@ static struct sctp_sched_ops sctp_sched_fcfs = { > extern struct sctp_sched_ops sctp_sched_prio; > extern struct sctp_sched_ops sctp_sched_rr; > > -struct sctp_sched_ops *sctp_sched_ops[] = { > +static struct sctp_sched_ops *sctp_sched_ops[] = { > &sctp_sched_fcfs, > &sctp_sched_prio, > &sctp_sched_rr, Perhaps these should also be const to move more data to text ---  include/net/sctp/stream_sched.h |  3 ++-  include/net/sctp/structs.h      |  2 +-  net/sctp/stream.c               |  6 +++---  net/sctp/stream_sched.c         | 17 +++++++++--------  4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/include/net/sctp/stream_sched.h b/include/net/sctp/stream_sched.h index c676550a4c7d..431235c7587a 100644 --- a/include/net/sctp/stream_sched.h +++ b/include/net/sctp/stream_sched.h @@ -67,6 +67,7 @@ void sctp_sched_dequeue_done(struct sctp_outq *q, struct sctp_chunk *ch);    void sctp_sched_dequeue_common(struct sctp_outq *q, struct sctp_chunk *ch);  int sctp_sched_init_sid(struct sctp_stream *stream, __u16 sid, gfp_t gfp); -struct sctp_sched_ops *sctp_sched_ops_from_stream(struct sctp_stream *stream); +const struct sctp_sched_ops * +sctp_sched_ops_from_stream(struct sctp_stream *stream);    #endif /* __sctp_stream_sched_h__ */ diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 6168e3449131..032ec5618e8a 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h @@ -1028,7 +1028,7 @@ struct sctp_outq {   struct list_head out_chunk_list;     /* Stream scheduler being used */ - struct sctp_sched_ops *sched; + const struct sctp_sched_ops *sched;     unsigned int out_qlen; /* Total length of queued data chunks. */   diff --git a/net/sctp/stream.c b/net/sctp/stream.c index 5ea33a2c453b..62678c2229e4 100644 --- a/net/sctp/stream.c +++ b/net/sctp/stream.c @@ -140,7 +140,7 @@ static int sctp_stream_alloc_in(struct sctp_stream *stream, __u16 incnt,  int sctp_stream_init(struct sctp_stream *stream, __u16 outcnt, __u16 incnt,        gfp_t gfp)  { - struct sctp_sched_ops *sched = sctp_sched_ops_from_stream(stream); + const struct sctp_sched_ops *sched = sctp_sched_ops_from_stream(stream);   int i, ret = 0;     gfp |= __GFP_NOWARN; @@ -201,7 +201,7 @@ int sctp_stream_init_ext(struct sctp_stream *stream, __u16 sid)    void sctp_stream_free(struct sctp_stream *stream)  { - struct sctp_sched_ops *sched = sctp_sched_ops_from_stream(stream); + const struct sctp_sched_ops *sched = sctp_sched_ops_from_stream(stream);   int i;     sched->free(stream); @@ -224,7 +224,7 @@ void sctp_stream_clear(struct sctp_stream *stream)    void sctp_stream_update(struct sctp_stream *stream, struct sctp_stream *new)  { - struct sctp_sched_ops *sched = sctp_sched_ops_from_stream(stream); + const struct sctp_sched_ops *sched = sctp_sched_ops_from_stream(stream);     sched->unsched_all(stream);   sctp_stream_outq_migrate(stream, new, new->outcnt); diff --git a/net/sctp/stream_sched.c b/net/sctp/stream_sched.c index 03513a9fa110..642542be57ec 100644 --- a/net/sctp/stream_sched.c +++ b/net/sctp/stream_sched.c @@ -106,7 +106,7 @@ static void sctp_sched_fcfs_unsched_all(struct sctp_stream *stream)  {  }   -static struct sctp_sched_ops sctp_sched_fcfs = { +static const struct sctp_sched_ops sctp_sched_fcfs = {   .set = sctp_sched_fcfs_set,   .get = sctp_sched_fcfs_get,   .init = sctp_sched_fcfs_init, @@ -121,10 +121,10 @@ static struct sctp_sched_ops sctp_sched_fcfs = {    /* API to other parts of the stack */   -extern struct sctp_sched_ops sctp_sched_prio; -extern struct sctp_sched_ops sctp_sched_rr; +extern const struct sctp_sched_ops sctp_sched_prio; +extern const struct sctp_sched_ops sctp_sched_rr;   -struct sctp_sched_ops *sctp_sched_ops[] = { +static const struct sctp_sched_ops *sctp_sched_ops[] = {   &sctp_sched_fcfs,   &sctp_sched_prio,   &sctp_sched_rr, @@ -133,8 +133,8 @@ struct sctp_sched_ops *sctp_sched_ops[] = {  int sctp_sched_set_sched(struct sctp_association *asoc,    enum sctp_sched_type sched)  { - struct sctp_sched_ops *n = sctp_sched_ops[sched]; - struct sctp_sched_ops *old = asoc->outqueue.sched; + const struct sctp_sched_ops *n = sctp_sched_ops[sched]; + const struct sctp_sched_ops *old = asoc->outqueue.sched;   struct sctp_datamsg *msg = NULL;   struct sctp_chunk *ch;   int i, ret = 0; @@ -259,13 +259,14 @@ void sctp_sched_dequeue_common(struct sctp_outq *q, struct sctp_chunk *ch)    int sctp_sched_init_sid(struct sctp_stream *stream, __u16 sid, gfp_t gfp)  { - struct sctp_sched_ops *sched = sctp_sched_ops_from_stream(stream); + const struct sctp_sched_ops *sched = sctp_sched_ops_from_stream(stream);     INIT_LIST_HEAD(&stream->out[sid].ext->outq);   return sched->init_sid(stream, sid, gfp);  }   -struct sctp_sched_ops *sctp_sched_ops_from_stream(struct sctp_stream *stream) +const struct sctp_sched_ops * +sctp_sched_ops_from_stream(struct sctp_stream *stream)  {   struct sctp_association *asoc;