Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 44619
b: refs/heads/master
c: f98b657
h: refs/heads/master
i:
  44617: 25d9d4e
  44615: 2a01e95
v: v3
  • Loading branch information
Jason Gaston authored and Jeff Garzik committed Dec 16, 2006
1 parent 714011a commit 036c407
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 121 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a08727bae727fc2ca3a6ee9506d77786b71070b3
refs/heads/master: f98b6573f190aff2748894da13a48bab0f10c733
20 changes: 16 additions & 4 deletions trunk/drivers/ata/ata_piix.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,26 @@ static const struct pci_device_id piix_pci_tbl[] = {
{ 0x8086, 0x27c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci },
/* 2801GBM/GHM (ICH7M, identical to ICH6M) */
{ 0x8086, 0x27c4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6m_sata_ahci },
/* Enterprise Southbridge 2 (where's the datasheet?) */
/* Enterprise Southbridge 2 (631xESB/632xESB) */
{ 0x8086, 0x2680, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci },
/* SATA Controller 1 IDE (ICH8, no datasheet yet) */
/* SATA Controller 1 IDE (ICH8) */
{ 0x8086, 0x2820, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci },
/* SATA Controller 2 IDE (ICH8, ditto) */
/* SATA Controller 2 IDE (ICH8) */
{ 0x8086, 0x2825, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci },
/* Mobile SATA Controller IDE (ICH8M, ditto) */
/* Mobile SATA Controller IDE (ICH8M) */
{ 0x8086, 0x2828, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci },
/* SATA Controller IDE (ICH9) */
{ 0x8086, 0x2920, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci },
/* SATA Controller IDE (ICH9) */
{ 0x8086, 0x2921, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci },
/* SATA Controller IDE (ICH9) */
{ 0x8086, 0x2926, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci },
/* SATA Controller IDE (ICH9M) */
{ 0x8086, 0x2928, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci },
/* SATA Controller IDE (ICH9M) */
{ 0x8086, 0x292d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci },
/* SATA Controller IDE (ICH9M) */
{ 0x8086, 0x292e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci },

{ } /* terminate list */
};
Expand Down
32 changes: 10 additions & 22 deletions trunk/include/linux/workqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,16 @@
#include <linux/timer.h>
#include <linux/linkage.h>
#include <linux/bitops.h>
#include <asm/atomic.h>

struct workqueue_struct;

struct work_struct;
typedef void (*work_func_t)(struct work_struct *work);

/*
* The first word is the work queue pointer and the flags rolled into
* one
*/
#define work_data_bits(work) ((unsigned long *)(&(work)->data))

