9
0
Fork 0

Fixes for kernel stub builds

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@3473 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2011-04-06 16:40:47 +00:00
parent 962865582a
commit 92b691c853
26 changed files with 145 additions and 114 deletions

View File

@ -62,6 +62,7 @@
#include <errno.h>
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/fs.h>
#include <nuttx/clock.h>
#include <nuttx/arch.h>
@ -628,7 +629,7 @@ static inline FAR struct rtl8187x_state_s *rtl8187x_allocclass(void)
FAR struct rtl8187x_state_s *priv;
DEBUGASSERT(!up_interrupt_context());
priv = (FAR struct rtl8187x_state_s *)malloc(sizeof(struct rtl8187x_state_s));
priv = (FAR struct rtl8187x_state_s *)kmalloc(sizeof(struct rtl8187x_state_s));
uvdbg("Allocated: %p\n", priv);;
return priv;
}
@ -656,7 +657,7 @@ static inline void rtl8187x_freeclass(FAR struct rtl8187x_state_s *class)
*/
uvdbg("Freeing: %p\n", class);
free(class);
kfree(class);
}
/****************************************************************************
@ -3454,7 +3455,6 @@ static void rtl8225_settxpower(FAR struct rtl8187x_state_s *priv, int channel)
{
uint8_t cck_power, ofdm_power;
const uint8_t *tmp;
uint32_t regval;
int i;
cck_power = priv->channels[channel - 1].val & 0xf;
@ -3505,7 +3505,6 @@ static void rtl8225z2_settxpower(FAR struct rtl8187x_state_s *priv, int channel)
uint8_t cck_power;
uint8_t ofdm_power;
const uint8_t *tmp;
uint32_t regval;
int i;
cck_power = priv->channels[channel - 1].val & 0xF;

View File

@ -1,7 +1,7 @@
/****************************************************************************
* drivers/bch/bchlib_setup.c
*
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -49,6 +49,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/fs.h>
#include "bch_internal.h"
@ -92,7 +93,7 @@ int bchlib_setup(const char *blkdev, bool readonly, FAR void **handle)
/* Allocate the BCH state structure */
bch = (FAR struct bchlib_s*)zalloc(sizeof(struct bchlib_s));
bch = (FAR struct bchlib_s*)kzalloc(sizeof(struct bchlib_s));
if (!bch)
{
fdbg("Failed to allocate BCH structure\n");
@ -141,7 +142,7 @@ int bchlib_setup(const char *blkdev, bool readonly, FAR void **handle)
/* Allocate the sector I/O buffer */
bch->buffer = (FAR uint8_t *)malloc(bch->sectsize);
bch->buffer = (FAR uint8_t *)kmalloc(bch->sectsize);
if (!bch->buffer)
{
fdbg("Failed to allocate sector buffer\n");
@ -153,6 +154,6 @@ int bchlib_setup(const char *blkdev, bool readonly, FAR void **handle)
return OK;
errout_with_bch:
free(bch);
kfree(bch);
return ret;
}

View File

@ -1,7 +1,7 @@
/****************************************************************************
* drivers/bch/bchlib_teardown.c
*
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -44,6 +44,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/fs.h>
#include "bch_internal.h"
@ -102,11 +103,11 @@ int bchlib_teardown(FAR void *handle)
if (bch->buffer)
{
free(bch->buffer);
kfree(bch->buffer);
}
sem_destroy(&bch->sem);
free(bch);
kfree(bch);
return OK;
}

View File

@ -46,6 +46,7 @@
#include <errno.h>
#include <stdio.h>
#include <nuttx/kmalloc.h>
#include <nuttx/i2c/st_lis331dl.h>
/************************************************************************************
@ -152,7 +153,7 @@ struct st_lis331dl_dev_s * st_lis331dl_init(struct i2c_dev_s * i2c, uint16_t add
ASSERT(i2c);
ASSERT(address);
if ( (dev = malloc( sizeof(struct st_lis331dl_dev_s) )) == NULL )
if ( (dev = kmalloc( sizeof(struct st_lis331dl_dev_s) )) == NULL )
return NULL;
memset(dev, 0, sizeof(struct st_lis331dl_dev_s));
@ -189,7 +190,7 @@ struct st_lis331dl_dev_s * st_lis331dl_init(struct i2c_dev_s * i2c, uint16_t add
}
/* Error exit */
free(dev);
kfree(dev);
errno = retval;
return NULL;
}
@ -200,7 +201,7 @@ int st_lis331dl_deinit(struct st_lis331dl_dev_s * dev)
ASSERT(dev);
st_lis331dl_powerdown(dev);
free(dev);
kfree(dev);
return OK;
}

