Skip to content

Commit

Permalink
Fix a few errors concerning use of section block comments in .c files: (
Browse files Browse the repository at this point in the history
#95)

1. No .c file should include a "Public Types" section.  Only a header file can define a public type.  A .c file can only define a private type.  Several files contained private type definitions.  The section that they were defined in, however, was incorrectly named "Public Types."  Those were easilty changed to "Private Types" which is what they are.

2. No .c file should include a "Public Function Prototypes" section.  All global function prototypes should be provided via a header file and never declared with a .c file.

For No. 2, I corrected as many cases as was reasonable for the time that I had available.  But there are still a dozen or so .c files that declare "Public Function Prototypes" within a .c file.  This is bad programming style.  These declarations should all be moved to the proper header files.
  • Loading branch information
patacongo authored and Ouss4 committed Jan 13, 2020
1 parent f8bcd58 commit f005698
Show file tree
Hide file tree
Showing 33 changed files with 71 additions and 234 deletions.
2 changes: 1 addition & 1 deletion arch/arm/src/cxd56xx/cxd56_dmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ static int (*intc_handler[])(int irq, FAR void *context, FAR void *arg) = {
};

/****************************************************************************
* Public Types
* Private Types
****************************************************************************/

/* This structure describes one DMA channel */
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/cxd56xx/cxd56_udmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
#define ALIGN_UP(v, m) (((v) + (m)) & ~m)

/****************************************************************************
* Public Types
* Private Types
****************************************************************************/

/* This structure describes one DMA channel */
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/src/efm32/efm32_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@
#define ALIGN_UP(v,m) (((v) + (m)) & ~m)

/****************************************************************************
* Public Types
* Private Types
****************************************************************************/

/* This structure describes one DMA channel */

struct dma_channel_s
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/efm32/efm32_gpioirq.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ static int efm32_odd_interrupt(int irq, void *context, FAR void *arg)
}

/************************************************************************************
* Public Function Prototypes
* Public Functions
************************************************************************************/

/************************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/imx1/imx_boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ static const struct section_mapping_s section_mapping[] =
************************************************************************************/

/* All i.MX architectures must provide the following entry point. This entry point
* is called early in the intitialization -- after all memory has been configured
* is called early in the initialization -- after all memory has been configured
* and mapped but before any devices have been initialized.
*/

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/stm32/stm32_ccm.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
struct mm_heap_s g_ccm_heap;

/****************************************************************************
* Public Function Prototypes
* Public Functions
****************************************************************************/

#endif /* HAVE_CCM_HEAP */
10 changes: 1 addition & 9 deletions arch/arm/src/stm32f7/stm32_dtcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,14 @@

#ifdef HAVE_DTCM_HEAP

/****************************************************************************
* Pre-processor Definitions
****************************************************************************/

/****************************************************************************
* Private Types
****************************************************************************/

/****************************************************************************
* Public Data
****************************************************************************/

struct mm_heap_s g_dtcm_heap;

/****************************************************************************
* Public Function Prototypes
* Public Functions
****************************************************************************/

#endif /* HAVE_DTCM_HEAP */
2 changes: 1 addition & 1 deletion arch/hc/src/m9s12/m9s12_dumpgpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
#define MEBIPORT_K 2

/****************************************************************************
* Public Types
* Private Types
****************************************************************************/

struct gpio_piminfo_s
Expand Down
2 changes: 1 addition & 1 deletion arch/renesas/src/rx65n/rx65n_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@
#define NX_ALIGN32 __attribute__((aligned(32)))

/****************************************************************************
* Public Types
* Private Types
****************************************************************************/

/* Ethernet TX DMA Descriptor */
Expand Down
4 changes: 3 additions & 1 deletion arch/sim/src/sim/up_testset.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,16 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/

/* Must match definitions in arch/sim/include/spinlock.h */

#define SP_UNLOCKED 0 /* The Un-locked state */
#define SP_LOCKED 1 /* The Locked state */

/****************************************************************************
* Public Types
* Private Types
****************************************************************************/

/* Must match definitions in arch/sim/include/spinlock.h */