struct work_struct {
atomic_long_t data;
/* the first word is the work queue pointer and the flags rolled into
* one */
unsigned long management;
#define WORK_STRUCT_PENDING 0 /* T if work item pending execution */
#define WORK_STRUCT_NOAUTOREL 1 /* F if work item automatically released on exec */
#define WORK_STRUCT_FLAG_MASK (3UL)
Expand All @@ -31,9 +26,6 @@ struct work_struct {
work_func_t func;
};

#define WORK_DATA_INIT(autorelease) \
ATOMIC_LONG_INIT((autorelease) << WORK_STRUCT_NOAUTOREL)

struct delayed_work {
struct work_struct work;
struct timer_list timer;
Expand All @@ -44,13 +36,13 @@ struct execute_work {
};

#define __WORK_INITIALIZER(n, f) { \
.data = WORK_DATA_INIT(0), \
.management = 0, \
.entry = { &(n).entry, &(n).entry }, \
.func = (f), \
}

#define __WORK_INITIALIZER_NAR(n, f) { \
.data = WORK_DATA_INIT(1), \
.management = (1 << WORK_STRUCT_NOAUTOREL), \
.entry = { &(n).entry, &(n).entry }, \
.func = (f), \
}
Expand Down Expand Up @@ -90,21 +82,17 @@ struct execute_work {

/*
* initialize all of a work item in one go
*
* NOTE! No point in using "atomic_long_set()": useing a direct
* assignment of the work data initializer allows the compiler
* to generate better code.
*/
#define INIT_WORK(_work, _func) \
do { \
(_work)->data = (atomic_long_t) WORK_DATA_INIT(0); \
(_work)->management = 0; \
INIT_LIST_HEAD(&(_work)->entry); \
PREPARE_WORK((_work), (_func)); \
} while (0)

#define INIT_WORK_NAR(_work, _func) \
do { \
(_work)->data = (atomic_long_t) WORK_DATA_INIT(1); \
(_work)->management = (1 << WORK_STRUCT_NOAUTOREL); \
INIT_LIST_HEAD(&(_work)->entry); \
PREPARE_WORK((_work), (_func)); \
} while (0)
Expand All @@ -126,7 +114,7 @@ struct execute_work {
* @work: The work item in question
*/
#define work_pending(work) \
test_bit(WORK_STRUCT_PENDING, work_data_bits(work))
test_bit(WORK_STRUCT_PENDING, &(work)->management)

/**
* delayed_work_pending - Find out whether a delayable work item is currently
Expand Down Expand Up @@ -155,7 +143,7 @@ struct execute_work {
* This should also be used to release a delayed work item.
*/
#define work_release(work) \
clear_bit(WORK_STRUCT_PENDING, work_data_bits(work))
clear_bit(WORK_STRUCT_PENDING, &(work)->management)


extern struct workqueue_struct *__create_workqueue(const char *name,
Expand Down Expand Up @@ -200,7 +188,7 @@ static inline int cancel_delayed_work(struct delayed_work *work)

ret = del_timer_sync(&work->timer);
if (ret)
work_release(&work->work);
clear_bit(WORK_STRUCT_PENDING, &work->work.management);
return ret;
}

Expand Down
16 changes: 8 additions & 8 deletions trunk/kernel/workqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ static inline void set_wq_data(struct work_struct *work, void *wq)
BUG_ON(!work_pending(work));

new = (unsigned long) wq | (1UL << WORK_STRUCT_PENDING);
new |= WORK_STRUCT_FLAG_MASK & *work_data_bits(work);
atomic_long_set(&work->data, new);
new |= work->management & WORK_STRUCT_FLAG_MASK;
work->management = new;
}

static inline void *get_wq_data(struct work_struct *work)
{
return (void *) (atomic_long_read(&work->data) & WORK_STRUCT_WQ_DATA_MASK);
return (void *) (work->management & WORK_STRUCT_WQ_DATA_MASK);
}

static int __run_work(struct cpu_workqueue_struct *cwq, struct work_struct *work)
Expand Down Expand Up @@ -133,7 +133,7 @@ static int __run_work(struct cpu_workqueue_struct *cwq, struct work_struct *work
list_del_init(&work->entry);
spin_unlock_irqrestore(&cwq->lock, flags);

if (!test_bit(WORK_STRUCT_NOAUTOREL, work_data_bits(work)))
if (!test_bit(WORK_STRUCT_NOAUTOREL, &work->management))
work_release(work);
f(work);

Expand Down Expand Up @@ -206,7 +206,7 @@ int fastcall queue_work(struct workqueue_struct *wq, struct work_struct *work)
{
int ret = 0, cpu = get_cpu();

if (!test_and_set_bit(WORK_STRUCT_PENDING, work_data_bits(work))) {
if (!test_and_set_bit(WORK_STRUCT_PENDING, &work->management)) {
if (unlikely(is_single_threaded(wq)))
cpu = singlethread_cpu;
BUG_ON(!list_empty(&work->entry));
Expand Down Expand Up @@ -248,7 +248,7 @@ int fastcall queue_delayed_work(struct workqueue_struct *wq,
if (delay == 0)
return queue_work(wq, work);

if (!test_and_set_bit(WORK_STRUCT_PENDING, work_data_bits(work))) {
if (!test_and_set_bit(WORK_STRUCT_PENDING, &work->management)) {
BUG_ON(timer_pending(timer));
BUG_ON(!list_empty(&work->entry));

Expand Down Expand Up @@ -280,7 +280,7 @@ int queue_delayed_work_on(int cpu, struct workqueue_struct *wq,
struct timer_list *timer = &dwork->timer;
struct work_struct *work = &dwork->work;

if (!test_and_set_bit(WORK_STRUCT_PENDING, work_data_bits(work))) {
if (!test_and_set_bit(WORK_STRUCT_PENDING, &work->management)) {
BUG_ON(timer_pending(timer));
BUG_ON(!list_empty(&work->entry));

Expand Down Expand Up @@ -321,7 +321,7 @@ static void run_workqueue(struct cpu_workqueue_struct *cwq)
spin_unlock_irqrestore(&cwq->lock, flags);

BUG_ON(get_wq_data(work) != cwq);
if (!test_bit(WORK_STRUCT_NOAUTOREL, work_data_bits(work)))
if (!test_bit(WORK_STRUCT_NOAUTOREL, &work->management))
work_release(work);
f(work);

Expand Down
Loading

0 comments on commit 036c407

Please sign in to comment.