Skip to content
Snippets Groups Projects
Select Git revision
  • 7522297e1638f985e5d52f34b871e742b10586d4
  • vme-testing default
  • ci-test
  • master
  • remoteproc
  • am625-sk-ov5640
  • pcal6534-upstreaming
  • lps22df-upstreaming
  • msc-upstreaming
  • imx8mp
  • iio/noa1305
  • vme-next
  • vme-next-4.14-rc4
  • v4.14-rc4
  • v4.14-rc3
  • v4.14-rc2
  • v4.14-rc1
  • v4.13
  • vme-next-4.13-rc7
  • v4.13-rc7
  • v4.13-rc6
  • v4.13-rc5
  • v4.13-rc4
  • v4.13-rc3
  • v4.13-rc2
  • v4.13-rc1
  • v4.12
  • v4.12-rc7
  • v4.12-rc6
  • v4.12-rc5
  • v4.12-rc4
  • v4.12-rc3
32 results

rtc-ds3232.c

Blame
  • async-thread.c 18.28 KiB
    /*
     * Copyright (C) 2007 Oracle.  All rights reserved.
     *
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public
     * License v2 as published by the Free Software Foundation.
     *
     * This program is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     * General Public License for more details.
     *
     * You should have received a copy of the GNU General Public
     * License along with this program; if not, write to the
     * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
     * Boston, MA 021110-1307, USA.
     */
    
    #include <linux/kthread.h>
    #include <linux/slab.h>
    #include <linux/list.h>
    #include <linux/spinlock.h>
    #include <linux/freezer.h>
    #include "async-thread.h"
    
    #define WORK_QUEUED_BIT 0
    #define WORK_DONE_BIT 1
    #define WORK_ORDER_DONE_BIT 2
    #define WORK_HIGH_PRIO_BIT 3
    
    /*
     * container for the kthread task pointer and the list of pending work
     * One of these is allocated per thread.
     */
    struct btrfs_worker_thread {
    	/* pool we belong to */
    	struct btrfs_workers *workers;
    
    	/* list of struct btrfs_work that are waiting for service */
    	struct list_head pending;
    	struct list_head prio_pending;
    
    	/* list of worker threads from struct btrfs_workers */
    	struct list_head worker_list;
    
    	/* kthread */
    	struct task_struct *task;
    
    	/* number of things on the pending list */
    	atomic_t num_pending;
    
    	/* reference counter for this struct */
    	atomic_t refs;
    
    	unsigned long sequence;
    
    	/* protects the pending list. */
    	spinlock_t lock;
    
    	/* set to non-zero when this thread is already awake and kicking */
    	int working;
    
    	/* are we currently idle */
    	int idle;
    };
    
    static int __btrfs_start_workers(struct btrfs_workers *workers);
    
    /*
     * btrfs_start_workers uses kthread_run, which can block waiting for memory