View File

@ -1,7 +1,7 @@
/****************************************************************************
* drivers/loop.c
*
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -56,6 +56,7 @@
#include <debug.h>
#include <errno.h>
#include <nuttx/kmalloc.h>
#include <nuttx/fs.h>
/****************************************************************************
@ -377,7 +378,7 @@ int losetup(const char *devname, const char *filename, uint16_t sectsize,
/* Allocate a loop device structure */
dev = (FAR struct loop_struct_s *)zalloc(sizeof(struct loop_struct_s));
dev = (FAR struct loop_struct_s *)kzalloc(sizeof(struct loop_struct_s));
if (!dev)
{
return -ENOMEM;
@ -437,7 +438,7 @@ int losetup(const char *devname, const char *filename, uint16_t sectsize,
errout_with_fd:
close(dev->fd);
errout_with_dev:
free(dev);
kfree(dev);
return ret;
}
@ -500,6 +501,6 @@ int loteardown(const char *devname)
(void)close(dev->fd);
}
free(dev);
kfree(dev);
return ret;
}

View File

@ -52,6 +52,7 @@
#include <debug.h>
#include <errno.h>
#include <nuttx/kmalloc.h>
#include <nuttx/fs.h>
#include <nuttx/ioctl.h>
#include <nuttx/clock.h>
@ -2891,7 +2892,7 @@ static void mmcsd_hwuninitialize(FAR struct mmcsd_state_s *priv)
{
mmcsd_removed(priv);
SDIO_RESET(priv->dev);
free(priv);
kfree(priv);
}
}
@ -2932,7 +2933,7 @@ int mmcsd_slotinitialize(int minor, FAR struct sdio_dev_s *dev)
/* Allocate a MMC/SD state structure */
priv = (FAR struct mmcsd_state_s *)malloc(sizeof(struct mmcsd_state_s));
priv = (FAR struct mmcsd_state_s *)kmalloc(sizeof(struct mmcsd_state_s));
if (priv)
{
/* Initialize the MMC/SD state structure */
@ -3010,6 +3011,6 @@ errout_with_hwinit:
#endif
mmcsd_hwuninitialize(priv);
errout_with_alloc:
free(priv);
kfree(priv);
return ret;
}

View File

@ -2,7 +2,7 @@
* drivers/mtd/at45db.c
* Driver for SPI-based AT45DB161D (16Mbit)
*
* Copyright (C) 2010 Gregory Nutt. All rights reserved.
* Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -59,6 +59,7 @@
#include <errno.h>
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/arch.h>
#include <nuttx/ioctl.h>
#include <nuttx/spi.h>
@ -826,7 +827,7 @@ FAR struct mtd_dev_s *at45db_initialize(FAR struct spi_dev_s *spi)
* to be extended to handle multiple FLASH parts on the same SPI bus.
*/
priv = (FAR struct at45db_dev_s *)malloc(sizeof(struct at45db_dev_s));
priv = (FAR struct at45db_dev_s *)kmalloc(sizeof(struct at45db_dev_s));
if (priv)
{
/* Initialize the allocated structure */
@ -893,6 +894,6 @@ FAR struct mtd_dev_s *at45db_initialize(FAR struct spi_dev_s *spi)
errout:
at45db_unlock(priv);
free(priv);
kfree(priv);
return NULL;
}

View File

@ -49,6 +49,7 @@
#include <debug.h>
#include <errno.h>
#include <nuttx/kmalloc.h>
#include <nuttx/fs.h>
#include <nuttx/ioctl.h>
#include <nuttx/mtd.h>
@ -468,7 +469,7 @@ int ftl_initialize(int minor, uint8_t *buffer, FAR struct mtd_dev_s *mtd)
/* Allocate a ramdisk device structure */
dev = (struct ftl_struct_s *)malloc(sizeof(struct ftl_struct_s));
dev = (struct ftl_struct_s *)kmalloc(sizeof(struct ftl_struct_s));
if (dev)
{
/* Initialize the ramdisk device structure */
@ -484,18 +485,18 @@ int ftl_initialize(int minor, uint8_t *buffer, FAR struct mtd_dev_s *mtd)
if (ret < 0)
{
fdbg("MTD ioctl(MTDIOC_GEOMETRY) failed: %d\n", ret);
free(dev);
kfree(dev);
return ret;
}
/* Allocate one, in-memory erase block buffer */
#ifdef CONFIG_FS_WRITABLE
dev->eblock = (FAR uint8_t *)malloc(dev->geo.erasesize);
dev->eblock = (FAR uint8_t *)kmalloc(dev->geo.erasesize);
if (!dev->eblock)
{
fdbg("Failed to allocate an erase block buffer\n");
free(dev);
kfree(dev);
return -ENOMEM;
}
#endif
@ -525,7 +526,7 @@ int ftl_initialize(int minor, uint8_t *buffer, FAR struct mtd_dev_s *mtd)
if (ret < 0)
{
fdbg("rwb_initialize failed: %d\n", ret);
free(dev);
kfree(dev);
return ret;
}
#endif
@ -540,7 +541,7 @@ int ftl_initialize(int minor, uint8_t *buffer, FAR struct mtd_dev_s *mtd)
if (ret < 0)
{
fdbg("register_blockdriver failed: %d\n", -ret);
free(dev);
kfree(dev);
}
}
return ret;

