Skip to content

Commit

Permalink
nuttx: resolve various 'FAR' and 'CODE' issues
Browse files Browse the repository at this point in the history
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
  • Loading branch information
pkarashchenko committed Aug 25, 2024
1 parent a4b4fd1 commit f76724f
Show file tree
Hide file tree
Showing 43 changed files with 128 additions and 121 deletions.
2 changes: 1 addition & 1 deletion binfmt/libelf/libelf_coredump.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ static void elf_emit_memory(FAR struct elf_dumpinfo_s *cinfo, int memsegs)

static void elf_emit_tcb_phdr(FAR struct elf_dumpinfo_s *cinfo,
FAR struct tcb_s *tcb,
FAR Elf_Phdr *phdr, off_t *offset)
FAR Elf_Phdr *phdr, FAR off_t *offset)
{
uintptr_t sp;

Expand Down
2 changes: 1 addition & 1 deletion drivers/lcd/memlcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ static inline void __clear_bit(int nr, uint8_t *addr)
*p &= ~mask;
}

static inline int __test_bit(int nr, const volatile uint8_t *addr)
static inline int __test_bit(int nr, FAR const volatile uint8_t *addr)
{
return 1 & (addr[BIT_BYTE(nr)] >> (nr & (BITS_PER_BYTE - 1)));
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/modem/alt1250/altcom_hdlr_firmware.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ int32_t altcom_injectimage_pkt_compose(FAR void **arg, size_t arglen,
int32_t size = 0;

FAR uint8_t *sending_data = (FAR uint8_t *)arg[0];
int len = *(int *)arg[1];
bool mode = *(bool *)arg[2];
int len = *(FAR int *)arg[1];
bool mode = *(FAR bool *)arg[2];

#ifndef CONFIG_MODEM_ALT1250_DISABLE_PV1
if (altver == ALTCOM_VER1)
Expand Down
20 changes: 11 additions & 9 deletions drivers/modem/alt1250/altcom_pkt.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ static bool is_header_ok(FAR struct altcom_cmdhdr_s *hdr)
* Public Functions
****************************************************************************/

bool altcom_is_v1pkt_ok(struct altcom_cmdhdr_s *cmdhdr)
bool altcom_is_v1pkt_ok(FAR struct altcom_cmdhdr_s *cmdhdr)
{
struct calculated_checksum checksum;

Expand All @@ -292,7 +292,7 @@ bool altcom_is_v1pkt_ok(struct altcom_cmdhdr_s *cmdhdr)
&& (cmdhdr->payload[0] == LTE_RESULT_OK);
}

bool altcom_is_v4pkt_ok(struct altcom_cmdhdr_s *cmdhdr)
bool altcom_is_v4pkt_ok(FAR struct altcom_cmdhdr_s *cmdhdr)
{
struct calculated_checksum checksum;

Expand All @@ -308,9 +308,10 @@ bool altcom_is_v4pkt_ok(struct altcom_cmdhdr_s *cmdhdr)

FAR void *altcom_make_poweron_cmd_v1(int *sz)
{
struct altcom_cmdhdr_s *hdr = (struct altcom_cmdhdr_s *)g_poweron_cmd;
struct altcom_cmdfooter_s *footer
= (struct altcom_cmdfooter_s *)&hdr->payload[0];
FAR struct altcom_cmdhdr_s *hdr =
(FAR struct altcom_cmdhdr_s *)g_poweron_cmd;
FAR struct altcom_cmdfooter_s *footer =
(FAR struct altcom_cmdfooter_s *)&hdr->payload[0];

set_header_top(hdr, ALTCOM_VER1, ALTCOM_CMDID_POWER_ON_V1);
hdr->v1_options = htons(ALTCOM_CMDOPT_CHECKSUM_EN);
Expand All @@ -334,11 +335,12 @@ FAR void *altcom_make_poweron_cmd_v1(int *sz)

FAR void *altcom_make_poweron_cmd_v4(int *sz)
{
struct altcom_cmdhdr_s *hdr = (struct altcom_cmdhdr_s *)g_poweron_cmd;
FAR struct altcom_cmdhdr_s *hdr =
(FAR struct altcom_cmdhdr_s *)g_poweron_cmd;

set_header_top(hdr, ALTCOM_VER4, ALTCOM_CMDID_POWER_ON_V4);
hdr->v4_hdr_cksum = htons(calc_checksum_v4((FAR uint8_t *)hdr,
sizeof(struct altcom_cmdhdr_s)-4));
sizeof(struct altcom_cmdhdr_s) - 4));
hdr->v4_data_cksum = htons(calc_checksum_v4(&hdr->payload[0], 0));

/* No payload of this altcom command. So sending size is just header size */
Expand Down Expand Up @@ -405,8 +407,8 @@ uint16_t altcom_make_header(FAR struct altcom_cmdhdr_s *hdr,

if (ver == ALTCOM_VER1)
{
struct altcom_cmdfooter_s *footer
= (struct altcom_cmdfooter_s *)&hdr->payload[sz];
FAR struct altcom_cmdfooter_s *footer =
(FAR struct altcom_cmdfooter_s *)&hdr->payload[sz];

hdr->v1_options = htons(ALTCOM_CMDOPT_CHECKSUM_EN);
hdr->v1_checksum =
Expand Down
12 changes: 6 additions & 6 deletions drivers/modem/alt1250/altmdm.c
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ static altmdm_state_t process_state_v1set(uint32_t event,
altmdm_state_t state)
{
int len;
void *pkt;
FAR void *pkt;

pkt = altcom_make_poweron_cmd_v1(&len);
set_vp(VP_TRYV1);
Expand All @@ -934,7 +934,7 @@ static altmdm_state_t process_state_v4set(uint32_t event,
altmdm_state_t state)
{
int len;
void *pkt;
FAR void *pkt;

pkt = altcom_make_poweron_cmd_v4(&len);
set_vp(VP_TRYV4);
Expand Down Expand Up @@ -962,7 +962,7 @@ static altmdm_state_t process_state_sleepset(uint32_t event,
static altmdm_state_t process_state_txprepare(uint32_t event,
altmdm_state_t state)
{
void *buff;
FAR void *buff;
int len;

nxsem_wait_uninterruptible(&g_altmdm_dev.lock_txreq);
Expand Down Expand Up @@ -1217,7 +1217,7 @@ static altmdm_state_t process_state_gotrx(uint32_t event,
altmdm_state_t state)
{
enum version_phase_e vp;
void *rcv_data;
FAR void *rcv_data;

state = ALTMDM_STATE_DECIDEDELAY;

Expand All @@ -1232,7 +1232,7 @@ static altmdm_state_t process_state_gotrx(uint32_t event,
vp = get_vp();
if (vp == VP_TRYV1)
{
if (altcom_is_v1pkt_ok((struct altcom_cmdhdr_s *)rcv_data))
if (altcom_is_v1pkt_ok((FAR struct altcom_cmdhdr_s *)rcv_data))
{
set_vp(VP_V1);
set_return_code(ALTMDM_RETURN_RESET_V1);
Expand All @@ -1244,7 +1244,7 @@ static altmdm_state_t process_state_gotrx(uint32_t event,
}
}
else if ((vp == VP_TRYV4)
&& altcom_is_v4pkt_ok((struct altcom_cmdhdr_s *)rcv_data))
&& altcom_is_v4pkt_ok((FAR struct altcom_cmdhdr_s *)rcv_data))
{
set_vp(VP_V4);
set_return_code(ALTMDM_RETURN_RESET_V4);
Expand Down
2 changes: 1 addition & 1 deletion drivers/mtd/gd5f.c
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ static int gd5f_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)

case MTDIOC_ECCSTATUS:
{
uint8_t *result = (FAR uint8_t *)arg;
FAR uint8_t *result = (FAR uint8_t *)arg;
*result =
(priv->eccstatus & GD5F_FEATURE_ECC_MASK)
>> GD5F_FEATURE_ECC_OFFSET;
Expand Down
2 changes: 1 addition & 1 deletion drivers/mtd/mx35.c
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ static int mx35_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)

case MTDIOC_ECCSTATUS:
{
uint8_t *result = (FAR uint8_t *)arg;
FAR uint8_t *result = (FAR uint8_t *)arg;
*result =
(priv->eccstatus & MX35_FEATURE_ECC_MASK) >>
MX35_FEATURE_ECC_OFFSET;
Expand Down
6 changes: 3 additions & 3 deletions drivers/mtd/smart.c
Original file line number Diff line number Diff line change
Expand Up @@ -3231,7 +3231,7 @@ static inline int smart_llformat(FAR struct smart_struct_s *dev,
#ifdef CONFIG_SMART_CRC_8
sectorheader->crc8 = smart_calc_sector_crc(dev);
#elif defined(CONFIG_SMART_CRC_16)
*((uint16_t *)sectorheader->crc16) = smart_calc_sector_crc(dev);
*((FAR uint16_t *)sectorheader->crc16) = smart_calc_sector_crc(dev);
#elif defined(CONFIG_SMART_CRC_32)
*((FAR uint32_t *)sectorheader->crc32) = smart_calc_sector_crc(dev);
#endif
Expand Down Expand Up @@ -3393,7 +3393,7 @@ static int smart_relocate_sector(FAR struct smart_struct_s *dev,
#ifdef CONFIG_SMART_CRC_8
header->crc8 = smart_calc_sector_crc(dev);
#elif defined(CONFIG_SMART_CRC_16)
*((uint16_t *)header->crc16) = smart_calc_sector_crc(dev);
*((FAR uint16_t *)header->crc16) = smart_calc_sector_crc(dev);
#elif defined(CONFIG_SMART_CRC_32)
*((FAR uint32_t *)header->crc32) = smart_calc_sector_crc(dev);
#endif
Expand Down Expand Up @@ -4818,7 +4818,7 @@ static int smart_writesector(FAR struct smart_struct_s *dev,
#ifdef CONFIG_SMART_CRC_8
header->crc8 = smart_calc_sector_crc(dev);
#elif defined(CONFIG_SMART_CRC_16)
*((uint16_t *)header->crc16) = smart_calc_sector_crc(dev);
*((FAR uint16_t *)header->crc16) = smart_calc_sector_crc(dev);
#elif defined(CONFIG_SMART_CRC_32)
*((FAR uint32_t *)header->crc32) = smart_calc_sector_crc(dev);
#endif
Expand Down
2 changes: 1 addition & 1 deletion drivers/sensors/apds9922.c
Original file line number Diff line number Diff line change
Expand Up @@ -1996,7 +1996,7 @@ static ssize_t apds9922_als_read(FAR struct file *filep, FAR char *buffer,
return (ssize_t)-EINVAL;
}

ptr = (int *)buffer;
ptr = (FAR int *)buffer;

if (priv->als < 0)
{
Expand Down
2 changes: 1 addition & 1 deletion drivers/sensors/as726x.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ static float as726x_getcalibrated(FAR struct as726x_dev_s *priv,
colourdata |= ((uint32_t) byte2 << (8 * 1));
colourdata |= ((uint32_t) byte3 << (8 * 0));

return *((float *)(&colourdata));
return *((FAR float *)(&colourdata));
}

/****************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion drivers/sensors/max31865.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ static ssize_t max31865_read(FAR struct file *filep, FAR char *buffer,
temp = (-RTD_A + sqrt(RTD_A * RTD_A - 4 * RTD_B * (1 - rt / 100.0))) \
/ (2 * RTD_B);

*(float *)buffer = temp;
*(FAR float *)buffer = temp;

sninfo("MAX31865 ADC: %d, RTD: %.2f, temperature: %.1f\n", \
regmsb, rt, temp);
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -1779,7 +1779,7 @@ static void uart_launch_foreach(FAR struct tcb_s *tcb, FAR void *arg)
if (!strcmp(tcb->name, CONFIG_TTY_LAUNCH_FILEPATH))
#endif
{
*(int *)arg = 1;
*(FAR int *)arg = 1;
}
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/usbdev/cdcacm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2435,7 +2435,7 @@ static int cdcuart_ioctl(FAR struct file *filep, int cmd, unsigned long arg)

leave_critical_section(flags);

*(int *)arg = count;
*(FAR int *)arg = count;
ret = 0;
}
break;
Expand All @@ -2461,7 +2461,7 @@ static int cdcuart_ioctl(FAR struct file *filep, int cmd, unsigned long arg)

leave_critical_section(flags);

*(int *)arg = count;
*(FAR int *)arg = count;
ret = 0;
}
break;
Expand Down
4 changes: 2 additions & 2 deletions fs/mnemofs/mnemofs.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ struct mfs_dirent_s
struct timespec st_ctim; /* Time of last status change */
struct mfs_ctz_s ctz;
uint8_t namelen;
FAR char name[];
char name[];
};

/* Parent iterator */
Expand Down Expand Up @@ -320,7 +320,7 @@ extern "C"
****************************************************************************/

static mfs_t inline mfs_blkremsz(FAR const struct mfs_sb_s * const sb,
mfs_t pg, mfs_t pgoff)
mfs_t pg, mfs_t pgoff)
{
return MFS_BLKSZ(sb) - (MFS_PG2BLKPGOFF(sb, pg) * sb->pg_sz + pgoff);
}
Expand Down
4 changes: 2 additions & 2 deletions fs/mnemofs/mnemofs_ctz.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ static void ctz_off2loc(FAR const struct mfs_sb_s * const sb, mfs_t off,
static mfs_t ctz_blkdatasz(FAR const struct mfs_sb_s * const sb,
const mfs_t idx);
static void ctz_copyidxptrs(FAR const struct mfs_sb_s * const sb,
FAR struct mfs_ctz_s ctz, const mfs_t idx,
struct mfs_ctz_s ctz, const mfs_t idx,
FAR char *buf);

/****************************************************************************
Expand Down Expand Up @@ -259,7 +259,7 @@ static mfs_t ctz_blkdatasz(FAR const struct mfs_sb_s * const sb,
****************************************************************************/

static void ctz_copyidxptrs(FAR const struct mfs_sb_s * const sb,
FAR struct mfs_ctz_s ctz, const mfs_t idx,
struct mfs_ctz_s ctz, const mfs_t idx,
FAR char *buf)
{
mfs_t i;
Expand Down
2 changes: 1 addition & 1 deletion fs/nxffs/nxffs.h
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ int nxffs_verifyblock(FAR struct nxffs_volume_s *volume, off_t block);
*
****************************************************************************/

int nxffs_validblock(struct nxffs_volume_s *volume, off_t *block);
int nxffs_validblock(FAR struct nxffs_volume_s *volume, FAR off_t *block);

/****************************************************************************
* Name: nxffs_blockstats
Expand Down
2 changes: 1 addition & 1 deletion fs/nxffs/nxffs_block.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ int nxffs_verifyblock(FAR struct nxffs_volume_s *volume, off_t block)
*
****************************************************************************/

int nxffs_validblock(struct nxffs_volume_s *volume, off_t *block)
int nxffs_validblock(FAR struct nxffs_volume_s *volume, FAR off_t *block)
{
off_t i;
int ret;
Expand Down
2 changes: 1 addition & 1 deletion fs/nxffs/nxffs_pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ static inline off_t nxffs_mediacheck(FAR struct nxffs_volume_s *volume,

static inline int nxffs_startpos(FAR struct nxffs_volume_s *volume,
FAR struct nxffs_pack_s *pack,
off_t *froffset)
FAR off_t *froffset)
{
struct nxffs_blkentry_s blkentry;
off_t offset = *froffset;
Expand Down
2 changes: 1 addition & 1 deletion fs/procfs/fs_procfsutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@

size_t procfs_memcpy(FAR const char *src, size_t srclen,
FAR char *dest, size_t destlen,
off_t *offset)
FAR off_t *offset)
{
size_t copysize;
size_t lnoffset;
Expand Down
6 changes: 3 additions & 3 deletions fs/vfs/fs_sendfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
****************************************************************************/

static ssize_t copyfile(FAR struct file *outfile, FAR struct file *infile,
off_t *offset, size_t count)
FAR off_t *offset, size_t count)
{
FAR uint8_t *iobuffer;
FAR uint8_t *wrbuffer;
Expand Down Expand Up @@ -243,7 +243,7 @@ static ssize_t copyfile(FAR struct file *outfile, FAR struct file *infile,
****************************************************************************/

ssize_t file_sendfile(FAR struct file *outfile, FAR struct file *infile,
off_t *offset, size_t count)
FAR off_t *offset, size_t count)
{
if (count == 0)
{
Expand Down Expand Up @@ -327,7 +327,7 @@ ssize_t file_sendfile(FAR struct file *outfile, FAR struct file *infile,
*
****************************************************************************/

ssize_t sendfile(int outfd, int infd, off_t *offset, size_t count)
ssize_t sendfile(int outfd, int infd, FAR off_t *offset, size_t count)
{
FAR struct file *outfile;
FAR struct file *infile;
Expand Down
2 changes: 1 addition & 1 deletion include/dsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ void phase_angle_update(FAR struct phase_angle_f32_s *angle, float val);
void svm3_init(FAR struct svm3_state_f32_s *s);
void svm3(FAR struct svm3_state_f32_s *s, FAR ab_frame_f32_t *ab);
void svm3_current_correct(FAR struct svm3_state_f32_s *s,
float *c0, float *c1, float *c2);
FAR float *c0, FAR float *c1, FAR float *c2);

/* Field Oriented Control */

Expand Down
Loading

0 comments on commit f76724f

Please sign in to comment.