typedef uint8_t spinlock_t;
Expand Down
4 changes: 0 additions & 4 deletions boards/arm/cxd56xx/drivers/audio/cxd56_audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@
#define AUDIO_DNC_ID_NUM (CXD56_AUDIO_DNC_ID_FF + 1)
#define AUDIO_VOL_ID_NUM (CXD56_AUDIO_VOLID_MIXER_OUT + 1)

/***************************************************************************
* Public Function Prototypes
****************************************************************************/

/***************************************************************************
* Private Types
****************************************************************************/
Expand Down
8 changes: 0 additions & 8 deletions boards/arm/cxd56xx/drivers/audio/cxd56_audio_ac_reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,6 @@
#define SRCIN_SEL_AU_DAT_SEL2 1
#define SRCIN_SEL_CODECDSP_MIX 3

/****************************************************************************
* Public Function Prototypes
****************************************************************************/

/****************************************************************************
* Private Data
****************************************************************************/
Expand Down Expand Up @@ -449,10 +445,6 @@ const struct audio_ac_reg_s g_ac_reg[RI_REG_MAX_ENTRY] =
{0x0780, 0, 1, 0x00000000}, /* RAM_RW_EN (0x00) */
};

/****************************************************************************
* Public Data
****************************************************************************/

/****************************************************************************
* Private Functions
****************************************************************************/
Expand Down
8 changes: 0 additions & 8 deletions boards/arm/cxd56xx/drivers/audio/cxd56_audio_aca.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,14 +356,6 @@ typedef enum

extern uint32_t as_aca_control(uint8_t type, uint32_t param);

/****************************************************************************
* Private Data
****************************************************************************/

/****************************************************************************
* Public Data
****************************************************************************/

/****************************************************************************
* Private Functions
****************************************************************************/
Expand Down
6 changes: 3 additions & 3 deletions boards/arm/cxd56xx/drivers/audio/cxd56_audio_analog.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@
* Public Function Prototypes
****************************************************************************/

inline void cxd56_audio_clock_enable(uint32_t clk, uint32_t div);
inline void cxd56_audio_clock_disable(void);
inline bool cxd56_audio_clock_is_enabled(void);
inline void cxd56_audio_clock_enable(uint32_t clk, uint32_t div);
inline void cxd56_audio_clock_disable(void);
inline bool cxd56_audio_clock_is_enabled(void);

/****************************************************************************
* Private Data
Expand Down
8 changes: 0 additions & 8 deletions boards/arm/cxd56xx/drivers/audio/cxd56_audio_bca_reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,6 @@ enum dma_i2s_out_sel_e

#define BCA_REG_MAX_BIT 32

/***************************************************************************
* Public Function Prototypes
****************************************************************************/

/***************************************************************************
* Private Data
****************************************************************************/

/***************************************************************************
* Public Data
****************************************************************************/
Expand Down
8 changes: 0 additions & 8 deletions boards/arm/cxd56xx/drivers/audio/cxd56_audio_beep.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@

#define VOL_MIN -90

/***************************************************************************
* Public Function Prototypes
****************************************************************************/

/***************************************************************************
* Private Data
****************************************************************************/
Expand All @@ -83,10 +79,6 @@ static const uint16_t g_beepfreqtable[] =
3840, 4085, 94
};

/***************************************************************************
* Public Data
****************************************************************************/

/***************************************************************************
* Private Functions
****************************************************************************/
Expand Down
9 changes: 1 addition & 8 deletions boards/arm/cxd56xx/drivers/audio/cxd56_audio_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@
#define MIC_CH_BITNUM 4
#define MIC_CH_BITMAP 0xf

/****************************************************************************
* Public Function Prototypes
****************************************************************************/

/****************************************************************************
* Private Data
****************************************************************************/
Expand All @@ -64,6 +60,7 @@ struct cxd56_audio_cfg_s
cxd56_audio_clkmode_t clk_mode;
cxd56_audio_sp_drv_t sp_driver;
};

static struct cxd56_audio_cfg_s g_audio_cfg =
{
1,
Expand All @@ -74,10 +71,6 @@ static struct cxd56_audio_cfg_s g_audio_cfg =
CXD56_AUDIO_CFG_SP_DRIVER
};