View File

@ -2,7 +2,7 @@
* drivers/mtd/m25px.c
* Driver for SPI-based M25P1 (128Kbit), M25P64 (64Mbit), and M25P128 (128Mbit) FLASH
*
* Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
* Copyright (C) 2009-2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -47,6 +47,7 @@
#include <errno.h>
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/ioctl.h>
#include <nuttx/spi.h>
#include <nuttx/mtd.h>
@ -673,7 +674,7 @@ FAR struct mtd_dev_s *m25p_initialize(FAR struct spi_dev_s *dev)
* to be extended to handle multiple FLASH parts on the same SPI bus.
*/
priv = (FAR struct m25p_dev_s *)malloc(sizeof(struct m25p_dev_s));
priv = (FAR struct m25p_dev_s *)kmalloc(sizeof(struct m25p_dev_s));
if (priv)
{
/* Initialize the allocated structure */
@ -697,7 +698,7 @@ FAR struct mtd_dev_s *m25p_initialize(FAR struct spi_dev_s *dev)
/* Unrecognized! Discard all of that work we just did and return NULL */
fdbg("Unrecognized\n");
free(priv);
kfree(priv);
priv = NULL;
}
}

View File

@ -67,6 +67,7 @@
#include <debug.h>
#include <assert.h>
#include <nuttx/kmalloc.h>
#include <nuttx/ioctl.h>
#include <nuttx/spi.h>
#include <nuttx/mtd.h>
@ -635,7 +636,7 @@ FAR struct mtd_dev_s *ramtron_initialize(FAR struct spi_dev_s *dev)
* to be extended to handle multiple FLASH parts on the same SPI bus.
*/
priv = (FAR struct ramtron_dev_s *)malloc(sizeof(struct ramtron_dev_s));
priv = (FAR struct ramtron_dev_s *)kmalloc(sizeof(struct ramtron_dev_s));
if (priv)
{
/* Initialize the allocated structure */
@ -656,7 +657,7 @@ FAR struct mtd_dev_s *ramtron_initialize(FAR struct spi_dev_s *dev)
if (ramtron_readid(priv) != OK)
{
/* Unrecognized! Discard all of that work we just did and return NULL */
free(priv);
kfree(priv);
priv = NULL;
}
}

View File

@ -186,7 +186,7 @@ struct slip_driver_s
****************************************************************************/
/* We really should get rid of CONFIG_SLIP_NINTERFACES and, instead,
* malloc() new interface instances as needed.
* kmalloc() new interface instances as needed.
*/
static struct slip_driver_s g_slip[CONFIG_SLIP_NINTERFACES];

View File

