type
stringclasses
5 values
content
stringlengths
9
163k
functions
void zram_stat64_add(struct zram *zram, u64 *v, u64 inc) { spin_lock(&zram->stat64_lock); *v = *v + inc; spin_unlock(&zram->stat64_lock); }
functions
void zram_stat64_sub(struct zram *zram, u64 *v, u64 dec) { spin_lock(&zram->stat64_lock); *v = *v - dec; spin_unlock(&zram->stat64_lock); }
functions
void zram_stat64_inc(struct zram *zram, u64 *v) { zram_stat64_add(zram, v, 1); }
functions
int zram_test_flag(struct zram *zram, u32 index, enum zram_pageflags flag) { return zram->table[index].flags & BIT(flag); }
functions
void zram_set_flag(struct zram *zram, u32 index, enum zram_pageflags flag) { zram->table[index].flags |= BIT(flag); }
functions
void zram_clear_flag(struct zram *zram, u32 index, enum zram_pageflags flag) { zram->table[index].flags &= ~BIT(flag); }
functions
int page_zero_filled(void *ptr) { unsigned int pos; unsigned long *page; page = (unsigned long *)ptr; for (pos = 0; pos != PAGE_SIZE / sizeof(*page); pos++) { if (page[pos]) return 0; }
functions
void zram_set_disksize(struct zram *zram, size_t totalram_bytes) { if (!zram->disksize) { pr_info( "disk size not provided. You can use disksize_kb module " "param to specify size.\nUsing default: (%u%% of RAM).\n", default_disksize_perc_ram ); zram->disksize = default_disksize_perc_ram * (totalram_by...
functions
void setup_swap_header(struct zram *zram, union swap_header *s) { s->info.version = 1; s->info.last_page = (zram->disksize >> PAGE_SHIFT) - 1; s->info.nr_badpages = 0; memcpy(s->magic.magic, "SWAPSPACE2", 10); }
functions
void zram_free_page(struct zram *zram, size_t index) { u32 clen; void *obj; struct page *page = zram->table[index].page; u32 offset = zram->table[index].offset; if (unlikely(!page)) { /* * No memory is allocated for zero filled pages. * Simply clear zero page flag. */ if (zram_test_flag(zram, index,...
functions
void handle_zero_page(struct bio_vec *bvec) { struct page *page = bvec->bv_page; void *user_mem; user_mem = kmap_atomic(page, KM_USER0); memset(user_mem + bvec->bv_offset, 0, bvec->bv_len); kunmap_atomic(user_mem, KM_USER0); flush_dcache_page(page); }
functions
void handle_uncompressed_page(struct zram *zram, struct bio_vec *bvec, u32 index, int offset) { struct page *page = bvec->bv_page; unsigned char *user_mem, *cmem; user_mem = kmap_atomic(page, KM_USER0); cmem = kmap_atomic(zram->table[index].page, KM_USER1); memcpy(user_mem + bvec->bv_offset, cmem + offs...
functions
int is_partial_io(struct bio_vec *bvec) { return bvec->bv_len != PAGE_SIZE; }
functions
int zram_bvec_read(struct zram *zram, struct bio_vec *bvec, u32 index, int offset, struct bio *bio) { int ret; size_t clen; struct page *page; struct zobj_header *zheader; unsigned char *user_mem, *cmem, *uncmem = NULL; page = bvec->bv_page; if (zram_test_flag(zram, index, ZRAM_ZERO)) { handle_zero_page...
functions
int zram_read_before_write(struct zram *zram, char *mem, u32 index) { int ret; size_t clen = PAGE_SIZE; struct zobj_header *zheader; unsigned char *cmem; if (zram_test_flag(zram, index, ZRAM_ZERO) || !zram->table[index].page) { memset(mem, 0, PAGE_SIZE); return 0; }
functions
int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, int offset) { int ret; u32 store_offset; size_t clen; struct zobj_header *zheader; struct page *page, *page_store; unsigned char *user_mem, *cmem, *src, *uncmem = NULL; page = bvec->bv_page; src = zram->compress_buffer; if (is_part...
functions
int zram_bvec_rw(struct zram *zram, struct bio_vec *bvec, u32 index, int offset, struct bio *bio, int rw) { int ret; if (rw == READ) { down_read(&zram->lock); ret = zram_bvec_read(zram, bvec, index, offset, bio); up_read(&zram->lock); }
functions
void update_position(u32 *index, int *offset, struct bio_vec *bvec) { if (*offset + bvec->bv_len >= PAGE_SIZE) (*index)++; *offset = (*offset + bvec->bv_len) % PAGE_SIZE; }
functions
void __zram_make_request(struct zram *zram, struct bio *bio, int rw) { int i, offset; u32 index; struct bio_vec *bvec; switch (rw) { case READ: zram_stat64_inc(zram, &zram->stats.num_reads); break; case WRITE: zram_stat64_inc(zram, &zram->stats.num_writes); break; }
functions
int valid_io_request(struct zram *zram, struct bio *bio) { if (unlikely( (bio->bi_sector >= (zram->disksize >> SECTOR_SHIFT)) || (bio->bi_sector & (ZRAM_SECTOR_PER_LOGICAL_BLOCK - 1)) || (bio->bi_size & (ZRAM_LOGICAL_BLOCK_SIZE - 1)))) { return 0; }
functions
int zram_make_request(struct request_queue *queue, struct bio *bio) { struct zram *zram = queue->queuedata; if (unlikely(!zram->init_done) && zram_init_device(zram)) goto error; down_read(&zram->init_lock); if (unlikely(!zram->init_done)) goto error_unlock; if (!valid_io_request(zram, bio)) { zram_stat64_...
functions
void __zram_reset_device(struct zram *zram) { size_t index; zram->init_done = 0; /* Free various per-device buffers */ kfree(zram->compress_workmem); free_pages((unsigned long)zram->compress_buffer, 1); zram->compress_workmem = NULL; zram->compress_buffer = NULL; /* Free all pages that are still in this zra...
functions
void zram_reset_device(struct zram *zram) { down_write(&zram->init_lock); __zram_reset_device(zram); up_write(&zram->init_lock); }
functions
int zram_init_device(struct zram *zram) { int ret; size_t num_pages; #ifdef CONFIG_ZRAM_FOR_ANDROID struct page *page; union swap_header *swap_header; #endif /* CONFIG_ZRAM_FOR_ANDROID */ down_write(&zram->init_lock); if (zram->init_done) { up_write(&zram->init_lock); return 0; }
functions
void zram_slot_free_notify(struct block_device *bdev, unsigned long index) { struct zram *zram; zram = bdev->bd_disk->private_data; zram_free_page(zram, index); zram_stat64_inc(zram, &zram->stats.notify_free); }
functions
int create_device(struct zram *zram, int device_id) { int ret = 0; init_rwsem(&zram->lock); init_rwsem(&zram->init_lock); spin_lock_init(&zram->stat64_lock); zram->queue = blk_alloc_queue(GFP_KERNEL); if (!zram->queue) { pr_err("Error allocating disk queue for device %d\n", device_id); ret = -ENOMEM; g...
functions
void destroy_device(struct zram *zram) { sysfs_remove_group(&disk_to_dev(zram->disk)->kobj, &zram_disk_attr_group); if (zram->disk) { del_gendisk(zram->disk); put_disk(zram->disk); }
functions
__init zram_init(void) { int ret, dev_id; if (zram_num_devices > max_num_devices) { pr_warning("Invalid value for num_devices: %u\n", zram_num_devices); ret = -EINVAL; goto out; }
functions
__exit zram_exit(void) { int i; struct zram *zram; for (i = 0; i < zram_num_devices; i++) { zram = &zram_devices[i]; get_disk(zram->disk); destroy_device(zram); if (zram->init_done) zram_reset_device(zram); put_disk(zram->disk); }
includes
#include <strings.h>
functions
int jim_adapter_name(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { Jim_GetOptInfo goi; Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1); /* return the name of the interface */ /* TCL code might need to know the exact type... */ /* FUTURE: we allow this as a means to "set" the interface. */ if (goi.argc !...
functions
int default_khz(int khz, int *jtag_speed) { LOG_ERROR("Translation from khz to jtag_speed not implemented"); return ERROR_FAIL; }
functions
int default_speed_div(int speed, int *khz) { LOG_ERROR("Translation from jtag_speed to khz not implemented"); return ERROR_FAIL; }
functions
int default_power_dropout(int *dropout) { *dropout = 0; /* by default we can't detect power dropout */ return ERROR_OK; }
functions
int default_srst_asserted(int *srst_asserted) { *srst_asserted = 0; /* by default we can't detect srst asserted */ return ERROR_OK; }
functions
int interface_register_commands(struct command_context *ctx) { return register_commands(ctx, NULL, interface_command_handlers); }
includes
#include <linux/init.h>
includes
#include <linux/err.h>
includes
#include <linux/module.h>
includes
#include <linux/time.h>
includes
#include <linux/wait.h>
includes
#include <linux/platform_device.h>
includes
#include <linux/slab.h>
includes
#include <linux/dma-mapping.h>
includes
#include <linux/of.h>
includes
#include <linux/freezer.h>
includes
#include <sound/core.h>
includes
#include <sound/soc.h>
includes
#include <sound/soc-dapm.h>
includes
#include <sound/pcm.h>
includes
#include <sound/timer.h>
includes
#include <sound/initval.h>
includes
#include <sound/control.h>
includes
#include <sound/q6lsm.h>
includes
#include <sound/lsm_params.h>
defines
#define msm_lsm_ioctl_compat NULL
structs
struct lsm_priv { struct snd_pcm_substream *substream; struct lsm_client *lsm_client; struct snd_lsm_event_status *event_status; spinlock_t event_lock; wait_queue_head_t event_wait; unsigned long event_avail; atomic_t event_wait_stop; };
structs
struct snd_lsm_sound_model32 { compat_uptr_t data; u32 data_size; enum lsm_detection_mode detection_mode; u16 min_keyw_confidence; u16 min_user_confidence; bool detect_failure; };
structs
struct snd_lsm_event_status32 { u16 status; u16 payload_size; u8 payload[0]; };
structs
struct snd_lsm_sound_model_v2_32 { compat_uptr_t data; compat_uptr_t confidence_level; u32 data_size; enum lsm_detection_mode detection_mode; u8 num_confidence_levels; bool detect_failure; };
functions
void lsm_event_handler(uint32_t opcode, uint32_t token, void *payload, void *priv) { unsigned long flags; struct lsm_priv *prtd = priv; struct snd_pcm_substream *substream = prtd->substream; uint16_t status = 0; uint16_t payload_size = 0; uint16_t index = 0; pr_debug("%s: Opcode 0x%x\n", __func__, opco...
functions
int msm_lsm_ioctl_shared(struct snd_pcm_substream *substream, unsigned int cmd, void *arg) { unsigned long flags; int ret; struct snd_lsm_sound_model snd_model; struct snd_lsm_sound_model_v2 snd_model_v2; struct snd_lsm_session_data session_data; int rc = 0; int xchg = 0; u32 size = 0; struct snd_pcm_runti...
functions
else if (xchg) { pr_debug("%s: Wait aborted\n", __func__); rc = 0; }
functions
int msm_lsm_ioctl_compat(struct snd_pcm_substream *substream, unsigned int cmd, void __user *arg) { struct snd_pcm_runtime *runtime; int err = 0; u32 size = 0; if (PCM_RUNTIME_CHECK(substream)) return -ENXIO; runtime = substream->runtime; switch (cmd) { case SNDRV_LSM_REG_SND_MODEL32: { struct snd_lsm_...
functions
int msm_lsm_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg) { int err = 0; u32 size = 0; struct snd_lsm_session_data session_data; if (!substream) { pr_err("%s: Invalid params\n", __func__); return -EINVAL; }
functions
int msm_lsm_open(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; struct lsm_priv *prtd; pr_debug("%s\n", __func__); prtd = kzalloc(sizeof(struct lsm_priv), GFP_KERNEL); if (!prtd) { pr_err("%s: Failed to allocate memory for lsm_priv\n", __func__); return -...
functions
int msm_lsm_prepare(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; struct lsm_priv *prtd = runtime->private_data; if (!prtd->lsm_client) { pr_err("%s: LSM client data ptr is NULL\n", __func__); return -EINVAL; }
functions
int msm_lsm_close(struct snd_pcm_substream *substream) { unsigned long flags; struct snd_pcm_runtime *runtime = substream->runtime; struct lsm_priv *prtd = runtime->private_data; int ret = 0; pr_debug("%s\n", __func__); if (prtd->lsm_client->started) { ret = q6lsm_stop(prtd->lsm_client, true); if (ret) pr...
functions
int msm_asoc_lsm_new(struct snd_soc_pcm_runtime *rtd) { struct snd_card *card = rtd->card->snd_card; if (!card->dev->coherent_dma_mask) card->dev->coherent_dma_mask = DMA_BIT_MASK(32); return 0; }
functions
int msm_asoc_lsm_probe(struct snd_soc_platform *platform) { pr_debug("enter %s\n", __func__); return 0; }
functions
int msm_lsm_probe(struct platform_device *pdev) { if (pdev->dev.of_node) dev_set_name(&pdev->dev, "%s", "msm-lsm-client"); return snd_soc_register_platform(&pdev->dev, &msm_soc_platform); }
functions
int msm_lsm_remove(struct platform_device *pdev) { snd_soc_unregister_platform(&pdev->dev); return 0; }
functions
__init msm_soc_platform_init(void) { return platform_driver_register(&msm_lsm_driver); }
functions
__exit msm_soc_platform_exit(void) { platform_driver_unregister(&msm_lsm_driver); }
includes
#include <stdlib.h>
includes
#include <Xm/Xm.h>
includes
#include <Xm/PushBP.h>
includes
#include <Xm/MessageB.h>
functions
void Push(Widget w, XtPointer client, XtPointer call) { Widget dialog = (Widget)client; XtManageChild(dialog); { static XtWidgetGeometry Expected[] = { CWWidth | CWHeight , 6, 52, 214, 111, 0,0,0, /* Box */ CWWidth | CWHeight | CWX | CWY, 11, 11, 52, 26, 0,0,0, /* Symbol */ CWWid...
main
int main(int argc, char **argv) { XtAppContext app; XmString xms; Arg args[3]; int nargs; toplevel = XtVaAppInitialize(&app, "listTest", NULL, 0, &argc, argv, NULL, NULL); push = XmCreatePushButton(toplevel, "push", NULL, 0); XtVaSetValues(push, XtVaTypedArg, XmNlabelString, XtRString, "Push me ...
includes
#include <linux/module.h>
includes
#include <linux/signal.h>
includes
#include <linux/mm.h>
includes
#include <linux/hardirq.h>
includes
#include <linux/init.h>
includes
#include <linux/kprobes.h>
includes
#include <linux/uaccess.h>
includes
#include <linux/page-flags.h>
includes
#include <linux/sched.h>
includes
#include <linux/highmem.h>
includes
#include <linux/perf_event.h>
includes
#include <asm/exception.h>
includes
#include <asm/pgtable.h>
includes
#include <asm/system_misc.h>
includes
#include <asm/system_info.h>
includes
#include <asm/tlbflush.h>
defines
#define VM_FAULT_BADMAP 0x010000
defines
#define VM_FAULT_BADACCESS 0x020000
structs
struct fsr_info { int (*fn)(unsigned long addr, unsigned int fsr, struct pt_regs *regs); int sig; int code; const char *name; };
functions
int notify_page_fault(struct pt_regs *regs, unsigned int fsr) { int ret = 0; if (!user_mode(regs)) { /* kprobe_running() needs smp_processor_id() */ preempt_disable(); if (kprobe_running() && kprobe_fault_handler(regs, fsr)) ret = 1; preempt_enable(); }