On 06/06/16 16:31, Savolainen, Petri (Nokia - FI/Espoo) wrote:

-----Original Message-----
From: lng-odp [mailto:[email protected]] On Behalf Of Maxim
Uvarov
Sent: Monday, June 06, 2016 3:22 PM
To: [email protected]
Subject: Re: [lng-odp] [PATCH v2 4/6] linux-gen: sched: add skeleton for
strict priority

WARNING: externs should be avoided in .c files
#94: FILE: platform/linux-generic/odp_schedule_if.c:9:
+extern const schedule_fn_t schedule_sp_fn;

WARNING: externs should be avoided in .c files
#95: FILE: platform/linux-generic/odp_schedule_if.c:10:
+extern const schedule_fn_t schedule_default_fn;


odp_schedule_if.c has externs (already in the repo) since this is the single 
place that needs to refer those and select between them (#ifdef). It's cleaner 
to have both externs and the ifdef co-located, than separated into a header and 
the c file. Externs in header would not provide any benefit here, since there's 
single references to those.


odp_schedule_if.c

extern const schedule_fn_t schedule_sp_fn;
extern const schedule_api_t schedule_sp_api;

extern const schedule_fn_t schedule_default_fn;
extern const schedule_api_t schedule_default_api;

#ifdef ODP_SCHEDULE_SP
const schedule_fn_t *sched_fn   = &schedule_sp_fn;
const schedule_api_t *sched_api = &schedule_sp_api;
#else
const schedule_fn_t  *sched_fn  = &schedule_default_fn;
const schedule_api_t *sched_api = &schedule_default_api;
#endif


- Petri


Petri, I think we have externs before we started to use checkpatch.pl and agree that code should be cleared after we do later fixes.
To be consistent here we have to follow previous agreement.

For current case you have references in odp_schedule_sp.c and odp_schedule_if.c, but both of them do:
#include <odp_schedule_if.h>

so for me it's more logical to have declarations there and remove extern word at all.

Maxim.



_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to