/****************************************************************************
* Public Data
****************************************************************************/

/****************************************************************************
* Private Functions
****************************************************************************/
Expand Down
20 changes: 0 additions & 20 deletions boards/arm/cxd56xx/drivers/audio/cxd56_audio_digital.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,26 +45,6 @@
#include "cxd56_audio_bca_reg.h"
#include "cxd56_audio_digital.h"

/***************************************************************************
* Pre-processor Definitions
****************************************************************************/

/***************************************************************************
* Public Function Prototypes
****************************************************************************/

/***************************************************************************
* Private Data
****************************************************************************/

/***************************************************************************
* Public Data
****************************************************************************/

/***************************************************************************
* Private Functions
****************************************************************************/

/***************************************************************************
* Public Functions
****************************************************************************/
Expand Down
20 changes: 5 additions & 15 deletions boards/arm/cxd56xx/drivers/audio/cxd56_audio_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,11 @@ enum audio_irq_reg_type_e
#define DMA_SMP_WAIT_HIRES 10 /* usec per sample. */
#define DMA_SMP_WAIT_NORMALT 40 /* usec per sample. */

/***************************************************************************
* Public Function Prototypes
****************************************************************************/
/* Private Macros */

#define SET_DMA_ACT(_path_) g_dma_act_status |= (1 << _path_)
#define CLR_DMA_ACT(_path_) g_dma_act_status &= ~(1 << _path_)
#define IS_DMA_ACT(_path_) ((g_dma_act_status & (1 << _path_)) != 0)

/***************************************************************************
* Private Data
Expand All @@ -110,18 +112,6 @@ static bool s_work_arroud_dmac[DMA_HANDLE_MAX_NUM] =
true
};

/***************************************************************************
* Private Macro
****************************************************************************/

#define SET_DMA_ACT(_path_) g_dma_act_status |= (1 << _path_)
#define CLR_DMA_ACT(_path_) g_dma_act_status &= ~(1 << _path_)
#define IS_DMA_ACT(_path_) ((g_dma_act_status & (1 << _path_)) != 0)

/***************************************************************************
* Public Data
****************************************************************************/

/***************************************************************************
* Private Functions
****************************************************************************/
Expand Down
20 changes: 0 additions & 20 deletions boards/arm/cxd56xx/drivers/audio/cxd56_audio_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,6 @@
#include "cxd56_audio_filter.h"
#include "cxd56_audio_ac_reg.h"

/***************************************************************************
* Pre-processor Definitions
****************************************************************************/

/***************************************************************************
* Public Function Prototypes
****************************************************************************/

/***************************************************************************
* Private Data
****************************************************************************/

/***************************************************************************
* Public Data
****************************************************************************/

/***************************************************************************
* Private Functions
****************************************************************************/

/***************************************************************************
* Public Functions
****************************************************************************/
Expand Down
16 changes: 0 additions & 16 deletions boards/arm/cxd56xx/drivers/audio/cxd56_audio_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,12 @@

#include "cxd56_audio_irq.h"

/***************************************************************************
* Pre-processor Definitions
****************************************************************************/

/***************************************************************************
* Public Function Prototypes
****************************************************************************/

extern void cxd56_audio_dma_int_handler(void);

/***************************************************************************
* Private Data
****************************************************************************/

/***************************************************************************
* Public Data
****************************************************************************/

/***************************************************************************
* Private Functions
****************************************************************************/

/***************************************************************************
* Public Functions
****************************************************************************/
Expand Down
16 changes: 0 additions & 16 deletions boards/arm/cxd56xx/drivers/audio/cxd56_audio_mic.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,6 @@
#define MIC_CH_BITNUM 4
#define MIC_CH_BITMAP 0xf

/***************************************************************************
* Public Function Prototypes
****************************************************************************/

/***************************************************************************
* Private Data
****************************************************************************/

/***************************************************************************
* Public Data
****************************************************************************/

/***************************************************************************
* Private Functions
****************************************************************************/

/***************************************************************************
* Public Functions
****************************************************************************/
Expand Down
Loading

0 comments on commit f005698

Please sign in to comment.