type
stringclasses
5 values
content
stringlengths
9
163k
functions
int loop_set_status64(struct loop_device *lo, const struct loop_info64 __user *arg) { struct loop_info64 info64; if (copy_from_user(&info64, arg, sizeof (struct loop_info64))) return -EFAULT; return loop_set_status(lo, &info64); }
functions
int loop_get_status_old(struct loop_device *lo, struct loop_info __user *arg) { struct loop_info info; struct loop_info64 info64; int err = 0; if (!arg) err = -EINVAL; if (!err) err = loop_get_status(lo, &info64); if (!err) err = loop_info64_to_old(&info64, &info); if (!err && copy_to_user(arg, &info, siz...
functions
int loop_get_status64(struct loop_device *lo, struct loop_info64 __user *arg) { struct loop_info64 info64; int err = 0; if (!arg) err = -EINVAL; if (!err) err = loop_get_status(lo, &info64); if (!err && copy_to_user(arg, &info64, sizeof(info64))) err = -EFAULT; return err; }
functions
int loop_set_capacity(struct loop_device *lo, struct block_device *bdev) { int err; sector_t sec; loff_t sz; err = -ENXIO; if (unlikely(lo->lo_state != Lo_bound)) goto out; err = figure_loop_size(lo); if (unlikely(err)) goto out; sec = get_capacity(lo->lo_disk); /* the width of sector_t may be narrow for ...
functions
int lo_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg) { struct loop_device *lo = bdev->bd_disk->private_data; int err; mutex_lock_nested(&lo->lo_ctl_mutex, 1); switch (cmd) { case LOOP_SET_FD: err = loop_set_fd(lo, mode, bdev, arg); break; case LOOP_CHANGE_FD: err = lo...
functions
int loop_info64_from_compat(const struct compat_loop_info __user *arg, struct loop_info64 *info64) { struct compat_loop_info info; if (copy_from_user(&info, arg, sizeof(info))) return -EFAULT; memset(info64, 0, sizeof(*info64)); info64->lo_number = info.lo_number; info64->lo_device = info.lo_device; info64...
functions
int loop_info64_to_compat(const struct loop_info64 *info64, struct compat_loop_info __user *arg) { struct compat_loop_info info; memset(&info, 0, sizeof(info)); info.lo_number = info64->lo_number; info.lo_device = info64->lo_device; info.lo_inode = info64->lo_inode; info.lo_rdevice = info64->lo_rdevice; ...
functions
int loop_set_status_compat(struct loop_device *lo, const struct compat_loop_info __user *arg) { struct loop_info64 info64; int ret; ret = loop_info64_from_compat(arg, &info64); if (ret < 0) return ret; return loop_set_status(lo, &info64); }
functions
int loop_get_status_compat(struct loop_device *lo, struct compat_loop_info __user *arg) { struct loop_info64 info64; int err = 0; if (!arg) err = -EINVAL; if (!err) err = loop_get_status(lo, &info64); if (!err) err = loop_info64_to_compat(&info64, arg); return err; }
functions
int lo_compat_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg) { struct loop_device *lo = bdev->bd_disk->private_data; int err; switch(cmd) { case LOOP_SET_STATUS: mutex_lock(&lo->lo_ctl_mutex); err = loop_set_status_compat( lo, (const struct compat_loop_info __user ...
functions
int lo_open(struct block_device *bdev, fmode_t mode) { struct loop_device *lo; int err = 0; mutex_lock(&loop_index_mutex); lo = bdev->bd_disk->private_data; if (!lo) { err = -ENXIO; goto out; }
functions
int lo_release(struct gendisk *disk, fmode_t mode) { struct loop_device *lo = disk->private_data; int err; mutex_lock(&lo->lo_ctl_mutex); if (--lo->lo_refcnt) goto out; if (lo->lo_flags & LO_FLAGS_AUTOCLEAR) { /* * In autoclear mode, stop the loop thread * and remove configuration after last close. ...
functions
int loop_register_transfer(struct loop_func_table *funcs) { unsigned int n = funcs->number; if (n >= MAX_LO_CRYPT || xfer_funcs[n]) return -EINVAL; xfer_funcs[n] = funcs; return 0; }
functions
int unregister_transfer_cb(int id, void *ptr, void *data) { struct loop_device *lo = ptr; struct loop_func_table *xfer = data; mutex_lock(&lo->lo_ctl_mutex); if (lo->lo_encryption == xfer) loop_release_xfer(lo); mutex_unlock(&lo->lo_ctl_mutex); return 0; }
functions
int loop_unregister_transfer(int number) { unsigned int n = number; struct loop_func_table *xfer; if (n == 0 || n >= MAX_LO_CRYPT || (xfer = xfer_funcs[n]) == NULL) return -EINVAL; xfer_funcs[n] = NULL; idr_for_each(&loop_index_idr, &unregister_transfer_cb, xfer); return 0; }
functions
int loop_add(struct loop_device **l, int i) { struct loop_device *lo; struct gendisk *disk; int err; lo = kzalloc(sizeof(*lo), GFP_KERNEL); if (!lo) { err = -ENOMEM; goto out; }
functions
else if (i == -1) { int m; /* get next free nr */ err = idr_get_new(&loop_index_idr, lo, &m); if (err >= 0) i = m; }
functions
void loop_remove(struct loop_device *lo) { del_gendisk(lo->lo_disk); blk_cleanup_queue(lo->lo_queue); put_disk(lo->lo_disk); kfree(lo); }
functions
int find_free_cb(int id, void *ptr, void *data) { struct loop_device *lo = ptr; struct loop_device **l = data; if (lo->lo_state == Lo_unbound) { *l = lo; return 1; }
functions
int loop_lookup(struct loop_device **l, int i) { struct loop_device *lo; int ret = -ENODEV; if (i < 0) { int err; err = idr_for_each(&loop_index_idr, &find_free_cb, &lo); if (err == 1) { *l = lo; ret = lo->lo_number; }
functions
long loop_control_ioctl(struct file *file, unsigned int cmd, unsigned long parm) { struct loop_device *lo; int ret = -ENOSYS; mutex_lock(&loop_index_mutex); switch (cmd) { case LOOP_CTL_ADD: ret = loop_lookup(&lo, parm); if (ret >= 0) { ret = -EEXIST; break; }
functions
__init loop_init(void) { int i, nr; unsigned long range; struct loop_device *lo; int err; err = misc_register(&loop_misc); if (err < 0) return err; part_shift = 0; if (max_part > 0) { part_shift = fls(max_part); /* * Adjust max_part according to part_shift as it is exported * to user space so tha...
functions
int loop_exit_cb(int id, void *ptr, void *data) { struct loop_device *lo = ptr; loop_remove(lo); return 0; }
functions
__exit loop_exit(void) { unsigned long range; range = max_loop ? max_loop << part_shift : 1UL << MINORBITS; idr_for_each(&loop_index_idr, &loop_exit_cb, NULL); idr_destroy(&loop_index_idr); blk_unregister_region(MKDEV(LOOP_MAJOR, 0), range); unregister_blkdev(LOOP_MAJOR, "loop"); misc_deregister(&loop_misc);...
functions
__init max_loop_setup(char *str) { max_loop = simple_strtol(str, NULL, 0); return 1; }
defines
#define configQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
defines
#define configQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
defines
#define mainQUEUE_SEND_FREQUENCY_MS ( 500 / portTICK_PERIOD_MS )
defines
#define mainQUEUE_LENGTH ( 1 )
functions
void main(void) { extern void HardwareSetup( void ); /* Renesas provided CPU configuration routine. The clocks are configured in here. */ HardwareSetup(); /* Turn all LEDs off. */ vParTestInitialise(); /* Create the queue. */ xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); ...
functions
void prvQueueSendTask( void *pvParameters ) { TickType_t xNextWakeTime; const unsigned long ulValueToSend = 100UL; /* Initialise xNextWakeTime - this only needs to be done once. */ xNextWakeTime = xTaskGetTickCount(); for( ;; ) { /* Place this task in the blocked state until it is time to run again. ...
functions
void prvQueueReceiveTask( void *pvParameters ) { unsigned long ulReceivedValue; for( ;; ) { /* Wait until something arives in the queue - this will block indefinitely provided INCLUDE_vTaskSuspend is set to 1 in FreeRTOSConfig.h. */ xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); /* ...
functions
void vApplicationSetupTimerInterrupt( void ) { /* Enable compare match timer 0. */ MSTP( CMT0 ) = 0; /* Interrupt on compare match. */ CMT0.CMCR.BIT.CMIE = 1; /* Set the compare match value. */ CMT0.CMCOR = ( unsigned short ) ( ( ( configPERIPHERAL_CLOCK_HZ / configTICK_RATE_HZ ) -1 ) / 8 ); /* ...
functions
void vApplicationMallocFailedHook( void ) { for( ;; ); }
functions
void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) { for( ;; ); }
functions
void vApplicationIdleHook( void ) { /* Just to prevent the variable getting optimised away. */ ( void ) ulHighFrequencyTickCount; }
includes
#include <linux/module.h>
includes
#include <linux/types.h>
includes
#include <linux/init.h>
includes
#include <linux/kernel.h>
includes
#include <linux/string.h>
includes
#include <linux/slab.h>
includes
#include <linux/ioport.h>
includes
#include <linux/device.h>
includes
#include <linux/platform_device.h>
includes
#include <linux/mtd/mtd.h>
includes
#include <linux/mtd/map.h>
includes
#include <linux/mtd/partitions.h>
includes
#include <asm/io.h>
includes
#include <asm/mach/flash.h>
includes
#include <linux/reboot.h>
defines
#define BYTE0(h) ((h) & 0xFF)
defines
#define BYTE1(h) (((h) >> 8) & 0xFF)
defines
#define BYTE0(h) (((h) >> 8) & 0xFF)
defines
#define BYTE1(h) ((h) & 0xFF)
structs
struct ixp4xx_flash_info { struct mtd_info *mtd; struct map_info map; struct mtd_partition *partitions; struct resource *res; };
functions
u16 flash_read16(void __iomem *addr) { return be16_to_cpu(__raw_readw((void __iomem *)((unsigned long)addr ^ 0x2))); }
functions
void flash_write16(u16 d, void __iomem *addr) { __raw_writew(cpu_to_be16(d), (void __iomem *)((unsigned long)addr ^ 0x2)); }
functions
u16 flash_read16(const void __iomem *addr) { return __raw_readw(addr); }
functions
void flash_write16(u16 d, void __iomem *addr) { __raw_writew(d, addr); }
functions
map_word ixp4xx_read16(struct map_info *map, unsigned long ofs) { map_word val; val.x[0] = flash_read16(map->virt + ofs); return val; }
functions
void ixp4xx_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len) { u8 *dest = (u8 *) to; void __iomem *src = map->virt + from; if (len <= 0) return; if (from & 1) { *dest++ = BYTE1(flash_read16(src)); src++; --len; }
functions
void ixp4xx_probe_write16(struct map_info *map, map_word d, unsigned long adr) { if (!(adr & 1)) flash_write16(d.x[0], map->virt + adr); }
functions
void ixp4xx_write16(struct map_info *map, map_word d, unsigned long adr) { flash_write16(d.x[0], map->virt + adr); }
functions
int ixp4xx_flash_remove(struct platform_device *dev) { struct flash_platform_data *plat = dev->dev.platform_data; struct ixp4xx_flash_info *info = platform_get_drvdata(dev); platform_set_drvdata(dev, NULL); if(!info) return 0; if (info->mtd) { del_mtd_partitions(info->mtd); map_destroy(info->mtd); }
functions
int ixp4xx_flash_probe(struct platform_device *dev) { struct flash_platform_data *plat = dev->dev.platform_data; struct ixp4xx_flash_info *info; int err = -1; if (!plat) return -ENODEV; if (plat->init) { err = plat->init(); if (err) return err; }
functions
__init ixp4xx_flash_init(void) { return platform_driver_register(&ixp4xx_flash_driver); }
functions
__exit ixp4xx_flash_exit(void) { platform_driver_unregister(&ixp4xx_flash_driver); }
defines
#define PREI_USB_PHY_A_REG_BASE 0xC1108400 //0x2100
defines
#define PREI_USB_PHY_B_REG_BASE 0xC1108420 //0X2108
defines
#define PREI_USB_PHY_REG_BASE PREI_USB_PHY_B_REG_BASE
defines
#define PREI_USB_PHY_REG_BASE PREI_USB_PHY_A_REG_BASE
defines
#define P_RESET1_REGISTER (volatile unsigned long *)0xc1104408
defines
#define USB_CLK_SEL_XTAL 0
defines
#define USB_CLK_SEL_XTAL_DIV_2 1
defines
#define USB_CLK_SEL_DDR_PLL 2
defines
#define USB_CLK_SEL_MPLL_OUT0 3
defines
#define USB_CLK_SEL_MPLL_OUT1 4
defines
#define USB_CLK_SEL_MPLL_OUT2 5
defines
#define USB_CLK_SEL_FCLK_DIV2 6
defines
#define USB_CLK_SEL_FCLK_DIV3 7
functions
void set_usb_phy_config(int cfg) { int time_dly = 500; usb_aml_regs_t * usb_aml_regs = (usb_aml_regs_t * )PREI_USB_PHY_REG_BASE; usb_config_data_t config; usb_ctrl_data_t control; *P_RESET1_REGISTER = (1<<2);//usb reset config.d32 = usb_aml_regs->config; if(cfg == EXT_CLOCK) {/...
functions
void set_usb_phy_config(int cfg) { int divider =0; int clk_sel = 0; int i; int time_dly = 500; // ------------------------------------------------------------ // CLK_SEL: These bits select the source for the 12Mhz: // 0 = Oscillator pad input (when a 24Mhz XTAL is used), // 1 = Oscil...
functions
int chip_watchdog(void) { watchdog_clear(); return 0; }
functions
void usb_memcpy(char * dst,char * src,int len) { while(len--) { *(unsigned char*)dst++ = *(unsigned char*)src++; }
functions
void usb_memcpy_32bits(int *dst,int *src,int len) { while(len--) { *dst = *src; dst++; src++; }
includes
#include <linux/kernel.h>
includes
#include <linux/mm.h>
includes
#include <linux/page-flags.h>
includes
#include <linux/kernel-page-flags.h>
includes
#include <linux/sched.h>
includes
#include <linux/ksm.h>
includes
#include <linux/rmap.h>
includes
#include <linux/pagemap.h>
includes
#include <linux/swap.h>
includes
#include <linux/backing-dev.h>
includes
#include <linux/migrate.h>
includes
#include <linux/page-isolation.h>
includes
#include <linux/suspend.h>
includes
#include <linux/slab.h>