type
stringclasses
5 values
content
stringlengths
9
163k
defines
#define NLMDBG_FACILITY NLMDBG_SVCLOCK
defines
#define nlm_deadlock nlm4_deadlock
defines
#define nlm_deadlock nlm_lck_denied
functions
void nlmsvc_insert_block_locked(struct nlm_block *block, unsigned long when) { struct nlm_block *b; struct list_head *pos; dprintk("lockd: nlmsvc_insert_block(%p, %ld)\n", block, when); if (list_empty(&block->b_list)) { kref_get(&block->b_count); }
functions
void nlmsvc_insert_block(struct nlm_block *block, unsigned long when) { spin_lock(&nlm_blocked_lock); nlmsvc_insert_block_locked(block, when); spin_unlock(&nlm_blocked_lock); }
functions
void nlmsvc_remove_block(struct nlm_block *block) { if (!list_empty(&block->b_list)) { spin_lock(&nlm_blocked_lock); list_del_init(&block->b_list); spin_unlock(&nlm_blocked_lock); nlmsvc_release_block(block); }
functions
int nlm_cookie_match(struct nlm_cookie *a, struct nlm_cookie *b) { if (a->len != b->len) return 0; if (memcmp(a->data, b->data, a->len)) return 0; return 1; }
functions
int nlmsvc_unlink_block(struct nlm_block *block) { int status; dprintk("lockd: unlinking block %p...\n", block); /* Remove block from list */ status = posix_unblock_lock(&block->b_call->a_args.lock.fl); nlmsvc_remove_block(block); return status; }
functions
void nlmsvc_free_block(struct kref *kref) { struct nlm_block *block = container_of(kref, struct nlm_block, b_count); struct nlm_file *file = block->b_file; dprintk("lockd: freeing block %p...\n", block); /* Remove block from file's list of blocks */ list_del_init(&block->b_flist); mutex_unlock(&file->f_mutex);...
functions
void nlmsvc_release_block(struct nlm_block *block) { if (block != NULL) kref_put_mutex(&block->b_count, nlmsvc_free_block, &block->b_file->f_mutex); }
functions
void nlmsvc_traverse_blocks(struct nlm_host *host, struct nlm_file *file, nlm_host_match_fn_t match) { struct nlm_block *block, *next; restart: mutex_lock(&file->f_mutex); list_for_each_entry_safe(block, next, &file->f_blocks, b_flist) { if (!match(block->b_host, host)) continue; /* Do not destroy bloc...
functions
int nlmsvc_setgrantargs(struct nlm_rqst *call, struct nlm_lock *lock) { locks_copy_lock(&call->a_args.lock.fl, &lock->fl); memcpy(&call->a_args.lock.fh, &lock->fh, sizeof(call->a_args.lock.fh)); call->a_args.lock.caller = utsname()->nodename; call->a_args.lock.oh.len = lock->oh.len; /* set default data area */ c...
functions
void nlmsvc_freegrantargs(struct nlm_rqst *call) { if (call->a_args.lock.oh.data != call->a_owner) kfree(call->a_args.lock.oh.data); locks_release_private(&call->a_args.lock.fl); }
functions
__be32 nlmsvc_defer_lock_rqst(struct svc_rqst *rqstp, struct nlm_block *block) { __be32 status = nlm_lck_denied_nolocks; block->b_flags |= B_QUEUED; nlmsvc_insert_block(block, NLM_TIMEOUT); block->b_cache_req = &rqstp->rq_chandle; if (rqstp->rq_chandle.defer) { block->b_deferred_req = rqstp->rq_chandle.def...
functions
__be32 nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file, struct nlm_host *host, struct nlm_lock *lock, int wait, struct nlm_cookie *cookie, int reclaim) { struct nlm_block *block = NULL; int error; __be32 ret; dprintk("lockd: nlmsvc_lock(%s/%ld, ty=%d, pi=%d, %Ld-%Ld, bl=%d)\n", file_ino...
functions
__be32 nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file, struct nlm_host *host, struct nlm_lock *lock, struct nlm_lock *conflock, struct nlm_cookie *cookie) { struct nlm_block *block = NULL; int error; __be32 ret; dprintk("lockd: nlmsvc_testlock(%s/%ld, ty=%d, %Ld-%Ld)\n", file_inode(file...
functions
__be32 nlmsvc_unlock(struct net *net, struct nlm_file *file, struct nlm_lock *lock) { int error; dprintk("lockd: nlmsvc_unlock(%s/%ld, pi=%d, %Ld-%Ld)\n", file_inode(file->f_file)->i_sb->s_id, file_inode(file->f_file)->i_ino, lock->fl.fl_pid, (long long)lock->fl.fl_start, (long long)lock->fl.fl_e...
functions
__be32 nlmsvc_cancel_blocked(struct net *net, struct nlm_file *file, struct nlm_lock *lock) { struct nlm_block *block; int status = 0; dprintk("lockd: nlmsvc_cancel(%s/%ld, pi=%d, %Ld-%Ld)\n", file_inode(file->f_file)->i_sb->s_id, file_inode(file->f_file)->i_ino, lock->fl.fl_pid, (long long)lock->fl...
functions
void nlmsvc_update_deferred_block(struct nlm_block *block, struct file_lock *conf, int result) { block->b_flags |= B_GOT_CALLBACK; if (result == 0) block->b_granted = 1; else block->b_flags |= B_TIMED_OUT; if (conf) { if (block->b_fl) __locks_copy_lock(block->b_fl, conf); }
functions
int nlmsvc_grant_deferred(struct file_lock *fl, struct file_lock *conf, int result) { struct nlm_block *block; int rc = -ENOENT; spin_lock(&nlm_blocked_lock); list_for_each_entry(block, &nlm_blocked, b_list) { if (nlm_compare_locks(&block->b_call->a_args.lock.fl, fl)) { dprintk("lockd: nlmsvc_notify_bloc...
functions
void nlmsvc_notify_blocked(struct file_lock *fl) { struct nlm_block *block; dprintk("lockd: VFS unblock notification for block %p\n", fl); spin_lock(&nlm_blocked_lock); list_for_each_entry(block, &nlm_blocked, b_list) { if (nlm_compare_locks(&block->b_call->a_args.lock.fl, fl)) { nlmsvc_insert_block_locked(bl...
functions
int nlmsvc_same_owner(struct file_lock *fl1, struct file_lock *fl2) { return fl1->fl_owner == fl2->fl_owner && fl1->fl_pid == fl2->fl_pid; }
functions
long nlmsvc_owner_key(struct file_lock *fl) { return (unsigned long)fl->fl_owner ^ (unsigned long)fl->fl_pid; }
functions
void nlmsvc_grant_blocked(struct nlm_block *block) { struct nlm_file *file = block->b_file; struct nlm_lock *lock = &block->b_call->a_args.lock; int error; dprintk("lockd: grant blocked lock %p\n", block); kref_get(&block->b_count); /* Unlink block request from list */ nlmsvc_unlink_block(block); /* If ...
functions
void nlmsvc_grant_callback(struct rpc_task *task, void *data) { struct nlm_rqst *call = data; struct nlm_block *block = call->a_block; unsigned long timeout; dprintk("lockd: GRANT_MSG RPC callback\n"); spin_lock(&nlm_blocked_lock); /* if the block is not on a list at this point then it has * been invalidate...
functions
void nlmsvc_grant_release(void *data) { struct nlm_rqst *call = data; nlmsvc_release_block(call->a_block); }
functions
void nlmsvc_grant_reply(struct nlm_cookie *cookie, __be32 status) { struct nlm_block *block; dprintk("grant_reply: looking for cookie %x, s=%d \n", *(unsigned int *)(cookie->data), status); if (!(block = nlmsvc_find_block(cookie))) return; if (block) { if (status == nlm_lck_denied_grace_period) { /* Try ...
functions
void retry_deferred_block(struct nlm_block *block) { if (!(block->b_flags & B_GOT_CALLBACK)) block->b_flags |= B_TIMED_OUT; nlmsvc_insert_block(block, NLM_TIMEOUT); dprintk("revisit block %p flags %d\n", block, block->b_flags); if (block->b_deferred_req) { block->b_deferred_req->revisit(block->b_deferred_req, 0...
functions
long nlmsvc_retry_blocked(void) { unsigned long timeout = MAX_SCHEDULE_TIMEOUT; struct nlm_block *block; spin_lock(&nlm_blocked_lock); while (!list_empty(&nlm_blocked) && !kthread_should_stop()) { block = list_entry(nlm_blocked.next, struct nlm_block, b_list); if (block->b_when == NLM_NEVER) break; if (t...
includes
#include <drm/drmP.h>
includes
#include <drm/drm_crtc.h>
includes
#include <drm/drm_fb_helper.h>
includes
#include <drm/drm_crtc_helper.h>
includes
#include <drm/drm_gem_cma_helper.h>
includes
#include <drm/drm_fb_cma_helper.h>
includes
#include <linux/module.h>
structs
struct drm_fb_cma { struct drm_framebuffer fb; struct drm_gem_cma_object *obj[4]; };
structs
struct drm_fbdev_cma { struct drm_fb_helper fb_helper; struct drm_fb_cma *fb; };
functions
void drm_fb_cma_destroy(struct drm_framebuffer *fb) { struct drm_fb_cma *fb_cma = to_fb_cma(fb); int i; for (i = 0; i < 4; i++) { if (fb_cma->obj[i]) drm_gem_object_unreference_unlocked(&fb_cma->obj[i]->base); }
functions
int drm_fb_cma_create_handle(struct drm_framebuffer *fb, struct drm_file *file_priv, unsigned int *handle) { struct drm_fb_cma *fb_cma = to_fb_cma(fb); return drm_gem_handle_create(file_priv, &fb_cma->obj[0]->base, handle); }
functions
void drm_fb_cma_describe(struct drm_framebuffer *fb, struct seq_file *m) { struct drm_fb_cma *fb_cma = to_fb_cma(fb); int i, n = drm_format_num_planes(fb->pixel_format); seq_printf(m, "fb: %dx%d@%4.4s\n", fb->width, fb->height, (char *)&fb->pixel_format); for (i = 0; i < n; i++) { seq_printf(m, " %d: offse...
functions
int drm_fb_cma_debugfs_show(struct seq_file *m, void *arg) { struct drm_info_node *node = (struct drm_info_node *) m->private; struct drm_device *dev = node->minor->dev; struct drm_framebuffer *fb; int ret; ret = mutex_lock_interruptible(&dev->mode_config.mutex); if (ret) return ret; ret = mutex_lock_interru...
functions
int drm_fbdev_cma_create(struct drm_fb_helper *helper, struct drm_fb_helper_surface_size *sizes) { struct drm_fbdev_cma *fbdev_cma = to_fbdev_cma(helper); struct drm_mode_fb_cmd2 mode_cmd = { 0 }
functions
void drm_fbdev_cma_fini(struct drm_fbdev_cma *fbdev_cma) { if (fbdev_cma->fb_helper.fbdev) { struct fb_info *info; int ret; info = fbdev_cma->fb_helper.fbdev; ret = unregister_framebuffer(info); if (ret < 0) DRM_DEBUG_KMS("failed unregister_framebuffer()\n"); if (info->cmap.len) fb_dealloc_cmap(&in...
functions
void drm_fbdev_cma_restore_mode(struct drm_fbdev_cma *fbdev_cma) { if (fbdev_cma) { struct drm_device *dev = fbdev_cma->fb_helper.dev; drm_modeset_lock_all(dev); drm_fb_helper_restore_fbdev_mode(&fbdev_cma->fb_helper); drm_modeset_unlock_all(dev); }
functions
void drm_fbdev_cma_hotplug_event(struct drm_fbdev_cma *fbdev_cma) { if (fbdev_cma) drm_fb_helper_hotplug_event(&fbdev_cma->fb_helper); }
includes
#include <stdio.h>
includes
#include <stdlib.h>
includes
#include <unistd.h>
includes
#include <fcntl.h>
includes
#include <sys/stat.h>
includes
#include <sys/types.h>
includes
#include <string.h>
includes
#include <stdint.h>
includes
#include <errno.h>
includes
#include <signal.h>
functions
void write_int(char *path, int i) { char buf[1024]; int fd = open(path, O_RDWR); if (fd < 0) { perror("open"); exit(1); }
functions
void set_led(int on) { write_int("/sys/class/leds/hp::hddprotect/brightness", on); }
functions
void protect(int seconds) { write_int("/sys/block/sda/device/unload_heads", seconds*1000); }
functions
int on_ac(void) { // /sys/class/power_supply/AC0/online }
functions
int lid_open(void) { // /proc/acpi/button/lid/LID/state }
functions
void ignore_me(void) { protect(0); set_led(0); }
main
int main(int argc, char* argv[]) { int fd, ret; fd = open("/dev/freefall", O_RDONLY); if (fd < 0) { perror("open"); return EXIT_FAILURE; }
includes
#include <linux/module.h>
includes
#include <linux/pci.h>
includes
#include <linux/moduleparam.h>
includes
#include <linux/interrupt.h>
functions
void wil_set_capabilities(struct wil6210_priv *wil) { u32 rev_id = ioread32(wil->csr + HOSTADDR(RGF_USER_JTAG_DEV_ID)); bitmap_zero(wil->hw_capabilities, hw_capability_last); switch (rev_id) { case JTAG_DEV_ID_SPARROW_B0: wil->hw_name = "Sparrow B0"; wil->hw_version = HW_VER_SPARROW_B0; break; default: w...
functions
void wil_disable_irq(struct wil6210_priv *wil) { int irq = wil->pdev->irq; disable_irq(irq); if (wil->n_msi == 3) { disable_irq(irq + 1); disable_irq(irq + 2); }
functions
void wil_enable_irq(struct wil6210_priv *wil) { int irq = wil->pdev->irq; enable_irq(irq); if (wil->n_msi == 3) { enable_irq(irq + 1); enable_irq(irq + 2); }
functions
int wil_if_pcie_enable(struct wil6210_priv *wil) { struct pci_dev *pdev = wil->pdev; int rc; /* on platforms with buggy ACPI, pdev->msi_enabled may be set to * allow pci_enable_device to work. This indicates INTx was not routed * and only MSI should be used */ int msi_only = pdev->msi_enabled; wil_dbg_misc(...
functions
int wil_if_pcie_disable(struct wil6210_priv *wil) { struct pci_dev *pdev = wil->pdev; wil_dbg_misc(wil, "%s()\n", __func__); pci_clear_master(pdev); /* disable and release IRQ */ wil6210_fini_irq(wil, pdev->irq); /* safe to call if no MSI */ pci_disable_msi(pdev); /* TODO: disable HW */ return 0; }
functions
int wil_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) { struct wil6210_priv *wil; struct device *dev = &pdev->dev; int rc; /* check HW */ dev_info(&pdev->dev, WIL_NAME " device found [%04x:%04x] (rev %x)\n", (int)pdev->vendor, (int)pdev->device, (int)pdev->revision); if (pci_resource_le...
functions
void wil_pcie_remove(struct pci_dev *pdev) { struct wil6210_priv *wil = pci_get_drvdata(pdev); void __iomem *csr = wil->csr; wil_dbg_misc(wil, "%s()\n", __func__); wil6210_debugfs_remove(wil); wil_if_remove(wil); wil_if_pcie_disable(wil); pci_iounmap(pdev, csr); pci_release_region(pdev, 0); pci_disable_devic...
functions
__init wil6210_driver_init(void) { int rc; rc = wil_platform_modinit(); if (rc) return rc; rc = pci_register_driver(&wil6210_driver); if (rc) wil_platform_modexit(); return rc; }
functions
__exit wil6210_driver_exit(void) { pci_unregister_driver(&wil6210_driver); wil_platform_modexit(); }
includes
#include <linux/slab.h>
includes
#include <linux/scatterlist.h>
includes
#include <linux/dma-mapping.h>
functions
void push_buffer_init(struct push_buffer *pb) { *(u32 *)(pb->mapped + pb->size_bytes) = host1x_opcode_restart(0); }
functions
void cdma_timeout_cpu_incr(struct host1x_cdma *cdma, u32 getptr, u32 syncpt_incrs, u32 syncval, u32 nr_slots) { struct host1x *host1x = cdma_to_host1x(cdma); struct push_buffer *pb = &cdma->push_buffer; unsigned int i; for (i = 0; i < syncpt_incrs; i++) host1x_syncpt_incr(cdma->timeout.syncpt); /* after CP...
functions
void cdma_start(struct host1x_cdma *cdma) { struct host1x_channel *ch = cdma_to_channel(cdma); if (cdma->running) return; cdma->last_pos = cdma->push_buffer.pos; host1x_ch_writel(ch, HOST1X_CHANNEL_DMACTRL_DMASTOP, HOST1X_CHANNEL_DMACTRL); /* set base, put and end pointer */ host1x_ch_writel(ch, cdma->p...
functions
void cdma_timeout_restart(struct host1x_cdma *cdma, u32 getptr) { struct host1x *host1x = cdma_to_host1x(cdma); struct host1x_channel *ch = cdma_to_channel(cdma); if (cdma->running) return; cdma->last_pos = cdma->push_buffer.pos; host1x_ch_writel(ch, HOST1X_CHANNEL_DMACTRL_DMASTOP, HOST1X_CHANNEL_DMACTRL)...
functions
void cdma_flush(struct host1x_cdma *cdma) { struct host1x_channel *ch = cdma_to_channel(cdma); if (cdma->push_buffer.pos != cdma->last_pos) { host1x_ch_writel(ch, cdma->push_buffer.pos, HOST1X_CHANNEL_DMAPUT); cdma->last_pos = cdma->push_buffer.pos; }
functions
void cdma_stop(struct host1x_cdma *cdma) { struct host1x_channel *ch = cdma_to_channel(cdma); mutex_lock(&cdma->lock); if (cdma->running) { host1x_cdma_wait_locked(cdma, CDMA_EVENT_SYNC_QUEUE_EMPTY); host1x_ch_writel(ch, HOST1X_CHANNEL_DMACTRL_DMASTOP, HOST1X_CHANNEL_DMACTRL); cdma->running = false; }
functions
void cdma_freeze(struct host1x_cdma *cdma) { struct host1x *host = cdma_to_host1x(cdma); struct host1x_channel *ch = cdma_to_channel(cdma); u32 cmdproc_stop; if (cdma->torndown && !cdma->running) { dev_warn(host->dev, "Already torn down\n"); return; }
functions
void cdma_resume(struct host1x_cdma *cdma, u32 getptr) { struct host1x *host1x = cdma_to_host1x(cdma); struct host1x_channel *ch = cdma_to_channel(cdma); u32 cmdproc_stop; dev_dbg(host1x->dev, "resuming channel (id %u, DMAGET restart = 0x%x)\n", ch->id, getptr); cmdproc_stop = host1x_sync_readl(host1x, HOST1...
functions
void cdma_timeout_handler(struct work_struct *work) { u32 prev_cmdproc, cmdproc_stop, syncpt_val; struct host1x_cdma *cdma; struct host1x *host1x; struct host1x_channel *ch; cdma = container_of(to_delayed_work(work), struct host1x_cdma, timeout.wq); host1x = cdma_to_host1x(cdma); ch = cdma_to_channel(cdm...
functions
int cdma_timeout_init(struct host1x_cdma *cdma, unsigned int syncpt) { INIT_DELAYED_WORK(&cdma->timeout.wq, cdma_timeout_handler); cdma->timeout.initialized = true; return 0; }
functions
void cdma_timeout_destroy(struct host1x_cdma *cdma) { if (cdma->timeout.initialized) cancel_delayed_work(&cdma->timeout.wq); cdma->timeout.initialized = false; }
includes
#include <linux/types.h>
includes
#include <linux/string.h>
includes
#include <linux/kernel.h>
includes
#include <linux/interrupt.h>
includes
#include <linux/ide.h>
includes
#include <linux/bitops.h>
functions
u8 ide_get_best_pio_mode(ide_drive_t *drive, u8 mode_wanted, u8 max_mode) { u16 *id = drive->id; int pio_mode = -1, overridden = 0; if (mode_wanted != 255) return min_t(u8, mode_wanted, max_mode); if ((drive->hwif->host_flags & IDE_HFLAG_PIO_NO_BLACKLIST) == 0) pio_mode = ide_scan_pio_blacklist((char *)&id[AT...
functions
int ide_pio_need_iordy(ide_drive_t *drive, const u8 pio) { /* * IORDY may lead to controller lock up on certain controllers * if the port is not occupied. */ if (pio == 0 && (drive->hwif->port_flags & IDE_PFLAG_PROBING)) return 0; return ata_id_pio_need_iordy(drive->id, pio); }
functions
int ide_set_pio_mode(ide_drive_t *drive, const u8 mode) { ide_hwif_t *hwif = drive->hwif; const struct ide_port_ops *port_ops = hwif->port_ops; if (hwif->host_flags & IDE_HFLAG_NO_SET_MODE) return 0; if (port_ops == NULL || port_ops->set_pio_mode == NULL) return -1; /* * TODO: temporary hack for some lega...
functions
int ide_set_dma_mode(ide_drive_t *drive, const u8 mode) { ide_hwif_t *hwif = drive->hwif; const struct ide_port_ops *port_ops = hwif->port_ops; if (hwif->host_flags & IDE_HFLAG_NO_SET_MODE) return 0; if (port_ops == NULL || port_ops->set_dma_mode == NULL) return -1; if (hwif->host_flags & IDE_HFLAG_POST_SET...