@ -52,6 +52,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/fs.h>
#if CONFIG_DEBUG
# include <nuttx/arch.h>
@ -150,7 +151,7 @@ FAR struct pipe_dev_s *pipecommon_allocdev(void)
/* Allocate a private structure to manage the pipe */
dev = (struct pipe_dev_s *)malloc(sizeof(struct pipe_dev_s));
dev = (struct pipe_dev_s *)kmalloc(sizeof(struct pipe_dev_s));
if (dev)
{
/* Initialize the private structure */
@ -172,7 +173,7 @@ void pipecommon_freedev(FAR struct pipe_dev_s *dev)
sem_destroy(&dev->d_bfsem);
sem_destroy(&dev->d_rdsem);
sem_destroy(&dev->d_wrsem);
free(dev);
kfree(dev);
}
/****************************************************************************
@ -209,7 +210,7 @@ int pipecommon_open(FAR struct file *filep)
if (dev->d_refs == 0)
{
dev->d_buffer = (uint8_t*)malloc(CONFIG_DEV_PIPE_SIZE);
dev->d_buffer = (uint8_t*)kmalloc(CONFIG_DEV_PIPE_SIZE);
if (!dev->d_buffer)
{
(void)sem_post(&dev->d_bfsem);
@ -330,7 +331,7 @@ int pipecommon_close(FAR struct file *filep)
{
/* Yes... deallocate the buffer */
free(dev->d_buffer);
kfree(dev->d_buffer);
dev->d_buffer = NULL;
/* And reset all counts and indices */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* drivers/ramdisk.c
*
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -49,6 +49,7 @@
#include <debug.h>
#include <errno.h>
#include <nuttx/kmalloc.h>
#include <nuttx/fs.h>
#include <nuttx/ramdisk.h>
@ -305,7 +306,7 @@ int romdisk_register(int minor, uint8_t *buffer, uint32_t nsectors,
/* Allocate a ramdisk device structure */
dev = (struct rd_struct_s *)malloc(sizeof(struct rd_struct_s));
dev = (struct rd_struct_s *)kmalloc(sizeof(struct rd_struct_s));
if (dev)
{
/* Initialize the ramdisk device structure */
@ -327,7 +328,7 @@ int romdisk_register(int minor, uint8_t *buffer, uint32_t nsectors,
if (ret < 0)
{
fdbg("register_blockdriver failed: %d\n", -ret);
free(dev);
kfree(dev);
}
}
return ret;

View File

@ -1,7 +1,7 @@
/****************************************************************************
* drivers/rwbuffer.c
*
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -50,6 +50,7 @@
#include <errno.h>
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/wqueue.h>
#include <nuttx/rwbuffer.h>
@ -425,10 +426,10 @@ int rwb_initialize(FAR struct rwbuffer_s *rwb)
if (rwb->wrmaxblocks > 0)
{
allocsize = rwb->wrmaxblocks * rwb->blocksize;
rwb->wrbuffer = malloc(allocsize);
rwb->wrbuffer = kmalloc(allocsize);
if (!rwb->wrbuffer)
{
fdbg("Write buffer malloc(%d) failed\n", allocsizee);
fdbg("Write buffer kmalloc(%d) failed\n", allocsizee);
return -ENOMEM;
}
}
@ -453,10 +454,10 @@ int rwb_initialize(FAR struct rwbuffer_s *rwb)
if (rwb->rhmaxblocks > 0)
{
allocsize = rwb->rhmaxblocks * rwb->blocksize;
rwb->rhbuffer = malloc(allocsize);
rwb->rhbuffer = kmalloc(allocsize);
if (!rwb->rhbuffer)
{
fdbg("Read-ahead buffer malloc(%d) failed\n", allocsize);
fdbg("Read-ahead buffer kmalloc(%d) failed\n", allocsize);
return -ENOMEM;
}
}
@ -477,7 +478,7 @@ void rwb_uninitialize(FAR struct rwbuffer_s *rwb)
sem_destroy(&rwb->wrsem);
if (rwb->wrbuffer)
{
free(rwb->wrbuffer);
kfree(rwb->wrbuffer);
}
#endif
@ -485,7 +486,7 @@ void rwb_uninitialize(FAR struct rwbuffer_s *rwb)
sem_destroy(&rwb->rhsem);
if (rwb->rhbuffer)
{
free(rwb->rhbuffer);
kfree(rwb->rhbuffer);
}
#endif
}

View File

@ -1,7 +1,7 @@
/****************************************************************************
* drivers/usbdev/usbdev_serial.c
*
* Copyright (C) 2008-2010 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* This logic emulates the Prolific PL2303 serial/USB converter
@ -53,6 +53,7 @@
#include <queue.h>
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/arch.h>
#include <nuttx/serial.h>
#include <nuttx/usb/usb.h>
@ -1300,9 +1301,9 @@ static int usbclass_bind(FAR struct usbdev_s *dev, FAR struct usbdevclass_driver
/* Pre-allocate all endpoints... the endpoints will not be functional
* until the SET CONFIGURATION request is processed in usbclass_setconfig.
* This is done here because there may be calls to malloc and the SET
* This is done here because there may be calls to kmalloc and the SET
* CONFIGURATION processing probably occurrs within interrupt handling
* logic where malloc calls will fail.
* logic where kmalloc calls will fail.
*/
/* Pre-allocate the IN interrupt endpoint */
@ -2163,7 +2164,7 @@ int usbdev_serialinitialize(int minor)
/* Allocate the structures needed */
alloc = (FAR struct usbser_alloc_s*)malloc(sizeof(struct usbser_alloc_s));
alloc = (FAR struct usbser_alloc_s*)kmalloc(sizeof(struct usbser_alloc_s));
if (!alloc)
{
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_ALLOCDEVSTRUCT), 0);
@ -2244,6 +2245,6 @@ int usbdev_serialinitialize(int minor)
errout_with_class:
usbdev_unregister(&drvr->drvr);
errout_with_alloc:
free(alloc);
kfree(alloc);
return ret;
}

