Commit 99ddca63 authored by Dave Jones's avatar Dave Jones

Merge tetrachloride.(none):/mnt/raid/src/kernel/2.5/bk-linus

into tetrachloride.(none):/mnt/raid/src/kernel/2.5/agpgart
parents 2b4363d9 77b3055a
......@@ -49,7 +49,7 @@ mtrr_file_del(unsigned long base, unsigned long size,
struct file *file, int page)
{
int reg;
unsigned int *fcount = file->private_data;
unsigned int *fcount = FILE_FCOUNT(file);
if (!page) {
if ((base & (PAGE_SIZE - 1)) || (size & (PAGE_SIZE - 1)))
......
......@@ -220,6 +220,14 @@ void clear_IO_APIC_pin(unsigned int apic, unsigned int pin)
struct IO_APIC_route_entry entry;
unsigned long flags;
/* Check delivery_mode to be sure we're not clearing an SMI pin */
spin_lock_irqsave(&ioapic_lock, flags);
*(((int*)&entry) + 0) = io_apic_read(apic, 0x10 + 2 * pin);
*(((int*)&entry) + 1) = io_apic_read(apic, 0x11 + 2 * pin);
spin_unlock_irqrestore(&ioapic_lock, flags);
if (entry.delivery_mode == dest_SMI)
return;
/*
* Disable it in the IO-APIC irq-routing table:
*/
......
......@@ -1149,7 +1149,9 @@ int __devinit __cpu_up(unsigned int cpu)
void __init smp_cpus_done(unsigned int max_cpus)
{
#ifdef CONFIG_X86_IO_APIC
setup_ioapic_dest(TARGET_CPUS);
#endif
zap_low_mappings();
}
......
......@@ -20,8 +20,6 @@
#include <asm/tlb.h>
#include <asm/tlbflush.h>
#include <linux/sysctl.h>
static long htlbpagemem;
int htlbpage_max;
static long htlbzone_pages;
......@@ -398,8 +396,6 @@ int set_hugetlb_mem_size(int count)
{
int lcount;
struct page *page;
extern long htlbzone_pages;
extern struct list_head htlbpage_freelist;
if (count < 0)
lcount = count;
......
......@@ -12,6 +12,7 @@
#include <linux/config.h>
#include <linux/types.h>
#include <linux/mm.h>
#include <asm/param.h>
#include <asm/signal.h>
......@@ -40,7 +41,6 @@
#define CLOCKS_PER_SEC IA32_CLOCKS_PER_SEC
extern void ia64_elf32_init (struct pt_regs *regs);
extern void put_dirty_page (struct task_struct * tsk, struct page *page, unsigned long address);
static void elf32_set_personality (void);
......@@ -200,7 +200,7 @@ ia32_setup_arg_pages (struct linux_binprm *bprm)
struct page *page = bprm->page[i];
if (page) {
bprm->page[i] = NULL;
put_dirty_page(current, page, stack_base);
put_dirty_page(current, page, stack_base, PAGE_COPY);
}
stack_base += PAGE_SIZE;
}
......
......@@ -12,13 +12,12 @@
#include <linux/pagemap.h>
#include <linux/smp_lock.h>
#include <linux/slab.h>
#include <linux/sysctl.h>
#include <asm/mman.h>
#include <asm/pgalloc.h>
#include <asm/tlb.h>
#include <asm/tlbflush.h>
#include <linux/sysctl.h>
#define TASK_HPAGE_BASE (REGION_HPAGE << REGION_SHIFT)
static long htlbpagemem;
......@@ -392,8 +391,6 @@ int set_hugetlb_mem_size(int count)
{
int lcount;
struct page *page ;
extern long htlbzone_pages;
extern struct list_head htlbpage_freelist;
if (count < 0)
lcount = count;
......
......@@ -18,6 +18,7 @@
#include <linux/smp_lock.h>
#include <linux/init.h>
#include <linux/pagemap.h>
#include <linux/mm.h>
#include <linux/highmem.h>
#include <linux/spinlock.h>
#include <linux/binfmts.h>
......@@ -32,8 +33,6 @@
#endif
extern void put_dirty_page(struct task_struct * tsk, struct page *page, unsigned long address);
#undef STACK_TOP
#define STACK_TOP TASK31_SIZE
......@@ -81,7 +80,7 @@ int setup_arg_pages32(struct linux_binprm *bprm)
struct page *page = bprm->page[i];
if (page) {
bprm->page[i] = NULL;
put_dirty_page(current,page,stack_base);
put_dirty_page(current,page,stack_base,PAGE_COPY);
}
stack_base += PAGE_SIZE;
}
......
......@@ -13,6 +13,7 @@
#include <linux/sched.h>
#include <linux/string.h>
#include <linux/binfmts.h>
#include <linux/mm.h>
#include <asm/segment.h>
#include <asm/ptrace.h>
#include <asm/processor.h>
......@@ -272,9 +273,6 @@ static void elf32_init(struct pt_regs *regs)
set_thread_flag(TIF_IA32);
}
extern void put_dirty_page(struct task_struct * tsk, struct page *page, unsigned long address);
int setup_arg_pages(struct linux_binprm *bprm)
{
unsigned long stack_base;
......@@ -319,7 +317,7 @@ int setup_arg_pages(struct linux_binprm *bprm)
struct page *page = bprm->page[i];
if (page) {
bprm->page[i] = NULL;
put_dirty_page(current,page,stack_base);
put_dirty_page(current,page,stack_base,PAGE_COPY_EXEC);
}
stack_base += PAGE_SIZE;
}
......
......@@ -48,8 +48,7 @@
static DAC960_Controller_T *DAC960_Controllers[DAC960_MaxControllers];
static int DAC960_ControllerCount;
static PROC_DirectoryEntry_T *DAC960_ProcDirectoryEntry;
static struct proc_dir_entry *DAC960_ProcDirectoryEntry;
static long disk_size(DAC960_Controller_T *p, int drive_nr)
{
......@@ -759,12 +758,15 @@ static void DAC960_ExecuteCommand(DAC960_Command_T *Command)
{
DAC960_Controller_T *Controller = Command->Controller;
DECLARE_COMPLETION(Completion);
unsigned long ProcessorFlags;
unsigned long flags;
Command->Completion = &Completion;
DAC960_AcquireControllerLock(Controller, &ProcessorFlags);
spin_lock_irqsave(&Controller->queue_lock, flags);
DAC960_QueueCommand(Command);
DAC960_ReleaseControllerLock(Controller, &ProcessorFlags);
if (in_interrupt()) return;
spin_unlock_irqrestore(&Controller->queue_lock, flags);
if (in_interrupt())
return;
wait_for_completion(&Completion);
}
......@@ -1132,7 +1134,7 @@ static boolean DAC960_V1_EnableMemoryMailboxInterface(DAC960_Controller_T
{
void *ControllerBaseAddress = Controller->BaseAddress;
DAC960_HardwareType_T hw_type = Controller->HardwareType;
PCI_Device_T *PCI_Device = Controller->PCIDevice;
struct pci_dev *PCI_Device = Controller->PCIDevice;
struct dma_loaf *DmaPages = &Controller->DmaPages;
size_t DmaPagesSize;
size_t CommandMailboxesSize;
......@@ -1337,7 +1339,7 @@ static boolean DAC960_V2_EnableMemoryMailboxInterface(DAC960_Controller_T
*Controller)
{
void *ControllerBaseAddress = Controller->BaseAddress;
PCI_Device_T *PCI_Device = Controller->PCIDevice;
struct pci_dev *PCI_Device = Controller->PCIDevice;
struct dma_loaf *DmaPages = &Controller->DmaPages;
size_t DmaPagesSize;
size_t CommandMailboxesSize;
......@@ -1915,8 +1917,8 @@ static boolean DAC960_V1_ReadDeviceConfiguration(DAC960_Controller_T
dma_addr_t SCSI_NewInquiryUnitSerialNumberDMA[DAC960_V1_MaxChannels];
DAC960_SCSI_Inquiry_UnitSerialNumber_T *SCSI_NewInquiryUnitSerialNumberCPU[DAC960_V1_MaxChannels];
Completion_T Completions[DAC960_V1_MaxChannels];
unsigned long ProcessorFlags;
struct completion Completions[DAC960_V1_MaxChannels];
unsigned long flags;
int Channel, TargetID;
if (!init_dma_loaf(Controller->PCIDevice, &local_dma,
......@@ -1951,7 +1953,7 @@ static boolean DAC960_V1_ReadDeviceConfiguration(DAC960_Controller_T
DAC960_V1_DCDB_T *DCDB = DCDBs_cpu[Channel];
dma_addr_t DCDB_dma = DCDBs_dma[Channel];
DAC960_Command_T *Command = Controller->Commands[Channel];
Completion_T *Completion = &Completions[Channel];
struct completion *Completion = &Completions[Channel];
init_completion(Completion);
DAC960_V1_ClearCommand(Command);
......@@ -1977,9 +1979,10 @@ static boolean DAC960_V1_ReadDeviceConfiguration(DAC960_Controller_T
DCDB->CDB[3] = 0; /* Reserved */
DCDB->CDB[4] = sizeof(DAC960_SCSI_Inquiry_T);
DCDB->CDB[5] = 0; /* Control */
DAC960_AcquireControllerLock(Controller, &ProcessorFlags);
spin_lock_irqsave(&Controller->queue_lock, flags);
DAC960_QueueCommand(Command);
DAC960_ReleaseControllerLock(Controller, &ProcessorFlags);
spin_unlock_irqrestore(&Controller->queue_lock, flags);
}
/*
* Wait for the problems submitted in the previous loop
......@@ -1999,7 +2002,7 @@ static boolean DAC960_V1_ReadDeviceConfiguration(DAC960_Controller_T
&Controller->V1.InquiryUnitSerialNumber[Channel][TargetID];
DAC960_Command_T *Command = Controller->Commands[Channel];
DAC960_V1_DCDB_T *DCDB = DCDBs_cpu[Channel];
Completion_T *Completion = &Completions[Channel];
struct completion *Completion = &Completions[Channel];
wait_for_completion(Completion);
......@@ -2021,9 +2024,10 @@ static boolean DAC960_V1_ReadDeviceConfiguration(DAC960_Controller_T
DCDB->CDB[3] = 0; /* Reserved */
DCDB->CDB[4] = sizeof(DAC960_SCSI_Inquiry_UnitSerialNumber_T);
DCDB->CDB[5] = 0; /* Control */
DAC960_AcquireControllerLock(Controller, &ProcessorFlags);
spin_lock_irqsave(&Controller->queue_lock, flags);
DAC960_QueueCommand(Command);
DAC960_ReleaseControllerLock(Controller, &ProcessorFlags);
spin_unlock_irqrestore(&Controller->queue_lock, flags);
wait_for_completion(Completion);
if (Command->V1.CommandStatus != DAC960_V1_NormalCompletion) {
......@@ -2457,7 +2461,7 @@ static boolean DAC960_V2_ReportDeviceConfiguration(DAC960_Controller_T
static boolean DAC960_RegisterBlockDevice(DAC960_Controller_T *Controller)
{
int MajorNumber = DAC960_MAJOR + Controller->ControllerNumber;
RequestQueue_T *RequestQueue;
struct request_queue *RequestQueue;
int n;
/*
......@@ -2642,11 +2646,13 @@ static void DAC960_DetectCleanup(DAC960_Controller_T *Controller)
*/
static DAC960_Controller_T *
DAC960_DetectController(PCI_Device_T *PCI_Device,
DAC960_DetectController(struct pci_dev *PCI_Device,
const struct pci_device_id *entry)
{
struct DAC960_privdata *privdata = (struct DAC960_privdata *)entry->driver_data;
irqreturn_t (*InterruptHandler)(int, void *, Registers_T *) = privdata->InterruptHandler;
struct DAC960_privdata *privdata =
(struct DAC960_privdata *)entry->driver_data;
irqreturn_t (*InterruptHandler)(int, void *, struct pt_regs *) =
privdata->InterruptHandler;
unsigned int MemoryWindowSize = privdata->MemoryWindowSize;
DAC960_Controller_T *Controller = NULL;
unsigned char DeviceFunction = PCI_Device->devfn;
......@@ -3001,7 +3007,7 @@ static void DAC960_FinalizeController(DAC960_Controller_T *Controller)
{
if (Controller->ControllerInitialized)
{
unsigned long ProcessorFlags;
unsigned long flags;
/*
* Acquiring and releasing lock here eliminates
......@@ -3019,9 +3025,11 @@ static void DAC960_FinalizeController(DAC960_Controller_T *Controller)
* commands that complete from this time on will NOT return
* their command structure to the free list.
*/
DAC960_AcquireControllerLock(Controller, &ProcessorFlags);
spin_lock_irqsave(&Controller->queue_lock, flags);
Controller->ShutdownMonitoringTimer = 1;
DAC960_ReleaseControllerLock(Controller, &ProcessorFlags);
spin_unlock_irqrestore(&Controller->queue_lock, flags);
del_timer_sync(&Controller->MonitoringTimer);
if (Controller->FirmwareType == DAC960_V1_Controller)
{
......@@ -3088,7 +3096,7 @@ DAC960_Probe(struct pci_dev *dev, const struct pci_device_id *entry)
DAC960_Finalize finalizes the DAC960 Driver.
*/
static void DAC960_Remove(PCI_Device_T *PCI_Device)
static void DAC960_Remove(struct pci_dev *PCI_Device)
{
int Controller_Number = (int)pci_get_drvdata(PCI_Device);
DAC960_Controller_T *Controller = DAC960_Controllers[Controller_Number];
......@@ -3236,8 +3244,8 @@ static void DAC960_V2_QueueReadWriteCommand(DAC960_Command_T *Command)
static boolean DAC960_ProcessRequest(DAC960_Controller_T *Controller,
boolean WaitForCommand)
{
RequestQueue_T *RequestQueue = &Controller->RequestQueue;
IO_Request_T *Request;
struct request_queue *RequestQueue = &Controller->RequestQueue;
struct request *Request;
DAC960_Command_T *Command;
if (!Controller->ControllerInitialized)
......@@ -3293,7 +3301,7 @@ static boolean DAC960_ProcessRequest(DAC960_Controller_T *Controller,
static void DAC960_queue_partial_rw(DAC960_Command_T *Command)
{
DAC960_Controller_T *Controller = Command->Controller;
IO_Request_T *Request = Command->Request;
struct request *Request = Command->Request;
if (Command->DmaDirection == PCI_DMA_FROMDEVICE)
Command->CommandType = DAC960_ReadRetryCommand;
......@@ -3324,43 +3332,17 @@ static void DAC960_queue_partial_rw(DAC960_Command_T *Command)
return;
}
/*
DAC960_ProcessRequests attempts to remove as many I/O Requests as possible
from Controller's I/O Request Queue and queue them to the Controller.
*/
static inline void DAC960_ProcessRequests(DAC960_Controller_T *Controller)
{
int Counter = 0;
while (DAC960_ProcessRequest(Controller, Counter++ == 0)) ;
}
/*
DAC960_RequestFunction is the I/O Request Function for DAC960 Controllers.
*/
static void DAC960_RequestFunction(RequestQueue_T *RequestQueue)
static void DAC960_RequestFunction(struct request_queue *RequestQueue)
{
DAC960_Controller_T *Controller =
(DAC960_Controller_T *) RequestQueue->queuedata;
ProcessorFlags_T ProcessorFlags;
/*
Acquire exclusive access to Controller.
*/
DAC960_AcquireControllerLockRF(Controller, &ProcessorFlags);
/*
Process I/O Requests for Controller.
*/
DAC960_ProcessRequests(Controller);
/*
Release exclusive access to Controller.
*/
DAC960_ReleaseControllerLockRF(Controller, &ProcessorFlags);
int i = 0;
while (DAC960_ProcessRequest(RequestQueue->queuedata, (i++ == 0)))
;
}
/*
DAC960_ProcessCompletedBuffer performs completion processing for an
individual Buffer.
......@@ -3369,7 +3351,7 @@ static void DAC960_RequestFunction(RequestQueue_T *RequestQueue)
static inline boolean DAC960_ProcessCompletedRequest(DAC960_Command_T *Command,
boolean SuccessfulIO)
{
IO_Request_T *Request = Command->Request;
struct request *Request = Command->Request;
int UpToDate;
UpToDate = 0;
......@@ -5174,20 +5156,14 @@ static void DAC960_V2_ProcessCompletedCommand(DAC960_Command_T *Command)
static irqreturn_t DAC960_BA_InterruptHandler(int IRQ_Channel,
void *DeviceIdentifier,
Registers_T *InterruptRegisters)
struct pt_regs *InterruptRegisters)
{
DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier;
void *ControllerBaseAddress = Controller->BaseAddress;
DAC960_V2_StatusMailbox_T *NextStatusMailbox;
ProcessorFlags_T ProcessorFlags;
unsigned long flags;
/*
Acquire exclusive access to Controller.
*/
DAC960_AcquireControllerLockIH(Controller, &ProcessorFlags);
/*
Process Hardware Interrupts for Controller.
*/
spin_lock_irqsave(&Controller->queue_lock, flags);
DAC960_BA_AcknowledgeInterrupt(ControllerBaseAddress);
NextStatusMailbox = Controller->V2.NextStatusMailbox;
while (NextStatusMailbox->Fields.CommandIdentifier > 0)
......@@ -5210,11 +5186,9 @@ static irqreturn_t DAC960_BA_InterruptHandler(int IRQ_Channel,
Attempt to remove additional I/O Requests from the Controller's
I/O Request Queue and queue them to the Controller.
*/
while (DAC960_ProcessRequest(Controller, false)) ;
/*
Release exclusive access to Controller.
*/
DAC960_ReleaseControllerLockIH(Controller, &ProcessorFlags);
while (DAC960_ProcessRequest(Controller, false))
;
spin_unlock_irqrestore(&Controller->queue_lock, flags);
return IRQ_HANDLED;
}
......@@ -5226,19 +5200,14 @@ static irqreturn_t DAC960_BA_InterruptHandler(int IRQ_Channel,
static irqreturn_t DAC960_LP_InterruptHandler(int IRQ_Channel,
void *DeviceIdentifier,
Registers_T *InterruptRegisters)
struct pt_regs *InterruptRegisters)
{
DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier;
void *ControllerBaseAddress = Controller->BaseAddress;
DAC960_V2_StatusMailbox_T *NextStatusMailbox;
ProcessorFlags_T ProcessorFlags;
/*
Acquire exclusive access to Controller.
*/
DAC960_AcquireControllerLockIH(Controller, &ProcessorFlags);
/*
Process Hardware Interrupts for Controller.
*/
unsigned long flags;
spin_lock_irqsave(&Controller->queue_lock, flags);
DAC960_LP_AcknowledgeInterrupt(ControllerBaseAddress);
NextStatusMailbox = Controller->V2.NextStatusMailbox;
while (NextStatusMailbox->Fields.CommandIdentifier > 0)
......@@ -5261,11 +5230,9 @@ static irqreturn_t DAC960_LP_InterruptHandler(int IRQ_Channel,
Attempt to remove additional I/O Requests from the Controller's
I/O Request Queue and queue them to the Controller.
*/
while (DAC960_ProcessRequest(Controller, false)) ;
/*
Release exclusive access to Controller.
*/
DAC960_ReleaseControllerLockIH(Controller, &ProcessorFlags);
while (DAC960_ProcessRequest(Controller, false))
;
spin_unlock_irqrestore(&Controller->queue_lock, flags);
return IRQ_HANDLED;
}
......@@ -5277,19 +5244,14 @@ static irqreturn_t DAC960_LP_InterruptHandler(int IRQ_Channel,
static irqreturn_t DAC960_LA_InterruptHandler(int IRQ_Channel,
void *DeviceIdentifier,
Registers_T *InterruptRegisters)
struct pt_regs *InterruptRegisters)
{
DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier;
void *ControllerBaseAddress = Controller->BaseAddress;
DAC960_V1_StatusMailbox_T *NextStatusMailbox;
ProcessorFlags_T ProcessorFlags;
/*
Acquire exclusive access to Controller.
*/
DAC960_AcquireControllerLockIH(Controller, &ProcessorFlags);
/*
Process Hardware Interrupts for Controller.
*/
unsigned long flags;
spin_lock_irqsave(&Controller->queue_lock, flags);
DAC960_LA_AcknowledgeInterrupt(ControllerBaseAddress);
NextStatusMailbox = Controller->V1.NextStatusMailbox;
while (NextStatusMailbox->Fields.Valid)
......@@ -5308,11 +5270,9 @@ static irqreturn_t DAC960_LA_InterruptHandler(int IRQ_Channel,
Attempt to remove additional I/O Requests from the Controller's
I/O Request Queue and queue them to the Controller.
*/
while (DAC960_ProcessRequest(Controller, false)) ;
/*
Release exclusive access to Controller.
*/
DAC960_ReleaseControllerLockIH(Controller, &ProcessorFlags);
while (DAC960_ProcessRequest(Controller, false))
;
spin_unlock_irqrestore(&Controller->queue_lock, flags);
return IRQ_HANDLED;
}
......@@ -5324,19 +5284,14 @@ static irqreturn_t DAC960_LA_InterruptHandler(int IRQ_Channel,
static irqreturn_t DAC960_PG_InterruptHandler(int IRQ_Channel,
void *DeviceIdentifier,
Registers_T *InterruptRegisters)
struct pt_regs *InterruptRegisters)
{
DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier;
void *ControllerBaseAddress = Controller->BaseAddress;
DAC960_V1_StatusMailbox_T *NextStatusMailbox;
ProcessorFlags_T ProcessorFlags;
/*
Acquire exclusive access to Controller.
*/
DAC960_AcquireControllerLockIH(Controller, &ProcessorFlags);
/*
Process Hardware Interrupts for Controller.
*/
unsigned long flags;
spin_lock_irqsave(&Controller->queue_lock, flags);
DAC960_PG_AcknowledgeInterrupt(ControllerBaseAddress);
NextStatusMailbox = Controller->V1.NextStatusMailbox;
while (NextStatusMailbox->Fields.Valid)
......@@ -5355,11 +5310,9 @@ static irqreturn_t DAC960_PG_InterruptHandler(int IRQ_Channel,
Attempt to remove additional I/O Requests from the Controller's
I/O Request Queue and queue them to the Controller.
*/
while (DAC960_ProcessRequest(Controller, false)) ;
/*
Release exclusive access to Controller.
*/
DAC960_ReleaseControllerLockIH(Controller, &ProcessorFlags);
while (DAC960_ProcessRequest(Controller, false))
;
spin_unlock_irqrestore(&Controller->queue_lock, flags);
return IRQ_HANDLED;
}
......@@ -5371,18 +5324,13 @@ static irqreturn_t DAC960_PG_InterruptHandler(int IRQ_Channel,
static irqreturn_t DAC960_PD_InterruptHandler(int IRQ_Channel,
void *DeviceIdentifier,
Registers_T *InterruptRegisters)
struct pt_regs *InterruptRegisters)
{
DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier;
void *ControllerBaseAddress = Controller->BaseAddress;
ProcessorFlags_T ProcessorFlags;
/*
Acquire exclusive access to Controller.
*/
DAC960_AcquireControllerLockIH(Controller, &ProcessorFlags);
/*
Process Hardware Interrupts for Controller.
*/
unsigned long flags;
spin_lock_irqsave(&Controller->queue_lock, flags);
while (DAC960_PD_StatusAvailableP(ControllerBaseAddress))
{
DAC960_V1_CommandIdentifier_T CommandIdentifier =
......@@ -5398,11 +5346,9 @@ static irqreturn_t DAC960_PD_InterruptHandler(int IRQ_Channel,
Attempt to remove additional I/O Requests from the Controller's
I/O Request Queue and queue them to the Controller.
*/
while (DAC960_ProcessRequest(Controller, false)) ;
/*
Release exclusive access to Controller.
*/
DAC960_ReleaseControllerLockIH(Controller, &ProcessorFlags);
while (DAC960_ProcessRequest(Controller, false))
;
spin_unlock_irqrestore(&Controller->queue_lock, flags);
return IRQ_HANDLED;
}
......@@ -5418,18 +5364,13 @@ static irqreturn_t DAC960_PD_InterruptHandler(int IRQ_Channel,
static irqreturn_t DAC960_P_InterruptHandler(int IRQ_Channel,
void *DeviceIdentifier,
Registers_T *InterruptRegisters)
struct pt_regs *InterruptRegisters)
{
DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier;
void *ControllerBaseAddress = Controller->BaseAddress;
ProcessorFlags_T ProcessorFlags;
/*
Acquire exclusive access to Controller.
*/
DAC960_AcquireControllerLockIH(Controller, &ProcessorFlags);
/*
Process Hardware Interrupts for Controller.
*/
unsigned long flags;
spin_lock_irqsave(&Controller->queue_lock, flags);
while (DAC960_PD_StatusAvailableP(ControllerBaseAddress))
{
DAC960_V1_CommandIdentifier_T CommandIdentifier =
......@@ -5480,11 +5421,9 @@ static irqreturn_t DAC960_P_InterruptHandler(int IRQ_Channel,
Attempt to remove additional I/O Requests from the Controller's
I/O Request Queue and queue them to the Controller.
*/
while (DAC960_ProcessRequest(Controller, false)) ;
/*
Release exclusive access to Controller.
*/
DAC960_ReleaseControllerLockIH(Controller, &ProcessorFlags);
while (DAC960_ProcessRequest(Controller, false))
;
spin_unlock_irqrestore(&Controller->queue_lock, flags);
return IRQ_HANDLED;
}
......@@ -5547,13 +5486,11 @@ static void DAC960_MonitoringTimerFunction(unsigned long TimerData)
{
DAC960_Controller_T *Controller = (DAC960_Controller_T *) TimerData;
DAC960_Command_T *Command;
ProcessorFlags_T ProcessorFlags;
unsigned long flags;
if (Controller->FirmwareType == DAC960_V1_Controller)
{
/*
Acquire exclusive access to Controller.
*/
DAC960_AcquireControllerLock(Controller, &ProcessorFlags);
spin_lock_irqsave(&Controller->queue_lock, flags);
/*
Queue a Status Monitoring Command to Controller.
*/
......@@ -5561,10 +5498,7 @@ static void DAC960_MonitoringTimerFunction(unsigned long TimerData)
if (Command != NULL)
DAC960_V1_QueueMonitoringCommand(Command);
else Controller->MonitoringCommandDeferred = true;
/*
Release exclusive access to Controller.
*/
DAC960_ReleaseControllerLock(Controller, &ProcessorFlags);
spin_unlock_irqrestore(&Controller->queue_lock, flags);
}
else
{
......@@ -5613,10 +5547,8 @@ static void DAC960_MonitoringTimerFunction(unsigned long TimerData)
}
Controller->V2.StatusChangeCounter = StatusChangeCounter;
Controller->PrimaryMonitoringTime = jiffies;
/*
Acquire exclusive access to Controller.
*/
DAC960_AcquireControllerLock(Controller, &ProcessorFlags);
spin_lock_irqsave(&Controller->queue_lock, flags);
/*
Queue a Status Monitoring Command to Controller.
*/
......@@ -5624,10 +5556,7 @@ static void DAC960_MonitoringTimerFunction(unsigned long TimerData)
if (Command != NULL)
DAC960_V2_QueueMonitoringCommand(Command);
else Controller->MonitoringCommandDeferred = true;
/*
Release exclusive access to Controller.
*/
DAC960_ReleaseControllerLock(Controller, &ProcessorFlags);
spin_unlock_irqrestore(&Controller->queue_lock, flags);
/*
Wake up any processes waiting on a Health Status Buffer change.
*/
......@@ -5639,7 +5568,7 @@ static void DAC960_MonitoringTimerFunction(unsigned long TimerData)
DAC960_UserIOCTL is the User IOCTL Function for the DAC960 Driver.
*/
static int DAC960_UserIOCTL(Inode_T *Inode, File_T *File,
static int DAC960_UserIOCTL(struct inode *inode, struct file *file,
unsigned int Request, unsigned long Argument)
{
int ErrorCode = 0;
......@@ -5691,7 +5620,7 @@ static int DAC960_UserIOCTL(Inode_T *Inode, File_T *File,
DAC960_V1_DCDB_T DCDB;
DAC960_V1_DCDB_T *DCDB_IOBUF = NULL;
dma_addr_t DCDB_IOBUFDMA;
ProcessorFlags_T ProcessorFlags;
unsigned long flags;
int ControllerNumber, DataTransferLength;
unsigned char *DataTransferBuffer = NULL;
dma_addr_t DataTransferBufferDMA;
......@@ -5764,7 +5693,7 @@ static int DAC960_UserIOCTL(Inode_T *Inode, File_T *File,
}
if (CommandOpcode == DAC960_V1_DCDB)
{
DAC960_AcquireControllerLock(Controller, &ProcessorFlags);
spin_lock_irqsave(&Controller->queue_lock, flags);
while ((Command = DAC960_AllocateCommand(Controller)) == NULL)
DAC960_WaitForCommand(Controller);
while (Controller->V1.DirectCommandActive[DCDB.Channel]
......@@ -5778,7 +5707,7 @@ static int DAC960_UserIOCTL(Inode_T *Inode, File_T *File,
}
Controller->V1.DirectCommandActive[DCDB.Channel]
[DCDB.TargetID] = true;
DAC960_ReleaseControllerLock(Controller, &ProcessorFlags);
spin_unlock_irqrestore(&Controller->queue_lock, flags);
DAC960_V1_ClearCommand(Command);
Command->CommandType = DAC960_ImmediateCommand;
memcpy(&Command->V1.CommandMailbox, &UserCommand.CommandMailbox,
......@@ -5789,10 +5718,10 @@ static int DAC960_UserIOCTL(Inode_T *Inode, File_T *File,
}
else
{
DAC960_AcquireControllerLock(Controller, &ProcessorFlags);
spin_lock_irqsave(&Controller->queue_lock, flags);
while ((Command = DAC960_AllocateCommand(Controller)) == NULL)
DAC960_WaitForCommand(Controller);
DAC960_ReleaseControllerLock(Controller, &ProcessorFlags);
spin_unlock_irqrestore(&Controller->queue_lock, flags);
DAC960_V1_ClearCommand(Command);
Command->CommandType = DAC960_ImmediateCommand;
memcpy(&Command->V1.CommandMailbox, &UserCommand.CommandMailbox,
......@@ -5803,9 +5732,9 @@ static int DAC960_UserIOCTL(Inode_T *Inode, File_T *File,
}
DAC960_ExecuteCommand(Command);
CommandStatus = Command->V1.CommandStatus;
DAC960_AcquireControllerLock(Controller, &ProcessorFlags);
spin_lock_irqsave(&Controller->queue_lock, flags);
DAC960_DeallocateCommand(Command);
DAC960_ReleaseControllerLock(Controller, &ProcessorFlags);
spin_unlock_irqrestore(&Controller->queue_lock, flags);
if (DataTransferLength > 0)
{
if (copy_to_user(UserCommand.DataTransferBuffer,
......@@ -5848,7 +5777,7 @@ static int DAC960_UserIOCTL(Inode_T *Inode, File_T *File,
DAC960_Command_T *Command = NULL;
DAC960_V2_CommandMailbox_T *CommandMailbox;
DAC960_V2_CommandStatus_T CommandStatus;
ProcessorFlags_T ProcessorFlags;
unsigned long flags;
int ControllerNumber, DataTransferLength;
int DataTransferResidue, RequestSenseLength;
unsigned char *DataTransferBuffer = NULL;
......@@ -5900,10 +5829,10 @@ static int DAC960_UserIOCTL(Inode_T *Inode, File_T *File,
}
memset(RequestSenseBuffer, 0, RequestSenseLength);
}
DAC960_AcquireControllerLock(Controller, &ProcessorFlags);
spin_lock_irqsave(&Controller->queue_lock, flags);
while ((Command = DAC960_AllocateCommand(Controller)) == NULL)
DAC960_WaitForCommand(Controller);
DAC960_ReleaseControllerLock(Controller, &ProcessorFlags);
spin_unlock_irqrestore(&Controller->queue_lock, flags);
DAC960_V2_ClearCommand(Command);
Command->CommandType = DAC960_ImmediateCommand;
CommandMailbox = &Command->V2.CommandMailbox;
......@@ -5951,9 +5880,9 @@ static int DAC960_UserIOCTL(Inode_T *Inode, File_T *File,
CommandStatus = Command->V2.CommandStatus;
RequestSenseLength = Command->V2.RequestSenseLength;
DataTransferResidue = Command->V2.DataTransferResidue;
DAC960_AcquireControllerLock(Controller, &ProcessorFlags);
spin_lock_irqsave(&Controller->queue_lock, flags);
DAC960_DeallocateCommand(Command);
DAC960_ReleaseControllerLock(Controller, &ProcessorFlags);
spin_unlock_irqrestore(&Controller->queue_lock, flags);
if (RequestSenseLength > UserCommand.RequestSenseLength)
RequestSenseLength = UserCommand.RequestSenseLength;
if (copy_to_user(&UserSpaceUserCommand->DataTransferLength,
......@@ -6302,12 +6231,13 @@ static boolean DAC960_V1_ExecuteUserCommand(DAC960_Controller_T *Controller,
{
DAC960_Command_T *Command;
DAC960_V1_CommandMailbox_T *CommandMailbox;
ProcessorFlags_T ProcessorFlags;
unsigned long flags;
unsigned char Channel, TargetID, LogicalDriveNumber;
DAC960_AcquireControllerLock(Controller, &ProcessorFlags);
spin_lock_irqsave(&Controller->queue_lock, flags);
while ((Command = DAC960_AllocateCommand(Controller)) == NULL)
DAC960_WaitForCommand(Controller);
DAC960_ReleaseControllerLock(Controller, &ProcessorFlags);
spin_unlock_irqrestore(&Controller->queue_lock, flags);
Controller->UserStatusLength = 0;
DAC960_V1_ClearCommand(Command);
Command->CommandType = DAC960_ImmediateCommand;
......@@ -6497,9 +6427,10 @@ static boolean DAC960_V1_ExecuteUserCommand(DAC960_Controller_T *Controller,
}
else DAC960_UserCritical("Illegal User Command: '%s'\n",
Controller, UserCommand);
DAC960_AcquireControllerLock(Controller, &ProcessorFlags);
spin_lock_irqsave(&Controller->queue_lock, flags);
DAC960_DeallocateCommand(Command);
DAC960_ReleaseControllerLock(Controller, &ProcessorFlags);
spin_unlock_irqrestore(&Controller->queue_lock, flags);
return true;
}
......@@ -6562,13 +6493,14 @@ static boolean DAC960_V2_ExecuteUserCommand(DAC960_Controller_T *Controller,
{
DAC960_Command_T *Command;
DAC960_V2_CommandMailbox_T *CommandMailbox;
ProcessorFlags_T ProcessorFlags;
unsigned long flags;
unsigned char Channel, TargetID, LogicalDriveNumber;
unsigned short LogicalDeviceNumber;
DAC960_AcquireControllerLock(Controller, &ProcessorFlags);
spin_lock_irqsave(&Controller->queue_lock, flags);
while ((Command = DAC960_AllocateCommand(Controller)) == NULL)
DAC960_WaitForCommand(Controller);
DAC960_ReleaseControllerLock(Controller, &ProcessorFlags);
spin_unlock_irqrestore(&Controller->queue_lock, flags);
Controller->UserStatusLength = 0;
DAC960_V2_ClearCommand(Command);
Command->CommandType = DAC960_ImmediateCommand;
......@@ -6758,9 +6690,10 @@ static boolean DAC960_V2_ExecuteUserCommand(DAC960_Controller_T *Controller,
Controller->SuppressEnclosureMessages = true;
else DAC960_UserCritical("Illegal User Command: '%s'\n",
Controller, UserCommand);
DAC960_AcquireControllerLock(Controller, &ProcessorFlags);
spin_lock_irqsave(&Controller->queue_lock, flags);
DAC960_DeallocateCommand(Command);
DAC960_ReleaseControllerLock(Controller, &ProcessorFlags);
spin_unlock_irqrestore(&Controller->queue_lock, flags);
return true;
}
......@@ -6893,7 +6826,7 @@ static int DAC960_ProcReadUserCommand(char *Page, char **Start, off_t Offset,
DAC960_ProcWriteUserCommand implements writing /proc/rd/cN/user_command.
*/
static int DAC960_ProcWriteUserCommand(File_T *File, const char *Buffer,
static int DAC960_ProcWriteUserCommand(struct file *file, const char *Buffer,
unsigned long Count, void *Data)
{
DAC960_Controller_T *Controller = (DAC960_Controller_T *) Data;
......@@ -6921,9 +6854,9 @@ static int DAC960_ProcWriteUserCommand(File_T *File, const char *Buffer,
static void DAC960_CreateProcEntries(DAC960_Controller_T *Controller)
{
PROC_DirectoryEntry_T *StatusProcEntry;
PROC_DirectoryEntry_T *ControllerProcEntry;
PROC_DirectoryEntry_T *UserCommandProcEntry;
struct proc_dir_entry *StatusProcEntry;
struct proc_dir_entry *ControllerProcEntry;
struct proc_dir_entry *UserCommandProcEntry;
if (DAC960_ProcDirectoryEntry == NULL) {
DAC960_ProcDirectoryEntry = proc_mkdir("rd", NULL);
......
......@@ -2203,33 +2203,10 @@ static char
DAC960_Message(DAC960_UserCriticalLevel, Format, ##Arguments)
/*
Define types for some of the structures that interface with the rest
of the Linux Kernel and I/O Subsystem.
*/
typedef struct file File_T;
typedef struct block_device_operations BlockDeviceOperations_T;
typedef struct completion Completion_T;
typedef struct hd_geometry DiskGeometry_T;
typedef struct inode Inode_T;
typedef struct inode_operations InodeOperations_T;
typedef kdev_t KernelDevice_T;
typedef struct list_head ListHead_T;
typedef struct pci_dev PCI_Device_T;
typedef struct proc_dir_entry PROC_DirectoryEntry_T;
typedef unsigned long ProcessorFlags_T;
typedef struct pt_regs Registers_T;
typedef struct request IO_Request_T;
typedef request_queue_t RequestQueue_T;
typedef struct super_block SuperBlock_T;
typedef struct timer_list Timer_T;
typedef wait_queue_head_t WaitQueue_T;
struct DAC960_privdata {
DAC960_HardwareType_T HardwareType;
DAC960_FirmwareType_T FirmwareType;
irqreturn_t (*InterruptHandler)(int, void *, Registers_T *);
irqreturn_t (*InterruptHandler)(int, void *, struct pt_regs *);
unsigned int MemoryWindowSize;
};
......@@ -2295,14 +2272,14 @@ typedef struct DAC960_Command
DAC960_CommandType_T CommandType;
struct DAC960_Controller *Controller;
struct DAC960_Command *Next;
Completion_T *Completion;
struct completion *Completion;
unsigned int LogicalDriveNumber;
unsigned int BlockNumber;
unsigned int BlockCount;
unsigned int SegmentCount;
int DmaDirection;
struct scatterlist *cmd_sglist;
IO_Request_T *Request;
struct request *Request;
struct pci_dev *PciDevice;
union {
struct {
......@@ -2344,7 +2321,7 @@ typedef struct DAC960_Controller
DAC960_HardwareType_T HardwareType;
DAC960_IO_Address_T IO_Address;
DAC960_PCI_Address_T PCI_Address;
PCI_Device_T *PCIDevice;
struct pci_dev *PCIDevice;
unsigned char ControllerNumber;
unsigned char ControllerName[4];
unsigned char ModelName[20];
......@@ -2383,19 +2360,19 @@ typedef struct DAC960_Controller
boolean DriveSpinUpMessageDisplayed;
boolean MonitoringAlertMode;
boolean SuppressEnclosureMessages;
Timer_T MonitoringTimer;
struct timer_list MonitoringTimer;
struct gendisk *disks[DAC960_MaxLogicalDrives];
struct pci_pool *ScatterGatherPool;
DAC960_Command_T *FreeCommands;
unsigned char *CombinedStatusBuffer;
unsigned char *CurrentStatusBuffer;
RequestQueue_T RequestQueue;
struct request_queue RequestQueue;
spinlock_t queue_lock;
WaitQueue_T CommandWaitQueue;
WaitQueue_T HealthStatusWaitQueue;
wait_queue_head_t CommandWaitQueue;
wait_queue_head_t HealthStatusWaitQueue;
DAC960_Command_T InitialCommand;
DAC960_Command_T *Commands[DAC960_MaxDriverQueueDepth];
PROC_DirectoryEntry_T *ControllerProcEntry;
struct proc_dir_entry *ControllerProcEntry;
boolean LogicalDriveInitiallyAccessible[DAC960_MaxLogicalDrives];
void (*QueueCommand)(DAC960_Command_T *Command);
boolean (*ReadControllerConfiguration)(struct DAC960_Controller *);
......@@ -2595,85 +2572,6 @@ void dma_addr_writeql(dma_addr_t addr, void *write_address)
writel(u.wl[1], write_address + 4);
}
/*
DAC960_AcquireControllerLock acquires exclusive access to Controller.
Reference the queue_lock through the controller structure,
rather than through the request queue. These macros are
used to mutex on the controller structure during initialization,
BEFORE the request queue is allocated and initialized in
DAC960_RegisterBlockDevice().
*/
static inline
void DAC960_AcquireControllerLock(DAC960_Controller_T *Controller,
ProcessorFlags_T *ProcessorFlags)
{
spin_lock_irqsave(&Controller->queue_lock, *ProcessorFlags);
}
/*
DAC960_ReleaseControllerLock releases exclusive access to Controller.
*/
static inline
void DAC960_ReleaseControllerLock(DAC960_Controller_T *Controller,
ProcessorFlags_T *ProcessorFlags)
{
spin_unlock_irqrestore(&Controller->queue_lock, *ProcessorFlags);
}
/*
DAC960_AcquireControllerLockRF acquires exclusive access to Controller,
but is only called from the request function with the queue lock held.
*/
static inline
void DAC960_AcquireControllerLockRF(DAC960_Controller_T *Controller,
ProcessorFlags_T *ProcessorFlags)
{
}
/*
DAC960_ReleaseControllerLockRF releases exclusive access to Controller,
but is only called from the request function with the queue lock held.
*/
static inline
void DAC960_ReleaseControllerLockRF(DAC960_Controller_T *Controller,
ProcessorFlags_T *ProcessorFlags)
{
}
/*
DAC960_AcquireControllerLockIH acquires exclusive access to Controller,
but is only called from the interrupt handler.
*/
static inline
void DAC960_AcquireControllerLockIH(DAC960_Controller_T *Controller,
ProcessorFlags_T *ProcessorFlags)
{
spin_lock_irqsave(&Controller->queue_lock, *ProcessorFlags);
}
/*
DAC960_ReleaseControllerLockIH releases exclusive access to Controller,
but is only called from the interrupt handler.
*/
static inline
void DAC960_ReleaseControllerLockIH(DAC960_Controller_T *Controller,
ProcessorFlags_T *ProcessorFlags)
{
spin_unlock_irqrestore(&Controller->queue_lock, *ProcessorFlags);
}
/*
Define the DAC960 BA Series Controller Interface Register Offsets.
*/
......@@ -4230,17 +4128,18 @@ void DAC960_P_To_PD_TranslateReadWriteCommand(DAC960_V1_CommandMailbox_T
static void DAC960_FinalizeController(DAC960_Controller_T *);
static void DAC960_V1_QueueReadWriteCommand(DAC960_Command_T *);
static void DAC960_V2_QueueReadWriteCommand(DAC960_Command_T *);
static void DAC960_RequestFunction(RequestQueue_T *);
static irqreturn_t DAC960_BA_InterruptHandler(int, void *, Registers_T *);
static irqreturn_t DAC960_LP_InterruptHandler(int, void *, Registers_T *);
static irqreturn_t DAC960_LA_InterruptHandler(int, void *, Registers_T *);
static irqreturn_t DAC960_PG_InterruptHandler(int, void *, Registers_T *);
static irqreturn_t DAC960_PD_InterruptHandler(int, void *, Registers_T *);
static irqreturn_t DAC960_P_InterruptHandler(int, void *, Registers_T *);
static void DAC960_RequestFunction(struct request_queue *);
static irqreturn_t DAC960_BA_InterruptHandler(int, void *, struct pt_regs *);
static irqreturn_t DAC960_LP_InterruptHandler(int, void *, struct pt_regs *);
static irqreturn_t DAC960_LA_InterruptHandler(int, void *, struct pt_regs *);
static irqreturn_t DAC960_PG_InterruptHandler(int, void *, struct pt_regs *);
static irqreturn_t DAC960_PD_InterruptHandler(int, void *, struct pt_regs *);
static irqreturn_t DAC960_P_InterruptHandler(int, void *, struct pt_regs *);
static void DAC960_V1_QueueMonitoringCommand(DAC960_Command_T *);
static void DAC960_V2_QueueMonitoringCommand(DAC960_Command_T *);
static void DAC960_MonitoringTimerFunction(unsigned long);
static int DAC960_UserIOCTL(Inode_T *, File_T *, unsigned int, unsigned long);
static int DAC960_UserIOCTL(struct inode *, struct file *,
unsigned int, unsigned long);
static void DAC960_Message(DAC960_MessageLevel_T, unsigned char *,
DAC960_Controller_T *, ...);
static void DAC960_CreateProcEntries(DAC960_Controller_T *);
......
......@@ -1046,7 +1046,7 @@ cciss_update_non_disk_devices(int cntl_num, int hostno)
}
else {
printk(KERN_ERR "cciss: Report physical LUNs failed.\n");
return;
goto out;
}
......@@ -1091,7 +1091,7 @@ cciss_update_non_disk_devices(int cntl_num, int hostno)
}
adjust_cciss_scsi_table(cntl_num, hostno, currentsd, ncurrent);
out:
kfree(inq_buff);
kfree(ld_buff);
return;
......
......@@ -651,7 +651,8 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file,
int lo_flags = 0;
int error;
MOD_INC_USE_COUNT;
/* This is safe, since we have a reference from open(). */
__module_get(THIS_MODULE);
error = -EBUSY;
if (lo->lo_state != Lo_unbound)
......@@ -751,7 +752,8 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file,
out_putf:
fput(file);
out:
MOD_DEC_USE_COUNT;
/* This is safe: open() is still holding a reference. */
module_put(THIS_MODULE);
return error;
}
......@@ -824,7 +826,8 @@ static int loop_clr_fd(struct loop_device *lo, struct block_device *bdev)
filp->f_dentry->d_inode->i_mapping->gfp_mask = gfp;
lo->lo_state = Lo_unbound;
fput(filp);
MOD_DEC_USE_COUNT;
/* This is safe: open() is still holding a reference. */
module_put(THIS_MODULE);
return 0;
}
......
......@@ -174,7 +174,7 @@ struct ipmi_smi
int
ipmi_register_all_cmd_rcvr(ipmi_user_t user)
{
int flags;
unsigned long flags;
int rv = -EBUSY;
write_lock_irqsave(&(user->intf->users_lock), flags);
......@@ -193,7 +193,7 @@ ipmi_register_all_cmd_rcvr(ipmi_user_t user)
int
ipmi_unregister_all_cmd_rcvr(ipmi_user_t user)
{
int flags;
unsigned long flags;
int rv = -EINVAL;
write_lock_irqsave(&(user->intf->users_lock), flags);
......@@ -1023,7 +1023,7 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers,
int rv;
ipmi_smi_t new_intf;
struct list_head *entry;
unsigned int flags;
unsigned long flags;
/* Make sure the driver is actually initialized, this handles
......@@ -1148,7 +1148,7 @@ int ipmi_unregister_smi(ipmi_smi_t intf)
int rv = -ENODEV;
int i;
struct list_head *entry;
unsigned int flags;
unsigned long flags;
down_write(&interfaces_sem);
if (list_empty(&(intf->users)))
......
......@@ -522,7 +522,7 @@ static loff_t null_lseek(struct file * file, loff_t offset, int orig)
*/
static loff_t memory_lseek(struct file * file, loff_t offset, int orig)
{
int ret;
loff_t ret;
lock_kernel();
switch (orig) {
......
/*
* linux/drivers/char/pcmcia/synclink_cs.c
*
* $Id: synclink_cs.c,v 4.6 2003/04/21 17:46:55 paulkf Exp $
* $Id: synclink_cs.c,v 4.10 2003/05/13 16:06:03 paulkf Exp $
*
* Device driver for Microgate SyncLink PC Card
* multiprotocol serial adapter.
......@@ -430,7 +430,7 @@ static void rx_reset_buffers(MGSLPC_INFO *info);
static int rx_alloc_buffers(MGSLPC_INFO *info);
static void rx_free_buffers(MGSLPC_INFO *info);
static void mgslpc_isr(int irq, void *dev_id, struct pt_regs * regs);
static irqreturn_t mgslpc_isr(int irq, void *dev_id, struct pt_regs * regs);
/*
* Bottom half interrupt handlers
......@@ -476,6 +476,7 @@ static int cuamajor=0;
static int debug_level = 0;
static int maxframe[MAX_DEVICE_COUNT] = {0,};
static int dosyncppp[MAX_DEVICE_COUNT] = {1,1,1,1};
/* The old way: bit map of interrupts to choose from */
/* This means pick from 15, 14, 12, 11, 10, 9, 7, 5, 4, and 3 */
......@@ -492,11 +493,12 @@ MODULE_PARM(ttymajor,"i");
MODULE_PARM(cuamajor,"i");
MODULE_PARM(debug_level,"i");
MODULE_PARM(maxframe,"1-" __MODULE_STRING(MAX_DEVICE_COUNT) "i");
MODULE_PARM(dosyncppp,"1-" __MODULE_STRING(MAX_DEVICE_COUNT) "i");
MODULE_LICENSE("GPL");
static char *driver_name = "SyncLink PC Card driver";
static char *driver_version = "$Revision: 4.6 $";
static char *driver_version = "$Revision: 4.10 $";
static struct tty_driver serial_driver, callout_driver;
static int serial_refcount;
......@@ -574,9 +576,6 @@ static dev_link_t *mgslpc_attach(void)
link->priv = info;
/* Initialize the dev_link_t structure */
init_timer(&link->release);
link->release.function = &mgslpc_release;
link->release.data = (u_long)link;
/* Interrupt setup */
link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
......@@ -813,7 +812,7 @@ static int mgslpc_event(event_t event, int priority,
link->state &= ~DEV_PRESENT;
if (link->state & DEV_CONFIG) {
((MGSLPC_INFO *)link->priv)->stop = 1;
mod_timer(&link->release, jiffies + HZ/20);
mgslpc_release((u_long)link);
}
break;
case CS_EVENT_CARD_INSERTION:
......@@ -1356,7 +1355,7 @@ void ri_change(MGSLPC_INFO *info)
* dev_id device ID supplied during interrupt registration
* regs interrupted processor context
*/
static void mgslpc_isr(int irq, void *dev_id, struct pt_regs * regs)
static irqreturn_t mgslpc_isr(int irq, void *dev_id, struct pt_regs * regs)
{
MGSLPC_INFO * info = (MGSLPC_INFO *)dev_id;
unsigned short isr;
......@@ -1366,10 +1365,10 @@ static void mgslpc_isr(int irq, void *dev_id, struct pt_regs * regs)
if (debug_level >= DEBUG_LEVEL_ISR)
printk("mgslpc_isr(%d) entry.\n", irq);
if (!info)
return;
return IRQ_NONE;
if (!(info->link.state & DEV_CONFIG))
return;
return IRQ_HANDLED;
spin_lock(&info->lock);
......@@ -1459,6 +1458,8 @@ static void mgslpc_isr(int irq, void *dev_id, struct pt_regs * regs)
if (debug_level >= DEBUG_LEVEL_ISR)
printk("%s(%d):mgslpc_isr(%d)exit.\n",
__FILE__,__LINE__,irq);
return IRQ_HANDLED;
}
/* Initialize and start device.
......@@ -3113,8 +3114,7 @@ void mgslpc_add_device(MGSLPC_INFO *info)
if (info->line < MAX_DEVICE_COUNT) {
if (maxframe[info->line])
info->max_frame_size = maxframe[info->line];
// info->dosyncppp = dosyncppp[info->line];
info->dosyncppp = 1;
info->dosyncppp = dosyncppp[info->line];
}
mgslpc_device_count++;
......@@ -3276,7 +3276,6 @@ static void __exit synclink_cs_exit(void)
unregister_pccard_driver(&dev_info);
while (dev_list != NULL) {
del_timer(&dev_list->release);
if (dev_list->state & DEV_CONFIG)
mgslpc_release((u_long)dev_list);
mgslpc_detach(dev_list);
......
......@@ -203,6 +203,7 @@ register_slot (acpi_handle handle, u32 lvl, void *context, void **rv)
if (ACPI_FAILURE(status)) {
err("failed to register interrupt notify handler\n");
kfree(newfunc);
return status;
}
......
......@@ -222,6 +222,8 @@ int isdn_x25iface_connect_ind(struct concap_proto *cprot)
printk(KERN_WARNING
"isdn_x25iface_connect_ind while unconfigured %s\n"
, MY_DEVNAME(cprot->net_dev) );
if (skb)
dev_kfree_skb(skb);
return -1;
}
*state_p = WAN_CONNECTED;
......
......@@ -1071,6 +1071,7 @@ static void pcbit_set_msn(struct pcbit_dev *dev, char *list)
ptr->msn = kmalloc(len, GFP_ATOMIC);
if (!ptr->msn) {
printk(KERN_WARNING "kmalloc failed\n");
kfree(ptr);
return;
}
......
......@@ -278,6 +278,7 @@ int dm_hash_rename(const char *old, const char *new)
DMWARN("asked to rename to an already existing name %s -> %s",
old, new);
up_write(&_hash_lock);
kfree(new_name);
return -EBUSY;
}
......@@ -289,6 +290,7 @@ int dm_hash_rename(const char *old, const char *new)
DMWARN("asked to rename a non existent device %s -> %s",
old, new);
up_write(&_hash_lock);
kfree(new_name);
return -ENXIO;
}
......
......@@ -122,6 +122,8 @@ int dm_register_target(struct target_type *t)
list_add(&ti->list, &_targets);
up_write(&_lock);
if (rv)
kfree(ti);
return rv;
}
......
......@@ -12,6 +12,7 @@
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/fs.h>
#include <linux/miscdevice.h>
#include <asm/uaccess.h>
#include "miropcm20-rds-core.h"
......
......@@ -167,6 +167,7 @@ static int bt819_attach(struct i2c_adapter *adap, int addr , unsigned long flags
decoder = kmalloc(sizeof(struct bt819), GFP_KERNEL);
if (decoder == NULL) {
MOD_DEC_USE_COUNT;
kfree(client);
return -ENOMEM;
}
......
......@@ -311,8 +311,10 @@ static void videodev_proc_create_dev (struct video_device *vfd, char *name)
return;
p = create_proc_entry(name, S_IFREG|S_IRUGO|S_IWUSR, video_dev_proc_entry);
if (!p)
if (!p) {
kfree(d);
return;
}
p->data = vfd;
p->read_proc = videodev_proc_read;
......
......@@ -2018,15 +2018,14 @@ static int i2o_systab_send(struct i2o_controller *iop)
{
printk(KERN_ERR "%s: Unable to set SysTab (status=%#x).\n",
iop->name, -ret);
kfree(privbuf);
}
else
{
dprintk(KERN_INFO "%s: SysTab set.\n", iop->name);
kfree(privbuf);
}
i2o_status_get(iop); // Entered READY state
kfree(privbuf);
return ret;
}
......
......@@ -203,6 +203,7 @@ static struct mtd_info *cfi_intelext_setup(struct map_info *map)
if (!mtd->eraseregions) {
printk(KERN_ERR "Failed to allocate memory for MTD erase region info\n");
kfree(cfi->cmdset_priv);
kfree(mtd);
return NULL;
}
......@@ -227,6 +228,7 @@ static struct mtd_info *cfi_intelext_setup(struct map_info *map)
printk(KERN_WARNING "Sum of regions (%lx) != total size of set of interleaved chips (%lx)\n", offset, devsize);
kfree(mtd->eraseregions);
kfree(cfi->cmdset_priv);
kfree(mtd);
return NULL;
}
......
......@@ -174,6 +174,7 @@ static struct mtd_info *cfi_amdstd_setup(struct map_info *map)
if (!mtd->eraseregions) {
printk(KERN_WARNING "Failed to allocate memory for MTD erase region info\n");
kfree(cfi->cmdset_priv);
kfree(mtd);
return NULL;
}
......@@ -197,6 +198,7 @@ static struct mtd_info *cfi_amdstd_setup(struct map_info *map)
printk(KERN_WARNING "Sum of regions (%lx) != total size of set of interleaved chips (%lx)\n", offset, devsize);
kfree(mtd->eraseregions);
kfree(cfi->cmdset_priv);
kfree(mtd);
return NULL;
}
#if 0
......
......@@ -116,8 +116,10 @@ struct mtd_info *sharp_probe(struct map_info *map)
return NULL;
sharp = kmalloc(sizeof(*sharp), GFP_KERNEL);
if(!sharp)
if(!sharp) {
kfree(mtd);
return NULL;
}
memset(mtd, 0, sizeof(*mtd));
......
......@@ -1630,16 +1630,21 @@ static void set_multicast_list(struct net_device *dev)
}
static int set_mac_address(struct net_device *dev, void *addr)
static int set_mac_address(struct net_device *dev, void *p)
{
int i;
struct sockaddr *addr = p;
if (netif_running(dev))
return -EBUSY;
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
if (net_debug) {
printk("%s: Setting MAC address to ", dev->name);
for (i = 0; i < 6; i++)
printk(" %2.2x", dev->dev_addr[i] = ((unsigned char *)addr)[i]);
for (i = 0; i < dev->addr_len; i++)
printk(" %2.2x", dev->dev_addr[i]);
printk(".\n");
}
/* set the Ethernet address */
......
......@@ -287,7 +287,8 @@ int copy_strings_kernel(int argc,char ** argv, struct linux_binprm *bprm)
*
* tsk->mmap_sem is held for writing.
*/
void put_dirty_page(struct task_struct * tsk, struct page *page, unsigned long address)
void put_dirty_page(struct task_struct *tsk, struct page *page,
unsigned long address, pgprot_t prot)
{
pgd_t * pgd;
pmd_t * pmd;
......@@ -295,7 +296,8 @@ void put_dirty_page(struct task_struct * tsk, struct page *page, unsigned long a
struct pte_chain *pte_chain;
if (page_count(page) != 1)
printk(KERN_ERR "mem_map disagrees with %p at %08lx\n", page, address);
printk(KERN_ERR "mem_map disagrees with %p at %08lx\n",
page, address);
pgd = pgd_offset(tsk->mm, address);
pte_chain = pte_chain_alloc(GFP_KERNEL);
......@@ -314,7 +316,7 @@ void put_dirty_page(struct task_struct * tsk, struct page *page, unsigned long a
}
lru_cache_add_active(page);
flush_dcache_page(page);
set_pte(pte, pte_mkdirty(pte_mkwrite(mk_pte(page, PAGE_COPY))));
set_pte(pte, pte_mkdirty(pte_mkwrite(mk_pte(page, prot))));
pte_chain = page_add_rmap(page, pte, pte_chain);
pte_unmap(pte);
tsk->mm->rss++;
......@@ -421,7 +423,8 @@ int setup_arg_pages(struct linux_binprm *bprm)
struct page *page = bprm->page[i];
if (page) {
bprm->page[i] = NULL;
put_dirty_page(current,page,stack_base);
put_dirty_page(current, page, stack_base,
mpnt->vm_page_prot);
}
stack_base += PAGE_SIZE;
}
......@@ -434,8 +437,6 @@ int setup_arg_pages(struct linux_binprm *bprm)
#else
#define put_dirty_page(tsk, page, address)
#define setup_arg_pages(bprm) (0)
static inline void free_arg_pages(struct linux_binprm *bprm)
{
int i;
......
......@@ -19,6 +19,14 @@
#define check_apicid_used(bitmap, apicid) (bitmap & (1 << apicid))
#define check_apicid_present(bit) (phys_cpu_present_map & (1 << bit))
#define APIC_ID_MASK (0xF<<24)
static inline unsigned get_apic_id(unsigned long x)
{
return (((x)>>24)&0xF);
}
#define GET_APIC_ID(x) get_apic_id(x)
static inline int apic_id_registered(void)
{
return (test_bit(GET_APIC_ID(apic_read(APIC_ID)),
......
......@@ -426,7 +426,8 @@ extern int handle_mm_fault(struct mm_struct *mm,struct vm_area_struct *vma, unsi
extern int make_pages_present(unsigned long addr, unsigned long end);
extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write);
extern long sys_remap_file_pages(unsigned long start, unsigned long size, unsigned long prot, unsigned long pgoff, unsigned long nonblock);
void put_dirty_page(struct task_struct *tsk, struct page *page,
unsigned long address, pgprot_t prot);
int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start,
int len, int write, int force, struct page **pages, struct vm_area_struct **vmas);
......
......@@ -74,10 +74,6 @@ static inline int on_each_cpu(void (*func) (void *info), void *info,
*/
extern int smp_threads_ready;
extern volatile unsigned long smp_msg_data;
extern volatile int smp_src_cpu;
extern volatile int smp_msg_id;
#define MSG_ALL_BUT_SELF 0x8000 /* Assume <32768 CPU's */
#define MSG_ALL 0x8001
......
......@@ -79,10 +79,10 @@ typedef struct {
do { \
CHECK_LOCK(x); \
if ((x)->lock&&(x)->babble) { \
(x)->babble--; \
printk("%s:%d: spin_lock(%s:%p) already locked by %s/%d\n", \
__FILE__,__LINE__, (x)->module, \
(x), (x)->owner, (x)->oline); \
(x)->babble--; \
} \
(x)->lock = 1; \
(x)->owner = __FILE__; \
......@@ -95,10 +95,10 @@ typedef struct {
({ \
CHECK_LOCK(x); \
if ((x)->lock&&(x)->babble) { \
(x)->babble--; \
printk("%s:%d: spin_is_locked(%s:%p) already locked by %s/%d\n", \
__FILE__,__LINE__, (x)->module, \
(x), (x)->owner, (x)->oline); \
(x)->babble--; \
} \
0; \
})
......@@ -109,10 +109,10 @@ typedef struct {
({ \
CHECK_LOCK(x); \
if ((x)->lock&&(x)->babble) { \
(x)->babble--; \
printk("%s:%d: spin_trylock(%s:%p) already locked by %s/%d\n", \
__FILE__,__LINE__, (x)->module, \
(x), (x)->owner, (x)->oline); \
(x)->babble--; \
} \
(x)->lock = 1; \
(x)->owner = __FILE__; \
......@@ -124,10 +124,10 @@ typedef struct {
do { \
CHECK_LOCK(x); \
if ((x)->lock&&(x)->babble) { \
(x)->babble--; \
printk("%s:%d: spin_unlock_wait(%s:%p) owned by %s/%d\n", \
__FILE__,__LINE__, (x)->module, (x), \
(x)->owner, (x)->oline); \
(x)->babble--; \
}\
} while (0)
......@@ -135,9 +135,9 @@ typedef struct {
do { \
CHECK_LOCK(x); \
if (!(x)->lock&&(x)->babble) { \
(x)->babble--; \
printk("%s:%d: spin_unlock(%s:%p) not locked\n", \
__FILE__,__LINE__, (x)->module, (x));\
(x)->babble--; \
} \
(x)->lock = 0; \
} while (0)
......
......@@ -1080,7 +1080,7 @@ snd_info_entry_t *snd_info_create_device(const char *name, unsigned int number,
entry->p = p;
up(&info_mutex);
if (strncmp(name, "controlC", 8) == 0) /* created in sound.c */
if (strncmp(name, "controlC", 8) != 0) /* created in sound.c */
devfs_mk_cdev(MKDEV(_major, minor), mode, "snd/%s", name);
return entry;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment