Commit 946f68b9 authored by Andrew Morton's avatar Andrew Morton Committed by Christoph Hellwig

[PATCH] DAC960 patch to entry points with a new fix

From: Dave Olien <dmo@osdl.org>

Christoph submitted a patch to linus last week fixing up some DAC960 driver
entry points.  That patch will OOPS during boot on version 2 controller
types.  Christoph's version of the disk_size() function was dereferencing
a NULL pointer in it's "else" clause.

Christoph's patch hasn't appeared in linus's BK tree yet.  So, I'm
resending Christoph's orignal patch with my fix to disk_size() included.
This patch can be applied to the driver in Linus's BK tree from April 28.

Here's Christoph's original description of his patch:

Some grepping showed that DAC960's open routine was duplicating parts
of check_disk_change().  I went on fixing this by implementing a
media_changed method and making DAC960_Open use it.  While looking
at the surrounding code I noticed that

  (a) all methods weren't using the private data the upperlayer
      hands to it properly, but instead using kdev_t-based indexes
  (b) DAC960_Open/DAC960_Release was keeping never used counters
  (c) DAC960_Open was doing tons of checks the upperlayer already does
  (d) DAC960_Release was entirely superflous.

The patch below corrects that and rewrites the block entry points
into readable code - 100 LOC are gone and the same amount replaced
by readable code.
parent 9af8670a
This diff is collapsed.
...@@ -2364,7 +2364,6 @@ typedef struct DAC960_Controller ...@@ -2364,7 +2364,6 @@ typedef struct DAC960_Controller
unsigned short MaxBlocksPerCommand; unsigned short MaxBlocksPerCommand;
unsigned short ControllerScatterGatherLimit; unsigned short ControllerScatterGatherLimit;
unsigned short DriverScatterGatherLimit; unsigned short DriverScatterGatherLimit;
unsigned int ControllerUsageCount;
u64 BounceBufferLimit; u64 BounceBufferLimit;
unsigned int CombinedStatusBufferLength; unsigned int CombinedStatusBufferLength;
unsigned int InitialStatusLength; unsigned int InitialStatusLength;
...@@ -2397,7 +2396,6 @@ typedef struct DAC960_Controller ...@@ -2397,7 +2396,6 @@ typedef struct DAC960_Controller
DAC960_Command_T InitialCommand; DAC960_Command_T InitialCommand;
DAC960_Command_T *Commands[DAC960_MaxDriverQueueDepth]; DAC960_Command_T *Commands[DAC960_MaxDriverQueueDepth];
PROC_DirectoryEntry_T *ControllerProcEntry; PROC_DirectoryEntry_T *ControllerProcEntry;
unsigned int LogicalDriveUsageCount[DAC960_MaxLogicalDrives];
boolean LogicalDriveInitiallyAccessible[DAC960_MaxLogicalDrives]; boolean LogicalDriveInitiallyAccessible[DAC960_MaxLogicalDrives];
void (*QueueCommand)(DAC960_Command_T *Command); void (*QueueCommand)(DAC960_Command_T *Command);
boolean (*ReadControllerConfiguration)(struct DAC960_Controller *); boolean (*ReadControllerConfiguration)(struct DAC960_Controller *);
...@@ -4242,9 +4240,6 @@ static irqreturn_t DAC960_P_InterruptHandler(int, void *, Registers_T *); ...@@ -4242,9 +4240,6 @@ static irqreturn_t DAC960_P_InterruptHandler(int, void *, Registers_T *);
static void DAC960_V1_QueueMonitoringCommand(DAC960_Command_T *); static void DAC960_V1_QueueMonitoringCommand(DAC960_Command_T *);
static void DAC960_V2_QueueMonitoringCommand(DAC960_Command_T *); static void DAC960_V2_QueueMonitoringCommand(DAC960_Command_T *);
static void DAC960_MonitoringTimerFunction(unsigned long); static void DAC960_MonitoringTimerFunction(unsigned long);
static int DAC960_Open(Inode_T *, File_T *);
static int DAC960_Release(Inode_T *, File_T *);
static int DAC960_IOCTL(Inode_T *, File_T *, unsigned int, unsigned long);
static int DAC960_UserIOCTL(Inode_T *, File_T *, unsigned int, unsigned long); static int DAC960_UserIOCTL(Inode_T *, File_T *, unsigned int, unsigned long);
static void DAC960_Message(DAC960_MessageLevel_T, unsigned char *, static void DAC960_Message(DAC960_MessageLevel_T, unsigned char *,
DAC960_Controller_T *, ...); DAC960_Controller_T *, ...);
......
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