View File

@ -1,7 +1,7 @@
/****************************************************************************
* drivers/usbdev/usbdev_storage.c
*
* Copyright (C) 2008-2010 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Mass storage class device. Bulk-only with SCSI subclass.
@ -72,6 +72,7 @@
#include <queue.h>
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/arch.h>
#include <nuttx/fs.h>
#include <nuttx/usb/usb.h>
@ -531,9 +532,9 @@ static int usbstrg_bind(FAR struct usbdev_s *dev, FAR struct usbdevclass_driver_
/* Pre-allocate all endpoints... the endpoints will not be functional
* until the SET CONFIGURATION request is processed in usbstrg_setconfig.
* This is done here because there may be calls to malloc and the SET
* This is done here because there may be calls to kmalloc and the SET
* CONFIGURATION processing probably occurrs within interrupt handling
* logic where malloc calls will fail.
* logic where kmalloc calls will fail.
*/
/* Pre-allocate the IN bulk endpoint */
@ -1477,7 +1478,7 @@ int usbstrg_configure(unsigned int nluns, void **handle)
/* Allocate the structures needed */
alloc = (FAR struct usbstrg_alloc_s*)malloc(sizeof(struct usbstrg_alloc_s));
alloc = (FAR struct usbstrg_alloc_s*)kmalloc(sizeof(struct usbstrg_alloc_s));
if (!alloc)
{
usbtrace(TRACE_CLSERROR(USBSTRG_TRACEERR_ALLOCDEVSTRUCT), 0);
@ -1497,7 +1498,7 @@ int usbstrg_configure(unsigned int nluns, void **handle)
/* Allocate the LUN table */
priv->luntab = (struct usbstrg_lun_s*)malloc(priv->nluns*sizeof(struct usbstrg_lun_s));
priv->luntab = (struct usbstrg_lun_s*)kmalloc(priv->nluns*sizeof(struct usbstrg_lun_s));
if (!priv->luntab)
{
ret = -ENOMEM;
@ -1638,7 +1639,7 @@ int usbstrg_bindlun(FAR void *handle, FAR const char *drvrpath,
if (!priv->iobuffer)
{
priv->iobuffer = (uint8_t*)malloc(geo.geo_sectorsize);
priv->iobuffer = (uint8_t*)kmalloc(geo.geo_sectorsize);
if (!priv->iobuffer)
{
usbtrace(TRACE_CLSERROR(USBSTRG_TRACEERR_ALLOCIOBUFFER), geo.geo_sectorsize);
@ -1891,13 +1892,13 @@ void usbstrg_uninitialize(FAR void *handle)
{
usbstrg_lununinitialize(&priv->luntab[i]);
}
free(priv->luntab);
kfree(priv->luntab);
/* Release the I/O buffer */
if (priv->iobuffer)
{
free(priv->iobuffer);
kfree(priv->iobuffer);
}
/* Uninitialize and release the driver structure */
@ -1905,5 +1906,5 @@ void usbstrg_uninitialize(FAR void *handle)
pthread_mutex_destroy(&priv->mutex);
pthread_cond_destroy(&priv->cond);
free(priv);
kfree(priv);
}

View File

@ -53,6 +53,7 @@
#include <errno.h>
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/fs.h>
#include <nuttx/arch.h>
#include <nuttx/wqueue.h>
@ -490,7 +491,7 @@ static inline FAR struct usbhost_state_s *usbhost_allocclass(void)
FAR struct usbhost_state_s *priv;
DEBUGASSERT(!up_interrupt_context());
priv = (FAR struct usbhost_state_s *)malloc(sizeof(struct usbhost_state_s));
priv = (FAR struct usbhost_state_s *)kmalloc(sizeof(struct usbhost_state_s));
uvdbg("Allocated: %p\n", priv);;
return priv;
}
@ -513,12 +514,10 @@ static inline void usbhost_freeclass(FAR struct usbhost_state_s *class)
{
DEBUGASSERT(class != NULL);
/* Free the class instance (calling sched_free() in case we are executing
* from an interrupt handler.
*/
/* Free the class instance. */
uvdbg("Freeing: %p\n", class);;
free(class);
kfree(class);
}
/****************************************************************************

View File

@ -47,6 +47,7 @@
#include <errno.h>
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/fs.h>
#include <nuttx/arch.h>
#include <nuttx/wqueue.h>
@ -252,7 +253,7 @@ static inline FAR struct usbhost_state_s *usbhost_allocclass(void)
FAR struct usbhost_state_s *priv;
DEBUGASSERT(!up_interrupt_context());
priv = (FAR struct usbhost_state_s *)malloc(sizeof(struct usbhost_state_s));
priv = (FAR struct usbhost_state_s *)kmalloc(sizeof(struct usbhost_state_s));
uvdbg("Allocated: %p\n", priv);;
return priv;
}
@ -275,12 +276,12 @@ static inline void usbhost_freeclass(FAR struct usbhost_state_s *class)
{
DEBUGASSERT(class != NULL);
/* Free the class instance (calling sched_free() in case we are executing
* from an interrupt handler.
/* Free the class instance (perhaps calling sched_free() in case we are
* executing from an interrupt handler.
*/
uvdbg("Freeing: %p\n", class);;
free(class);
kfree(class);
}
/****************************************************************************

View File

@ -1,7 +1,7 @@
/****************************************************************************
* drivers/usbhost/usbhost_storage.c
*
* Copyright (C) 2010 Gregory Nutt. All rights reserved.
* Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -47,6 +47,7 @@
#include <errno.h>
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/fs.h>
#include <nuttx/arch.h>
#include <nuttx/wqueue.h>
@ -72,7 +73,7 @@
#endif
/* If the create() method is called by the USB host device driver from an
* interrupt handler, then it will be unable to call malloc() in order to
* interrupt handler, then it will be unable to call kmalloc() in order to
* allocate a new class instance. If the create() method is called from the
* interrupt level, then class instances must be pre-allocated.
*/
@ -378,11 +379,11 @@ static inline FAR struct usbhost_state_s *usbhost_allocclass(void)
FAR struct usbhost_state_s *priv;
/* We are not executing from an interrupt handler so we can just call
* malloc() to get memory for the class instance.
* kmalloc() to get memory for the class instance.
*/
DEBUGASSERT(!up_interrupt_context());
priv = (FAR struct usbhost_state_s *)malloc(sizeof(struct usbhost_state_s));
priv = (FAR struct usbhost_state_s *)kmalloc(sizeof(struct usbhost_state_s));
uvdbg("Allocated: %p\n", priv);;
return priv;
}
@ -427,7 +428,7 @@ static inline void usbhost_freeclass(FAR struct usbhost_state_s *class)
*/
uvdbg("Freeing: %p\n", class);;
free(class);
kfree(class);
}
#endif

View File

@ -58,6 +58,7 @@
#include <errno.h>
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/fs.h>
#include <nuttx/fat.h>
#include <nuttx/dirent.h>
@ -286,7 +287,7 @@ static int fat_open(FAR struct file *filep, const char *relpath,
* file.
*/
ff = (struct fat_file_s *)zalloc(sizeof(struct fat_file_s));
ff = (struct fat_file_s *)kzalloc(sizeof(struct fat_file_s));
if (!ff)
{
ret = -ENOMEM;
@ -295,7 +296,7 @@ static int fat_open(FAR struct file *filep, const char *relpath,
/* Create a file buffer to support partial sector accesses */
ff->ff_buffer = (uint8_t*)malloc(fs->fs_hwsectorsize);
ff->ff_buffer = (uint8_t*)kmalloc(fs->fs_hwsectorsize);
if (!ff->ff_buffer)
{
ret = -ENOMEM;
@ -344,7 +345,7 @@ static int fat_open(FAR struct file *filep, const char *relpath,
ssize_t offset = (ssize_t)fat_seek(filep, ff->ff_size, SEEK_SET);
if (offset < 0)
{
free(ff);
kfree(ff);
return (int)offset;
}
}
@ -356,7 +357,7 @@ static int fat_open(FAR struct file *filep, const char *relpath,
*/
errout_with_struct:
free(ff);
kfree(ff);
errout_with_semaphore:
fat_semgive(fs);
@ -402,12 +403,12 @@ static int fat_close(FAR struct file *filep)
if (ff->ff_buffer)
{
free(ff->ff_buffer);
kfree(ff->ff_buffer);
}
/* Then free the file structure itself. */
free(ff);
kfree(ff);
filep->f_priv = NULL;
return ret;
}
@ -1491,7 +1492,7 @@ static int fat_bind(FAR struct inode *blkdriver, const void *data,
/* Create an instance of the mountpt state structure */
fs = (struct fat_mountpt_s *)zalloc(sizeof(struct fat_mountpt_s));
fs = (struct fat_mountpt_s *)kzalloc(sizeof(struct fat_mountpt_s));
if (!fs)
{
return -ENOMEM;
@ -1513,7 +1514,7 @@ static int fat_bind(FAR struct inode *blkdriver, const void *data,
if (ret != 0)
{
sem_destroy(&fs->fs_sem);
free(fs);
kfree(fs);
return ret;
}
@ -1581,9 +1582,9 @@ static int fat_unbind(void *handle, FAR struct inode **blkdriver)
if (fs->fs_buffer)
{
free(fs->fs_buffer);
kfree(fs->fs_buffer);
}
free(fs);
kfree(fs);
}
fat_semgive(fs);

View File

@ -56,6 +56,7 @@
#include <errno.h>
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/fs.h>
#include <nuttx/fat.h>
@ -626,7 +627,7 @@ int fat_mount(struct fat_mountpt_s *fs, bool writeable)
/* Allocate a buffer to hold one hardware sector */
fs->fs_buffer = (uint8_t*)malloc(fs->fs_hwsectorsize);
fs->fs_buffer = (uint8_t*)kmalloc(fs->fs_hwsectorsize);
if (!fs->fs_buffer)
{
ret = -ENOMEM;
@ -724,7 +725,7 @@ int fat_mount(struct fat_mountpt_s *fs, bool writeable)
return OK;
errout_with_buffer:
free(fs->fs_buffer);
kfree(fs->fs_buffer);
fs->fs_buffer = 0;
errout:
fs->fs_mounted = false;

View File

@ -168,11 +168,15 @@
#if CONFIG_NFILE_DESCRIPTORS > 0 || CONFIG_NSOCKET_DESCRIPTORS > 0
# define SYS_close (__SYS_descriptors+0)
# define SYS_ioctl (__SYS_descriptors+1)
# define SYS_poll (__SYS_descriptors+2)
# define SYS_read (__SYS_descriptors+3)
# define SYS_select (__SYS_descriptors+4)
# define SYS_write (__SYS_descriptors+5)
# define __SYS_filedesc (__SYS_descriptors+6)
# define SYS_read (__SYS_descriptors+2)
# define SYS_write (__SYS_descriptors+3)
# ifndef CONFIG_DISABLE_POLL
# define SYS_poll (__SYS_descriptors+4)
# define SYS_select (__SYS_descriptors+5)
# define __SYS_filedesc (__SYS_descriptors+6)
# else
# define __SYS_filedesc (__SYS_descriptors+4)
# endif
#else
# define __SYS_filedesc __SYS_descriptors
#endif
@ -252,16 +256,15 @@
# define SYS_pthread_setschedparam (__SYS_pthread+24)
# define SYS_pthread_setschedprio (__SYS_pthread+25)
# define SYS_pthread_setspecific (__SYS_pthread+26)
# define SYS_pthread_testcancel (__SYS_pthread+27)
# define SYS_pthread_yield (__SYS_pthread+28)
# define SYS_pthread_yield (__SYS_pthread+27)
# ifndef CONFIG_DISABLE_SIGNAL
# define SYS_pthread_cond_timedwait (__SYS_pthread+29)
# define SYS_pthread_kill (__SYS_pthread+30)
# define SYS_pthread_sigmask (__SYS_pthread+31)
# define __SYS_mqueue (__SYS_pthread+32)
# define SYS_pthread_cond_timedwait (__SYS_pthread+28)
# define SYS_pthread_kill (__SYS_pthread+29)
# define SYS_pthread_sigmask (__SYS_pthread+30)
# define __SYS_mqueue (__SYS_pthread+31)
# else
# define __SYS_mqueue (__SYS_pthread+29)
# define __SYS_mqueue (__SYS_pthread+28)
# endif
#else

View File

@ -123,18 +123,31 @@ endif
depend: .depend
# Clean Targets:
# Clean user-mode temporary files (retaining the UBIN binary)
uclean:
@rm -f $(UBIN) .userlib *~ .*.swp
$(call CLEAN)
ifneq ($(OBJEXT),)
@( if [ -f .userlib ]; then rm -f *$(OBJEXT); fi )
endif
@rm -f .userlib *~ .*.swp
# Clean kernel-mode temporary files (retaining the KBIN binary)
kclean:
@rm -f $(KBIN) .kernlib *~ .*.swp
$(call CLEAN)
ifneq ($(OBJEXT),)
@( if [ -f .kernlib ]; then rm -f *$(OBJEXT); fi )
endif
@rm -f .kernlib *~ .*.swp
# Really clean everything
clean: uclean kclean
@rm -f $(BIN) *~ .*.swp
@rm -f $(BIN) $(UBIN) $(KBIN) *~ .*.swp
$(call CLEAN)
# Deep clean -- removes all traces of the configuration
distclean: clean
@rm -f Make.dep .depend

View File

@ -190,7 +190,6 @@ extern uintptr_t STUB_pthread_setcancelstate(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_pthread_setschedparam(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3);
extern uintptr_t STUB_pthread_setschedprio(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_pthread_setspecific(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_pthread_testcancel(void);
extern uintptr_t STUB_pthread_yield(void);
extern uintptr_t STUB_pthread_cond_timedwait(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3);

View File

@ -125,10 +125,12 @@ STUB_LOOKUP(3, STUB_up_assert_code) /* SYS_up_assert_code */
#if CONFIG_NFILE_DESCRIPTORS > 0 || CONFIG_NSOCKET_DESCRIPTORS > 0
STUB_LOOKUP(1, STUB_close) /* SYS_close */
STUB_LOOKUP(3, STUB_ioctl) /* SYS_ioctl */
STUB_LOOKUP(3, STUB_poll) /* SYS_poll */
STUB_LOOKUP(3, STUB_read) /* SYS_read */
STUB_LOOKUP(5, STUB_select) /* SYS_select */
STUB_LOOKUP(3, STUB_write) /* SYS_write */
# ifndef CONFIG_DISABLE_POLL
STUB_LOOKUP(3, STUB_poll) /* SYS_poll */
STUB_LOOKUP(5, STUB_select) /* SYS_select */
# endif
#endif
/* The following are defined if file descriptors are enabled */
@ -197,7 +199,6 @@ STUB_LOOKUP(3, STUB_up_assert_code) /* SYS_up_assert_code */
STUB_LOOKUP(3, STUB_pthread_setschedparam) /* SYS_pthread_setschedparam */
STUB_LOOKUP(2, STUB_pthread_setschedprio) /* SYS_pthread_setschedprio */
STUB_LOOKUP(2, STUB_pthread_setspecific) /* SYS_pthread_setspecific */
STUB_LOOKUP(0, STUB_pthread_testcancel) /* SYS_pthread_testcancel */
STUB_LOOKUP(0, STUB_pthread_yield) /* SYS_pthread_yield */
# ifndef CONFIG_DISABLE_SIGNAL
STUB_LOOKUP(3, STUB_pthread_cond_timedwait) /* SYS_pthread_cond_timedwait */

View File

@ -39,7 +39,7 @@
"open","fcntl.h","CONFIG_NFILE_DESCRIPTORS > 0","int","const char*","int","..."
"opendir","dirent.h","CONFIG_NFILE_DESCRIPTORS > 0","FAR DIR*","FAR const char*"
"pipe","unistd.h","CONFIG_NFILE_DESCRIPTORS > 0","int","int [2]|int*"
"poll","poll.h","CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0","int","FAR struct pollfd*","nfds_t","int"
"poll","poll.h","!defined(CONFIG_DISABLE_POLL) && (CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0)","int","FAR struct pollfd*","nfds_t","int"
"pthread_barrier_destroy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_barrier_t*"
"pthread_barrier_init","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_barrier_t*","FAR const pthread_barrierattr_t*","unsigned int"
"pthread_barrier_wait","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_barrier_t*"
@ -70,7 +70,6 @@
"pthread_setschedprio","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","pthread_t","int"
"pthread_setspecific","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","pthread_key_t","FAR void*"
"pthread_sigmask","pthread.h","!defined(CONFIG_DISABLE_SIGNALS) && !defined(CONFIG_DISABLE_PTHREAD)","int","int","FAR const sigset_t*","FAR sigset_t*"
"pthread_testcancel","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","void"
"pthread_yield","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","void"
"putenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","int","FAR const char*"
"read","unistd.h","CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0","ssize_t","int","FAR void*","size_t"
@ -91,7 +90,7 @@
"sched_unlock","sched.h","","int"
"sched_yield","sched.h","","int"
"seekdir","dirent.h","CONFIG_NFILE_DESCRIPTORS > 0","void","FAR DIR*","off_t"
"select","sys/select.h","CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0","int","int","FAR fd_set*","FAR fd_set*","FAR fd_set*","FAR struct timeval*"
"select","sys/select.h","!defined(CONFIG_DISABLE_POLL) && (CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0)","int","int","FAR fd_set*","FAR fd_set*","FAR fd_set*","FAR struct timeval*"
"sem_close","semaphore.h","","int","FAR sem_t*"
"sem_destroy","semaphore.h","","int","FAR sem_t*"
"sem_open","semaphore.h","","FAR sem_t*","FAR const char*","int","..."

Can't render this file because it has a wrong number of fields in line 2.