Re: [PATCH 1/32] ide-tape: move historical changelog to Documentation/ide/ChangeLog.ide-tape.1995-2002

2008-01-27 Thread Bartlomiej Zolnierkiewicz
On Sunday 27 January 2008, Borislav Petkov wrote:
 Also, cleanup whitespace and update comments.
 
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]

applied with some changes

 ---
  Documentation/ide/ChangeLog.ide-tape.1995-2002 |  405 +++
  drivers/ide/ide-tape.c |  414 
 +---
  2 files changed, 409 insertions(+), 410 deletions(-)
 
 diff --git a/Documentation/ide/ChangeLog.ide-tape.1995-2002 
 b/Documentation/ide/ChangeLog.ide-tape.1995-2002
 new file mode 100644
 index 000..e406762
 --- /dev/null
 +++ b/Documentation/ide/ChangeLog.ide-tape.1995-2002
 @@ -0,0 +1,405 @@
 +/*
 + * IDE ATAPI streaming tape driver.
 + *
 + * This driver is a part of the Linux ide driver and works in co-operation
 + * with drivers/block/ide.c.

I removed incorrect reference to drivers/block/ide.c

 + * The driver, in co-operation with ide.c, basically traverses the
 + * request-list for the block device interface. The character device
 + * interface, on the other hand, creates new requests, adds them
 + * to the request-list of the block device, and waits for their completion.
 + *
 + * Pipelined operation mode is now supported on both reads and writes.
 + *
 + * The block device major and minor numbers are determined from the
 + * tape's relative position in the ide interfaces, as explained in ide.c.
 + *
 + * The character device interface consists of the following devices:
 + *
 + * ht0   major 37, minor 0   first  IDE tape, rewind on 
 close.
 + * ht1   major 37, minor 1   second IDE tape, rewind on 
 close.
 + * ...
 + * nht0  major 37, minor 128 first  IDE tape, no rewind on 
 close.
 + * nht1  major 37, minor 129 second IDE tape, no rewind on 
 close.
 + * ...
 + *
 + * The general magnetic tape commands compatible interface, as defined by
 + * include/linux/mtio.h, is accessible through the character device.
 + *
 + * General ide driver configuration options, such as the interrupt-unmask
 + * flag, can be configured by issuing an ioctl to the block device interface,
 + * as any other ide device.
 + *
 + * Our own ide-tape ioctl's can be issued to either the block device or
 + * the character device interface.
 + *
 + * Maximal throughput with minimal bus load will usually be achieved in the
 + * following scenario:
 + *
 + *   1.  ide-tape is operating in the pipelined operation mode.
 + *   2.  No buffering is performed by the user backup program.

the above is not the part of the changelog

[...]

 + * Here are some words from the first releases of hd.c, which are quoted
 + * in ide.c and apply here as well:
 + *
 + * | Special care is recommended.  Have Fun!

[...]

ditto

 + * An overview of the pipelined operation mode.
 + *
 + * In the pipelined write mode, we will usually just add requests to our
 + * pipeline and return immediately, before we even start to service them. The
 + * user program will then have enough time to prepare the next request while
 + * we are still busy servicing previous requests. In the pipelined read mode,
 + * the situation is similar - we add read-ahead requests into the pipeline,
 + * before the user even requested them.
 + *
 + * The pipeline can be viewed as a safety net which will be activated when
 + * the system load is high and prevents the user backup program from keeping 
 up
 + * with the current tape speed. At this point, the pipeline will get
 + * shorter and shorter but the tape will still be streaming at the same 
 speed.
 + * Assuming we have enough pipeline stages, the system load will hopefully
 + * decrease before the pipeline is completely empty, and the backup program
 + * will be able to catch up and refill the pipeline again.
 + *
 + * When using the pipelined mode, it would be best to disable any type of
 + * buffering done by the user program, as ide-tape already provides all the
 + * benefits in the kernel, where it can be done in a more efficient way.
 + * As we will usually not block the user program on a request, the most
 + * efficient user code will then be a simple read-write-read-... cycle.
 + * Any additional logic will usually just slow down the backup process.
 + *
 + * Using the pipelined mode, I get a constant over 400 KBps throughput,
 + * which seems to be the maximum throughput supported by my tape.
 + *
 + * However, there are some downfalls:
 + *
 + *   1.  We use memory (for data buffers) in proportional to the number
 + *   of pipeline stages (each stage is about 26 KB with my tape).
 + *   2.  In the pipelined write mode, we cheat and postpone error codes
 + *   to the user task. In read mode, the actual tape position
 + *   will be a bit further than the last requested block.
 + *
 + * Concerning (1):
 + *
 + *   1.  We allocate stages dynamically only when we need them. When
 + *   we don't need them, we don't consume additional memory. In
 + *   

Re: [PATCH 3/32] ide-tape: remove struct idetape_request_sense_result_t

2008-01-27 Thread Bartlomiej Zolnierkiewicz
On Sunday 27 January 2008, Borislav Petkov wrote:
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
 ---
  drivers/ide/ide-tape.c |   83 +++
  1 files changed, 27 insertions(+), 56 deletions(-)

applied with minor changes

 diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
 index 3bedeb8..173ac0d 100644
 --- a/drivers/ide/ide-tape.c
 +++ b/drivers/ide/ide-tape.c

[...]

   /*
 -  * If error was the result of a zero-length read or write command,
 -  * with sense key=5, asc=0x22, ascq=0, let it slide.  Some drives
 -  * (i.e. Seagate STT3401A Travan) don't support 0-length read/writes.
 +  * If error was the result of a zero-length read or write command, with
 +  * sense key=5, asc=0x22, ascq=0, let it slide.  Some drives (i.e.
 +  * Seagate STT3401A Travan) don't support 0-length read/writes.
*/

This chunk is unnecessary, I dropped it.

   if ((pc-c[0] == IDETAPE_READ_CMD || pc-c[0] == IDETAPE_WRITE_CMD)
 -  pc-c[4] == 0  pc-c[3] == 0  pc-c[2] == 0) { /* length==0 
 */
 - if (result-sense_key == 5) {
 + /* length==0 */
 +  pc-c[4] == 0  pc-c[3] == 0  pc-c[2] == 0) {
 + if (tape-sense_key == 5) {
   /* don't report an error, everything's ok */
   pc-error = 0;
   /* don't retry read/write */
   set_bit(PC_ABORT, pc-flags);
   }
   }
 - if (pc-c[0] == IDETAPE_READ_CMD  result-filemark) {
 + if (pc-c[0] == IDETAPE_READ_CMD  !!(sense[2]  0x80)) {

needless !! removed

   pc-error = IDETAPE_ERROR_FILEMARK;
   set_bit(PC_ABORT, pc-flags);
   }
   if (pc-c[0] == IDETAPE_WRITE_CMD) {
 - if (result-eom ||
 - (result-sense_key == 0xd  result-asc == 0x0 
 -  result-ascq == 0x2)) {
 + if (!!(sense[2]  0x40) ||

ditto
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 06/32] ide-tape: remove IDETAPE_DEBUG_BUGS

2008-01-27 Thread Bartlomiej Zolnierkiewicz
On Sunday 27 January 2008, Borislav Petkov wrote:
 From: Borislav Petkov [EMAIL PROTECTED]
 
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]

applied

 ---
  drivers/ide/ide-tape.c |   42 ++
  1 files changed, 2 insertions(+), 40 deletions(-)
 
 diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
 index dbececc..efb9d25 100644
 --- a/drivers/ide/ide-tape.c
 +++ b/drivers/ide/ide-tape.c
 @@ -107,7 +107,6 @@ typedef struct os_dat_s {
   *   The following are used to debug the driver:
   *
   *   Setting IDETAPE_DEBUG_LOG to 1 will log driver flow control.
 - *   Setting IDETAPE_DEBUG_BUGS to 1 will enable self-sanity checks in
   *   some places.

the above line should also go away (I removed it while merging the patch)
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 22/32] ide-tape: struct idetape_packet_command_s: shorten member names

2008-01-27 Thread Bartlomiej Zolnierkiewicz
On Sunday 27 January 2008, Borislav Petkov wrote:
 From: Borislav Petkov [EMAIL PROTECTED]
 
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
 ---
  drivers/ide/ide-tape.c |   88 ---
  1 files changed, 45 insertions(+), 43 deletions(-)
 
 diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
 index b487d56..4690f71 100644
 --- a/drivers/ide/ide-tape.c
 +++ b/drivers/ide/ide-tape.c
 @@ -193,24 +193,25 @@ struct idetape_bh {
   char *b_data;
  };
  
 -/*
 - *   Our view of a packet command.
 - */
  typedef struct idetape_packet_command_s {
 - u8 c[12];   /* Actual packet bytes */
 - int retries;/* On each retry, we increment 
 retries */
 - int error;  /* Error code */
 - int request_transfer;   /* Bytes to transfer */
 - int actually_transferred;   /* Bytes actually transferred */
 - int buffer_size;/* Size of our data buffer */
 + u8 c[12];   /* Actual packet bytes */
 + int retries;/* On each retry, we increment retries */
 + int error;  /* Error code */
 + int rq_xfer;/* Request bytes to transfer */
 + int xferred;/* Bytes actually transferred */
 + int buf_size;   /* Size of our data buffer */
   struct idetape_bh *bh;
   char *b_data;
   int b_count;
 - u8 *buffer; /* Data buffer */
 - u8 *current_position;   /* Pointer into the above 
 buffer */
 - ide_startstop_t (*callback) (ide_drive_t *);/* Called when this 
 packet command is completed */
 + u8 *buffer; /* Data buffer */
 + u8 *cur_pos;/* Pointer into the above buffer */
 +
 + /* Called when this packet command is completed */
 + ide_startstop_t (*callback) (ide_drive_t *);
   u8 pc_buffer[IDETAPE_PC_BUFFER_SIZE];   /* Temporary buffer */
 - unsigned long flags;/* Status/Action bit flags: 
 long for set_bit */
 +
 + /* Status/Action bit flags: long for set_bit */
 + unsigned long flags;
  } idetape_pc_t;

ide-{floppy,scsi} are using 'request_transfer', 'actually_transferred',
'buffer_size' and 'current_position' in their packet command structures.

We are going to unify ATAPI packet command handling for all ATAPI
device drivers and this patch is a change in the opposite direction.
(IOW I suggest to drop it until ATAPI handling gets unified). 

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 10/32] ide-tape: remove struct idetape_read_position_result_t

2008-01-27 Thread Bartlomiej Zolnierkiewicz
On Sunday 27 January 2008, Borislav Petkov wrote:
 From: Borislav Petkov [EMAIL PROTECTED]
 
 There should be no functional changes resulting from this patch.
 
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
 ---
  drivers/ide/ide-tape.c |   49 +--
  1 files changed, 18 insertions(+), 31 deletions(-)

[...]
  
 -static ide_startstop_t idetape_read_position_callback (ide_drive_t *drive)
 +static ide_startstop_t idetape_read_position_callback(ide_drive_t *drive)
  {
   idetape_tape_t *tape = drive-driver_data;
 - idetape_read_position_result_t *result;
 + u8 *readpos = tape-pc-buffer;
  
   debug_log(DBG_PROCS, Enter %s\n, __func__);
  
   if (!tape-pc-error) {
 - result = (idetape_read_position_result_t *) tape-pc-buffer;
 - debug_log(DBG_SENSE, BOP - %s\n, result-bop ? Yes : No);
 - debug_log(DBG_SENSE, EOP - %s\n, result-eop ? Yes : No);
 + debug_log(DBG_SENSE, BOP - %s\n,
 + !!(readpos[0]  0x80) ? Yes : No);
 + debug_log(DBG_SENSE, EOP - %s\n,
 + !!(readpos[0]  0x40) ? Yes : No);
 +
 + if (!!(readpos[0]  0x4)) {
 + printk(KERN_INFO ide-tape: Block location is unknown
 + to the tape\n);

all !! above are unnecessary

Otherwise is fine but depends on patch #7 so I couldn't merge it
(please move this patch near the beginning of the series).

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/32] ide-tape redux v1

2008-01-27 Thread Bartlomiej Zolnierkiewicz

Hi,

On Sunday 27 January 2008, Borislav Petkov wrote:
 Hi Bart,
 
 after a lot of hammering ide-tape got pimped pretty considerably (ca. 600 
 lines
 shorter and slicker :)). I'm sure there's more to be done like, e.g. replacing

Good work. :)

 the BKL in idetape_write_release() with finer-grained locking etc, probably 
 also
 some pipeline improvements, removal of OnStream support, etc. but that'll come
 later.

On-Stream support has been long gone but it seems that deprecation
warning etc. managed to survive.

w.r.t. to the pipeline-mode: it should be pipelined into /dev/null

rationale:
- it is _very_ complex
- causes errors to be deferred till the next user-space access
- direct I/O using blk_rq_map_user() will offer superior performance

the only question is whether to remove it...

  Documentation/ide/ChangeLog.ide-tape.1995-2002 |  405 +++
  drivers/ide/Kconfig|3 +-
  drivers/ide/ide-tape.c | 4146 
 +---
  3 files changed, 1991 insertions(+), 2563 deletions(-)

applied #1-6, #8-9, #11-20, #29, #31

#10, #24 and #25 are also fine but since they depend on other patches
I couldn't merge them immediately

#7 and #21 need some recasting

#22 should be deferred for now

#26-28, #30 and #32 are still to be reviewed

BTW what happend to patch #23?

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 25/32] ide-tape: simplify code branching in the interrupt handler

2008-01-27 Thread Bartlomiej Zolnierkiewicz
On Sunday 27 January 2008, Borislav Petkov wrote:
 From: Borislav Petkov [EMAIL PROTECTED]
 
 ... by adding a new typedef function pointer idetape_io_buf in order to call
 the proper buffer i/o handler depending on the data direction.
 
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
 ---
  drivers/ide/ide-tape.c |   54 +--
  1 files changed, 29 insertions(+), 25 deletions(-)

[...]

 +typedef void idetape_io_buf(ide_drive_t *, idetape_pc_t *, uint);

'uint' - 'unsigned int'

[...]

Otherwise this patch is fine but depends on other patches needing rework
(please move it near the beginning of the series).

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 31/32] ide-tape: remove idetape_config_t typedef

2008-01-27 Thread Bartlomiej Zolnierkiewicz
On Sunday 27 January 2008, Borislav Petkov wrote:
 From: Borislav Petkov [EMAIL PROTECTED]
 
 Since this is used only in idetape_blkdev_ioctl(), remove the typedef and make
 the struct function-local.
 
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]

applied

 ---
  drivers/ide/ide-tape.c |   23 +++
  1 files changed, 11 insertions(+), 12 deletions(-)
 
 diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
 index c22d7f6..424879d 100644
 --- a/drivers/ide/ide-tape.c
 +++ b/drivers/ide/ide-tape.c
 @@ -540,15 +540,6 @@ struct idetape_id_gcw {
  #define  IDETAPE_CAPABILITIES_PAGE   0x2a
  
  /*
 - *   Run time configurable parameters.
 - */
 -typedef struct {
 - int dsc_rw_frequency;
 - int dsc_media_access_frequency;
 - int nr_stages;
 -} idetape_config_t;
 -
 -/*
   *   The variables below are used for the character device interface.
   *   Additional state variables are defined in our ide_drive_t structure.
   */
 @@ -2742,14 +2733,21 @@ static int idetape_rewind_tape (ide_drive_t *drive)
  static int idetape_blkdev_ioctl(ide_drive_t *drive, unsigned int cmd, 
 unsigned long arg)
  {
   idetape_tape_t *tape = drive-driver_data;
 - idetape_config_t config;
 +
 + struct idetape_config {
 + int dsc_rw_frequency;
 + int dsc_media_access_frequency;
 + int nr_stages;
 + } config;
 +
   void __user *argp = (void __user *)arg;
  
   debug_log(DBG_PROCS, Enter %s\n, __func__);
  
   switch (cmd) {
   case 0x0340:
 - if (copy_from_user(config, argp, sizeof 
 (idetape_config_t)))
 + if (copy_from_user(config, argp,
 + sizeof(struct idetape_config)))

s/sizeof(struct idetape_config)/sizeof(config)/ so it fits nicely in one line

   return -EFAULT;
   tape-best_dsc_rw_freq = config.dsc_rw_frequency;
   tape-max_stages = config.nr_stages;
 @@ -2757,7 +2755,8 @@ static int idetape_blkdev_ioctl(ide_drive_t *drive, 
 unsigned int cmd, unsigned l
   case 0x0350:
   config.dsc_rw_frequency = (int) tape-best_dsc_rw_freq;
   config.nr_stages = tape-max_stages; 
 - if (copy_to_user(argp, config, sizeof 
 (idetape_config_t)))
 + if (copy_to_user(argp, config,
 + sizeof(struct idetape_config)))

ditto
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 07/32] ide-tape: refactor the debug logging facility

2008-01-27 Thread Bartlomiej Zolnierkiewicz
On Sunday 27 January 2008, Borislav Petkov wrote:
 From: Borislav Petkov [EMAIL PROTECTED]
 
 Teach the debug logging macro to differentiate different log levels based on 
 the
 type of debug level enabled specifically instead of a threshold-based one.
 Thus, convert tape-debug_level to a bitmask that is written to over /proc.

This warrants rename of the setting from debug_level to debug_mask.

 Also,
 - Cleanup and simplify debug macro thus removing a lot of code lines,
 - Get rid of unused debug levels,
 - Adjust the loglevel at several places where it was simply missing (e.g.
 idetape_chrdev_open() etc.)
 
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
 ---
  drivers/ide/ide-tape.c |  310 
 +---
  1 files changed, 107 insertions(+), 203 deletions(-)
 
 diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
 index efb9d25..a2e7df0 100644
 --- a/drivers/ide/ide-tape.c
 +++ b/drivers/ide/ide-tape.c
 @@ -103,24 +103,27 @@ typedef struct os_dat_s {
  #define IDETAPE_MAX_PIPELINE_STAGES  400
  #define IDETAPE_INCREASE_STAGES_RATE  20
  
 -/*
 - *   The following are used to debug the driver:
 - *
 - *   Setting IDETAPE_DEBUG_LOG to 1 will log driver flow control.
 - *   some places.
 - *
 - *   Setting them to 0 will restore normal operation mode:
 - *
 - *   1.  Disable logging normal successful operations.
 - *   2.  Disable self-sanity checks.
 - *   3.  Errors will still be logged, of course.
 - *
 - *   All the #if DEBUG code will be removed some day, when the driver
 - *   is verified to be stable enough. This will make it much more
 - *   esthetic.
 - */
 +enum {
 + DBG_ERR =   (1  0),
 + DBG_SENSE = (1  1),
 + DBG_CHRDEV =(1  2),
 + DBG_PROCS = (1  3),
 + DBG_PCRQ_STACK =(1  4),
 +};
 +
 +/* define to see debug info */
  #define IDETAPE_DEBUG_LOG0
  
 +#if IDETAPE_DEBUG_LOG
 +#define debug_log(lvl, fmt, args...) \
 +{\
 + if (tape-debug_level  lvl)\
 + printk(KERN_INFO ide-tape:  fmt, ## args) \
 +}
 +#else
 +#define debug_log(lvl, fmt, args...) do {} while (0)
 +#endif
 +

with IDETAPE_DEBUG_LOG defined to 1:

drivers/ide/ide-tape.c: In function ‘idetape_next_pc_storage’:
drivers/ide/ide-tape.c:929: error: expected ‘;’ before ‘}’ token
drivers/ide/ide-tape.c: In function ‘idetape_next_rq_storage’:
drivers/ide/ide-tape.c:953: error: expected ‘;’ before ‘}’ token
drivers/ide/ide-tape.c: In function ‘idetape_analyze_error’:
drivers/ide/ide-tape.c:988: error: expected ‘;’ before ‘}’ token
drivers/ide/ide-tape.c: In function ‘idetape_active_next_stage’:
drivers/ide/ide-tape.c:1045: warning: format ‘%f’ expects type ‘double’, but 
argument 2 has type ‘const char *’
drivers/ide/ide-tape.c:1045: error: expected ‘;’ before ‘}’ token
drivers/ide/ide-tape.c: In function ‘idetape_increase_max_pipeline_stages’:
drivers/ide/ide-tape.c:1073: error: expected ‘;’ before ‘}’ token
drivers/ide/ide-tape.c: In function ‘idetape_remove_stage_head’:
drivers/ide/ide-tape.c:1119: error: expected ‘;’ before ‘}’ token
drivers/ide/ide-tape.c: In function ‘idetape_abort_pipeline’:
drivers/ide/ide-tape.c:1154: error: expected ‘;’ before ‘}’ token
drivers/ide/ide-tape.c: In function ‘idetape_end_request’:
drivers/ide/ide-tape.c:1182: error: expected ‘;’ before ‘}’ token
drivers/ide/ide-tape.c: In function ‘idetape_request_sense_callback’:
drivers/ide/ide-tape.c:1247: error: expected ‘;’ before ‘}’ token
drivers/ide/ide-tape.c: In function ‘idetape_postpone_request’:
drivers/ide/ide-tape.c:1333: error: expected ‘;’ before ‘}’ token
drivers/ide/ide-tape.c: In function ‘idetape_pc_intr’:
drivers/ide/ide-tape.c:1359: error: expected ‘;’ before ‘}’ token
drivers/ide/ide-tape.c:1392: error: expected ‘;’ before ‘}’ token
drivers/ide/ide-tape.c:1398: error: expected ‘;’ before ‘}’ token
drivers/ide/ide-tape.c:1418: error: expected ‘;’ before ‘}’ token
drivers/ide/ide-tape.c:1424: error: expected ‘;’ before ‘}’ token
drivers/ide/ide-tape.c:1481: error: expected ‘;’ before ‘}’ token
drivers/ide/ide-tape.c:1505: error: expected ‘;’ before ‘}’ token
drivers/ide/ide-tape.c: In function ‘idetape_issue_packet_command’:
drivers/ide/ide-tape.c:1640: error: expected ‘;’ before ‘}’ token
drivers/ide/ide-tape.c: In function ‘idetape_pc_callback’:
drivers/ide/ide-tape.c:1679: error: expected ‘;’ before ‘}’ token
drivers/ide/ide-tape.c: In function ‘idetape_rw_callback’:
drivers/ide/ide-tape.c:1810: error: expected ‘;’ before ‘}’ token
drivers/ide/ide-tape.c: In function ‘idetape_do_request’:
drivers/ide/ide-tape.c:1886: error: expected ‘;’ before ‘}’ token
drivers/ide/ide-tape.c: In function ‘idetape_kmalloc_stage’:
drivers/ide/ide-tape.c:2079: error: expected ‘;’ before ‘}’ token
drivers/ide/ide-tape.c: In function ‘idetape_add_stage_tail’:
drivers/ide/ide-tape.c:2179: error: 

Re: [PATCH 08/32] ide-tape: remove struct idetape_capabilities_page_t

2008-01-27 Thread Bartlomiej Zolnierkiewicz
On Sunday 27 January 2008, Borislav Petkov wrote:
 From: Borislav Petkov [EMAIL PROTECTED]
 
 All those 2-byte values denoting the different capabilities are being written 
 to
 the local copy of the caps buffer without being converted to big endian for
 simplicity of usage and shorter code later.  Also, we add some comments 
 stating
 which are the fields of the caps page in question in order to alleviate the
 cryptic pointer casting exercises as in e.g. idetape_get_mode_sense_results().
 
 There should be no functional changes resulting from this patch.
 
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]

applied

 ---
  drivers/ide/ide-tape.c |  143 
 +++-
  1 files changed, 57 insertions(+), 86 deletions(-)

[...]

 - tape-capabilities = *capabilities; /* Save us a copy */
 - if (capabilities-blk512)
 + memcpy(tape-caps, caps, 20);
 + if (!!(caps[7]  0x02))
   tape-tape_block_size = 512;
 - else if (capabilities-blk1024)
 + else if (!!(caps[7]  0x04))
   tape-tape_block_size = 1024;
 +

I removed needless !! and extra newline while merging the patch.
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 29/32] ide-tape: remove mtio.h related comments

2008-01-27 Thread Bartlomiej Zolnierkiewicz
On Sunday 27 January 2008, Borislav Petkov wrote:
 From: Borislav Petkov [EMAIL PROTECTED]
 
 Those are already in mtio.h.
 
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]

applied

 ---
  drivers/ide/ide-tape.c |   96 +++
  1 files changed, 15 insertions(+), 81 deletions(-)

[...]

 -static int idetape_chrdev_ioctl (struct inode *inode, struct file *file, 
 unsigned int cmd, unsigned long arg)
 +static int idetape_chrdev_ioctl(struct inode *inode, struct file *file,
 + uint cmd, ulong arg)

I undid this change

lets stick to 'unsigned int' and 'unsigned long' like 99% of the kernel code
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 24/32] ide-tape: remove unreachable code chunk

2008-01-27 Thread Bartlomiej Zolnierkiewicz
On Sunday 27 January 2008, Borislav Petkov wrote:
 From: Borislav Petkov [EMAIL PROTECTED]
 
 tape-speed_ctl is set to 1 in idetape_setup(), but, in calculate_speeds() its
 value is tested for being 0, 1, or 2. Remove the if-branches where
 tape-speed_ctl != 1 since they are never executed.
 
 Also, rename calculate_speeds() by adding driver's prefix as is with the other
 function names.
 
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]

This change is fine but it seems to depend on ghost patch #23. ;)

Please move it near the beginning of the series when resubmitting.

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 21/32] ide-tape: idetape_chrdev_direction_t:shorten enum names

2008-01-27 Thread Bartlomiej Zolnierkiewicz
On Sunday 27 January 2008, Borislav Petkov wrote:
 From: Borislav Petkov [EMAIL PROTECTED]
 
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
 ---
  drivers/ide/ide-tape.c |   60 ---
  1 files changed, 31 insertions(+), 29 deletions(-)
 
 diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
 index cf308d7..b487d56 100644
 --- a/drivers/ide/ide-tape.c
 +++ b/drivers/ide/ide-tape.c
 @@ -178,11 +178,13 @@ enum {
  /*
   *   For general magnetic tape device compatibility.
   */
 +
 +/* tape directions */
  typedef enum {
 - idetape_direction_none,
 - idetape_direction_read,
 - idetape_direction_write
 -} idetape_chrdev_direction_t;
 + idetape_dir_none,
 + idetape_dir_read,
 + idetape_dir_write

Could you convert them to upper-case while at it?

 +} idetape_chrdev_dir_t;
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 21/21] ide: make remaining built-in only IDE host drivers modular

2008-01-26 Thread Bartlomiej Zolnierkiewicz

Hi,

On Friday 04 January 2008, Sergei Shtylyov wrote:
 Bartlomiej Zolnierkiewicz wrote:
 
  * Make remaining built-in only IDE host drivers modular, add ide-scan-pci.c
file for probing PCI host drivers registered with IDE core (special case
for built-in IDE and CONFIG_IDEPCI_PCIBUS_ORDER=y) and then take care of
the ordering in which all IDE host drivers are probed when IDE is built-in
during link time.
 
  * Move probing of gayle, falconide, macide, q40ide and buddha (m68k arch
specific) host drivers, before PCI ones (no PCI on m68k), ide-cris (cris
arch specific), cmd640 (x86 arch specific) and pmac (ppc arch specific).
 
  * Move probing of ide-cris (cris arch specific) host driver before cmd640
(x86 arch specific).
 
  * Move probing of mpc8xx (ppc specific) host driver before ide-pnp (depends
on ISA and none of ppc platform that use mpc8xx supports ISA) and 
  ide-h8300
(h8300 arch specific).
 
  * Add probe_vlb kernel parameter to cmd640 host driver and update
Documentation/ide.txt accordingly.
 
  * Make IDE_ARM config option visible so it can also be disabled if needed.
 
  * Remove bogus comment from ide.c while at it.
 
  Cc: Mikael Starvik [EMAIL PROTECTED]
  Cc: Geert Uytterhoeven [EMAIL PROTECTED]
  Cc: Roman Zippel [EMAIL PROTECTED]
  Cc: Benjamin Herrenschmidt [EMAIL PROTECTED]
  Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
 
 [...]
 
  Index: b/drivers/ide/h8300/ide-h8300.c
  ===
  --- a/drivers/ide/h8300/ide-h8300.c
  +++ b/drivers/ide/h8300/ide-h8300.c
 [...]
  @@ -104,7 +104,7 @@ void __init h8300_ide_init(void)
  hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
  if (hwif == NULL) {
  printk(KERN_ERR ide-h8300: IDE I/F register failed\n);
  -   return;
  +   return -ENOMEM;
  }
 
 ENOENT would seem more appropriate...

fixed in v2

  Index: b/drivers/ide/pci/cmd640.c
  ===
  --- a/drivers/ide/pci/cmd640.c
  +++ b/drivers/ide/pci/cmd640.c
  @@ -706,9 +706,9 @@ static int pci_conf2(void)
   }
   
   /*
  - * Probe for a cmd640 chipset, and initialize it if found.  Called from 
  ide.c
  + * Probe for a cmd640 chipset, and initialize it if found.
*/
  -int __init ide_probe_for_cmd640x (void)
  +static int __init cmd640x_init(void)
   {
   #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
  int second_port_toggled = 0;
  @@ -883,3 +883,7 @@ int __init ide_probe_for_cmd640x (void)
  return 1;
   }
   
  +module_param_named(probe_vlb, cmd640_vlb, bool, 0);
  +MODULE_PARM_DESC(probe, probe for VLB version of CMD640 chipset);
 
 Shouldn't 'probe' be 'probe_vlb' here?

fixed in v2

interdiff between v1 and v2:

[...]
v2:
* Fix two issues spotted by Sergei:
  - replace ENOMEM error value by ENOENT in ide-h8300 host driver
  - fix MODULE_PARM_DESC() in cmd640 host driver

Cc: Sergei Shtylyov [EMAIL PROTECTED]
[...]

diff -u b/drivers/ide/h8300/ide-h8300.c b/drivers/ide/h8300/ide-h8300.c
--- b/drivers/ide/h8300/ide-h8300.c
+++ b/drivers/ide/h8300/ide-h8300.c
@@ -104,7 +104,7 @@
hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
if (hwif == NULL) {
printk(KERN_ERR ide-h8300: IDE I/F register failed\n);
-   return -ENOMEM;
+   return -ENOENT;
}
 
index = hwif-index;
diff -u b/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c
--- b/drivers/ide/pci/cmd640.c
+++ b/drivers/ide/pci/cmd640.c
@@ -885,5 +885,5 @@
 
 module_param_named(probe_vlb, cmd640_vlb, bool, 0);
-MODULE_PARM_DESC(probe, probe for VLB version of CMD640 chipset);
+MODULE_PARM_DESC(probe_vlb, probe for VLB version of CMD640 chipset);
 
 module_init(cmd640x_init);

  +
  +module_init(cmd640x_init);
 
 BTW, it's interesting why this driver still uses it's own home-grown PCI 
 config. space access code? 8-)

Lets stick to you found it, you fix it rule. 8)

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: From: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] (linux.* mail to news gateway)

2008-01-26 Thread Bartlomiej Zolnierkiewicz
On Saturday 26 January 2008, Jan Engelhardt wrote:
 
 On Jan 26 2008 21:31, Frans Pop wrote:
   config BLK_DEV_IDE_PMAC
  -   bool Builtin PowerMac IDE support
  +   tristate Builtin PowerMac IDE support

this change is no-op at the moment because the next Kconfig line is:

depends on PPC_PMAC  IDE=y  BLK_DEV_IDE=y

[ PPC-specific IDE host drivers are still a special case because they are
  using ppc_ide_md architecture hooks instead of doing proper host driver
  initialization sequence - to be fixed after adding warm-plug support... ]

 This does not seem to make sense: if the option is now tristate, it is no
 longer Builtin, so probably s/Builtin // in the description.
 
 Or something like s/Builtin/Onboard/;

Please send a patch.

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ide-io: set REQ_FAILED when drive is dead

2008-01-25 Thread Bartlomiej Zolnierkiewicz
On Thursday 24 January 2008, Aristeu Rozanski wrote:
 Currently it's possible to ide-cd to set an incorrect blocksize by
 reading garbage if the drive is dead:
 
 ide_cd_probe()
  - cdrom_read_toc()
  - cdrom_read_capacity()
  - cdrom_queue_packet_command()
  - ide_do_drive_cmd()
  - ide_do_request()
  - start_request()
 
 on start_request():
 
 /* bail early if we've exceeded max_failures */
 if (drive-max_failures  (drive-failures  drive-max_failures)) {
 goto kill_rq;
 }
 (...)
 kill_rq:
 ide_kill_rq(drive, rq);
 return ide_stopped;
 
 ide_kill_rq() and the next calls won't set REQ_FAILED on rq-cmd_flags and 
 thus
 cdrom_queue_packet_command() won't return an error. then:
 
 stat = cdrom_queue_packet_command(drive, req);
 if (stat == 0) {
 *capacity = 1 + be32_to_cpu(capbuf.lba);
 *sectors_per_frame =
 be32_to_cpu(capbuf.blocklen)  SECTOR_BITS;
 }
 
 cdrom_read_capacity() ends believing capbuf is valid but in fact it's just
 uninitialized data. back to cdrom_read_toc():
 
 /* Try to get the total cdrom capacity and sector size. */
 stat = cdrom_read_capacity(drive, toc-capacity, sectors_per_frame,
sense);
 if (stat)
 toc-capacity = 0x1f;
 
 set_capacity(info-disk, toc-capacity * sectors_per_frame);
 /* Save a private copy of te TOC capacity for error handling */
 drive-probed_capacity = toc-capacity * sectors_per_frame;
 
 blk_queue_hardsect_size(drive-queue,
 sectors_per_frame  SECTOR_BITS);
 
 that will set drive-queue-hardsect_size to be the random value.
 hardsect_size is used to calculate inode-i_blkbits. later on, on a read
 path:
 
 void create_empty_buffers(struct page *page,
 unsigned long blocksize, unsigned long b_state)
 {   
 struct buffer_head *bh, *head, *tail;
 
 head = alloc_page_buffers(page, blocksize, 1);
 bh = head;
 do {
 bh-b_state |= b_state;
 tail = bh;
 bh = bh-b_this_page;
 } while (bh);
 tail-b_this_page = head;
 
 alloc_page_buffers() will return NULL if blocksize  4096. blocksize is
 calculed based on inode-i_blkbits. that will trigger a null
 dereference on create_empty_buffers().
 
 Signed-off-by: Aristeu Rozanski [EMAIL PROTECTED]

thanks, applied

 ---
  drivers/ide/ide-io.c |1 +
  1 file changed, 1 insertion(+)
 
 --- linus-2.6.orig/drivers/ide/ide-io.c   2007-12-18 07:54:59.0 
 -0500
 +++ linus-2.6/drivers/ide/ide-io.c2008-01-24 14:48:29.0 -0500
 @@ -1003,6 +1003,7 @@ static ide_startstop_t start_request (id
  
   /* bail early if we've exceeded max_failures */
   if (drive-max_failures  (drive-failures  drive-max_failures)) {
 + rq-cmd_flags |= REQ_FAILED;
   goto kill_rq;
   }
  
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ppc: fix #ifdef-s in mediabay driver

2008-01-23 Thread Bartlomiej Zolnierkiewicz
On Wednesday 23 January 2008, Benjamin Herrenschmidt wrote:
 
 On Wed, 2008-01-23 at 01:58 +0100, Bartlomiej Zolnierkiewicz wrote:
  I'm more worried about breaking automatic build checking (make randconfig)
  than a few extra bytes so if you remove all #ifdefs you'll have to either
  make BLK_DEV_IDE_PMAC select PMAC_MEDIABAY or make PMAC_MEDIABAY depend
  on BLK_DEV_IDE_PMAC (otherwise BLK_DEV_IDE=n  PMAC_MEDIABAY=y will fail
  since mediabay.c is referencing IDE code).
 
 I was thinking about having the pmac arch code provide an exported
 function pointer to put the hook in to avoid that problem.

BTW the other pending IDE patches (yet to posted) include rework of IDE
hot-plug support for PMAC media-bay so ide_init_hwif_ports()/ide_register_hw()
/ide_unregister() calls in mediabay.c will be replaced by something else.
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ide-cs: use ide_std_init_ports()

2008-01-22 Thread Bartlomiej Zolnierkiewicz

No reason to use ide_init_hwif_ports() in ide-cs (as a nice side-effect
this makes ide-cs work on archs that don't define IDE_ARCH_OBSOLETE_INIT).

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/legacy/ide-cs.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: b/drivers/ide/legacy/ide-cs.c
===
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -151,7 +151,7 @@ static int idecs_register(unsigned long 
 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
 
 memset(hw, 0, sizeof(hw));
-ide_init_hwif_ports(hw, io, ctl, NULL);
+ide_std_init_ports(hw, io, ctl);
 hw.irq = irq;
 hw.chipset = ide_pci;
 hw.dev = handle-dev;
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ppc: fix #ifdef-s in mediabay driver

2008-01-22 Thread Bartlomiej Zolnierkiewicz

* Replace incorrect CONFIG_BLK_DEV_IDE #ifdef in
  check_media_bay() by CONFIG_MAC_FLOPPY one.

* Replace incorrect CONFIG_BLK_DEV_IDE #ifdef-s by
  CONFIG_BLK_DEV_IDE_PMAC ones.

* check_media_bay() is used only by drivers/block/swim3.c
  so make this function available only if CONFIG_MAC_FLOPPY
  is defined.

* check_media_bay_by_base() and media_bay_set_ide_infos()
  are used only by drivers/ide/ppc/pmac.c so so make these
  functions available only if CONFIG_MAC_FLOPPY is defined.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
Ben, IMO this patch is safe for 2.6.24 (assuming that it builds fine :),
otherwise I would like to ask for permission to merge it through IDE
tree since I have other pending IDE patches depending on this one.

 drivers/macintosh/mediabay.c   |   46 ++---
 include/asm-powerpc/mediabay.h |   13 ---
 2 files changed, 30 insertions(+), 29 deletions(-)

Index: b/drivers/macintosh/mediabay.c
===
--- a/drivers/macintosh/mediabay.c
+++ b/drivers/macintosh/mediabay.c
@@ -78,12 +78,14 @@ struct media_bay_info {
int cached_gpio;
int sleeping;
struct semaphorelock;
-#ifdef CONFIG_BLK_DEV_IDE
+#ifdef CONFIG_BLK_DEV_IDE_PMAC
void __iomem*cd_base;
-   int cd_index;
int cd_irq;
int cd_retry;
 #endif
+#if defined(CONFIG_BLK_DEV_IDE_PMAC) || defined(CONFIG_MAC_FLOPPY)
+   int cd_index;
+#endif
 };
 
 #define MAX_BAYS   2
@@ -91,7 +93,7 @@ struct media_bay_info {
 static struct media_bay_info media_bays[MAX_BAYS];
 int media_bay_count = 0;
 
-#ifdef CONFIG_BLK_DEV_IDE
+#ifdef CONFIG_BLK_DEV_IDE_PMAC
 /* check the busy bit in the media-bay ide interface
(assumes the media-bay contains an ide device) */
 #define MB_IDE_READY(i)((readb(media_bays[i].cd_base + 0x70)  0x80) 
== 0)
@@ -401,7 +403,7 @@ static void poll_media_bay(struct media_
set_mb_power(bay, id != MB_NO);
bay-content_id = id;
if (id == MB_NO) {
-#ifdef CONFIG_BLK_DEV_IDE
+#ifdef CONFIG_BLK_DEV_IDE_PMAC
bay-cd_retry = 0;
 #endif
printk(KERN_INFO media bay %d is 
empty\n, bay-index);
@@ -414,9 +416,9 @@ static void poll_media_bay(struct media_
}
 }
 
+#ifdef CONFIG_MAC_FLOPPY
 int check_media_bay(struct device_node *which_bay, int what)
 {
-#ifdef CONFIG_BLK_DEV_IDE
int i;
 
for (i=0; imedia_bay_count; i++)
@@ -426,14 +428,14 @@ int check_media_bay(struct device_node *
media_bays[i].cd_index = -1;
return -EINVAL;
}
-#endif /* CONFIG_BLK_DEV_IDE */
return -ENODEV;
 }
 EXPORT_SYMBOL(check_media_bay);
+#endif /* CONFIG_MAC_FLOPPY */
 
+#ifdef CONFIG_BLK_DEV_IDE_PMAC
 int check_media_bay_by_base(unsigned long base, int what)
 {
-#ifdef CONFIG_BLK_DEV_IDE
int i;
 
for (i=0; imedia_bay_count; i++)
@@ -443,15 +445,13 @@ int check_media_bay_by_base(unsigned lon
media_bays[i].cd_index = -1;
return -EINVAL;
} 
-#endif
-   
+
return -ENODEV;
 }
 
 int media_bay_set_ide_infos(struct device_node* which_bay, unsigned long base,
-   int irq, int index)
+   int irq, int index)
 {
-#ifdef CONFIG_BLK_DEV_IDE
int i;
 
for (i=0; imedia_bay_count; i++) {
@@ -483,10 +483,10 @@ int media_bay_set_ide_infos(struct devic
return -ENODEV;
}
}
-#endif /* CONFIG_BLK_DEV_IDE */
-   
+
return -ENODEV;
 }
+#endif /* CONFIG_BLK_DEV_IDE_PMAC */
 
 static void media_bay_step(int i)
 {
@@ -521,14 +521,13 @@ static void media_bay_step(int i)
bay-state = mb_resetting;
MBDBG(mediabay%d: waiting reset (kind:%d)\n, i, 
bay-content_id);
break;
-   
case mb_resetting:
if (bay-content_id != MB_CD) {
MBDBG(mediabay%d: bay is up (kind:%d)\n, i, 
bay-content_id);
bay-state = mb_up;
break;
}
-#ifdef CONFIG_BLK_DEV_IDE
+#ifdef CONFIG_BLK_DEV_IDE_PMAC
MBDBG(mediabay%d: waiting IDE reset (kind:%d)\n, i, 
bay-content_id);
bay-ops-un_reset_ide(bay);
bay-timer = msecs_to_jiffies(MB_IDE_WAIT);
@@ -536,16 +535,14 @@ static void media_bay_step(int i)
 #else
printk(KERN_DEBUG media-bay %d is ide (not compiled in 
kernel)\n, i);
set_mb_power(bay, 0);
-#endif /* CONFIG_BLK_DEV_IDE

Re: [PATCH 0/12] ide-floppy redux v2.5

2008-01-21 Thread Bartlomiej Zolnierkiewicz

Hi Borislav,

On Sunday 20 January 2008, Borislav Petkov wrote:
 On Mon, Jan 14, 2008 at 10:38:17PM +0100, Bartlomiej Zolnierkiewicz wrote:
   By the way, I have an Iomega ZIP 100 drive somewhere in my hardware pile 
   and
   will do some testing with the new :) driver just in case.
  
  This would be great. :)
 Hi Bart,
 
 i just whipped rc8 along with your pata-2.6 tree on top and had several test
 runs of the ide-floppy driver (raw reads, software floppy disk eject, etc) and
 everything seems to work fine. I will keep this hardware setup here so that we
 could at least test ide-floppy occasionally. We should probably acknowledge 
 this

Big thanks for all great ide-floppy work!  I hope that you'll continue with
putting IDE device drivers in shape. :)

 major driver cleanup with a new driver version?

Yep.

 ---
 From 6f948b93839cdf397cb38ca75c3c6cc9a21e6070 Mon Sep 17 00:00:00 2001
 From: Borislav Petkov [EMAIL PROTECTED]
 Date: Sun, 20 Jan 2008 13:32:24 +0100
 Subject: [PATCH] ide-floppy: bump driver version number
 
 Acknowledge major ide-floppy code refactoring and cleanup by bumping the 
 driver
 version number. Also, remove a wrong comment.
 
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]

applied
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] pdc2026x: remove surplus initialiser

2008-01-21 Thread Bartlomiej Zolnierkiewicz

On Saturday 19 January 2008, Alan Cox wrote:
 
 Signed-off-by: Alan Cox [EMAIL PROTECTED]

applied with:

- s/pdc2026x/pdc202xx_old/ in patch summary
- drive-by CodingStyle fixups

 diff -u --new-file --recursive --exclude-from /usr/src/exclude 
 linux.vanilla-2.6.24-rc8-mm1/drivers/ide/pci/pdc202xx_old.c 
 linux-2.6.24-rc8-mm1/drivers/ide/pci/pdc202xx_old.c
 --- linux.vanilla-2.6.24-rc8-mm1/drivers/ide/pci/pdc202xx_old.c   
 2008-01-19 14:47:56.0 +
 +++ linux-2.6.24-rc8-mm1/drivers/ide/pci/pdc202xx_old.c   2008-01-19 
 15:00:08.0 +
 @@ -138,7 +138,7 @@
  static u8 __devinit pdc2026x_old_cable_detect(ide_hwif_t *hwif)
  {
   struct pci_dev *dev = to_pci_dev(hwif-dev);
 - u16 CIS = 0, mask = (hwif-channel) ? (111) : (110);
 + u16 CIS, mask = (hwif-channel) ? (111) : (110);
  
   pci_read_config_word(dev, 0x50, CIS);
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] pdc2026x: remove surplus initialiser

2008-01-21 Thread Bartlomiej Zolnierkiewicz
On Saturday 19 January 2008, Alan Cox wrote:
 On Sat, 19 Jan 2008 19:54:03 +0300
 Sergei Shtylyov [EMAIL PROTECTED] wrote:
 
  Hello.
  
  Alan Cox wrote:
  
   Signed-off-by: Alan Cox [EMAIL PROTECTED]
  
   diff -u --new-file --recursive --exclude-from /usr/src/exclude 
   linux.vanilla-2.6.24-rc8-mm1/drivers/ide/pci/pdc202xx_old.c 
   linux-2.6.24-rc8-mm1/drivers/ide/pci/pdc202xx_old.c
   --- linux.vanilla-2.6.24-rc8-mm1/drivers/ide/pci/pdc202xx_old.c   
   2008-01-19 14:47:56.0 +
   +++ linux-2.6.24-rc8-mm1/drivers/ide/pci/pdc202xx_old.c   2008-01-19 
   15:00:08.0 +
   @@ -138,7 +138,7 @@
static u8 __devinit pdc2026x_old_cable_detect(ide_hwif_t *hwif)
{
 struct pci_dev *dev = to_pci_dev(hwif-dev);
   - u16 CIS = 0, mask = (hwif-channel) ? (111) : (110);
   + u16 CIS, mask = (hwif-channel) ? (111) : (110);

 pci_read_config_word(dev, 0x50, CIS);
  
  Since we ignore the result of this function, if it fails CIS may be 
  left 
  uninitialized if the function fails. So, the initializer is not as useless 
  as 

pci_[bus]_read_config_*() functions always assign some value according to
drivers/pci/access.c (except for unaligned access to word/dword register).

  it seems (and there's a lot more of such cases in drivers/ide/pci/ :-)..

A lot of patch opportunities!

 If pci_read_config_word fails you are in very deep doodoo anyway. I don't
 think anyone checks it because there isn't an answer to now what

Yep, moreover we cannot just assume that 0 is a safe default value
because it doesn't have to be (i.e. in the above case cable bit set to
0 means 80-wires cable).

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ide-disk: use do_rw_taskfile() (take 2)

2008-01-21 Thread Bartlomiej Zolnierkiewicz

* Add IDE_TFLAG_DMA_PIO_FALLBACK taskfile flag to indicate the need
  to skip loading taskfile registers in do_rw_taskfile().

* Export do_rw_taskfile().

* Convert __ide_do_rw_disk() to use do_rw_taskfile().

* Unexport ide_tf_load().

* Unexport {pre_task_out,task_in}_intr() and make it static.

* Remove incorrect comment about do_rw_taskfile() from linux/ide.h.

There should be no functionality changes caused by this patch.

v2:
* Add missing blk_fs_request() check to task_dma_ok() (for VDMA).

Acked-by: Sergei Shtylyov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
replacement patch for the one in the IDE quilt tree

 drivers/ide/ide-disk.c |   29 ++---
 drivers/ide/ide-taskfile.c |   16 
 include/linux/ide.h|9 ++---
 3 files changed, 20 insertions(+), 34 deletions(-)

Index: b/drivers/ide/ide-disk.c
===
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -185,6 +185,7 @@ static ide_startstop_t __ide_do_rw_disk(
u8 lba48= (drive-addressing == 1) ? 1 : 0;
ide_task_t  task;
struct ide_taskfile *tf = task.tf;
+   ide_startstop_t rc;
 
if ((hwif-host_flags  IDE_HFLAG_NO_LBA48_DMA)  lba48  dma) {
if (block + rq-nr_sectors  1ULL  28)
@@ -252,32 +253,22 @@ static ide_startstop_t __ide_do_rw_disk(
task.tf_flags |= IDE_TFLAG_WRITE;
 
ide_tf_set_cmd(drive, task, dma);
+   if (!dma)
+   hwif-data_phase = task.data_phase;
+   task.rq = rq;
 
-   ide_tf_load(drive, task);
+   rc = do_rw_taskfile(drive, task);
 
-   if (dma) {
-   if (!hwif-dma_setup(drive)) {
-   hwif-dma_exec_cmd(drive, tf-command);
-   hwif-dma_start(drive);
-   return ide_started;
-   }
+   if (rc == ide_stopped  dma) {
/* fallback to PIO */
+   task.tf_flags |= IDE_TFLAG_DMA_PIO_FALLBACK;
ide_tf_set_cmd(drive, task, 0);
+   hwif-data_phase = task.data_phase;
ide_init_sg_cmd(drive, rq);
+   rc = do_rw_taskfile(drive, task);
}
 
-   hwif-data_phase = task.data_phase;
-
-   if (rq_data_dir(rq) == READ) {
-   ide_execute_command(drive, tf-command, task_in_intr,
-   WAIT_WORSTCASE, NULL);
-   return ide_started;
-   } else {
-   hwif-OUTBSYNC(drive, tf-command, IDE_COMMAND_REG);
-   ndelay(400);/* FIXME */
-
-   return pre_task_out_intr(drive, rq);
-   }
+   return rc;
 }
 
 /*
Index: b/drivers/ide/ide-taskfile.c
===
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -114,8 +114,6 @@ void ide_tf_load(ide_drive_t *drive, ide
hwif-OUTB((tf-device  HIHI) | drive-select.all, 
IDE_SELECT_REG);
 }
 
-EXPORT_SYMBOL_GPL(ide_tf_load);
-
 int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf)
 {
ide_task_t args;
@@ -133,7 +131,7 @@ int taskfile_lib_get_identify (ide_drive
 
 static int inline task_dma_ok(ide_task_t *task)
 {
-   if (task-tf_flags  IDE_TFLAG_FLAGGED)
+   if (blk_fs_request(task-rq) || (task-tf_flags  IDE_TFLAG_FLAGGED))
return 1;
 
switch (task-tf.command) {
@@ -154,6 +152,8 @@ static ide_startstop_t task_no_data_intr
 static ide_startstop_t set_geometry_intr(ide_drive_t *);
 static ide_startstop_t recal_intr(ide_drive_t *);
 static ide_startstop_t set_multmode_intr(ide_drive_t *);
+static ide_startstop_t pre_task_out_intr(ide_drive_t *, struct request *);
+static ide_startstop_t task_in_intr(ide_drive_t *);
 
 ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task)
 {
@@ -173,7 +173,8 @@ ide_startstop_t do_rw_taskfile (ide_driv
if (task-tf_flags  IDE_TFLAG_FLAGGED)
task-tf_flags |= IDE_TFLAG_FLAGGED_SET_IN_FLAGS;
 
-   ide_tf_load(drive, task);
+   if ((task-tf_flags  IDE_TFLAG_DMA_PIO_FALLBACK) == 0)
+   ide_tf_load(drive, task);
 
switch (task-data_phase) {
case TASKFILE_MULTI_OUT:
@@ -208,6 +209,7 @@ ide_startstop_t do_rw_taskfile (ide_driv
return ide_started;
}
 }
+EXPORT_SYMBOL_GPL(do_rw_taskfile);
 
 /*
  * set_multmode_intr() is invoked on completion of a WIN_SETMULT cmd.
@@ -446,7 +448,7 @@ static void task_end_request(ide_drive_t
 /*
  * Handler for command with PIO data-in phase (Read/Read Multiple).
  */
-ide_startstop_t task_in_intr (ide_drive_t *drive)
+static ide_startstop_t task_in_intr(ide_drive_t *drive)
 {
ide_hwif_t *hwif = drive-hwif;
struct request *rq = HWGROUP(drive)-rq;
@@ -477,7 +479,6 @@ ide_startstop_t task_in_intr (ide_drive_
 
return ide_started

[PATCH 00/16] ide: various fixes/cleanups

2008-01-21 Thread Bartlomiej Zolnierkiewicz

Easy stuff done as relax from more hard-core changes...

diffstat:

 drivers/ide/cris/ide-cris.c |6 -
 drivers/ide/ide-dma.c   |   20 ++
 drivers/ide/ide-iops.c  |  145 ++--
 drivers/ide/ide-probe.c |   35 ++
 drivers/ide/ide-tape.c  |4 -
 drivers/ide/ide-taskfile.c  |   11 ++-
 drivers/ide/ide.c   |5 -
 drivers/ide/pci/siimage.c   |   25 ---
 drivers/ide/pci/trm290.c|5 -
 drivers/scsi/ide-scsi.c |7 --
 include/linux/hdreg.h   |4 -
 include/linux/ide.h |   15 
 12 files changed, 113 insertions(+), 169 deletions(-)
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/16] ide-tape: use ide_execute_command()

2008-01-21 Thread Bartlomiej Zolnierkiewicz

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-tape.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: b/drivers/ide/ide-tape.c
===
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -2181,8 +2181,8 @@ static ide_startstop_t idetape_issue_pac
if (dma_ok) /* Will begin DMA later */
set_bit(PC_DMA_IN_PROGRESS, pc-flags);
if (test_bit(IDETAPE_DRQ_INTERRUPT, tape-flags)) {
-   ide_set_handler(drive, idetape_transfer_pc, IDETAPE_WAIT_CMD, 
NULL);
-   hwif-OUTB(WIN_PACKETCMD, IDE_COMMAND_REG);
+   ide_execute_command(drive, WIN_PACKETCMD, idetape_transfer_pc,
+   IDETAPE_WAIT_CMD, NULL);
return ide_started;
} else {
hwif-OUTB(WIN_PACKETCMD, IDE_COMMAND_REG);
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 02/16] ide-scsi: use ide_execute_command()

2008-01-21 Thread Bartlomiej Zolnierkiewicz

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/scsi/ide-scsi.c |7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

Index: b/drivers/scsi/ide-scsi.c
===
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -596,11 +596,8 @@ static ide_startstop_t idescsi_issue_pc 
set_bit(PC_DMA_OK, pc-flags);
 
if (test_bit(IDESCSI_DRQ_INTERRUPT, scsi-flags)) {
-   BUG_ON(HWGROUP(drive)-handler != NULL);
-   ide_set_handler(drive, idescsi_transfer_pc,
-   get_timeout(pc), idescsi_expiry);
-   /* Issue the packet command */
-   HWIF(drive)-OUTB(WIN_PACKETCMD, IDE_COMMAND_REG);
+   ide_execute_command(drive, WIN_PACKETCMD, idescsi_transfer_pc,
+   get_timeout(pc), idescsi_expiry);
return ide_started;
} else {
/* Issue the packet command */
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 03/16] trm290: use ide_execute_command()

2008-01-21 Thread Bartlomiej Zolnierkiewicz

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/pci/trm290.c |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

Index: b/drivers/ide/pci/trm290.c
===
--- a/drivers/ide/pci/trm290.c
+++ b/drivers/ide/pci/trm290.c
@@ -177,10 +177,7 @@ static void trm290_selectproc (ide_drive
 
 static void trm290_dma_exec_cmd(ide_drive_t *drive, u8 command)
 {
-   BUG_ON(HWGROUP(drive)-handler != NULL);/* paranoia check */
-   ide_set_handler(drive, ide_dma_intr, WAIT_CMD, NULL);
-   /* issue cmd to drive */
-   outb(command, IDE_COMMAND_REG);
+   ide_execute_command(drive, command, ide_dma_intr, WAIT_CMD, NULL);
 }
 
 static int trm290_dma_setup(ide_drive_t *drive)
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 04/16] ide-cris: use ide_execute_command()

2008-01-21 Thread Bartlomiej Zolnierkiewicz

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/cris/ide-cris.c |6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

Index: b/drivers/ide/cris/ide-cris.c
===
--- a/drivers/ide/cris/ide-cris.c
+++ b/drivers/ide/cris/ide-cris.c
@@ -1034,11 +1034,7 @@ static int cris_dma_setup(ide_drive_t *d
 
 static void cris_dma_exec_cmd(ide_drive_t *drive, u8 command)
 {
-   /* set the irq handler which will finish the request when DMA is done */
-   ide_set_handler(drive, cris_dma_intr, WAIT_CMD, NULL);
-
-   /* issue cmd to drive */
-   cris_ide_outb(command, IDE_COMMAND_REG);
+   ide_execute_command(drive, command, cris_dma_intr, WAIT_CMD, NULL);
 }
 
 static void cris_dma_start(ide_drive_t *drive)
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/16] ide-probe: remove needless Status register reads

2008-01-21 Thread Bartlomiej Zolnierkiewicz

* Cache value read from the Status register in 'stat' variable in do_probe()
  and enable_nest(), then remove remove needless Status register reads.

While at it:

* Add proper KERN_* levels to printk() calls.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-probe.c |   35 +--
 1 file changed, 21 insertions(+), 14 deletions(-)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -423,8 +423,9 @@ static int ide_busy_sleep(ide_hwif_t *hw
 
 static int do_probe (ide_drive_t *drive, u8 cmd)
 {
-   int rc;
ide_hwif_t *hwif = HWIF(drive);
+   int rc;
+   u8 stat;
 
if (drive-present) {
/* avoid waiting for inappropriate probes */
@@ -461,15 +462,17 @@ static int do_probe (ide_drive_t *drive,
/* failed: try again */
rc = try_to_identify(drive,cmd);
}
-   if (hwif-INB(IDE_STATUS_REG) == (BUSY_STAT|READY_STAT))
+
+   stat = hwif-INB(IDE_STATUS_REG);
+
+   if (stat == (BUSY_STAT | READY_STAT))
return 4;
 
if ((rc == 1  cmd == WIN_PIDENTIFY) 
((drive-autotune == IDE_TUNE_DEFAULT) ||
(drive-autotune == IDE_TUNE_AUTO))) {
-   printk(%s: no response (status = 0x%02x), 
-   resetting drive\n, drive-name,
-   hwif-INB(IDE_STATUS_REG));
+   printk(KERN_ERR %s: no response (status = 0x%02x), 
+   resetting drive\n, drive-name, stat);
msleep(50);
hwif-OUTB(drive-select.all, IDE_SELECT_REG);
msleep(50);
@@ -477,11 +480,13 @@ static int do_probe (ide_drive_t *drive,
(void)ide_busy_sleep(hwif);
rc = try_to_identify(drive, cmd);
}
+
+   /* ensure drive IRQ is clear */
+   stat = hwif-INB(IDE_STATUS_REG);
+
if (rc == 1)
-   printk(%s: no response (status = 0x%02x)\n,
-   drive-name, hwif-INB(IDE_STATUS_REG));
-   /* ensure drive irq is clear */
-   (void) hwif-INB(IDE_STATUS_REG);
+   printk(KERN_ERR %s: no response (status = 0x%02x)\n,
+   drive-name, stat);
} else {
/* not present or maybe ATAPI */
rc = 3;
@@ -502,6 +507,7 @@ static int do_probe (ide_drive_t *drive,
 static void enable_nest (ide_drive_t *drive)
 {
ide_hwif_t *hwif = HWIF(drive);
+   u8 stat;
 
printk(%s: enabling %s -- , hwif-name, drive-id-model);
SELECT_DRIVE(drive);
@@ -515,11 +521,12 @@ static void enable_nest (ide_drive_t *dr
 
msleep(50);
 
-   if (!OK_STAT((hwif-INB(IDE_STATUS_REG)), 0, BAD_STAT)) {
-   printk(failed (status = 0x%02x)\n, hwif-INB(IDE_STATUS_REG));
-   } else {
-   printk(success\n);
-   }
+   stat = hwif-INB(IDE_STATUS_REG);
+
+   if (!OK_STAT(stat, 0, BAD_STAT))
+   printk(KERN_CONT failed (status = 0x%02x)\n, stat);
+   else
+   printk(KERN_CONT success\n);
 
/* if !(success||timed-out) */
if (do_probe(drive, WIN_IDENTIFY) = 2) {
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 07/16] ide: convert -straight8 field in ide_hwif_t to bit flag

2008-01-21 Thread Bartlomiej Zolnierkiewicz

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 include/linux/ide.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: b/include/linux/ide.h
===
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -488,7 +488,6 @@ typedef struct hwif_s {
u8 major;   /* our major number */
u8 index;   /* 0 for ide0; 1 for ide1; ... */
u8 channel; /* for dual-port chips: 0=primary, 1=secondary */
-   u8 straight8;   /* Alan's straight 8 check */
u8 bus_state;   /* power state of the IDE bus */
 
u32 host_flags;
@@ -609,6 +608,7 @@ typedef struct hwif_s {
unsignedreset  : 1; /* reset after probe */
unsignedsg_mapped  : 1; /* sg_table and sg_nents are ready */
unsignedmmio   : 1; /* host uses MMIO */
+   unsignedstraight8  : 1; /* Alan's straight 8 check */
 
struct device   gendev;
struct completion gendev_rel_comp; /* To deal with device release() */
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 08/16] ide: remove -nice0 and -nice2 fields from ide_drive_t

2008-01-21 Thread Bartlomiej Zolnierkiewicz

* -nice0 and -nice2 ide_drive_t fields are always zero so remove them.

* IDE_NICE_0 and IDE_NICE_2 defines from linux/hdreg.h are no longer
  used by any kernel code so cover them with #ifndef/#endif __KERNEL__.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide.c |5 +
 include/linux/hdreg.h |4 +++-
 include/linux/ide.h   |2 --
 3 files changed, 4 insertions(+), 7 deletions(-)

Index: b/drivers/ide/ide.c
===
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -1035,11 +1035,8 @@ int generic_ide_ioctl(ide_drive_t *drive
case HDIO_GET_NICE:
return put_user(drive-dsc_overlap
IDE_NICE_DSC_OVERLAP|
drive-atapi_overlap  
IDE_NICE_ATAPI_OVERLAP  |
-   drive-nice0  
IDE_NICE_0  |
-   drive-nice1  
IDE_NICE_1  |
-   drive-nice2  
IDE_NICE_2,
+   drive-nice1  IDE_NICE_1,
(long __user *) arg);
-
 #ifdef CONFIG_IDE_TASK_IOCTL
case HDIO_DRIVE_TASKFILE:
if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
Index: b/include/linux/hdreg.h
===
--- a/include/linux/hdreg.h
+++ b/include/linux/hdreg.h
@@ -706,8 +706,10 @@ struct hd_driveid {
  */
 #define IDE_NICE_DSC_OVERLAP   (0) /* per the DSC overlap protocol */
 #define IDE_NICE_ATAPI_OVERLAP (1) /* not supported yet */
-#define IDE_NICE_0 (2) /* when sure that it won't affect us */
 #define IDE_NICE_1 (3) /* when probably won't affect us much */
+#ifndef __KERNEL__
+#define IDE_NICE_0 (2) /* when sure that it won't affect us */
 #define IDE_NICE_2 (4) /* when we know it's on our expense */
+#endif
 
 #endif /* _LINUX_HDREG_H */
Index: b/include/linux/ide.h
===
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -407,8 +407,6 @@ typedef struct ide_drive_s {
unsigned no_unmask  : 1;/* disallow setting unmask bit */
unsigned no_io_32bit: 1;/* disallow enabling 32bit I/O */
unsigned atapi_overlap  : 1;/* ATAPI overlap (not supported) */
-   unsigned nice0  : 1;/* give obvious excess bandwidth */
-   unsigned nice2  : 1;/* give a share in our own bandwidth */
unsigned doorlocking: 1;/* for removable only: door lock/unlock 
works */
unsigned nodma  : 1;/* disallow DMA */
unsigned autotune   : 2;/* 0=default, 1=autotune, 2=noautotune 
*/
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 09/16] ide: remove SATA_*_REG macros

2008-01-21 Thread Bartlomiej Zolnierkiewicz

* siimage.c: use hwif-sata_scr[SATA_{ERROR,STATUS}_OFFSET] instead of
  SATA_{ERROR,STATUS}_REG macros.

* Remove no longer needed SATA_*_REG macros.

While at it:

* Remove needless SATA Status register read from sil_sata_reset_poll().

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/pci/siimage.c |   25 -
 include/linux/ide.h   |6 --
 2 files changed, 16 insertions(+), 15 deletions(-)

Index: b/drivers/ide/pci/siimage.c
===
--- a/drivers/ide/pci/siimage.c
+++ b/drivers/ide/pci/siimage.c
@@ -331,15 +331,18 @@ static int siimage_mmio_ide_dma_test_irq
 {
ide_hwif_t *hwif= HWIF(drive);
unsigned long addr  = siimage_selreg(hwif, 0x1);
+   void __iomem *sata_error_addr
+   = (void __iomem *)hwif-sata_scr[SATA_ERROR_OFFSET];
 
-   if (SATA_ERROR_REG) {
+   if (sata_error_addr) {
unsigned long base = (unsigned long)hwif-hwif_data;
-
u32 ext_stat = readl((void __iomem *)(base + 0x10));
u8 watchdog = 0;
+
if (ext_stat  ((hwif-channel) ? 0x40 : 0x10)) {
-   u32 sata_error = readl((void __iomem *)SATA_ERROR_REG);
-   writel(sata_error, (void __iomem *)SATA_ERROR_REG);
+   u32 sata_error = readl(sata_error_addr);
+
+   writel(sata_error, sata_error_addr);
watchdog = (sata_error  0x0068) ? 1 : 0;
printk(KERN_WARNING %s: sata_error = 0x%08x, 
watchdog = %d, %s\n,
@@ -418,13 +421,17 @@ static int sil_sata_busproc(ide_drive_t 
 
 static int sil_sata_reset_poll(ide_drive_t *drive)
 {
-   if (SATA_STATUS_REG) {
-   ide_hwif_t *hwif= HWIF(drive);
+   ide_hwif_t *hwif = drive-hwif;
+   void __iomem *sata_status_addr
+   = (void __iomem *)hwif-sata_scr[SATA_STATUS_OFFSET];
+
+   if (sata_status_addr) {
+   /* SATA Status is available only when in MMIO mode */
+   u32 sata_stat = readl(sata_status_addr);
 
-   /* SATA_STATUS_REG is valid only when in MMIO mode */
-   if ((readl((void __iomem *)SATA_STATUS_REG)  0x03) != 0x03) {
+   if ((sata_stat  0x03) != 0x03) {
printk(KERN_WARNING %s: reset phy dead, 
status=0x%08x\n,
-   hwif-name, readl((void __iomem 
*)SATA_STATUS_REG));
+   hwif-name, sata_stat);
HWGROUP(drive)-polling = 0;
return ide_started;
}
Index: b/include/linux/ide.h
===
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -112,18 +112,12 @@ typedef unsigned char byte;   /* used ever
 #define SATA_NR_PORTS  (3) /* 16 possible ?? */
 
 #define SATA_STATUS_OFFSET (0)
-#define SATA_STATUS_REG
(HWIF(drive)-sata_scr[SATA_STATUS_OFFSET])
 #define SATA_ERROR_OFFSET  (1)
-#define SATA_ERROR_REG (HWIF(drive)-sata_scr[SATA_ERROR_OFFSET])
 #define SATA_CONTROL_OFFSET(2)
-#define SATA_CONTROL_REG   (HWIF(drive)-sata_scr[SATA_CONTROL_OFFSET])
 
 #define SATA_MISC_OFFSET   (0)
-#define SATA_MISC_REG  (HWIF(drive)-sata_misc[SATA_MISC_OFFSET])
 #define SATA_PHY_OFFSET(1)
-#define SATA_PHY_REG   (HWIF(drive)-sata_misc[SATA_PHY_OFFSET])
 #define SATA_IEN_OFFSET(2)
-#define SATA_IEN_REG   (HWIF(drive)-sata_misc[SATA_IEN_OFFSET])
 
 /*
  * Our Physical Region Descriptor (PRD) table should be large enough
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 11/16] ide: unexport SELECT_DRIVE()

2008-01-21 Thread Bartlomiej Zolnierkiewicz

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-iops.c |2 --
 1 file changed, 2 deletions(-)

Index: b/drivers/ide/ide-iops.c
===
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -163,8 +163,6 @@ void SELECT_DRIVE (ide_drive_t *drive)
HWIF(drive)-OUTB(drive-select.all, IDE_SELECT_REG);
 }
 
-EXPORT_SYMBOL(SELECT_DRIVE);
-
 void SELECT_MASK (ide_drive_t *drive, int mask)
 {
if (HWIF(drive)-maskproc)
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 12/16] ide: remove set_transfer()

2008-01-21 Thread Bartlomiej Zolnierkiewicz

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-iops.c |   18 --
 drivers/ide/ide-taskfile.c |6 +-
 include/linux/ide.h|1 -
 3 files changed, 5 insertions(+), 20 deletions(-)

Index: b/drivers/ide/ide-iops.c
===
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -627,24 +627,6 @@ int ide_ata66_check (ide_drive_t *drive,
return 0;
 }
 
-/*
- * Backside of HDIO_DRIVE_CMD call of SETFEATURES_XFER.
- * 1 : Safe to update drive-id DMA registers.
- * 0 : OOPs not allowed.
- */
-int set_transfer (ide_drive_t *drive, ide_task_t *args)
-{
-   if (args-tf.command == WIN_SETFEATURES 
-   args-tf.nsect = XFER_SW_DMA_0 
-   args-tf.feature == SETFEATURES_XFER 
-   (drive-id-dma_ultra ||
-drive-id-dma_mword ||
-drive-id-dma_1word))
-   return 1;
-
-   return 0;
-}
-
 #ifdef CONFIG_BLK_DEV_IDEDMA
 static u8 ide_auto_reduce_xfer (ide_drive_t *drive)
 {
Index: b/drivers/ide/ide-taskfile.c
===
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -755,6 +755,7 @@ int ide_cmd_ioctl (ide_drive_t *drive, u
u8 args[4], xfer_rate = 0;
ide_task_t tfargs;
struct ide_taskfile *tf = tfargs.tf;
+   struct hd_driveid *id = drive-id;
 
if (NULL == (void *) arg) {
struct request rq;
@@ -792,7 +793,10 @@ int ide_cmd_ioctl (ide_drive_t *drive, u
return -ENOMEM;
}
 
-   if (set_transfer(drive, tfargs)) {
+   if (tf-command == WIN_SETFEATURES 
+   tf-feature == SETFEATURES_XFER 
+   tf-nsect = XFER_SW_DMA_0 
+   (id-dma_ultra || id-dma_mword || id-dma_1word)) {
xfer_rate = args[1];
if (ide_ata66_check(drive, tfargs))
goto abort;
Index: b/include/linux/ide.h
===
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -993,7 +993,6 @@ extern int ide_driveid_update(ide_drive_
 extern int ide_ata66_check(ide_drive_t *, ide_task_t *);
 extern int ide_config_drive_speed(ide_drive_t *, u8);
 extern u8 eighty_ninty_three (ide_drive_t *);
-extern int set_transfer(ide_drive_t *, ide_task_t *);
 extern int taskfile_lib_get_identify(ide_drive_t *drive, u8 *);
 
 extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout);
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 13/16] ide: remove ide_ata66_check()

2008-01-21 Thread Bartlomiej Zolnierkiewicz

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-iops.c |   15 ---
 drivers/ide/ide-taskfile.c |5 -
 include/linux/ide.h|1 -
 3 files changed, 4 insertions(+), 17 deletions(-)

Index: b/drivers/ide/ide-iops.c
===
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -612,21 +612,6 @@ no_80w:
return 0;
 }
 
-int ide_ata66_check (ide_drive_t *drive, ide_task_t *args)
-{
-   if (args-tf.command == WIN_SETFEATURES 
-   args-tf.nsect  XFER_UDMA_2 
-   args-tf.feature == SETFEATURES_XFER) {
-   if (eighty_ninty_three(drive) == 0) {
-   printk(KERN_WARNING %s: UDMA speeds UDMA33 cannot 
-   be set\n, drive-name);
-   return 1;
-   }
-   }
-
-   return 0;
-}
-
 #ifdef CONFIG_BLK_DEV_IDEDMA
 static u8 ide_auto_reduce_xfer (ide_drive_t *drive)
 {
Index: b/drivers/ide/ide-taskfile.c
===
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -798,8 +798,11 @@ int ide_cmd_ioctl (ide_drive_t *drive, u
tf-nsect = XFER_SW_DMA_0 
(id-dma_ultra || id-dma_mword || id-dma_1word)) {
xfer_rate = args[1];
-   if (ide_ata66_check(drive, tfargs))
+   if (tf-nsect  XFER_UDMA_2  !eighty_ninty_three(drive)) {
+   printk(KERN_WARNING %s: UDMA speeds UDMA33 cannot 
+   be set\n, drive-name);
goto abort;
+   }
}
 
err = ide_raw_taskfile(drive, tfargs, buf, args[3]);
Index: b/include/linux/ide.h
===
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -990,7 +990,6 @@ int ide_task_ioctl(ide_drive_t *, unsign
 extern int system_bus_clock(void);
 
 extern int ide_driveid_update(ide_drive_t *);
-extern int ide_ata66_check(ide_drive_t *, ide_task_t *);
 extern int ide_config_drive_speed(ide_drive_t *, u8);
 extern u8 eighty_ninty_three (ide_drive_t *);
 extern int taskfile_lib_get_identify(ide_drive_t *drive, u8 *);
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 14/16] ide: move drive-crc_count check out from check_dma_crc()

2008-01-21 Thread Bartlomiej Zolnierkiewicz

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-iops.c |   24 
 1 file changed, 12 insertions(+), 12 deletions(-)

Index: b/drivers/ide/ide-iops.c
===
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -968,13 +968,10 @@ static ide_startstop_t reset_pollfunc (i
 static void check_dma_crc(ide_drive_t *drive)
 {
 #ifdef CONFIG_BLK_DEV_IDEDMA
-   if (drive-crc_count) {
-   ide_dma_off_quietly(drive);
-   ide_set_xfer_rate(drive, ide_auto_reduce_xfer(drive));
-   if (drive-current_speed = XFER_SW_DMA_0)
-   ide_dma_on(drive);
-   } else
-   ide_dma_off(drive);
+   ide_dma_off_quietly(drive);
+   ide_set_xfer_rate(drive, ide_auto_reduce_xfer(drive));
+   if (drive-current_speed = XFER_SW_DMA_0)
+   ide_dma_on(drive);
 #endif
 }
 
@@ -999,17 +996,20 @@ static void pre_reset(ide_drive_t *drive
else
drive-post_reset = 1;
 
-   if (!drive-keep_settings) {
-   if (drive-using_dma) {
+   if (drive-using_dma) {
+   if (drive-crc_count)
check_dma_crc(drive);
-   } else {
+   else
+   ide_dma_off(drive);
+   }
+
+   if (!drive-keep_settings) {
+   if (!drive-using_dma) {
drive-unmask = 0;
drive-io_32bit = 0;
}
return;
}
-   if (drive-using_dma)
-   check_dma_crc(drive);
 
if (HWIF(drive)-pre_reset != NULL)
HWIF(drive)-pre_reset(drive);
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 15/16] ide: remove ide_auto_reduce_xfer()

2008-01-21 Thread Bartlomiej Zolnierkiewicz

While at it:

* Remove needless '!drive-crc_count' check.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-iops.c |   41 +
 1 file changed, 13 insertions(+), 28 deletions(-)

Index: b/drivers/ide/ide-iops.c
===
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -612,33 +612,6 @@ no_80w:
return 0;
 }
 
-#ifdef CONFIG_BLK_DEV_IDEDMA
-static u8 ide_auto_reduce_xfer (ide_drive_t *drive)
-{
-   if (!drive-crc_count)
-   return drive-current_speed;
-   drive-crc_count = 0;
-
-   switch(drive-current_speed) {
-   case XFER_UDMA_7:   return XFER_UDMA_6;
-   case XFER_UDMA_6:   return XFER_UDMA_5;
-   case XFER_UDMA_5:   return XFER_UDMA_4;
-   case XFER_UDMA_4:   return XFER_UDMA_3;
-   case XFER_UDMA_3:   return XFER_UDMA_2;
-   case XFER_UDMA_2:   return XFER_UDMA_1;
-   case XFER_UDMA_1:   return XFER_UDMA_0;
-   /*
-* OOPS we do not goto non Ultra DMA modes
-* without iCRC's available we force
-* the system to PIO and make the user
-* invoke the ATA-1 ATA-2 DMA modes.
-*/
-   case XFER_UDMA_0:
-   default:return XFER_PIO_4;
-   }
-}
-#endif /* CONFIG_BLK_DEV_IDEDMA */
-
 int ide_driveid_update(ide_drive_t *drive)
 {
ide_hwif_t *hwif = drive-hwif;
@@ -968,8 +941,20 @@ static ide_startstop_t reset_pollfunc (i
 static void check_dma_crc(ide_drive_t *drive)
 {
 #ifdef CONFIG_BLK_DEV_IDEDMA
+   u8 mode;
+
ide_dma_off_quietly(drive);
-   ide_set_xfer_rate(drive, ide_auto_reduce_xfer(drive));
+   drive-crc_count = 0;
+   mode = drive-current_speed;
+   /*
+* Don't try non Ultra-DMA modes without iCRC's.  Force the
+* device to PIO and make the user enable SWDMA/MWDMA modes.
+*/
+   if (mode  XFER_UDMA_0  mode = XFER_UDMA_7)
+   mode--;
+   else
+   mode = XFER_PIO_4;
+   ide_set_xfer_rate(drive, mode);
if (drive-current_speed = XFER_SW_DMA_0)
ide_dma_on(drive);
 #endif
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 16/16] ide: move check_dma_crc() to ide-dma.c

2008-01-21 Thread Bartlomiej Zolnierkiewicz

* Move check_dma_crc() to ide-dma.c and add inline version for
  CONFIG_BLK_DEV_IDEDMA=n case.

* Rename check_dma_crc() to ide_check_dma_crc().

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-dma.c  |   20 
 drivers/ide/ide-iops.c |   24 +---
 include/linux/ide.h|2 ++
 3 files changed, 23 insertions(+), 23 deletions(-)

Index: b/drivers/ide/ide-dma.c
===
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -821,6 +821,26 @@ int ide_set_dma(ide_drive_t *drive)
return 0;
 }
 
+void ide_check_dma_crc(ide_drive_t *drive)
+{
+   u8 mode;
+
+   ide_dma_off_quietly(drive);
+   drive-crc_count = 0;
+   mode = drive-current_speed;
+   /*
+* Don't try non Ultra-DMA modes without iCRC's.  Force the
+* device to PIO and make the user enable SWDMA/MWDMA modes.
+*/
+   if (mode  XFER_UDMA_0  mode = XFER_UDMA_7)
+   mode--;
+   else
+   mode = XFER_PIO_4;
+   ide_set_xfer_rate(drive, mode);
+   if (drive-current_speed = XFER_SW_DMA_0)
+   ide_dma_on(drive);
+}
+
 #ifdef CONFIG_BLK_DEV_IDEDMA_PCI
 void ide_dma_lost_irq (ide_drive_t *drive)
 {
Index: b/drivers/ide/ide-iops.c
===
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -938,28 +938,6 @@ static ide_startstop_t reset_pollfunc (i
return ide_stopped;
 }
 
-static void check_dma_crc(ide_drive_t *drive)
-{
-#ifdef CONFIG_BLK_DEV_IDEDMA
-   u8 mode;
-
-   ide_dma_off_quietly(drive);
-   drive-crc_count = 0;
-   mode = drive-current_speed;
-   /*
-* Don't try non Ultra-DMA modes without iCRC's.  Force the
-* device to PIO and make the user enable SWDMA/MWDMA modes.
-*/
-   if (mode  XFER_UDMA_0  mode = XFER_UDMA_7)
-   mode--;
-   else
-   mode = XFER_PIO_4;
-   ide_set_xfer_rate(drive, mode);
-   if (drive-current_speed = XFER_SW_DMA_0)
-   ide_dma_on(drive);
-#endif
-}
-
 static void ide_disk_pre_reset(ide_drive_t *drive)
 {
int legacy = (drive-id-cfs_enable_2  0x0400) ? 0 : 1;
@@ -983,7 +961,7 @@ static void pre_reset(ide_drive_t *drive
 
if (drive-using_dma) {
if (drive-crc_count)
-   check_dma_crc(drive);
+   ide_check_dma_crc(drive);
else
ide_dma_off(drive);
}
Index: b/include/linux/ide.h
===
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1158,6 +1158,7 @@ void ide_dma_off_quietly(ide_drive_t *);
 void ide_dma_off(ide_drive_t *);
 void ide_dma_on(ide_drive_t *);
 int ide_set_dma(ide_drive_t *);
+void ide_check_dma_crc(ide_drive_t *);
 ide_startstop_t ide_dma_intr(ide_drive_t *);
 
 int ide_build_sglist(ide_drive_t *, struct request *);
@@ -1185,6 +1186,7 @@ static inline void ide_dma_off(ide_drive
 static inline void ide_dma_on(ide_drive_t *drive) { ; }
 static inline void ide_dma_verbose(ide_drive_t *drive) { ; }
 static inline int ide_set_dma(ide_drive_t *drive) { return 1; }
+static inline void ide_check_dma_crc(ide_drive_t *drive) { ; }
 #endif /* CONFIG_BLK_DEV_IDEDMA */
 
 #ifndef CONFIG_BLK_DEV_IDEDMA_PCI
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: ATA device reset, shoud I be concerned?

2008-01-21 Thread Bartlomiej Zolnierkiewicz
On Monday 21 January 2008, Tejun Heo wrote:

[...]

  Old IDE says it works for PATA. For SATA I can see it might need more
  care and you might simply not be able to get the info.
 
 Old IDE often locks up the machine hard after timeouts.  I'm all for

Could you point me to some bugreports?

I would like to know more about hosts/conditions for which it happens.

 gathering more info but benefit vs. risk equation just doesn't look good
 here.  Why take risk for a rare device which forgets to raise IRQ on
 media error?  If such behavior is wide spread among PATA drives  we
 can verify that TF register access after timeout is safe for PATA
 controllers, sure, but currently we aren't sure about either.

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Palmchip BK3710 IDE driver

2008-01-18 Thread Bartlomiej Zolnierkiewicz

On Friday 18 January 2008, Sergei Shtylyov wrote:
 Alan Cox wrote:
 
 It won't -- we can *not* call ide_setup_dma() which fills them out as 
  this 
 is not a PCI chip.
 
  Gak.
 
 Or maybe we still can -- with hwif-mmio set?
 AFAIR (from the 2006 discussion) Bart said it's *only* for PCI devices...

Well, since BLK_DEV_PALMCHIP_BK3710 selects BLK_DEV_IDEDMA_PCI it should be
possible to call ide_setup_dma() in this driver...

Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Palmchip BK3710 IDE driver

2008-01-18 Thread Bartlomiej Zolnierkiewicz

Hi,

On Thursday 17 January 2008, Anton Salnikov wrote:
 This is Palmchip BK3710 IDE controller support for kernel version 2.6.24-rc8.
 The IDE controller logic supports PIO, multiword DMA and ultra-DMA modes.
 Supports interface to compact Flash (CF) configured in True-IDE mode.

Thanks, overall it looks good but the way in which controller registers are
accessed needs to be reworked according to Alan's comments before this driver
can be accepted in the mainline.

 I had to export two functions (ide_dma_exec_cmd and __ide_dma_test_irq) from 
 driver/ide/ide-dma.c to get rid of copying them.

Please make the exports _GPL.

Also some minor comments below.

 Signed-off-by: Anton Salnikov [EMAIL PROTECTED]
 ---
 
  drivers/ide/Kconfig   |8 
  drivers/ide/arm/Makefile  |1 
  drivers/ide/arm/palm_bk3710.c |  486 
 ++
  drivers/ide/ide-dma.c |6 
  drivers/ide/ide-proc.c|1 
  include/linux/ide.h   |4 
  6 files changed, 503 insertions(+), 3 deletions(-)
 
 Index: 2.6.24-rc7.ide/drivers/ide/Kconfig
 ===
 --- 2.6.24-rc7.ide.orig/drivers/ide/Kconfig
 +++ 2.6.24-rc7.ide/drivers/ide/Kconfig
 @@ -1008,6 +1008,14 @@ config BLK_DEV_Q40IDE
 normally be on; disable it only if you are running a custom hard
 drive subsystem through an expansion card.
  
 +config BLK_DEV_PALMCHIP_BK3710
 + bool Palmchip bk3710 IDE controller support

tristate?

 + depends on ARCH_DAVINCI
 + select BLK_DEV_IDEDMA_PCI
 + help
 +   Say Y here if you want to support the onchip IDE controller on the
 +   TI DaVinci SoC

[...]

 Index: 2.6.24-rc7.ide/drivers/ide/arm/palm_bk3710.c
 ===
 --- /dev/null
 +++ 2.6.24-rc7.ide/drivers/ide/arm/palm_bk3710.c
 @@ -0,0 +1,486 @@
 +/*
 + * Palmchip bk3710 IDE controller
 + *
 + * Copyright (C) 2006 Texas Instruments.
 + * Copyright (C) 2007 MontaVista Software, Inc., [EMAIL PROTECTED]

[...]

 + Modifications:
 + ver. 1.0: Oct 2005, Swaminathan S
 + -

I would prefer revision history to be removed if possible (we keep changelogs
in git tree, also the date doesn't match with Copyrights notice).

[...]

 +static ide_hwif_t *palm_bk3710_hwif;

palm_bk3710_hwif is only accessed in palm_bk3710_probe() so may be as well
moved there (+ renamed to hwif to match usual naming used by other drivers)

 +static struct palm_bk3710_ideregs __iomem *palm_bk3710_base;
 +static long ide_palm_clk;
 +
 +static const struct palm_bk3710_udmatiming palm_bk3710_udmatimings[6] = {
 + {160, 240}, /* UDMA Mode 0 */
 + {125, 160}, /* UDMA Mode 1 */
 + {100, 120}, /* UDMA Mode 2 */
 + {100, 90},  /* UDMA Mode 3 */
 + {85,  60},  /* UDMA Mode 4 */
 + {85,  40}   /* UDMA Mode 5 */
 +};

Hmmm, but palm_bk3710_probe() limits max UDMA to UDMA4...?

 +static struct clk *ideclkp;
 +
 +static void palm_bk3710_setudmamode(unsigned int dev, unsigned int level)

'level' is a bit confusing name for UDMA mode number

 +{
 + char ide_tenv, ide_trp, ide_t0;

- char - u8
- ide_ prefix may as well be dropped

 + /* DMA Data Setup */
 + ide_t0 = (palm_bk3710_udmatimings[level].cycletime + ide_palm_clk - 1)
 + / ide_palm_clk - 1;
 + ide_tenv = (20 + ide_palm_clk - 1) / ide_palm_clk - 1;
 + ide_trp = (palm_bk3710_udmatimings[level].rptime + ide_palm_clk - 1)
 + / ide_palm_clk - 1;
 +
 +
 + if (!dev) {

Since this code needs to be recasted anyway it would be a nice cleanup
to merge '!dev' and 'dev' cases.

 + /* setup master device parameters */
 +
 + /* udmatim Register */
 + palm_bk3710_base-config.udmatim = 0xFFF0;
 + palm_bk3710_base-config.udmatim |= level;
 + /* udmastb Ultra DMA Access Strobe Width */
 + palm_bk3710_base-config.udmastb = 0xFF00;
 + palm_bk3710_base-config.udmastb |= ide_t0;
 + /* udmatrp Ultra DMA Ready to Pause Time */
 + palm_bk3710_base-config.udmatrp = 0xFF00;
 + palm_bk3710_base-config.udmatrp |= ide_trp;
 + /* udmaenv Ultra DMA envelop Time */
 + palm_bk3710_base-config.udmaenv = 0xFF00;
 + palm_bk3710_base-config.udmaenv |= ide_tenv;
 + /* Enable UDMA for Device 0 */
 + palm_bk3710_base-config.udmactl |= 1;
 + } else {
 + /* setup slave device parameters */
 +
 + /* udmatim Register */
 + palm_bk3710_base-config.udmatim = 0xFF0F;
 + palm_bk3710_base-config.udmatim |= (level  4);
 + /* udmastb Ultra DMA Access Strobe Width */
 + palm_bk3710_base-config.udmastb = 0xFF;
 + palm_bk3710_base-config.udmastb |= (ide_t0  8);
 + /* udmatrp Ultra 

Re: [PATCH 10/12] ide-floppy: remove atomic test_*bit macros

2008-01-16 Thread Bartlomiej Zolnierkiewicz
On Tuesday 15 January 2008, Borislav Petkov wrote:
 On Mon, Jan 14, 2008 at 11:32:58PM +0100, Bartlomiej Zolnierkiewicz wrote:
  On Monday 14 January 2008, Bartlomiej Zolnierkiewicz wrote:
   On Sunday 13 January 2008, Borislav Petkov wrote:
..and replace them with flag enums.

Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
  
  small update:
  
  PC_ABORT is never set and may as well be removed in a pre-patch
 
 Here you go, the one below should be pushed first...
 
 --
 From: Borislav Petkov [EMAIL PROTECTED]
 Date: Tue, 15 Jan 2008 20:34:50 +0100
 Subject: ide-floppy: remove unused flag PC_ABORT
 
 This flag was never being set in the code so remove it. By the way, the
 code in the second patch was being executed unconditionally, i.e. in case
 pc-retries  IDEFLOPPY_MAX_PC_RETRIES is true (actually that is the only case
 when the outer if-test passed), !test_bit(PC_ABORT, pc-flags)
 was always true so the comment is now incorrect and has to go.
 
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]

thanks, applied
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 10/12] ide-floppy: remove atomic test_*bit macros

2008-01-16 Thread Bartlomiej Zolnierkiewicz
On Tuesday 15 January 2008, Borislav Petkov wrote:

[...]

 .. this is the second one...
 
 
 From: Borislav Petkov [EMAIL PROTECTED]
 Date: Tue, 15 Jan 2008 20:49:18 +0100
 Subject: [PATCH 16/18] ide-floppy: remove atomic test_*bit macros
 
 ..and replace them with flag enums.
 
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]

applied

[...]

 @@ -1713,13 +1723,16 @@ static int idefloppy_media_changed(struct gendisk 
 *disk)
  {
   struct ide_floppy_obj *floppy = ide_floppy_g(disk);
   ide_drive_t *drive = floppy-drive;
 + int ret;
  
   /* do not scan partitions twice if this is a removable device */
   if (drive-attach) {
   drive-attach = 0;
   return 0;
   }
 - return test_and_clear_bit(IDEFLOPPY_MEDIA_CHANGED, floppy-flags);
 + ret = floppy-flags  IDEFLOPPY_FLAG_MEDIA_CHANGED;
 + floppy-flags = ~IDEFLOPPY_FLAG_MEDIA_CHANGED;
 + return ret;
  }

this chunk (idefloppy_media_changed() return value is now 2 instead of 1
if IDEFLOPPY_FLAG_MEDIA_CHANGED flag is set) seems to have slipped through

[ I fixed it while merging the patch ]
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: (was: Re:...) [PATCH 12/12] ide-floppy: fix most of the remaining checkpatch.pl issues-v2

2008-01-16 Thread Bartlomiej Zolnierkiewicz
On Tuesday 15 January 2008, Borislav Petkov wrote:
 ... and finally the last one. Whew! I think we're done here for now. :)
 
 --
 From: Borislav Petkov [EMAIL PROTECTED]
 Date: Tue, 15 Jan 2008 21:01:04 +0100
 Subject: ide-floppy: fix most of the remaining checkpatch.pl issues-v2
 
 such as
 ERROR: switch and case should be at the same indent
 ERROR: need spaces around that '=' (ctx:VxV)
 ERROR: trailing statements should be on next line
 WARNING: no space between function name and open parenthesis '('
 WARNING: printk() should include KERN_ facility level
 ERROR: That open brace { should be on the previous line
 ERROR: use tabs not spaces
 ERROR: do not use assignment in if condition
 WARNING: braces {} are not necessary for single statement blocks
 ERROR: need space after that ',' (ctx:VxV)
 WARNING: line over 80 characters
 ERROR: do not use assignment in if condition
 ...
 and so on.
 
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]

applied
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 00/22] ide: even more IDE probing code rework

2008-01-16 Thread Bartlomiej Zolnierkiewicz

Just another bunch of small fixes/cleanups...

diffstat:

 drivers/ide/arm/bast-ide.c|   22 +++-
 drivers/ide/arm/rapide.c  |4
 drivers/ide/ide-acpi.c|   60 +++
 drivers/ide/ide-pnp.c |9 -
 drivers/ide/ide-probe.c   |  204 +-
 drivers/ide/ide-proc.c|7 -
 drivers/ide/ide.c |   66 +++-
 drivers/ide/legacy/dtc2278.c  |   10 -
 drivers/ide/legacy/ht6560b.c  |   26 ++--
 drivers/ide/legacy/ide-cs.c   |   31 +
 drivers/ide/legacy/ide_platform.c |4
 drivers/ide/legacy/qd65xx.c   |   44 ++--
 drivers/ide/mips/au1xxx-ide.c |7 -
 drivers/ide/pci/delkin_cb.c   |   40 +--
 drivers/ide/pci/opti621.c |   10 +
 drivers/ide/pci/rz1000.c  |3
 drivers/ide/pci/scc_pata.c|4
 drivers/macintosh/mediabay.c  |2
 include/linux/ide.h   |   22 ++--
 19 files changed, 340 insertions(+), 235 deletions(-)
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 02/22] ide: remove redundant init_hwif_default() call from ide_register_hw()

2008-01-16 Thread Bartlomiej Zolnierkiewicz
ide_init_port_hw() call overrides setup done by init_hwif_default().

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide.c |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Index: b/drivers/ide/ide.c
===
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -716,10 +716,8 @@ int ide_register_hw(hw_regs_t *hw, void 
 found:
if (hwif-present)
ide_unregister(index);
-   else if (!hwif-hold) {
+   else if (!hwif-hold)
ide_init_port_data(hwif, index);
-   init_hwif_default(hwif, index);
-   }
 
ide_init_port_hw(hwif, hw);
hwif-quirkproc = quirkproc;
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 04/22] ide: add ide_deprecated_find_port() helper

2008-01-16 Thread Bartlomiej Zolnierkiewicz
* Factor out code for finding ide_hwifs[] slot from ide_register_hw()
  to ide_deprecated_find_port().

* Convert bast-ide, ide-cs and delkin_cb host drivers to use ide_device_add()
  instead of ide_register_hw() (while at it drop doing ide_unregister() loop
  which tries to unregister _all_ IDE interfaces if useable ide_hwifs[] slot
  cannot be find).

This patch leaves us with only two ide_register_hw() users:
- drivers/macintosh/mediabay.c
- drivers/ide/ide.c

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/arm/bast-ide.c  |   20 +++-
 drivers/ide/ide.c   |   41 +
 drivers/ide/legacy/ide-cs.c |   25 -
 drivers/ide/pci/delkin_cb.c |   33 +++--
 include/linux/ide.h |1 +
 5 files changed, 100 insertions(+), 20 deletions(-)

Index: b/drivers/ide/arm/bast-ide.c
===
--- a/drivers/ide/arm/bast-ide.c
+++ b/drivers/ide/arm/bast-ide.c
@@ -28,8 +28,10 @@ static int __init
 bastide_register(unsigned int base, unsigned int aux, int irq,
 ide_hwif_t **hwif)
 {
+   ide_hwif_t *hwif;
hw_regs_t hw;
int i;
+   u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
 
memset(hw, 0, sizeof(hw));
 
@@ -44,8 +46,24 @@ bastide_register(unsigned int base, unsi
hw.io_ports[IDE_CONTROL_OFFSET] = aux + (6 * 0x20);
hw.irq = irq;
 
-   ide_register_hw(hw, NULL, hwif);
+   hwif = ide_deprecated_find_port(hw.io_ports[IDE_DATA_OFFSET]);
+   if (hwif == NULL)
+   goto out;
 
+   i = hwif-index;
+
+   if (hwif-present)
+   ide_unregister(i, 0, 1);
+   else if (!hwif-hold)
+   ide_init_port_data(hwif, i);
+
+   ide_init_port_hw(hwif, hw);
+   hwif-quirkproc = NULL;
+
+   idx[0] = i;
+
+   ide_device_add(idx, NULL);
+out:
return 0;
 }
 
Index: b/drivers/ide/ide.c
===
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -683,6 +683,31 @@ void ide_init_port_hw(ide_hwif_t *hwif, 
 }
 EXPORT_SYMBOL_GPL(ide_init_port_hw);
 
+ide_hwif_t *ide_deprecated_find_port(unsigned long base)
+{
+   ide_hwif_t *hwif;
+   int i;
+
+   for (i = 0; i  MAX_HWIFS; i++) {
+   hwif = ide_hwifs[i];
+   if (hwif-io_ports[IDE_DATA_OFFSET] == base)
+   goto found;
+   }
+
+   for (i = 0; i  MAX_HWIFS; i++) {
+   hwif = ide_hwifs[i];
+   if (hwif-hold)
+   continue;
+   if (!hwif-present  hwif-mate == NULL)
+   goto found;
+   }
+
+   hwif = NULL;
+found:
+   return hwif;
+}
+EXPORT_SYMBOL_GPL(ide_deprecated_find_port);
+
 /**
  * ide_register_hw -   register IDE interface
  * @hw: hardware registers
@@ -702,18 +727,10 @@ int ide_register_hw(hw_regs_t *hw, void 
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
 
do {
-   for (index = 0; index  MAX_HWIFS; ++index) {
-   hwif = ide_hwifs[index];
-   if (hwif-io_ports[IDE_DATA_OFFSET] == 
hw-io_ports[IDE_DATA_OFFSET])
-   goto found;
-   }
-   for (index = 0; index  MAX_HWIFS; ++index) {
-   hwif = ide_hwifs[index];
-   if (hwif-hold)
-   continue;
-   if (!hwif-present  hwif-mate == NULL)
-   goto found;
-   }
+   hwif = ide_deprecated_find_port(hw-io_ports[IDE_DATA_OFFSET]);
+   index = hwif-index;
+   if (hwif)
+   goto found;
for (index = 0; index  MAX_HWIFS; index++)
ide_unregister(index, 1, 1);
} while (retry--);
Index: b/drivers/ide/legacy/ide-cs.c
===
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -145,13 +145,36 @@ static void ide_detach(struct pcmcia_dev
 
 static int idecs_register(unsigned long io, unsigned long ctl, unsigned long 
irq, struct pcmcia_device *handle)
 {
+ide_hwif_t *hwif;
 hw_regs_t hw;
+int i;
+u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
+
 memset(hw, 0, sizeof(hw));
 ide_init_hwif_ports(hw, io, ctl, NULL);
 hw.irq = irq;
 hw.chipset = ide_pci;
 hw.dev = handle-dev;
-return ide_register_hw(hw, ide_undecoded_slave, NULL);
+
+hwif = ide_deprecated_find_port(hw.io_ports[IDE_DATA_OFFSET]);
+if (hwif == NULL)
+   return -1;
+
+i = hwif-index;
+
+if (hwif-present)
+   ide_unregister(i, 0, 1);
+else if (!hwif-hold)
+   ide_init_port_data(hwif, i);
+
+ide_init_port_hw(hwif, hw);
+hwif-quirkproc = ide_undecoded_slave

[PATCH 05/22] ide: fix ide_unregister() usage in host drivers

2008-01-16 Thread Bartlomiej Zolnierkiewicz
bast-ide.c/ide-cs.c/delkin_cb.c:

* Don't set 'restore' flag for ide_unregister() when initializing new
  interface.

rapide.c/ide-pnp.c/ide-cs.c/ide_platform.c/au1xxx-ide.c/delkin_cb.c/scc_pata.c:

* Don't set 'init_default' and 'restore' flags for ide_unregister() when
  removing interface.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/arm/bast-ide.c|2 +-
 drivers/ide/arm/rapide.c  |2 +-
 drivers/ide/ide-pnp.c |2 +-
 drivers/ide/legacy/ide-cs.c   |4 ++--
 drivers/ide/legacy/ide_platform.c |2 +-
 drivers/ide/mips/au1xxx-ide.c |2 +-
 drivers/ide/pci/delkin_cb.c   |4 ++--
 drivers/ide/pci/scc_pata.c|2 +-
 8 files changed, 10 insertions(+), 10 deletions(-)

Index: b/drivers/ide/arm/bast-ide.c
===
--- a/drivers/ide/arm/bast-ide.c
+++ b/drivers/ide/arm/bast-ide.c
@@ -53,7 +53,7 @@ bastide_register(unsigned int base, unsi
i = hwif-index;
 
if (hwif-present)
-   ide_unregister(i, 0, 1);
+   ide_unregister(i, 0, 0);
else if (!hwif-hold)
ide_init_port_data(hwif, i);
 
Index: b/drivers/ide/arm/rapide.c
===
--- a/drivers/ide/arm/rapide.c
+++ b/drivers/ide/arm/rapide.c
@@ -76,7 +76,7 @@ static void __devexit rapide_remove(stru
 
ecard_set_drvdata(ec, NULL);
 
-   ide_unregister(hwif-index, 1, 1);
+   ide_unregister(hwif-index, 0, 0);
 
ecard_release_resources(ec);
 }
Index: b/drivers/ide/ide-pnp.c
===
--- a/drivers/ide/ide-pnp.c
+++ b/drivers/ide/ide-pnp.c
@@ -62,7 +62,7 @@ static void idepnp_remove(struct pnp_dev
ide_hwif_t *hwif = pnp_get_drvdata(dev);
 
if (hwif)
-   ide_unregister(hwif-index, 1, 1);
+   ide_unregister(hwif-index, 0, 0);
else
printk(KERN_ERR idepnp: Unable to remove device, please 
report.\n);
 }
Index: b/drivers/ide/legacy/ide-cs.c
===
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -163,7 +163,7 @@ static int idecs_register(unsigned long 
 i = hwif-index;
 
 if (hwif-present)
-   ide_unregister(i, 0, 1);
+   ide_unregister(i, 0, 0);
 else if (!hwif-hold)
ide_init_port_data(hwif, i);
 
@@ -360,7 +360,7 @@ void ide_release(struct pcmcia_device *l
 if (info-ndev) {
/* FIXME: if this fails we need to queue the cleanup somehow
   -- need to investigate the required PCMCIA magic */
-   ide_unregister(info-hd, 1, 1);
+   ide_unregister(info-hd, 0, 0);
 }
 info-ndev = 0;
 
Index: b/drivers/ide/legacy/ide_platform.c
===
--- a/drivers/ide/legacy/ide_platform.c
+++ b/drivers/ide/legacy/ide_platform.c
@@ -122,7 +122,7 @@ static int __devexit plat_ide_remove(str
 {
ide_hwif_t *hwif = pdev-dev.driver_data;
 
-   ide_unregister(hwif-index, 1, 1);
+   ide_unregister(hwif-index, 0, 0);
 
return 0;
 }
Index: b/drivers/ide/mips/au1xxx-ide.c
===
--- a/drivers/ide/mips/au1xxx-ide.c
+++ b/drivers/ide/mips/au1xxx-ide.c
@@ -678,7 +678,7 @@ static int au_ide_remove(struct device *
ide_hwif_t *hwif = dev_get_drvdata(dev);
_auide_hwif *ahwif = auide_hwif;
 
-   ide_unregister(hwif-index, 1, 1);
+   ide_unregister(hwif-index, 0, 0);
 
iounmap((void *)ahwif-regbase);
 
Index: b/drivers/ide/pci/delkin_cb.c
===
--- a/drivers/ide/pci/delkin_cb.c
+++ b/drivers/ide/pci/delkin_cb.c
@@ -85,7 +85,7 @@ delkin_cb_probe (struct pci_dev *dev, co
i = hwif-index;
 
if (hwif-present)
-   ide_unregister(i, 0, 1);
+   ide_unregister(i, 0, 0);
else if (!hwif-hold)
ide_init_port_data(hwif, i);
 
@@ -120,7 +120,7 @@ delkin_cb_remove (struct pci_dev *dev)
ide_hwif_t *hwif = pci_get_drvdata(dev);
 
if (hwif)
-   ide_unregister(hwif-index, 1, 1);
+   ide_unregister(hwif-index, 0, 0);
 
pci_disable_device(dev);
 }
Index: b/drivers/ide/pci/scc_pata.c
===
--- a/drivers/ide/pci/scc_pata.c
+++ b/drivers/ide/pci/scc_pata.c
@@ -736,7 +736,7 @@ static void __devexit scc_remove(struct 
hwif-dmatable_cpu = NULL;
}
 
-   ide_unregister(hwif-index, 1, 1);
+   ide_unregister(hwif-index, 0, 0);
 
hwif-chipset = ide_unknown;
iounmap((void*)ports-dma);
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http

[PATCH 06/22] ide: factor out code initializing devices from ide_init_port()

2008-01-16 Thread Bartlomiej Zolnierkiewicz
* Factor out code initializing devices from ide_init_port() to
  ide_port_init_devices().

* Call the new function from ide_device_add_all().

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-probe.c |   32 +---
 1 file changed, 17 insertions(+), 15 deletions(-)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1289,6 +1289,22 @@ static void hwif_register_devices(ide_hw
}
 }
 
+static void ide_port_init_devices(ide_hwif_t *hwif)
+{
+   int i;
+
+   for (i = 0; i  MAX_DRIVES; i++) {
+   ide_drive_t *drive = hwif-drives[i];
+
+   if (hwif-host_flags  IDE_HFLAG_IO_32BIT)
+   drive-io_32bit = 1;
+   if (hwif-host_flags  IDE_HFLAG_UNMASK_IRQS)
+   drive-unmask = 1;
+   if ((hwif-host_flags  IDE_HFLAG_NO_AUTOTUNE) == 0)
+   drive-autotune = 1;
+   }
+}
+
 static void ide_init_port(ide_hwif_t *hwif, unsigned int port,
  const struct ide_port_info *d)
 {
@@ -1314,16 +1330,6 @@ static void ide_init_port(ide_hwif_t *hw
if ((d-host_flags  IDE_HFLAG_SERIALIZE)  hwif-mate)
hwif-mate-serialized = hwif-serialized = 1;
 
-   if (d-host_flags  IDE_HFLAG_IO_32BIT) {
-   hwif-drives[0].io_32bit = 1;
-   hwif-drives[1].io_32bit = 1;
-   }
-
-   if (d-host_flags  IDE_HFLAG_UNMASK_IRQS) {
-   hwif-drives[0].unmask = 1;
-   hwif-drives[1].unmask = 1;
-   }
-
hwif-swdma_mask = d-swdma_mask;
hwif-mwdma_mask = d-mwdma_mask;
hwif-ultra_mask = d-udma_mask;
@@ -1332,11 +1338,6 @@ static void ide_init_port(ide_hwif_t *hw
if ((d-host_flags  IDE_HFLAG_NO_DMA) == 0  hwif-dma_base == 0)
hwif-swdma_mask = hwif-mwdma_mask = hwif-ultra_mask = 0;
 
-   if ((d-host_flags  IDE_HFLAG_NO_AUTOTUNE) == 0) {
-   hwif-drives[0].autotune = 1;
-   hwif-drives[1].autotune = 1;
-   }
-
if (d-host_flags  IDE_HFLAG_RQSIZE_256)
hwif-rqsize = 256;
 
@@ -1371,6 +1372,7 @@ int ide_device_add_all(u8 idx[MAX_HWIFS]
mate = (i  1) ? NULL : hwif;
 
ide_init_port(hwif, i  1, d);
+   ide_port_init_devices(hwif);
}
 
for (i = 0; i  MAX_HWIFS; i++) {
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 07/22] ide: add IDE_HFLAG_NO_{IO32_BIT,UNMASK_IRQS} host flags

2008-01-16 Thread Bartlomiej Zolnierkiewicz
* Use the same bit for IDE_HFLAG_CS5520 and IDE_HFLAG_VDMA host flags
  (both are used only by cs5520 host driver currently).

* Add IDE_HFLAG_NO_IO32_BIT host flag and use it instead of -no_io_32bit
  ide_hwif_t field.

* Add IDE_HFLAG_NO_UNMASK_IRQS host flag, then convert dtc2278 and rz1000
  host drivers to use it.

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-probe.c   |4 +++-
 drivers/ide/legacy/dtc2278.c  |   10 +++---
 drivers/ide/mips/au1xxx-ide.c |3 +--
 drivers/ide/pci/rz1000.c  |3 +--
 include/linux/ide.h   |   13 -
 5 files changed, 16 insertions(+), 17 deletions(-)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -822,7 +822,7 @@ static void ide_port_tune_devices(ide_hw
for (unit = 0; unit  MAX_DRIVES; ++unit) {
ide_drive_t *drive = hwif-drives[unit];
 
-   if (hwif-no_io_32bit)
+   if (hwif-host_flags  IDE_HFLAG_NO_IO_32BIT)
drive-no_io_32bit = 1;
else
drive-no_io_32bit = drive-id-dword_io ? 1 : 0;
@@ -1300,6 +1300,8 @@ static void ide_port_init_devices(ide_hw
drive-io_32bit = 1;
if (hwif-host_flags  IDE_HFLAG_UNMASK_IRQS)
drive-unmask = 1;
+   if (hwif-host_flags  IDE_HFLAG_NO_UNMASK_IRQS)
+   drive-no_unmask = 1;
if ((hwif-host_flags  IDE_HFLAG_NO_AUTOTUNE) == 0)
drive-autotune = 1;
}
Index: b/drivers/ide/legacy/dtc2278.c
===
--- a/drivers/ide/legacy/dtc2278.c
+++ b/drivers/ide/legacy/dtc2278.c
@@ -89,7 +89,10 @@ static void dtc2278_set_pio_mode(ide_dri
 static const struct ide_port_info dtc2278_port_info __initdata = {
.chipset= ide_dtc2278,
.host_flags = IDE_HFLAG_SERIALIZE |
+ IDE_HFLAG_NO_UNMASK_IRQS |
  IDE_HFLAG_IO_32BIT |
+ /* disallow -io_32bit changes */
+ IDE_HFLAG_NO_IO_32BIT |
  IDE_HFLAG_NO_DMA |
  IDE_HFLAG_NO_AUTOTUNE,
.pio_mask   = ATA_PIO4,
@@ -125,14 +128,7 @@ static int __init dtc2278_probe(void)
 #endif
local_irq_restore(flags);
 
-   hwif-no_io_32bit = 1;  /* disallow -io_32bit changes */
hwif-set_pio_mode = dtc2278_set_pio_mode;
-   hwif-drives[0].no_unmask = 1;
-   hwif-drives[1].no_unmask = 1;
-
-   mate-no_io_32bit = 1;
-   mate-drives[0].no_unmask = 1;
-   mate-drives[1].no_unmask = 1;
 
ide_device_add(idx, dtc2278_port_info);
 
Index: b/drivers/ide/mips/au1xxx-ide.c
===
--- a/drivers/ide/mips/au1xxx-ide.c
+++ b/drivers/ide/mips/au1xxx-ide.c
@@ -551,6 +551,7 @@ static void auide_setup_ports(hw_regs_t 
 static const struct ide_port_info au1xxx_port_info = {
.host_flags = IDE_HFLAG_POST_SET_MODE |
  IDE_HFLAG_NO_DMA | /* no SFF-style DMA */
+ IDE_HFLAG_NO_IO_32BIT |
  IDE_HFLAG_UNMASK_IRQS,
.pio_mask   = ATA_PIO4,
 #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
@@ -649,8 +650,6 @@ static int au_ide_probe(struct device *d
hwif-select_data   = 0;/* no chipset-specific code */
hwif-config_data   = 0;/* no chipset-specific code */
 
-   hwif-no_io_32bit   = 1;
-
auide_hwif.hwif = hwif;
hwif-hwif_data = auide_hwif;
 
Index: b/drivers/ide/pci/rz1000.c
===
--- a/drivers/ide/pci/rz1000.c
+++ b/drivers/ide/pci/rz1000.c
@@ -33,8 +33,7 @@ static void __devinit init_hwif_rz1000 (
} else {
if (hwif-mate)
hwif-mate-serialized = hwif-serialized = 1;
-   hwif-drives[0].no_unmask = 1;
-   hwif-drives[1].no_unmask = 1;
+   hwif-host_flags |= IDE_HFLAG_NO_UNMASK_IRQS;
printk(KERN_INFO %s: serialized, disabled unmasking 
(buggy RZ1000/RZ1001)\n, hwif-name);
}
Index: b/include/linux/ide.h
===
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -607,7 +607,6 @@ typedef struct hwif_s {
unsignedreset  : 1; /* reset after probe */
unsignedauto_poll  : 1; /* supports nop auto-poll */
unsignedsg_mapped  : 1

[PATCH 08/22] ide: add -init_port_devs method to ide_hwif_t

2008-01-16 Thread Bartlomiej Zolnierkiewicz
* Add -init_port_devs method to ide_hwif_t for a host specific
  initialization of devices on a port.  Call the new method from
  ide_port_init_devices().

* Convert ht6560b, qd65xx and opti621 host drivers to use the new
  -init_port_devs method.

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-probe.c  |3 ++
 drivers/ide/legacy/ht6560b.c |   26 +
 drivers/ide/legacy/qd65xx.c  |   44 ---
 drivers/ide/pci/opti621.c|   10 ++---
 include/linux/ide.h  |2 +
 5 files changed, 59 insertions(+), 26 deletions(-)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1305,6 +1305,9 @@ static void ide_port_init_devices(ide_hw
if ((hwif-host_flags  IDE_HFLAG_NO_AUTOTUNE) == 0)
drive-autotune = 1;
}
+
+   if (hwif-port_init_devs)
+   hwif-port_init_devs(hwif);
 }
 
 static void ide_init_port(ide_hwif_t *hwif, unsigned int port,
Index: b/drivers/ide/legacy/ht6560b.c
===
--- a/drivers/ide/legacy/ht6560b.c
+++ b/drivers/ide/legacy/ht6560b.c
@@ -300,6 +300,18 @@ static void ht6560b_set_pio_mode(ide_dri
 #endif
 }
 
+static void __init ht6560b_port_init_devs(ide_hwif_t *hwif)
+{
+   /* Setting default configurations for drives. */
+   int t = (HT_CONFIG_DEFAULT  8) | HT_TIMING_DEFAULT;
+
+   if (hwif-channel)
+   t |= (HT_SECONDARY_IF  8);
+
+   hwif-drives[0].drive_data = t;
+   hwif-drives[1].drive_data = t;
+}
+
 int probe_ht6560b = 0;
 
 module_param_named(probe, probe_ht6560b, bool, 0);
@@ -318,7 +330,6 @@ static int __init ht6560b_init(void)
 {
ide_hwif_t *hwif, *mate;
static u8 idx[4] = { 0, 1, 0xff, 0xff };
-   int t;
 
if (probe_ht6560b == 0)
return -ENODEV;
@@ -343,17 +354,8 @@ static int __init ht6560b_init(void)
mate-selectproc = ht6560b_selectproc;
mate-set_pio_mode = ht6560b_set_pio_mode;
 
-   /*
-* Setting default configurations for drives
-*/
-   t = (HT_CONFIG_DEFAULT  8);
-   t |= HT_TIMING_DEFAULT;
-   hwif-drives[0].drive_data = t;
-   hwif-drives[1].drive_data = t;
-
-   t |= (HT_SECONDARY_IF  8);
-   mate-drives[0].drive_data = t;
-   mate-drives[1].drive_data = t;
+   hwif-port_init_devs = ht6560b_port_init_devs;
+   mate-port_init_devs = ht6560b_port_init_devs;
 
ide_device_add(idx, ht6560b_port_info);
 
Index: b/drivers/ide/legacy/qd65xx.c
===
--- a/drivers/ide/legacy/qd65xx.c
+++ b/drivers/ide/legacy/qd65xx.c
@@ -305,13 +305,33 @@ static int __init qd_testreg(int port)
  * called to setup an ata channel : adjusts attributes  links for tuning
  */
 
-static void __init qd_setup(ide_hwif_t *hwif, int base, int config,
-   unsigned int data0, unsigned int data1)
+static void __init qd_setup(ide_hwif_t *hwif, int base, int config)
 {
hwif-select_data = base;
hwif-config_data = config;
-   hwif-drives[0].drive_data = data0;
-   hwif-drives[1].drive_data = data1;
+}
+
+static void __init qd6500_port_init_devs(ide_hwif_t *hwif)
+{
+   u8 base = hwif-select_data, config = QD_CONFIG(hwif);
+
+   hwif-drives[0].drive_data = QD6500_DEF_DATA;
+   hwif-drives[1].drive_data = QD6500_DEF_DATA;
+}
+
+static void __init qd6580_port_init_devs(ide_hwif_t *hwif)
+{
+   u16 t1, t2;
+   u8 base = hwif-select_data, config = QD_CONFIG(hwif);
+
+   if (QD_CONTROL(hwif)  QD_CONTR_SEC_DISABLED) {
+   t1 = QD6580_DEF_DATA;
+   t2 = QD6580_DEF_DATA2;
+   } else
+   t2 = t1 = hwif-channel ? QD6580_DEF_DATA2 : QD6580_DEF_DATA;
+
+   hwif-drives[0].drive_data = t1;
+   hwif-drives[1].drive_data = t2;
 }
 
 /*
@@ -396,8 +416,9 @@ static int __init qd_probe(int base)
return 1;
}
 
-   qd_setup(hwif, base, config, QD6500_DEF_DATA, QD6500_DEF_DATA);
+   qd_setup(hwif, base, config);
 
+   hwif-port_init_devs = qd6500_port_init_devs;
hwif-set_pio_mode = qd6500_set_pio_mode;
 
idx[unit] = unit;
@@ -429,9 +450,10 @@ static int __init qd_probe(int base)
hwif = ide_hwifs[unit];
printk(KERN_INFO %s: qd6580: single IDE board\n,
 hwif-name);
-   qd_setup(hwif, base, config | (control  8),
-QD6580_DEF_DATA, QD6580_DEF_DATA2);
 
+   qd_setup(hwif, base, config | (control  8));
+
+   hwif-port_init_devs

[PATCH 09/22] ide: remove incorrect init_gendisk() comment

2008-01-16 Thread Bartlomiej Zolnierkiewicz
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-probe.c |6 --
 1 file changed, 6 deletions(-)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1182,12 +1182,6 @@ static void drive_release_dev (struct de
complete(drive-gendev_rel_comp);
 }
 
-/*
- * init_gendisk() (as opposed to ide_geninit) is called for each major device,
- * after probing for drives, to allocate partition tables and other data
- * structures needed for the routines in genhd.c.  ide_geninit() gets called
- * somewhat later, during the partition check.
- */
 static void init_gendisk (ide_hwif_t *hwif)
 {
unsigned int unit;
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/22] ide: skip not present devices in init_gendisk()

2008-01-16 Thread Bartlomiej Zolnierkiewicz
No need to initialize drive-gendev and waste memory on IDE settings
for not present devices.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-probe.c |4 
 1 file changed, 4 insertions(+)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1194,6 +1194,10 @@ static void init_gendisk (ide_hwif_t *hw
 
for (unit = 0; unit  MAX_DRIVES; ++unit) {
ide_drive_t * drive = hwif-drives[unit];
+
+   if (!drive-present)
+   continue;
+
ide_add_generic_settings(drive);
snprintf(drive-gendev.bus_id,BUS_ID_SIZE,%u.%u,
 hwif-index,unit);
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 11/22] ide: move blk_register_region() call out from init_gendisk()

2008-01-16 Thread Bartlomiej Zolnierkiewicz
Move blk_register_region() call out from init_gendisk() to hwif_init().

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-probe.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1200,8 +1200,6 @@ static void init_gendisk (ide_hwif_t *hw
drive-gendev.driver_data = drive;
drive-gendev.release = drive_release_dev;
}
-   blk_register_region(MKDEV(hwif-major, 0), MAX_DRIVES  PARTN_BITS,
-   THIS_MODULE, ata_probe, ata_lock, hwif);
 }
 
 static int hwif_init(ide_hwif_t *hwif)
@@ -1261,6 +1259,8 @@ static int hwif_init(ide_hwif_t *hwif)
 
 done:
init_gendisk(hwif);
+   blk_register_region(MKDEV(hwif-major, 0), MAX_DRIVES  PARTN_BITS,
+   THIS_MODULE, ata_probe, ata_lock, hwif);
ide_acpi_init(hwif);
return 1;
 
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 12/22] ide: call init_gendisk() after ide_acpi_init()

2008-01-16 Thread Bartlomiej Zolnierkiewicz
There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-probe.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1258,10 +1258,10 @@ static int hwif_init(ide_hwif_t *hwif)
hwif-name, hwif-irq);
 
 done:
-   init_gendisk(hwif);
blk_register_region(MKDEV(hwif-major, 0), MAX_DRIVES  PARTN_BITS,
THIS_MODULE, ata_probe, ata_lock, hwif);
ide_acpi_init(hwif);
+   init_gendisk(hwif);
return 1;
 
 out:
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 13/22] ide: merge init_gendisk() into hwif_register_devices()

2008-01-16 Thread Bartlomiej Zolnierkiewicz
There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-probe.c |   44 
 1 file changed, 16 insertions(+), 28 deletions(-)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1182,26 +1182,6 @@ static void drive_release_dev (struct de
complete(drive-gendev_rel_comp);
 }
 
-static void init_gendisk (ide_hwif_t *hwif)
-{
-   unsigned int unit;
-
-   for (unit = 0; unit  MAX_DRIVES; ++unit) {
-   ide_drive_t * drive = hwif-drives[unit];
-
-   if (!drive-present)
-   continue;
-
-   ide_add_generic_settings(drive);
-   snprintf(drive-gendev.bus_id,BUS_ID_SIZE,%u.%u,
-hwif-index,unit);
-   drive-gendev.parent = hwif-gendev;
-   drive-gendev.bus = ide_bus_type;
-   drive-gendev.driver_data = drive;
-   drive-gendev.release = drive_release_dev;
-   }
-}
-
 static int hwif_init(ide_hwif_t *hwif)
 {
int old_irq;
@@ -1261,7 +1241,6 @@ done:
blk_register_region(MKDEV(hwif-major, 0), MAX_DRIVES  PARTN_BITS,
THIS_MODULE, ata_probe, ata_lock, hwif);
ide_acpi_init(hwif);
-   init_gendisk(hwif);
return 1;
 
 out:
@@ -1275,15 +1254,24 @@ static void hwif_register_devices(ide_hw
 
for (i = 0; i  MAX_DRIVES; i++) {
ide_drive_t *drive = hwif-drives[i];
+   struct device *dev = drive-gendev;
+   int ret;
 
-   if (drive-present) {
-   int ret = device_register(drive-gendev);
+   if (!drive-present)
+   continue;
 
-   if (ret  0)
-   printk(KERN_WARNING IDE: %s: 
-   device_register error: %d\n,
-   __FUNCTION__, ret);
-   }
+   ide_add_generic_settings(drive);
+
+   snprintf(dev-bus_id, BUS_ID_SIZE, %u.%u, hwif-index, i);
+   dev-parent = hwif-gendev;
+   dev-bus = ide_bus_type;
+   dev-driver_data = drive;
+   dev-release = drive_release_dev;
+
+   ret = device_register(dev);
+   if (ret  0)
+   printk(KERN_WARNING IDE: %s: device_register error: 
+   %d\n, __func__, ret);
}
 }
 
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 14/22] ide: move hwif-rqsize init from ide_init_queue() to init_irq()

2008-01-16 Thread Bartlomiej Zolnierkiewicz
Move hwif-rqsize init from ide_init_queue() to init_irq().

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-probe.c |   15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -881,13 +881,6 @@ static int ide_init_queue(ide_drive_t *d
q-queuedata = drive;
blk_queue_segment_boundary(q, 0x);
 
-   if (!hwif-rqsize) {
-   if ((hwif-host_flags  IDE_HFLAG_NO_LBA48) ||
-   (hwif-host_flags  IDE_HFLAG_NO_LBA48_DMA))
-   hwif-rqsize = 256;
-   else
-   hwif-rqsize = 65536;
-   }
if (hwif-rqsize  max_sectors)
max_sectors = hwif-rqsize;
blk_queue_max_sectors(q, max_sectors);
@@ -1019,6 +1012,14 @@ static int init_irq (ide_hwif_t *hwif)
goto out_unlink;
}
 
+   if (!hwif-rqsize) {
+   if ((hwif-host_flags  IDE_HFLAG_NO_LBA48) ||
+   (hwif-host_flags  IDE_HFLAG_NO_LBA48_DMA))
+   hwif-rqsize = 256;
+   else
+   hwif-rqsize = 65536;
+   }
+
/*
 * For any present drive:
 * - allocate the block device queue
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 15/22] ide: factor out adding drive to hwgroup from init_irq()

2008-01-16 Thread Bartlomiej Zolnierkiewicz
Factor out adding drive to hwgroup from init_irq() to
ide_add_drive_to_hwgroup().

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-probe.c |   29 ++---
 1 file changed, 18 insertions(+), 11 deletions(-)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -911,6 +911,23 @@ static int ide_init_queue(ide_drive_t *d
return 0;
 }
 
+static void ide_add_drive_to_hwgroup(ide_drive_t *drive)
+{
+   ide_hwgroup_t *hwgroup = drive-hwif-hwgroup;
+
+   spin_lock_irq(ide_lock);
+   if (!hwgroup-drive) {
+   /* first drive for hwgroup. */
+   drive-next = drive;
+   hwgroup-drive = drive;
+   hwgroup-hwif = HWIF(hwgroup-drive);
+   } else {
+   drive-next = hwgroup-drive-next;
+   hwgroup-drive-next = drive;
+   }
+   spin_unlock_irq(ide_lock);
+}
+
 /*
  * This routine sets up the irq for an ide interface, and creates a new
  * hwgroup for the irq/hwif if none was previously assigned.
@@ -1033,17 +1050,7 @@ static int init_irq (ide_hwif_t *hwif)
printk(KERN_ERR ide: failed to init %s\n,drive-name);
continue;
}
-   spin_lock_irq(ide_lock);
-   if (!hwgroup-drive) {
-   /* first drive for hwgroup. */
-   drive-next = drive;
-   hwgroup-drive = drive;
-   hwgroup-hwif = HWIF(hwgroup-drive);
-   } else {
-   drive-next = hwgroup-drive-next;
-   hwgroup-drive-next = drive;
-   }
-   spin_unlock_irq(ide_lock);
+   ide_add_drive_to_hwgroup(drive);
}
 
 #if !defined(__mc68000__)  !defined(CONFIG_APUS)
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 16/22] ide: factor out devices setup from init_irq()

2008-01-16 Thread Bartlomiej Zolnierkiewicz
* Factor out devices setup from init_irq() to ide_port_setup_devices().

While at it:
* Do devices setup after printing port information.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-probe.c |   44 
 1 file changed, 28 insertions(+), 16 deletions(-)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -929,6 +929,31 @@ static void ide_add_drive_to_hwgroup(ide
 }
 
 /*
+ * For any present drive:
+ * - allocate the block device queue
+ * - link drive into the hwgroup
+ */
+static void ide_port_setup_devices(ide_hwif_t *hwif)
+{
+   int i;
+
+   for (i = 0; i  MAX_DRIVES; i++) {
+   ide_drive_t *drive = hwif-drives[i];
+
+   if (!drive-present)
+   continue;
+
+   if (ide_init_queue(drive)) {
+   printk(KERN_ERR ide: failed to init %s\n,
+   drive-name);
+   continue;
+   }
+
+   ide_add_drive_to_hwgroup(drive);
+   }
+}
+
+/*
  * This routine sets up the irq for an ide interface, and creates a new
  * hwgroup for the irq/hwif if none was previously assigned.
  *
@@ -1037,22 +1062,6 @@ static int init_irq (ide_hwif_t *hwif)
hwif-rqsize = 65536;
}
 
-   /*
-* For any present drive:
-* - allocate the block device queue
-* - link drive into the hwgroup
-*/
-   for (index = 0; index  MAX_DRIVES; ++index) {
-   ide_drive_t *drive = hwif-drives[index];
-   if (!drive-present)
-   continue;
-   if (ide_init_queue(drive)) {
-   printk(KERN_ERR ide: failed to init %s\n,drive-name);
-   continue;
-   }
-   ide_add_drive_to_hwgroup(drive);
-   }
-
 #if !defined(__mc68000__)  !defined(CONFIG_APUS)
printk(%s at 0x%03lx-0x%03lx,0x%03lx on irq %d, hwif-name,
hwif-io_ports[IDE_DATA_OFFSET],
@@ -1066,6 +1075,9 @@ static int init_irq (ide_hwif_t *hwif)
printk( (%sed with %s),
hwif-sharing_irq ? shar : serializ, match-name);
printk(\n);
+
+   ide_port_setup_devices(hwif);
+
mutex_unlock(ide_cfg_mtx);
return 0;
 out_unlink:
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 17/22] ide: move ide_acpi_init() call to ide_device_add_all()

2008-01-16 Thread Bartlomiej Zolnierkiewicz
There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-probe.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1260,7 +1260,6 @@ static int hwif_init(ide_hwif_t *hwif)
 done:
blk_register_region(MKDEV(hwif-major, 0), MAX_DRIVES  PARTN_BITS,
THIS_MODULE, ata_probe, ata_lock, hwif);
-   ide_acpi_init(hwif);
return 1;
 
 out:
@@ -1429,6 +1428,8 @@ int ide_device_add_all(u8 idx[MAX_HWIFS]
rc = -1;
continue;
}
+
+   ide_acpi_init(hwif);
}
 
for (i = 0; i  MAX_HWIFS; i++) {
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 18/22] ide-acpi: remove needless exports

2008-01-16 Thread Bartlomiej Zolnierkiewicz
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-acpi.c |4 
 1 file changed, 4 deletions(-)

Index: b/drivers/ide/ide-acpi.c
===
--- a/drivers/ide/ide-acpi.c
+++ b/drivers/ide/ide-acpi.c
@@ -494,7 +494,6 @@ int ide_acpi_exec_tfs(ide_drive_t *drive
 
return ret;
 }
-EXPORT_SYMBOL_GPL(ide_acpi_exec_tfs);
 
 /**
  * ide_acpi_get_timing - get the channel (controller) timings
@@ -580,7 +579,6 @@ void ide_acpi_get_timing(ide_hwif_t *hwi
 
kfree(output.pointer);
 }
-EXPORT_SYMBOL_GPL(ide_acpi_get_timing);
 
 /**
  * ide_acpi_push_timing - set the channel (controller) timings
@@ -634,7 +632,6 @@ void ide_acpi_push_timing(ide_hwif_t *hw
}
DEBPRINT(_STM status: %d\n, status);
 }
-EXPORT_SYMBOL_GPL(ide_acpi_push_timing);
 
 /**
  * ide_acpi_set_state - set the channel power state
@@ -762,4 +759,3 @@ void ide_acpi_init(ide_hwif_t *hwif)
}
}
 }
-EXPORT_SYMBOL_GPL(ide_acpi_init);
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 19/22] ide-acpi: remove dead code from do_drive_get_GTF()

2008-01-16 Thread Bartlomiej Zolnierkiewicz
These pointers are always setup in ide_acpi_init().

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-acpi.c |   10 --
 1 file changed, 10 deletions(-)

Index: b/drivers/ide/ide-acpi.c
===
--- a/drivers/ide/ide-acpi.c
+++ b/drivers/ide/ide-acpi.c
@@ -280,16 +280,6 @@ static int do_drive_get_GTF(ide_drive_t 
 
port = hwif-channel ? drive-dn - 2: drive-dn;
 
-   if (!drive-acpidata) {
-   if (port == 0) {
-   drive-acpidata = hwif-acpidata-master;
-   hwif-acpidata-master.drive = drive;
-   } else {
-   drive-acpidata = hwif-acpidata-slave;
-   hwif-acpidata-slave.drive = drive;
-   }
-   }
-
DEBPRINT(ENTER: %s at %s, port#: %d, hard_port#: %d\n,
 hwif-name, dev-bus_id, port, hwif-channel);
 
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 20/22] ide: factor out devices setup from ide_acpi_init()

2008-01-16 Thread Bartlomiej Zolnierkiewicz
* Factor out devices setup from ide_acpi_init() to
  ide_acpi_port_init_devices().

* Call ide_acpi_port_init_devices() in ide_device_add_all().

While at it:
* Remove no longer needed 'drive' field from struct ide_acpi_drive_link.

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-acpi.c  |   49 +++-
 drivers/ide/ide-probe.c |1 
 include/linux/ide.h |2 +
 3 files changed, 23 insertions(+), 29 deletions(-)

Index: b/drivers/ide/ide-acpi.c
===
--- a/drivers/ide/ide-acpi.c
+++ b/drivers/ide/ide-acpi.c
@@ -39,7 +39,6 @@ struct GTM_buffer {
 };
 
 struct ide_acpi_drive_link {
-   ide_drive_t *drive;
acpi_handle  obj_handle;
u8   idbuff[512];
 };
@@ -675,11 +674,6 @@ void ide_acpi_set_state(ide_hwif_t *hwif
  */
 void ide_acpi_init(ide_hwif_t *hwif)
 {
-   int unit;
-   int err;
-   struct ide_acpi_drive_link  *master;
-   struct ide_acpi_drive_link  *slave;
-
ide_acpi_blacklist();
 
hwif-acpidata = kzalloc(sizeof(struct ide_acpi_hwif_link), GFP_KERNEL);
@@ -691,40 +685,38 @@ void ide_acpi_init(ide_hwif_t *hwif)
DEBPRINT(no ACPI object for %s found\n, hwif-name);
kfree(hwif-acpidata);
hwif-acpidata = NULL;
-   return;
}
+}
+
+void ide_acpi_port_init_devices(ide_hwif_t *hwif)
+{
+   ide_drive_t *drive;
+   int i, err;
+
+   if (hwif-acpidata == NULL)
+   return;
 
/*
 * The ACPI spec mandates that we send information
 * for both drives, regardless whether they are connected
 * or not.
 */
-   hwif-acpidata-master.drive = hwif-drives[0];
hwif-drives[0].acpidata = hwif-acpidata-master;
-   master = hwif-acpidata-master;
-
-   hwif-acpidata-slave.drive = hwif-drives[1];
hwif-drives[1].acpidata = hwif-acpidata-slave;
-   slave = hwif-acpidata-slave;
-
 
/*
 * Send IDENTIFY for each drive
 */
-   if (master-drive-present) {
-   err = taskfile_lib_get_identify(master-drive, master-idbuff);
-   if (err) {
-   DEBPRINT(identify device %s failed (%d)\n,
-master-drive-name, err);
-   }
-   }
+   for (i = 0; i  MAX_DRIVES; i++) {
+   drive = hwif-drives[i];
+
+   if (!drive-present)
+   continue;
 
-   if (slave-drive-present) {
-   err = taskfile_lib_get_identify(slave-drive, slave-idbuff);
-   if (err) {
+   err = taskfile_lib_get_identify(drive, drive-acpidata-idbuff);
+   if (err)
DEBPRINT(identify device %s failed (%d)\n,
-slave-drive-name, err);
-   }
+drive-name, err);
}
 
if (ide_noacpionboot) {
@@ -740,12 +732,11 @@ void ide_acpi_init(ide_hwif_t *hwif)
ide_acpi_get_timing(hwif);
ide_acpi_push_timing(hwif);
 
-   for (unit = 0; unit  MAX_DRIVES; ++unit) {
-   ide_drive_t *drive = hwif-drives[unit];
+   for (i = 0; i  MAX_DRIVES; i++) {
+   drive = hwif-drives[i];
 
-   if (drive-present) {
+   if (drive-present)
/* Execute ACPI startup code */
ide_acpi_exec_tfs(drive);
-   }
}
 }
Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1430,6 +1430,7 @@ int ide_device_add_all(u8 idx[MAX_HWIFS]
}
 
ide_acpi_init(hwif);
+   ide_acpi_port_init_devices(hwif);
}
 
for (i = 0; i  MAX_HWIFS; i++) {
Index: b/include/linux/ide.h
===
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1205,12 +1205,14 @@ extern int ide_acpi_exec_tfs(ide_drive_t
 extern void ide_acpi_get_timing(ide_hwif_t *hwif);
 extern void ide_acpi_push_timing(ide_hwif_t *hwif);
 extern void ide_acpi_init(ide_hwif_t *hwif);
+void ide_acpi_port_init_devices(ide_hwif_t *);
 extern void ide_acpi_set_state(ide_hwif_t *hwif, int on);
 #else
 static inline int ide_acpi_exec_tfs(ide_drive_t *drive) { return 0; }
 static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; }
 static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; }
 static inline void ide_acpi_init(ide_hwif_t *hwif) { ; }
+static inline void ide_acpi_port_init_devices(ide_hwif_t *hwif) { ; }
 static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {}
 #endif
 
-
To unsubscribe from this list: send the line

[PATCH 21/22] ide: move hwif-present check out from ide_proc_register_port()

2008-01-16 Thread Bartlomiej Zolnierkiewicz
Move hwif-present check out from ide_proc_register_port() to
ide_device_add_all().

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-probe.c |9 +++--
 drivers/ide/ide-proc.c  |3 ---
 2 files changed, 7 insertions(+), 5 deletions(-)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1448,8 +1448,13 @@ int ide_device_add_all(u8 idx[MAX_HWIFS]
}
 
for (i = 0; i  MAX_HWIFS; i++) {
-   if (idx[i] != 0xff)
-   ide_proc_register_port(ide_hwifs[idx[i]]);
+   if (idx[i] == 0xff)
+   continue;
+
+   hwif = ide_hwifs[idx[i]];
+
+   if (hwif-present)
+   ide_proc_register_port(hwif);
}
 
return rc;
Index: b/drivers/ide/ide-proc.c
===
--- a/drivers/ide/ide-proc.c
+++ b/drivers/ide/ide-proc.c
@@ -793,9 +793,6 @@ static ide_proc_entry_t hwif_entries[] =
 
 void ide_proc_register_port(ide_hwif_t *hwif)
 {
-   if (!hwif-present)
-   return;
-
if (!hwif-proc) {
hwif-proc = proc_mkdir(hwif-name, proc_ide_root);
 
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/12] ide-floppy redux v2.5

2008-01-14 Thread Bartlomiej Zolnierkiewicz

Hi,

On Sunday 13 January 2008, Borislav Petkov wrote:
 Hi Bart,
 
 here are the remaining patches which had issues to be worked out. I decided
 to keep the Flexible Disk Page and Capacity Descriptor in
 idefloppy_floppy_t for the sake of the two printk calls for which they are
 used. Otherwise, we'll be changing long-known driver behavior and this won't
 be acceptable. I'll audit the driver to see whether rq_data_dir() can replace
 the PC_WRITING flag completely and get rid of that one too.

Thanks, I applied patches #1-9 and #11, #10 needs small corrections and will
be applied once they are addressed (#12 is fine but since it depends on #11
it has also to wait a bit more).

 By the way, I have an Iomega ZIP 100 drive somewhere in my hardware pile and
 will do some testing with the new :) driver just in case.

This would be great. :)

Cheers,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 8/12] ide-floppy: merge idefloppy_{input,output}_buffers

2008-01-14 Thread Bartlomiej Zolnierkiewicz
On Sunday 13 January 2008, Borislav Petkov wrote:
 We merge idefloppy_{input,output}_buffers() into idefloppy_io_buffers() by
 introducing a 4th arg. called direction. According to its value
 we atapi_input_bytes() or atapi_output_bytes(). Also, this simplifies the
 interrupt handler logic a bit. Finally, rename idefloppy_io_buffers() to
 ide_floppy_io_buffers().
 
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]

This change depends on ide-floppy: use an xfer_func_t and io_buf_t typedefs
in order to unify rw which was not in the v2.5 series.

I took the patch #16/21 from the previous series and applied it manually
fixing rejects, please verify that I didn't brake something in the process.

[...]

 @@ -380,8 +352,13 @@ static void idefloppy_output_buffers (ide_drive_t 
 *drive, idefloppy_pc_t *pc, un
   idefloppy_do_end_request(drive, 1, done  9);
  
   if (bcount) {
 - printk(KERN_ERR %s: leftover data in idefloppy_output_buffers, 
 bcount == %d\n, drive-name, 
bcount);
 - idefloppy_write_zeros(drive, bcount);
 + printk(KERN_ERR %s: leftover data in idefloppy_output_buffers,
 +  bcount == %d\n, drive-name, bcount);

I fixed the above to use __func__ while at it.

[ __FUNCTION__ is gcc-specific, __func__ is in C99 and is shorter ]
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 10/12] ide-floppy: remove atomic test_*bit macros

2008-01-14 Thread Bartlomiej Zolnierkiewicz
On Sunday 13 January 2008, Borislav Petkov wrote:
 ..and replace them with flag enums.
 
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
 ---
  drivers/ide/ide-floppy.c |  132 +
  1 files changed, 73 insertions(+), 59 deletions(-)

[...]

 @@ -506,14 +516,14 @@ static ide_startstop_t idefloppy_pc_intr(ide_drive_t 
 *drive)
  
   debug_log(Reached %s interrupt handler\n, __FUNCTION__);
  
 - if (test_bit(PC_DMA_IN_PROGRESS, pc-flags)) {
 + if (PC_FLAG_DMA_IN_PROGRESS  pc-flags) {

the usual kernel convention is to put flag last, i.e.

pc-flags  PC_FLAG_DMA_IN_PROGRESS

[...]

 @@ -570,7 +581,7 @@ static ide_startstop_t idefloppy_pc_intr(ide_drive_t 
 *drive)
   printk(KERN_ERR ide-floppy: CoD != 0 in %s\n, __FUNCTION__);
   return ide_do_reset(drive);
   }
 - if (((ireason  IO) == IO) == test_bit(PC_WRITING, pc-flags)) {
 + if (((ireason  IO) == IO) == (PC_FLAG_WRITING   pc-flags)) {

- test_bit() returns 1 or 0 (= boolean)
- (pc-flags  PC_FLAG_WRITING) is 0x10 or 0

so the above comparison will fail

 @@ -607,7 +618,7 @@ static ide_startstop_t idefloppy_pc_intr(ide_drive_t 
 *drive)
   xferfunc(drive, pc-current_position, bcount);
   else
   ide_floppy_io_buffers(drive, pc, bcount,
 - test_bit(PC_WRITING, pc-flags));
 + (PC_FLAG_WRITING  pc-flags));

ditto, this may actually work but '(pc-flags  PC_FLAG_WRITING) ? 1 : 0'
would be much safer from maintainability POV

[...]

 @@ -1720,13 +1731,16 @@ static int idefloppy_media_changed(struct gendisk 
 *disk)
  {
   struct ide_floppy_obj *floppy = ide_floppy_g(disk);
   ide_drive_t *drive = floppy-drive;
 + int ret;
  
   /* do not scan partitions twice if this is a removable device */
   if (drive-attach) {
   drive-attach = 0;
   return 0;
   }
 - return test_and_clear_bit(IDEFLOPPY_MEDIA_CHANGED, floppy-flags);
 + ret = IDEFLOPPY_FLAG_MEDIA_CHANGED  floppy-flags;
 + floppy-flags = ~IDEFLOPPY_FLAG_MEDIA_CHANGED;
 + return ret;
  }

same issue

otherwise looks good, please fix/resubmit
(together with patch #12)
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 11/12] ide-floppy: remove IDEFLOPPY_DEBUG_INFO

2008-01-14 Thread Bartlomiej Zolnierkiewicz
On Sunday 13 January 2008, Borislav Petkov wrote:

[...]

 - printk(KERN_ERR ide-floppy: Packet size is not 12 bytes 
 long\n);
 + printk(KERN_ERR ide-floppy: Packet size is not 12 bytes 
 + long\n);

I added dumping 'gcw.packet_size' for unsupported packet sizes while
merging the patch.
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 10/12] ide-floppy: remove atomic test_*bit macros

2008-01-14 Thread Bartlomiej Zolnierkiewicz
On Monday 14 January 2008, Bartlomiej Zolnierkiewicz wrote:
 On Sunday 13 January 2008, Borislav Petkov wrote:
  ..and replace them with flag enums.
  
  Signed-off-by: Borislav Petkov [EMAIL PROTECTED]

small update:

PC_ABORT is never set and may as well be removed in a pre-patch
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: 40-wire cable detected when directly connected

2008-01-12 Thread Bartlomiej Zolnierkiewicz
On Saturday 12 January 2008, Bartlomiej Zolnierkiewicz wrote:

[...]

 I've re-read the whole thread and it seems that the possible solution for
 Addonics card would be to detect it by PCI Subsystem Vendor/Device IDs.

It seems I wasn't paying enough attention, Tejun already thought of this
but unfortunately Addonics didn't set custom Subsystem IDs.

 Could you send the output of 'lspci -vvv -xxx' command?

Still may be useful.

Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 21/21] ide-floppy: remove atomic test_*bit macros

2008-01-12 Thread Bartlomiej Zolnierkiewicz
On Friday 11 January 2008, Borislav Petkov wrote:
 This change is temporary and after unification of the IDE subsystem proper
 bit setting and testing macros will be introduced.
 
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
 ---
  drivers/ide/ide-floppy.c |   82 
 +-
  1 files changed, 45 insertions(+), 37 deletions(-)
 
 diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
 index 4106eb4..29c1983 100644
 --- a/drivers/ide/ide-floppy.c
 +++ b/drivers/ide/ide-floppy.c
 @@ -479,12 +479,12 @@ static ide_startstop_t idefloppy_pc_intr(ide_drive_t 
 *drive)
  
   debug_log(Reached %s interrupt handler\n, __FUNCTION__);
  
 - if (test_bit(PC_DMA_IN_PROGRESS, pc-flags)) {
 + if ((1UL  PC_DMA_IN_PROGRESS)  pc-flags) {

How's about introducing new defines i.e.

enum {
IDE_FLOPPY_FLAG_PC_ABORT= (1  0),
IDE_FLOPPY_FLAG_PC_DMA_RECOMMENDED  = (1  1),
IDE_FLOPPY_FLAG_PC_DMA_IN_PROGRESS  = (1  2),
...
}

instead of open-coding the bit-shifts?

   dma_error = HWIF(drive)-ide_dma_end(drive);
   if (dma_error) {
   printk(KERN_ERR %s: DMA %s error\n, drive-name,
   write ? write : read);
 - set_bit(PC_DMA_ERROR, pc-flags);
 + pc-flags |= (1UL  PC_DMA_ERROR);
   } else {
   pc-actually_transferred = pc-request_transfer;
   idefloppy_update_buffers(drive, pc);
 @@ -499,11 +499,11 @@ static ide_startstop_t idefloppy_pc_intr(ide_drive_t 
 *drive)
   /* No more interrupts */
   debug_log(Packet command completed, %d bytes transferred\n,
   pc-actually_transferred);
 - clear_bit(PC_DMA_IN_PROGRESS, pc-flags);
 + pc-flags = ((1UL  PC_DMA_IN_PROGRESS) ^ ~0UL);

Same can be achieved with:

pc-flags = ~(1  PC_DMA_IN_PROGRESS);
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 14/21] ide-floppy: mv idefloppy_{should_,}report_error

2008-01-12 Thread Bartlomiej Zolnierkiewicz
On Friday 11 January 2008, Borislav Petkov wrote:
 In addition to shortening the function name, move the printk-call into the
 function thereby saving some code lines. Also, make the function out_of_line
 since it is not on a performance critical path.
 
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
 ---
  drivers/ide/ide-floppy.c |   37 ++---
  1 files changed, 14 insertions(+), 23 deletions(-)
 
 diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
 index 49d83a1..b718615 100644
 --- a/drivers/ide/ide-floppy.c
 +++ b/drivers/ide/ide-floppy.c
 @@ -707,16 +707,18 @@ static ide_startstop_t 
 idefloppy_transfer_pc1(ide_drive_t *drive)
   return ide_started;
  }
  
 -/*
 - * Suppresses error messages resulting from Medium not present.
 - */
 -static inline int idefloppy_should_report_error(idefloppy_floppy_t *floppy)
 +static void idefloppy_report_error(idefloppy_floppy_t *floppy,
 + idefloppy_pc_t *pc)
  {

- Would make a sense to move the comment here instead of removing it
(it is useful unless you remeber all -{sense_key,asc,ascq} value).

   if (floppy-sense_key == 0x02 
   floppy-asc   == 0x3a 
   floppy-ascq  == 0x00)
 - return 0;
 - return 1;
 + return;

Otherwise the patch is fine.
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 19/21] ide-floppy: fix most of the remaining checkpatch.pl issues

2008-01-12 Thread Bartlomiej Zolnierkiewicz
On Friday 11 January 2008, Borislav Petkov wrote:
 i.e.,
 ERROR: switch and case should be at the same indent
 ERROR: need spaces around that '=' (ctx:VxV)
 ERROR: trailing statements should be on next line
 WARNING: no space between function name and open parenthesis '('
 WARNING: printk() should include KERN_ facility level
 ERROR: That open brace { should be on the previous line
 ERROR: use tabs not spaces
 ERROR: do not use assignment in if condition
 WARNING: braces {} are not necessary for single statement blocks
 ERROR: need space after that ',' (ctx:VxV)
 WARNING: line over 80 characters
 ERROR: do not use assignment in if condition
 ...

This should be the very last patch in the series
(and combined with patch #11).

 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
 ---
  drivers/ide/ide-floppy.c |  147 +++--
  1 files changed, 75 insertions(+), 72 deletions(-)
 
 diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
 index 0729df5..3d9b1e5 100644
 --- a/drivers/ide/ide-floppy.c
 +++ b/drivers/ide/ide-floppy.c
 @@ -47,13 +47,13 @@
  #define IDEFLOPPY_DEBUG_INFO 0
  #define IDEFLOPPY_DEBUG_BUGS 1
  
 -#define IDEFLOPPY_DEBUG( fmt, args... )
 +#define IDEFLOPPY_DEBUG(fmt, args...)
  
  #if IDEFLOPPY_DEBUG_LOG
  #define debug_log(fmt, args...) \
   printk(KERN_INFO ide-floppy:  fmt, ## args)
  #else
 -#define debug_log(fmt, args... ) do {} while(0)
 +#define debug_log(fmt, args...) do {} while (0)
  #endif

Hmmm, these could have been dealt with in patch #4...

[...]

 @@ -1314,34 +1314,34 @@ static int idefloppy_identify_device (ide_drive_t 
 *drive,struct hd_driveid *id)
  #if IDEFLOPPY_DEBUG_INFO
   printk(KERN_INFO Dumping ATAPI Identify Device floppy parameters\n);
   switch (gcw.protocol) {
 - case 0: case 1: sprintf(buffer, ATA);break;
 - case 2: sprintf(buffer, ATAPI);break;
 - case 3: sprintf(buffer, Reserved (Unknown to 
 ide-floppy));break;
 + case 0: case 1: sprintf(buffer, ATA); break;
 + case 2: sprintf(buffer, ATAPI); break;
 + case 3: sprintf(buffer, Reserved (Unknown to ide-floppy)); break;
   }
   printk(KERN_INFO Protocol Type: %s\n, buffer);
   switch (gcw.device_type) {
 - case 0: sprintf(buffer, Direct-access Device);break;
 - case 1: sprintf(buffer, Streaming Tape Device);break;
 - case 2: case 3: case 4: sprintf (buffer, Reserved);break;
 - case 5: sprintf(buffer, CD-ROM Device);break;
 - case 6: sprintf(buffer, Reserved);
 - case 7: sprintf(buffer, Optical memory Device);break;
 - case 0x1f: sprintf(buffer, Unknown or no Device type);break;
 - default: sprintf(buffer, Reserved);
 + case 0: sprintf(buffer, Direct-access Device); break;
 + case 1: sprintf(buffer, Streaming Tape Device); break;
 + case 2: case 3: case 4: sprintf(buffer, Reserved); break;
 + case 5: sprintf(buffer, CD-ROM Device); break;
 + case 6: sprintf(buffer, Reserved);
 + case 7: sprintf(buffer, Optical memory Device); break;
 + case 0x1f: sprintf(buffer, Unknown or no Device type); break;
 + default: sprintf(buffer, Reserved);
   }
   printk(KERN_INFO Device Type: %x - %s\n, gcw.device_type, buffer);
   printk(KERN_INFO Removable: %s\n, gcw.removable ? Yes:No);
   switch (gcw.drq_type) {
 - case 0: sprintf(buffer, Microprocessor DRQ);break;
 - case 1: sprintf(buffer, Interrupt DRQ);break;
 - case 2: sprintf(buffer, Accelerated DRQ);break;
 - case 3: sprintf(buffer, Reserved);break;
 + case 0: sprintf(buffer, Microprocessor DRQ); break;
 + case 1: sprintf(buffer, Interrupt DRQ); break;
 + case 2: sprintf(buffer, Accelerated DRQ); break;
 + case 3: sprintf(buffer, Reserved); break;
   }
   printk(KERN_INFO Command Packet DRQ Type: %s\n, buffer);
   switch (gcw.packet_size) {
 - case 0: sprintf(buffer, 12 bytes);break;
 - case 1: sprintf(buffer, 16 bytes);break;
 - default: sprintf(buffer, Reserved);break;
 + case 0: sprintf(buffer, 12 bytes); break;
 + case 1: sprintf(buffer, 16 bytes); break;
 + default: sprintf(buffer, Reserved); break;
   }
   printk(KERN_INFO Command Packet Size: %s\n, buffer);
  #endif /* IDEFLOPPY_DEBUG_INFO */

 @@ -1349,13 +1349,16 @@ static int idefloppy_identify_device (ide_drive_t 
 *drive,struct hd_driveid *id)
   if (gcw.protocol != 2)
   printk(KERN_ERR ide-floppy: Protocol is not ATAPI\n);
   else if (gcw.device_type != 0)
 - printk(KERN_ERR ide-floppy: Device type is not set to 
 floppy\n);
 + printk(KERN_ERR ide-floppy: Device type is not set to
 +  floppy\n);
   else if (!gcw.removable)
   printk(KERN_ERR ide-floppy: The removable flag is not set\n);
   else if (gcw.drq_type 

Re: [PATCH 18/21] ide-floppy: fix error handling in idefloppy_probe()

2008-01-12 Thread Bartlomiej Zolnierkiewicz
On Friday 11 January 2008, Borislav Petkov wrote:
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
 ---
  drivers/ide/ide-floppy.c |3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)
 
 diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
 index 89b26ea..0729df5 100644
 --- a/drivers/ide/ide-floppy.c
 +++ b/drivers/ide/ide-floppy.c
 @@ -1737,7 +1737,8 @@ static int ide_floppy_probe(ide_drive_t *drive)
emulation.\n, drive-name);
   goto failed;
   }
 - if ((floppy = kzalloc(sizeof (idefloppy_floppy_t), GFP_KERNEL)) == 
 NULL) {
 + floppy = kzalloc(sizeof(idefloppy_floppy_t), GFP_KERNEL);
 + if (!floppy) {
   printk(KERN_ERR ide-floppy: %s: Can't allocate a floppy
structure\n, drive-name);
   goto failed;

I'm unable to see any problem with error handling here?

This change should be combined with the rest of checkpatch.pl fixes.
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] IDE: terminate ACPI DMI list

2008-01-11 Thread Bartlomiej Zolnierkiewicz
On Friday 11 January 2008, Jeff Garzik wrote:
 Fix oops reported by Trond.
 
 Signed-off-by: Jeff Garzik [EMAIL PROTECTED]

Acked-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]

Linus, could you apply it?

 ---
  drivers/ide/ide-acpi.c |2 ++
  1 file changed, 2 insertions(+)
 
 diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c
 index fe6768a..899d565 100644
 --- a/drivers/ide/ide-acpi.c
 +++ b/drivers/ide/ide-acpi.c
 @@ -85,6 +85,8 @@ static const struct dmi_system_id ide_acpi_dmi_table[] = {
   DMI_MATCH(DMI_BIOS_VERSION, KAM1.60)
   },
   },
 +
 + { } /* terminate list */
  };
  
  static int ide_acpi_blacklist(void)
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch]workaround suspend bug for ACPI IDE

2008-01-10 Thread Bartlomiej Zolnierkiewicz
On Thursday 10 January 2008, Shaohua Li wrote:
 http://bugzilla.kernel.org/show_bug.cgi?id=9673
 ACPI _PS3 cause S4 breaks in the second attempt. The system has a _PS3
 method for IDE, which will call into SMM mode. Currently we haven't clue
 why just the second attempt fails, as it's totally in BIOS code, so
 blacklist the system so far for 2.6.24.
 
 A possible suspect is ACPI NVS isn't save/restore, we will revisit the
 bug after linux does ACPI NVS save/restore.
 
 Signed-off-by: Shaohua Li [EMAIL PROTECTED]

applied, I did three minor changes while at it:

* fixed some scripts/checkpatch.pl complaints
* const-ified ide_acpi_dmi_table[]
* credited Mikko using 'Reported-by:' tag

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [CALL-FOR-HELP] pata_ali: can't get MWDMA working!

2008-01-09 Thread Bartlomiej Zolnierkiewicz

Hi Tejun,

On Wednesday 09 January 2008, Tejun Heo wrote:
 Hello, all.
 
 Broken MWDMA on pata_ali has caused a number of bug reports.  I've been
 trying to fix it for some time now  finally got a machine with
 pata_ali and non-working MWDMA2 ATAPI device on my desk a few weeks ago.
  Testing confirms what users have been reporting - MWDMA2 works fine
 with the IDE alim15x3 driver while any DMA data transfer on pata_ali
 times out.
 
 At first I thought this was simple timing programming error, but no.
 pata_ali's mode programming wasn't wrong although it was different in
 how it programs empty slots.  Even after making pata_ali to program the
 controller exactly the same as alim15x3 (identical lspci -xxx results),
 MWDMA didn't work. (attached)
 
 I wondered whether the device was configured differently, so compared
 hdparm --Istdout results.  They were identical too. (attached)

ATA device, with non-removable media
Model Number:   IC25N040ATMR04-0
Serial Number:  MRG208K2K3A37H
Firmware Revision:  MO2OAD5A
...

Could you also send hdparm output for ATAPI device?  Does it use CDB intr?

 I walked through IDE and libata codes and found some differences in the
 order registers are accessed and which values are written (e.g. libata
 never turns on device 0/1 DMA capable bits in BMDMA status register
 while IDE does).  I made them access the registers in the same order and
 write the same values.  Still no go.
 
 Then, I made libata probing sequence very close to IDE such that no
 reset is performed and NIEN isn't tempered with.  No go.
 
 I thought maybe the drive should just be blacklisted.  I took the laptop
 apart, took out the DVD combo drive to ICH7 ata_piix.  It works just fine.
 
 So, I'm out of ideas at this point.  Any suggestions?  Ideas?

If ATAPI device uses CDB intr then -irq_clear will be called by
ata_host_intr() on CDB IRQ and may confuse DMA engine (it shouldn't
on most chipsets but older ALi-s are pretty weird)...?

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: 80 wire cable detection patch

2008-01-09 Thread Bartlomiej Zolnierkiewicz

Hi,

On Sunday 06 January 2008, George Kibardin wrote:
 Signed-off-by: George Kibardin [EMAIL PROTECTED]
 
 --- drivers/ide/ide-iops.c.orig 2008-01-03 18:35:23.0 +0300
 +++ drivers/ide/ide-iops.c  2008-01-03 18:12:29.0 +0300
 @@ -612,12 +612,12 @@
printk(KERN_DEBUG %s: skipping word 93 validity check\n,
  drive-name);
 
 -   if (hwif-cbl != ATA_CBL_PATA80  !ivb)
 -   goto no_80w;
 -
if (ide_dev_is_sata(id)  !ivb)
return 1;

Ehm, this was not changed in the code before generating patch but in
the patch itself so the patch won't apply... :(

 +   if (hwif-cbl != ATA_CBL_PATA80  !ivb)
 +   goto no_80w;
 +
/*
 * FIXME:
 * - change master/slave IDENTIFY order

This time I just applied fix by hand and added missing patch summary
(ide: fix cable detection for SATA bridges) but in the future please
make sure that the patch applies and has a meaningful description.

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ide: remove needless includes from PCI host drivers

2008-01-09 Thread Bartlomiej Zolnierkiewicz

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/pci/aec62xx.c  |1 -
 drivers/ide/pci/alim15x3.c |1 -
 drivers/ide/pci/amd74xx.c  |3 ---
 drivers/ide/pci/atiixp.c   |4 
 drivers/ide/pci/cmd640.c   |4 
 drivers/ide/pci/cmd64x.c   |1 -
 drivers/ide/pci/cs5520.c   |   10 --
 drivers/ide/pci/cs5530.c   |8 +---
 drivers/ide/pci/cy82c693.c |1 -
 drivers/ide/pci/delkin_cb.c|5 ++---
 drivers/ide/pci/generic.c  |7 ---
 drivers/ide/pci/hpt34x.c   |7 ---
 drivers/ide/pci/hpt366.c   |5 -
 drivers/ide/pci/it8213.c   |3 ---
 drivers/ide/pci/it821x.c   |3 ---
 drivers/ide/pci/jmicron.c  |3 ---
 drivers/ide/pci/ns87415.c  |4 
 drivers/ide/pci/opti621.c  |5 -
 drivers/ide/pci/pdc202xx_new.c |6 --
 drivers/ide/pci/pdc202xx_old.c |5 -
 drivers/ide/pci/piix.c |2 --
 drivers/ide/pci/rz1000.c   |7 ---
 drivers/ide/pci/sc1200.c   |8 +---
 drivers/ide/pci/serverworks.c  |2 --
 drivers/ide/pci/sgiioc4.c  |2 --
 drivers/ide/pci/siimage.c  |1 -
 drivers/ide/pci/sis5513.c  |9 -
 drivers/ide/pci/sl82c105.c |6 --
 drivers/ide/pci/slc90e66.c |4 
 drivers/ide/pci/triflex.c  |5 -
 drivers/ide/pci/trm290.c   |2 --
 drivers/ide/pci/via82cxxx.c|4 
 32 files changed, 4 insertions(+), 134 deletions(-)

Index: b/drivers/ide/pci/aec62xx.c
===
--- a/drivers/ide/pci/aec62xx.c
+++ b/drivers/ide/pci/aec62xx.c
@@ -7,7 +7,6 @@
 #include linux/module.h
 #include linux/types.h
 #include linux/pci.h
-#include linux/delay.h
 #include linux/hdreg.h
 #include linux/ide.h
 #include linux/init.h
Index: b/drivers/ide/pci/alim15x3.c
===
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -31,7 +31,6 @@
 #include linux/types.h
 #include linux/kernel.h
 #include linux/pci.h
-#include linux/delay.h
 #include linux/hdreg.h
 #include linux/ide.h
 #include linux/init.h
Index: b/drivers/ide/pci/amd74xx.c
===
--- a/drivers/ide/pci/amd74xx.c
+++ b/drivers/ide/pci/amd74xx.c
@@ -17,12 +17,9 @@
 
 #include linux/module.h
 #include linux/kernel.h
-#include linux/ioport.h
-#include linux/blkdev.h
 #include linux/pci.h
 #include linux/init.h
 #include linux/ide.h
-#include asm/io.h
 
 #include ide-timing.h
 
Index: b/drivers/ide/pci/atiixp.c
===
--- a/drivers/ide/pci/atiixp.c
+++ b/drivers/ide/pci/atiixp.c
@@ -6,15 +6,11 @@
 #include linux/types.h
 #include linux/module.h
 #include linux/kernel.h
-#include linux/ioport.h
 #include linux/pci.h
 #include linux/hdreg.h
 #include linux/ide.h
-#include linux/delay.h
 #include linux/init.h
 
-#include asm/io.h
-
 #define ATIIXP_IDE_PIO_TIMING  0x40
 #define ATIIXP_IDE_MDMA_TIMING 0x44
 #define ATIIXP_IDE_PIO_CONTROL 0x48
Index: b/drivers/ide/pci/cmd640.c
===
--- a/drivers/ide/pci/cmd640.c
+++ b/drivers/ide/pci/cmd640.c
@@ -103,10 +103,6 @@
 #include linux/types.h
 #include linux/kernel.h
 #include linux/delay.h
-#include linux/timer.h
-#include linux/mm.h
-#include linux/ioport.h
-#include linux/blkdev.h
 #include linux/hdreg.h
 #include linux/ide.h
 #include linux/init.h
Index: b/drivers/ide/pci/cmd64x.c
===
--- a/drivers/ide/pci/cmd64x.c
+++ b/drivers/ide/pci/cmd64x.c
@@ -13,7 +13,6 @@
 #include linux/module.h
 #include linux/types.h
 #include linux/pci.h
-#include linux/delay.h
 #include linux/hdreg.h
 #include linux/ide.h
 #include linux/init.h
Index: b/drivers/ide/pci/cs5520.c
===
--- a/drivers/ide/pci/cs5520.c
+++ b/drivers/ide/pci/cs5520.c
@@ -35,22 +35,12 @@
 #include linux/module.h
 #include linux/types.h
 #include linux/kernel.h
-#include linux/delay.h
-#include linux/timer.h
-#include linux/mm.h
-#include linux/ioport.h
-#include linux/blkdev.h
 #include linux/hdreg.h
-
-#include linux/interrupt.h
 #include linux/init.h
 #include linux/pci.h
 #include linux/ide.h
 #include linux/dma-mapping.h
 
-#include asm/io.h
-#include asm/irq.h
-
 struct pio_clocks
 {
int address;
Index: b/drivers/ide/pci/cs5530.c
===
--- a/drivers/ide/pci/cs5530.c
+++ b/drivers/ide/pci/cs5530.c
@@ -15,18 +15,12 @@
 #include linux/module.h
 #include linux/types.h
 #include linux/kernel.h
-#include linux/delay.h
-#include linux/timer.h
-#include linux/mm.h
-#include linux/ioport.h
-#include linux/blkdev.h
 #include linux/hdreg.h
-#include linux

Re: [RESEND PATCH 06/10] ide-floppy: report DMA handling in idefloppy_pc_intr() properly

2008-01-06 Thread Bartlomiej Zolnierkiewicz
On Saturday 05 January 2008, Borislav Petkov wrote:
 On Sat, Jan 05, 2008 at 04:46:05PM +0100, Bartlomiej Zolnierkiewicz wrote:
  Hmm, no.  The driver is called ide-floppy (ide_floppy) and it is more
  readable this way.
  
{
 idefloppy_t *floppy = drive-driver_data;
 struct gendisk *g = floppy-disk;
   @@ -1479,7 +1450,7 @@ static ide_proc_entry_t idefloppy_proc[] = {
};
#endif   /* CONFIG_IDE_PROC_FS */

   -static int ide_floppy_probe(ide_drive_t *);
   +static int idefloppy_probe(ide_drive_t *);
  
  ditto
   
  [...]
  
   @@ -1733,7 +1704,7 @@ static struct block_device_operations idefloppy_ops 
   = {
 .revalidate_disk= idefloppy_revalidate_disk
};

   -static int ide_floppy_probe(ide_drive_t *drive)
   +static int idefloppy_probe(ide_drive_t *drive)
  
  ditto
 Shouldn't those also conform to the driver function format idefloppy_bla() -
 after all, those function names are unambiguous for the whole file...?

Why conform to something sub-optimal instead of changing it?

+ I was using ide_floppy_* in the new code to tag the areas that were
rewritten. Currently it doesn't look that optimistic since there are five
ide_floppy_* functions and fifty idefloppy_* ones but I'm hoping that this
statistics will improve after your patches. :)

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC PATCH] ide-floppy: remove struct idefloppy_capabilities_page

2008-01-06 Thread Bartlomiej Zolnierkiewicz
On Sunday 06 January 2008, Borislav Petkov wrote:
 Hi Bart,
 
 before removing all those typedefs in ide-floppy i wanted to check with you 
 whether what
 i have in mind is in the right direction before doing all the work for 
 nothing.
 Here's the first patch removing struct idefloppy_capabilities_page. Please, 
 tell
 me whether it is similar to what you guys have in mind or is it missing the
 point.
 
 Thanks.

You are 100% on the right track. :)

 From 41c791f40e3fcf2287aa245f25796fa58bb17afc Mon Sep 17 00:00:00 2001
 From: Borislav Petkov [EMAIL PROTECTED]
 Date: Sun, 6 Jan 2008 10:37:47 +0100
 Subject: [PATCH] ide-floppy: remove struct idefloppy_capabilities_page
 
 This change is rather temporary and is in preparation of using generic 
 commands
 as is the case with ide-cd and the uniform cdrom layer (i.e. 
 init_cdrom_command())
 However, before this happens, we'll have to remove all typedefs and teach
 idefloppy_create_mode_sense_cmd() to work directly on u8 buffers.
 
 Also, since idefloppy_get_capability_page() was used to read only the sfrp 
 bit,
 rename the latter so that the name reflects what it does.
 
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]

applied
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/8] ide: more IDE probing code rework

2008-01-06 Thread Bartlomiej Zolnierkiewicz

* Convert legacy host drivers to use struct ide_port_info + ide_device_add()
  instead of open-coding initialization of IDE port data structures.

* Add -cable_detect method for cable detection + use it in PCI host drivers.

* Fix some bugs in the process (handling of idex=ata66 in atiixp, cs5535
  and scc_pata and handling I/O 32-bit setting in dtc2278 and au1xxx-ide).

diffstat:

 drivers/ide/arm/icside.c  |   25 ---
 drivers/ide/arm/ide_arm.c |2
 drivers/ide/arm/rapide.c  |2
 drivers/ide/cris/ide-cris.c   |   18 +++--
 drivers/ide/h8300/ide-h8300.c |2
 drivers/ide/ide-generic.c |2
 drivers/ide/ide-pnp.c |2
 drivers/ide/ide-probe.c   |   87 +-
 drivers/ide/ide.c |6 -
 drivers/ide/legacy/ali14xx.c  |   24 ++-
 drivers/ide/legacy/buddha.c   |2
 drivers/ide/legacy/dtc2278.c  |   36 ---
 drivers/ide/legacy/falconide.c|2
 drivers/ide/legacy/gayle.c|2
 drivers/ide/legacy/ht6560b.c  |   22 +++---
 drivers/ide/legacy/ide_platform.c |2
 drivers/ide/legacy/macide.c   |   12 ---
 drivers/ide/legacy/q40ide.c   |2
 drivers/ide/legacy/qd65xx.c   |   23 ---
 drivers/ide/legacy/umc8672.c  |   24 ++-
 drivers/ide/mips/au1xxx-ide.c |   34 +++---
 drivers/ide/mips/swarm.c  |2
 drivers/ide/pci/aec62xx.c |   25 +++
 drivers/ide/pci/alim15x3.c|5 -
 drivers/ide/pci/amd74xx.c |   18 ++---
 drivers/ide/pci/atiixp.c  |   30 -
 drivers/ide/pci/cmd640.c  |   31 -
 drivers/ide/pci/cmd64x.c  |5 -
 drivers/ide/pci/cs5520.c  |2
 drivers/ide/pci/cs5535.c  |   14 +---
 drivers/ide/pci/hpt366.c  |   84 ++---
 drivers/ide/pci/it8213.c  |   21 +++---
 drivers/ide/pci/it821x.c  |5 -
 drivers/ide/pci/jmicron.c |6 -
 drivers/ide/pci/pdc202xx_new.c|8 --
 drivers/ide/pci/pdc202xx_old.c|   10 +--
 drivers/ide/pci/piix.c|7 --
 drivers/ide/pci/scc_pata.c|   12 ++-
 drivers/ide/pci/serverworks.c |9 --
 drivers/ide/pci/sgiioc4.c |   18 +++--
 drivers/ide/pci/siimage.c |5 -
 drivers/ide/pci/sis5513.c |5 -
 drivers/ide/pci/slc90e66.c|   19 +++--
 drivers/ide/pci/tc86c001.c|   24 ---
 drivers/ide/pci/via82cxxx.c   |6 -
 drivers/ide/ppc/mpc8xx.c  |2
 drivers/ide/ppc/pmac.c|   84 ++---
 drivers/ide/setup-pci.c   |  123 +++---
 include/linux/ide.h   |   15 
 49 files changed, 459 insertions(+), 467 deletions(-)
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/8] dtc2278: fix -io_32bit handling

2008-01-06 Thread Bartlomiej Zolnierkiewicz
On DTC2278 32-bit I/O has to be enabled for both devices on the port
so always enable it during init time and disallow further changes.

Cc: Alan Cox [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide.c|4 
 drivers/ide/legacy/dtc2278.c |   12 ++--
 2 files changed, 6 insertions(+), 10 deletions(-)

Index: b/drivers/ide/ide.c
===
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -791,10 +791,6 @@ int set_io_32bit(ide_drive_t *drive, int
return -EBUSY;
 
drive-io_32bit = arg;
-#ifdef CONFIG_BLK_DEV_DTC2278
-   if (HWIF(drive)-chipset == ide_dtc2278)
-   HWIF(drive)-drives[!drive-select.b.unit].io_32bit = arg;
-#endif /* CONFIG_BLK_DEV_DTC2278 */
 
spin_unlock_irq(ide_lock);
 
Index: b/drivers/ide/legacy/dtc2278.c
===
--- a/drivers/ide/legacy/dtc2278.c
+++ b/drivers/ide/legacy/dtc2278.c
@@ -84,12 +84,6 @@ static void dtc2278_set_pio_mode(ide_dri
/* Actually we do - there is a data sheet available for the
   Winbond but does anyone actually care */
}
-
-   /*
-* 32bit I/O has to be enabled for *both* drives at the same time.
-*/
-   drive-io_32bit = 1;
-   HWIF(drive)-drives[!drive-select.b.unit].io_32bit = 1;
 }
 
 static int __init dtc2278_probe(void)
@@ -123,18 +117,24 @@ static int __init dtc2278_probe(void)
local_irq_restore(flags);
 
hwif-serialized = 1;
+   hwif-no_io_32bit = 1;  /* disallow -io_32bit changes */
hwif-chipset = ide_dtc2278;
hwif-pio_mask = ATA_PIO4;
hwif-set_pio_mode = dtc2278_set_pio_mode;
hwif-drives[0].no_unmask = 1;
hwif-drives[1].no_unmask = 1;
+   hwif-drives[0].io_32bit = 1;
+   hwif-drives[1].io_32bit = 1;
hwif-mate = mate;
 
mate-serialized = 1;
+   mate-no_io_32bit = 1;
mate-chipset = ide_dtc2278;
mate-pio_mask = ATA_PIO4;
mate-drives[0].no_unmask = 1;
mate-drives[1].no_unmask = 1;
+   mate-drives[0].io_32bit = 1;
+   mate-drives[1].io_32bit = 1;
mate-mate = hwif;
mate-channel = 1;
 
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/8] au1xxx-ide: fix -io_32bit handling

2008-01-06 Thread Bartlomiej Zolnierkiewicz
The host driver must set hwif's -no_io_32bit setting not drive's one
(ide_port_tune_devices() overrides drive's setting).

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/mips/au1xxx-ide.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Index: b/drivers/ide/mips/au1xxx-ide.c
===
--- a/drivers/ide/mips/au1xxx-ide.c
+++ b/drivers/ide/mips/au1xxx-ide.c
@@ -658,8 +658,7 @@ static int au_ide_probe(struct device *d
hwif-drives[0].autotune= 1;/* 1=autotune, 2=noautotune, 
0=default */
hwif-drives[1].autotune= 1;
 
-   hwif-drives[0].no_io_32bit = 1;
-   hwif-drives[1].no_io_32bit = 1;
+   hwif-no_io_32bit   = 1;
 
auide_hwif.hwif = hwif;
hwif-hwif_data = auide_hwif;
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/8] atiixp/cs5535/scc_pata: fix idex=ata66 parameter handling

2008-01-06 Thread Bartlomiej Zolnierkiewicz
Don't override the cable type if the idex=ata66 parameter was used.

While at it:

* atiixp.c: factor out cable detection to atiixp_cable_detect() from
  init_hwif_atiixp().

* cs5535.c: pass 'ide_hwif_t *hwif' instead of 'struct pci_dev *dev' to
  cs5535_cable_detect().

* scc_pata.c: factor out cable detection to scc_cable_detect() from
  init_hwif_scc() and remove incorrect comment.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
+16 bytes
 drivers/ide/pci/atiixp.c   |   24 +++-
 drivers/ide/pci/cs5535.c   |8 
 drivers/ide/pci/scc_pata.c |9 +++--
 3 files changed, 26 insertions(+), 15 deletions(-)

Index: b/drivers/ide/pci/atiixp.c
===
--- a/drivers/ide/pci/atiixp.c
+++ b/drivers/ide/pci/atiixp.c
@@ -121,6 +121,19 @@ static void atiixp_set_dma_mode(ide_driv
spin_unlock_irqrestore(atiixp_lock, flags);
 }
 
+static u8 __devinit atiixp_cable_detect(ide_hwif_t *hwif)
+{
+   struct pci_dev *pdev = to_pci_dev(hwif-dev);
+   u8 udma_mode = 0, ch = hwif-channel;
+
+   pci_read_config_byte(pdev, ATIIXP_IDE_UDMA_MODE + ch, udma_mode);
+
+   if ((udma_mode  0x07) = 0x04 || (udma_mode  0x70) = 0x40)
+   return ATA_CBL_PATA80;
+   else
+   return ATA_CBL_PATA40;
+}
+
 /**
  * init_hwif_atiixp-   fill in the hwif for the ATIIXP
  * @hwif: IDE interface
@@ -131,21 +144,14 @@ static void atiixp_set_dma_mode(ide_driv
 
 static void __devinit init_hwif_atiixp(ide_hwif_t *hwif)
 {
-   struct pci_dev *pdev = to_pci_dev(hwif-dev);
-   u8 udma_mode = 0, ch = hwif-channel;
-
hwif-set_pio_mode = atiixp_set_pio_mode;
hwif-set_dma_mode = atiixp_set_dma_mode;
 
if (!hwif-dma_base)
return;
 
-   pci_read_config_byte(pdev, ATIIXP_IDE_UDMA_MODE + ch, udma_mode);
-
-   if ((udma_mode  0x07) = 0x04 || (udma_mode  0x70) = 0x40)
-   hwif-cbl = ATA_CBL_PATA80;
-   else
-   hwif-cbl = ATA_CBL_PATA40;
+   if (hwif-cbl != ATA_CBL_PATA40_SHORT)
+   hwif-cbl = atiixp_cable_detect(hwif);
 }
 
 static const struct ide_port_info atiixp_pci_info[] __devinitdata = {
Index: b/drivers/ide/pci/cs5535.c
===
--- a/drivers/ide/pci/cs5535.c
+++ b/drivers/ide/pci/cs5535.c
@@ -155,8 +155,9 @@ static void cs5535_set_pio_mode(ide_driv
cs5535_set_speed(drive, XFER_PIO_0 + pio);
 }
 
-static u8 __devinit cs5535_cable_detect(struct pci_dev *dev)
+static u8 __devinit cs5535_cable_detect(ide_hwif_t *hwif)
 {
+   struct pci_dev *dev = to_pci_dev(hwif-dev);
u8 bit;
 
/* if a 80 wire cable was detected */
@@ -175,15 +176,14 @@ static u8 __devinit cs5535_cable_detect(
  */
 static void __devinit init_hwif_cs5535(ide_hwif_t *hwif)
 {
-   struct pci_dev *dev = to_pci_dev(hwif-dev);
-
hwif-set_pio_mode = cs5535_set_pio_mode;
hwif-set_dma_mode = cs5535_set_dma_mode;
 
if (hwif-dma_base == 0)
return;
 
-   hwif-cbl = cs5535_cable_detect(dev);
+   if (hwif-cbl != ATA_CBL_PATA40_SHORT)
+   hwif-cbl = cs5535_cable_detect(hwif);
 }
 
 static const struct ide_port_info cs5535_chipset __devinitdata = {
Index: b/drivers/ide/pci/scc_pata.c
===
--- a/drivers/ide/pci/scc_pata.c
+++ b/drivers/ide/pci/scc_pata.c
@@ -644,6 +644,11 @@ static void __devinit init_iops_scc(ide_
init_mmio_iops_scc(hwif);
 }
 
+static u8 __devinit scc_cable_detect(ide_hwif_t *hwif)
+{
+   return ATA_CBL_PATA80;
+}
+
 /**
  * init_hwif_scc   -   set up hwif
  * @hwif: interface to set up
@@ -678,8 +683,8 @@ static void __devinit init_hwif_scc(ide_
else
hwif-ultra_mask = ATA_UDMA5; /* 100MHz */
 
-   /* we support 80c cable only. */
-   hwif-cbl = ATA_CBL_PATA80;
+   if (hwif-cbl != ATA_CBL_PATA40_SHORT)
+   hwif-cbl = scc_cable_detect(hwif);
 }
 
 #define DECLARE_SCC_DEV(name_str)  \
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/8] macide: remove drive-capacity64 quirk

2008-01-06 Thread Bartlomiej Zolnierkiewicz
Nowadays IDE core always provides drive ID and ide-disk always setups
drive-capacity64 so this quirk is no longer needed.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/legacy/macide.c |   10 --
 1 file changed, 10 deletions(-)

Index: b/drivers/ide/legacy/macide.c
===
--- a/drivers/ide/legacy/macide.c
+++ b/drivers/ide/legacy/macide.c
@@ -123,16 +123,6 @@ static int __init macide_init(void)
ide_init_port_data(hwif, index);
ide_init_port_hw(hwif, hw);
 
-   if (macintosh_config-ide_type == MAC_IDE_BABOON 
-   macintosh_config-ident == MAC_MODEL_PB190) {
-   /* Fix breakage in ide-disk.c: drive capacity   */
-   /* is not initialized for drives without a  */
-   /* hardware ID, and we can't get that without   */
-   /* probing the drive which freezes a 190.   */
-   ide_drive_t *drive = hwif-drives[0];
-   drive-capacity64 = drive-cyl*drive-head*drive-sect;
-   }
-
hwif-mmio = 1;
 
ide_device_add(idx);
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/8] ide: always set DMA masks in ide_pci_setup_ports()

2008-01-06 Thread Bartlomiej Zolnierkiewicz
Always set DMA masks in ide_pci_setup_ports() to make sure that the valid
masks for a host are set.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
+34 bytes
 drivers/ide/setup-pci.c |   13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

Index: b/drivers/ide/setup-pci.c
===
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -556,10 +556,15 @@ void ide_pci_setup_ports(struct pci_dev 
hwif-drives[1].unmask = 1;
}
 
-   if (hwif-dma_base) {
-   hwif-swdma_mask = d-swdma_mask;
-   hwif-mwdma_mask = d-mwdma_mask;
-   hwif-ultra_mask = d-udma_mask;
+   hwif-swdma_mask = d-swdma_mask;
+   hwif-mwdma_mask = d-mwdma_mask;
+   hwif-ultra_mask = d-udma_mask;
+
+   if ((d-host_flags  IDE_HFLAG_NO_DMA) == 0 
+   hwif-dma_base == 0) {
+   hwif-swdma_mask = 0;
+   hwif-mwdma_mask = 0;
+   hwif-ultra_mask = 0;
}
 
hwif-drives[0].autotune = 1;
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/8] ide: separate PCI specific init from generic init in ide_pci_setup_ports()

2008-01-06 Thread Bartlomiej Zolnierkiewicz
* Setup -mate and -channel in ide_pci_setup_ports() instead of
  in ide_hwif_configure().

* Make 'port' parameter for ide_hwif_configure() 'unsigned int'.

* Separate PCI specific init from generic init in ide_pci_setup_ports().

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
+28 bytes
 drivers/ide/setup-pci.c |   29 +
 1 file changed, 21 insertions(+), 8 deletions(-)

Index: b/drivers/ide/setup-pci.c
===
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -337,7 +337,8 @@ static int ide_pci_check_iomem(struct pc
  * ide_hwif_configure  -   configure an IDE interface
  * @dev: PCI device holding interface
  * @d: IDE port info
- * @mate: Paired interface if any
+ * @port: port number
+ * @irq: PCI IRQ
  *
  * Perform the initial set up for the hardware interface structure. This
  * is done per interface port rather than per PCI device. There may be
@@ -346,7 +347,9 @@ static int ide_pci_check_iomem(struct pc
  * Returns the new hardware interface structure, or NULL on a failure
  */
 
-static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, const struct 
ide_port_info *d, ide_hwif_t *mate, int port, int irq)
+static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev,
+ const struct ide_port_info *d,
+ unsigned int port, int irq)
 {
unsigned long ctl = 0, base = 0;
ide_hwif_t *hwif;
@@ -392,12 +395,7 @@ static ide_hwif_t *ide_hwif_configure(st
 
hwif-dev = dev-dev;
hwif-cds = d;
-   hwif-channel = port;
 
-   if (mate) {
-   hwif-mate = mate;
-   mate-mate = hwif;
-   }
return hwif;
 }
 
@@ -525,10 +523,25 @@ void ide_pci_setup_ports(struct pci_dev 
continue;   /* port not enabled */
}
 
-   if ((hwif = ide_hwif_configure(dev, d, mate, port, pciirq)) == 
NULL)
+   hwif = ide_hwif_configure(dev, d, port, pciirq);
+   if (hwif == NULL)
continue;
 
*(idx + port) = hwif-index;
+   }
+
+   for (port = 0; port  channels; ++port) {
+   if (*(idx + port) == 0xff)
+   continue;
+
+   hwif = ide_hwifs[*(idx + port)];
+
+   if (mate) {
+   hwif-mate = mate;
+   mate-mate = hwif;
+   }
+
+   hwif-channel = port;
 
if (d-init_iops)
d-init_iops(hwif);
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/8] ide: add struct ide_port_info instances to legacy host drivers

2008-01-06 Thread Bartlomiej Zolnierkiewicz
* Remove 'struct pci_dev *dev' argument from ide_hwif_setup_dma().

* Un-static ide_hwif_setup_dma() and add CONFIG_BLK_DEV_IDEDMA_PCI=n version.

* Add 'const struct ide_port_info *d' argument to ide_device_add[_all]().

* Factor out generic ports init from ide_pci_setup_ports() to ide_init_port(),
  move it to ide-probe.c and call it in in ide_device_add_all() instead of
  ide_pci_setup_ports().

* Move -mate setup to ide_device_add_all() from ide_port_init().

* Add IDE_HFLAG_NO_AUTOTUNE host flag for host drivers that don't enable
  -autotune currently.

* Setup hwif-chipset in ide_init_port() but iff pi-chipset is set
  (to not override setup done by ide_hwif_configure()).

* Add ETRAX host handling to ide_device_add_all().

* cmd640.c: set IDE_HFLAG_ABUSE_* also for CONFIG_BLK_DEV_CMD640_ENHANCED=n.

* pmac.c: make pmac_ide_setup_dma() return an error value and move DMA masks
  setup to pmac_ide_setup_device().

* Add 'struct ide_port_info' instances to legacy host drivers, pass them to
  ide_device_add() calls and then remove open-coded ports initialization.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/arm/icside.c  |   25 +--
 drivers/ide/arm/ide_arm.c |2 
 drivers/ide/arm/rapide.c  |2 
 drivers/ide/cris/ide-cris.c   |   18 
 drivers/ide/h8300/ide-h8300.c |2 
 drivers/ide/ide-generic.c |2 
 drivers/ide/ide-pnp.c |2 
 drivers/ide/ide-probe.c   |   82 +++--
 drivers/ide/ide.c |2 
 drivers/ide/legacy/ali14xx.c  |   24 --
 drivers/ide/legacy/buddha.c   |2 
 drivers/ide/legacy/dtc2278.c  |   24 --
 drivers/ide/legacy/falconide.c|2 
 drivers/ide/legacy/gayle.c|2 
 drivers/ide/legacy/ht6560b.c  |   22 -
 drivers/ide/legacy/ide_platform.c |2 
 drivers/ide/legacy/macide.c   |2 
 drivers/ide/legacy/q40ide.c   |2 
 drivers/ide/legacy/qd65xx.c   |   23 +-
 drivers/ide/legacy/umc8672.c  |   24 --
 drivers/ide/mips/au1xxx-ide.c |   31 --
 drivers/ide/mips/swarm.c  |2 
 drivers/ide/pci/cmd640.c  |   31 ++
 drivers/ide/pci/cs5520.c  |2 
 drivers/ide/pci/sgiioc4.c |   18 +---
 drivers/ide/ppc/mpc8xx.c  |2 
 drivers/ide/ppc/pmac.c|   84 +++---
 drivers/ide/setup-pci.c   |   81 +++-
 include/linux/ide.h   |   13 -
 29 files changed, 259 insertions(+), 271 deletions(-)

Index: b/drivers/ide/arm/icside.c
===
--- a/drivers/ide/arm/icside.c
+++ b/drivers/ide/arm/icside.c
@@ -377,9 +377,6 @@ static void icside_dma_lost_irq(ide_driv
 
 static void icside_dma_init(ide_hwif_t *hwif)
 {
-   hwif-mwdma_mask= 7; /* MW0..2 */
-   hwif-swdma_mask= 7; /* SW0..2 */
-
hwif-dmatable_cpu  = NULL;
hwif-dmatable_dma  = 0;
hwif-set_dma_mode  = icside_set_dma_mode;
@@ -459,11 +456,19 @@ icside_register_v5(struct icside_state *
 
idx[0] = hwif-index;
 
-   ide_device_add(idx);
+   ide_device_add(idx, NULL);
 
return 0;
 }
 
+static const struct ide_port_info icside_v6_port_info __initdata = {
+   .host_flags = IDE_HFLAG_SERIALIZE |
+ IDE_HFLAG_NO_DMA | /* no SFF-style DMA */
+ IDE_HFLAG_NO_AUTOTUNE,
+   .mwdma_mask = ATA_MWDMA2,
+   .swdma_mask = ATA_SWDMA2,
+};
+
 static int __init
 icside_register_v6(struct icside_state *state, struct expansion_card *ec)
 {
@@ -472,6 +477,7 @@ icside_register_v6(struct icside_state *
unsigned int sel = 0;
int ret;
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
+   struct ide_port_info d = icside_v6_port_info;
 
ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0);
if (!ioc_base) {
@@ -521,30 +527,25 @@ icside_register_v6(struct icside_state *
state-hwif[1]= mate;
 
hwif-maskproc= icside_maskproc;
-   hwif-channel = 0;
hwif-hwif_data   = state;
-   hwif-mate= mate;
-   hwif-serialized  = 1;
hwif-config_data = (unsigned long)ioc_base;
hwif-select_data = sel;
 
mate-maskproc= icside_maskproc;
-   mate-channel = 1;
mate-hwif_data   = state;
-   mate-mate= hwif;
-   mate-serialized  = 1;
mate-config_data = (unsigned long)ioc_base;
mate-select_data = sel | 1;
 
if (ec-dma != NO_DMA  !request_dma(ec-dma, hwif-name)) {
icside_dma_init(hwif);
icside_dma_init(mate);
-   }
+   } else
+   d.mwdma_mask = d.swdma_mask = 0;
 
idx[0] = hwif-index;
idx[1] = mate

[PATCH 8/8] ide: add -cable_detect method to ide_hwif_t

2008-01-06 Thread Bartlomiej Zolnierkiewicz
* Add -cable_detect method to ide_hwif_t.

* Call the new method in ide_init_port() if:
  - the host supports UDMA modes  UDMA2 ('hwif-ultra_mask  78')
  - DMA initialization was successful (if hwif-dma_base is not set
ide_init_port() sets hwif-ultra_mask to zero)
  - idex=ata66 is not used ('hwif-cbl != ATA_CBL_PATA40_SHORT')

* Convert PCI host drivers to use -cable_detect method.

While at it:

* Factor out cable detection to separate functions (if not already done).

* hpt366.c/it8213.c/slc90e66.c:
  - don't check cable type if idex=ata66 is used

* pdc202xx_new.c:
  - add __devinit tag to pdcnew_cable_detect()

* pdc202xx_old.c:
  - rename pdc202xx_old_cable_detect() to pdc2026x_old_cable_detect()
  - add __devinit tag to pdc2026x_old_cable_detect()

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
-105 bytes
 drivers/ide/ide-probe.c|5 ++
 drivers/ide/pci/aec62xx.c  |   25 +---
 drivers/ide/pci/alim15x3.c |5 --
 drivers/ide/pci/amd74xx.c  |   18 
 drivers/ide/pci/atiixp.c   |6 --
 drivers/ide/pci/cmd64x.c   |5 --
 drivers/ide/pci/cs5535.c   |6 --
 drivers/ide/pci/hpt366.c   |   84 ++---
 drivers/ide/pci/it8213.c   |   21 +-
 drivers/ide/pci/it821x.c   |5 --
 drivers/ide/pci/jmicron.c  |6 --
 drivers/ide/pci/pdc202xx_new.c |8 ---
 drivers/ide/pci/pdc202xx_old.c |   10 ++--
 drivers/ide/pci/piix.c |7 ---
 drivers/ide/pci/scc_pata.c |3 -
 drivers/ide/pci/serverworks.c  |9 
 drivers/ide/pci/siimage.c  |5 --
 drivers/ide/pci/sis5513.c  |5 --
 drivers/ide/pci/slc90e66.c |   19 +
 drivers/ide/pci/tc86c001.c |   24 +++
 drivers/ide/pci/via82cxxx.c|6 --
 include/linux/ide.h|2 
 22 files changed, 137 insertions(+), 147 deletions(-)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1343,6 +1343,11 @@ static void ide_init_port(ide_hwif_t *hw
/* call chipset specific routine for each enabled port */
if (d-init_hwif)
d-init_hwif(hwif);
+
+   if (hwif-cable_detect  (hwif-ultra_mask  0x78)) {
+   if (hwif-cbl != ATA_CBL_PATA40_SHORT)
+   hwif-cbl = hwif-cable_detect(hwif);
+   }
 }
 
 int ide_device_add_all(u8 idx[MAX_HWIFS], const struct ide_port_info *d)
Index: b/drivers/ide/pci/aec62xx.c
===
--- a/drivers/ide/pci/aec62xx.c
+++ b/drivers/ide/pci/aec62xx.c
@@ -166,6 +166,16 @@ static unsigned int __devinit init_chips
return dev-irq;
 }
 
+static u8 __devinit atp86x_cable_detect(ide_hwif_t *hwif)
+{
+   struct pci_dev *dev = to_pci_dev(hwif-dev);
+   u8 ata66 = 0, mask = hwif-channel ? 0x02 : 0x01;
+
+   pci_read_config_byte(dev, 0x49, ata66);
+
+   return (ata66  mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80;
+}
+
 static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif)
 {
struct pci_dev *dev = to_pci_dev(hwif-dev);
@@ -174,21 +184,10 @@ static void __devinit init_hwif_aec62xx(
 
if (dev-device == PCI_DEVICE_ID_ARTOP_ATP850UF)
hwif-set_dma_mode = aec6210_set_mode;
-   else
+   else {
hwif-set_dma_mode = aec6260_set_mode;
 
-   if (hwif-dma_base == 0)
-   return;
-
-   if (dev-device == PCI_DEVICE_ID_ARTOP_ATP850UF)
-   return;
-
-   if (hwif-cbl != ATA_CBL_PATA40_SHORT) {
-   u8 ata66 = 0, mask = hwif-channel ? 0x02 : 0x01;
-
-   pci_read_config_byte(dev, 0x49, ata66);
-
-   hwif-cbl = (ata66  mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80;
+   hwif-cable_detect = atp86x_cable_detect;
}
 }
 
Index: b/drivers/ide/pci/alim15x3.c
===
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -666,13 +666,12 @@ static void __devinit init_hwif_common_a
hwif-set_dma_mode = ali_set_dma_mode;
hwif-udma_filter = ali_udma_filter;
 
+   hwif-cable_detect = ata66_ali15x3;
+
if (hwif-dma_base == 0)
return;
 
hwif-dma_setup = ali15x3_dma_setup;
-
-   if (hwif-cbl != ATA_CBL_PATA40_SHORT)
-   hwif-cbl = ata66_ali15x3(hwif);
 }
 
 /**
Index: b/drivers/ide/pci/amd74xx.c
===
--- a/drivers/ide/pci/amd74xx.c
+++ b/drivers/ide/pci/amd74xx.c
@@ -199,6 +199,14 @@ static unsigned int __devinit init_chips
return dev-irq;
 }
 
+static u8 __devinit amd_cable_detect(ide_hwif_t *hwif)
+{
+   if ((amd_80w  hwif-channel)  1)
+   return ATA_CBL_PATA80;
+   else
+   return ATA_CBL_PATA40;
+}
+
 static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif

Re: [PATCH] ide: delete filenames/versions from comments

2008-01-05 Thread Bartlomiej Zolnierkiewicz

Hi,

On Thursday 03 January 2008, Robert Hancock wrote:
 Bartlomiej Zolnierkiewicz wrote:
  Delete filenames/versions from comments.
  
  I'm leaving decisions about adding DRV_VERSION defines and 
  MODULE_VERSION()-s
  to maintainers of the respective drivers.
  
  While at it:
  
  * Remove unused VERSION define from ide.c.
  
  * Remove unused/stale DRV_VERSION define from au1xxx-ide.c.
  
  Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
 
 How about getting rid of this stupid thing in drivers/ide/ide.c:
 
 #define   REVISIONRevision: 7.00alpha2
 
 which is used in:
 
 printk(KERN_INFO Uniform Multi-Platform E-IDE driver  REVISION \n);
 
 It's been 7.00alpha2 for god knows how long, so clearly this version 
 number is not useful..

Yep, care to make a patch removing it?

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RESEND PATCH 02/10] ide-floppy: move ide-floppy struct and macro defs into its own header. While at it

2008-01-05 Thread Bartlomiej Zolnierkiewicz

Hi,

On Saturday 05 January 2008, Borislav Petkov wrote:
 On Fri, Jan 04, 2008 at 11:49:09PM +0100, Bartlomiej Zolnierkiewicz wrote:
  
  Hi,
 Hi Bart,
 
  Hmm, contrary to ide-cd.c case there doesn't seem to be a need currently for
  moving code out of ide-floppy.c (and this patch series doesn't change that).
 ?, you mean this patch series _does_ change that, meaning it moves the struct

I mean that even with this patch series applied there is no need to for header
file since ide-floppy will still be the only user of it.

 defs into a header file. Do i get this correctly that we don't need the header
 file and the struct defs should remain in the .c file?

Yes.

  Besides it would be better to just remove some structs like it has been done
  with i.e. struct atapi_capabilities_page in ide-cd.c case [1] because:
 
 [...]
 
  typedefs are evil (exceptions are rare) and should die :)
  
 
 i'm redoing them right now against ide-2.6.git and will post when ready. By 
 the

ide-2.6.git is for syncing with Linus, the development tree is kept in quilt
tree and is merged by Andrew to -mm.  Please get the quilt patch series from:

http://www.kernel.org/pub/linux/kernel/people/bart/pata-2.6/

or use the latest 2.6.24-rc6-mm1 kernel (should have most of IDE patches).

 way, i have done some more cleanups in the meantime. Should i include them 
 into
 this series or send them later?

Include! :)

Thanks,
Bart

PS I still have to comment on patches #5/6/8/9.
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RESEND PATCH 05/10] ide-floppy: factor out ioctl handlers from idefloppy_ioctl()

2008-01-05 Thread Bartlomiej Zolnierkiewicz

looks good, some minor issues noted below

On Thursday 03 January 2008, Borislav Petkov wrote:
 There should be no functional change resulting from this patch.
 
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
 ---
  drivers/ide/ide-floppy.c |   90 
 +-
  1 files changed, 57 insertions(+), 33 deletions(-)
 
 diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
 index 196a697..7823447 100644
 --- a/drivers/ide/ide-floppy.c
 +++ b/drivers/ide/ide-floppy.c
 @@ -1600,6 +1600,58 @@ static int idefloppy_getgeo(struct block_device *bdev, 
 struct hd_geometry *geo)
   return 0;
  }
  
 +static int idefloppy_lockdoor(struct inode *inode, idefloppy_pc_t *pc,
 + int event, unsigned int cmd)
 +{
 + struct block_device *bdev = inode-i_bdev;

if 'drive' is passed as an argument, 'inode' and 'bdev' can be removed
('floppy' can be obtained from drive-driver_data)

 + struct ide_floppy_obj *floppy = ide_floppy_g(bdev-bd_disk);
 + ide_drive_t *drive = floppy-drive;
 +
 + if (floppy-openers  1)
 + return -EBUSY;
 +
 + /* The IOMEGA Clik! Drive doesn't support this command -
 +  * no room for an eject mechanism */
 + if (!test_bit(IDEFLOPPY_CLIK_DRIVE, floppy-flags)) {
 + idefloppy_create_prevent_cmd(pc, event);
 + (void) idefloppy_queue_pc_tail(drive, pc);
 + }
 +
 + if (cmd == CDROMEJECT) {
 + idefloppy_create_start_stop_cmd(pc, 2);
 + (void) idefloppy_queue_pc_tail(drive, pc);
 + }
 +
 + return 0;
 +}
 +
 +static
 +int idefloppy_format_start(struct file *file, struct inode *inode,
 + void __user *argp)
 +{
 + struct block_device *bdev = inode-i_bdev;
 + struct ide_floppy_obj *floppy = ide_floppy_g(bdev-bd_disk);
 + ide_drive_t *drive = floppy-drive;
 + int err;
 +
 + if (!(file-f_mode  2))
 + return -EPERM;

if this check is left in idefloppy_ioctl() it is enough to pass 'drive'
and 'argp' to idefloppy_format_start()

 + if (floppy-openers  1) {
 + /* Don't format if someone is using the disk */
 + clear_bit(IDEFLOPPY_FORMAT_IN_PROGRESS, floppy-flags);
 + return -EBUSY;
 + }
 +
 + set_bit(IDEFLOPPY_FORMAT_IN_PROGRESS, floppy-flags);
 +
 + err = idefloppy_begin_format(drive, argp);

idefloppy_begin_format() is called only by idefloppy_format_start() so it
would make sense to just merge the latter function into the former one

 + if (err)
 + clear_bit(IDEFLOPPY_FORMAT_IN_PROGRESS, floppy-flags);
 +
 + return err;
 +}
 +
  static int idefloppy_ioctl(struct inode *inode, struct file *file,
   unsigned int cmd, unsigned long arg)
  {
 @@ -1612,47 +1664,19 @@ static int idefloppy_ioctl(struct inode *inode, 
 struct file *file,
   idefloppy_pc_t pc;
  
   switch (cmd) {
 +

stray newline, no need for it

   case CDROMEJECT:
   prevent = 0;

by adding:

if (cmd == CDROMEJECT)
prevent = 0;

to idefloppy_lockdoor() it is possible to remove the above line
(together with 'prevent' variable)

   /* fall through */
 - case CDROM_LOCKDOOR:
 - if (floppy-openers  1)
 - return -EBUSY;
  
 - /* The IOMEGA Clik! Drive doesn't support this command -
 -  * no room for an eject mechanism */
 -if (!test_bit(IDEFLOPPY_CLIK_DRIVE, floppy-flags)) {
 - idefloppy_create_prevent_cmd(pc, prevent);
 - (void) idefloppy_queue_pc_tail(drive, pc);
 - }
 - if (cmd == CDROMEJECT) {
 - idefloppy_create_start_stop_cmd(pc, 2);
 - (void) idefloppy_queue_pc_tail(drive, pc);
 - }
 - return 0;
 + case CDROM_LOCKDOOR:
 + return idefloppy_lockdoor(inode, pc, prevent, cmd);

[...]

 @@ -1669,7 +1693,7 @@ static int idefloppy_ioctl(struct inode *inode, struct 
 file *file,
*/
   if (cmd != CDROM_SEND_PACKET  cmd != SCSI_IOCTL_SEND_COMMAND)
   err = scsi_cmd_ioctl(file, bdev-bd_disk-queue,
 - bdev-bd_disk, cmd, argp);
 + bdev-bd_disk, cmd, argp);
   else
   err = -ENOTTY;
  

this chunk doesn't seem to be needed
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RESEND PATCH 06/10] ide-floppy: report DMA handling in idefloppy_pc_intr() properly

2008-01-05 Thread Bartlomiej Zolnierkiewicz

On Thursday 03 January 2008, Borislav Petkov wrote:
 while at it:
 -cleanup small issues raised by scripts/checkpatch.pl
 -remove redundant and shorten some comments

Could you split the above coding style fixes into a separate patch?

 There should be no functionality change resulting from this patch

The patch fixes the DMA error reporting so this is not true. :)

 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
 ---
  drivers/ide/ide-floppy.c |  195 
 --
  1 files changed, 83 insertions(+), 112 deletions(-)
 
 diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
 index 7823447..5d0fd1f 100644
 --- a/drivers/ide/ide-floppy.c
 +++ b/drivers/ide/ide-floppy.c
 @@ -5,9 +5,7 @@
   * Copyright (C) 2000 - 2002 Paul Bristow [EMAIL PROTECTED]
   *
   * The driver currently doesn't have any fancy features, just the bare
 - * minimum read/write support.

this comment should be removed as it is not true anymore
(SG_IO and IDEFLOPPY_IOCTL_FORMAT_* ioctls are supported)

[...]

 @@ -208,11 +204,11 @@ static void idefloppy_update_buffers (ide_drive_t 
 *drive, idefloppy_pc_t *pc)
  }
  
  /*
 - *   idefloppy_queue_pc_head generates a new packet command request in front
 - *   of the request queue, before the current request, so that it will be
 - *   processed immediately, on the next pass through the driver.
 + * Generates a new packet command request in front

a lot of space left in the above line

 + * of the request queue, before the current request, so that it will be
 + * processed immediately, on the next pass through the driver.
   */
 -static void idefloppy_queue_pc_head (ide_drive_t *drive,idefloppy_pc_t *pc,
 +static void idefloppy_queue_pc_head(ide_drive_t *drive, idefloppy_pc_t *pc,
   struct request *rq)
  {
   struct ide_floppy_obj *floppy = drive-driver_data;

[...]

 @@ -554,11 +545,7 @@ static ide_startstop_t idefloppy_transfer_pc1 
 (ide_drive_t *drive)
   return ide_started;
  }
  
 -/**
 - * idefloppy_should_report_error()
 - *
 - * Supresses error messages resulting from Medium not present
 - */
 +/* Supresses error messages resulting from Medium not present */

missing '.'

 @@ -792,7 +774,8 @@ static void idefloppy_create_rw_cmd (idefloppy_t *floppy, 
 idefloppy_pc_t *pc,
  }
  
  static void
 -idefloppy_blockpc_cmd(idefloppy_t *floppy, idefloppy_pc_t *pc, struct 
 request *rq)
 +idefloppy_blockpc_cmd(idefloppy_t *floppy, idefloppy_pc_t *pc,
 + struct request *rq)

might as well be converted to match the coding style:

static void idefloppy_blockpc_cmd...

[...]

 @@ -1437,7 +1408,7 @@ static void idefloppy_setup (ide_drive_t *drive, 
 idefloppy_t *floppy)
   idefloppy_add_settings(drive);
  }
  
 -static void ide_floppy_remove(ide_drive_t *drive)
 +static void idefloppy_remove(ide_drive_t *drive)

Hmm, no.  The driver is called ide-floppy (ide_floppy) and it is more
readable this way.

  {
   idefloppy_t *floppy = drive-driver_data;
   struct gendisk *g = floppy-disk;
 @@ -1479,7 +1450,7 @@ static ide_proc_entry_t idefloppy_proc[] = {
  };
  #endif   /* CONFIG_IDE_PROC_FS */
  
 -static int ide_floppy_probe(ide_drive_t *);
 +static int idefloppy_probe(ide_drive_t *);

ditto
 
[...]

 @@ -1733,7 +1704,7 @@ static struct block_device_operations idefloppy_ops = {
   .revalidate_disk= idefloppy_revalidate_disk
  };
  
 -static int ide_floppy_probe(ide_drive_t *drive)
 +static int idefloppy_probe(ide_drive_t *drive)

ditto

otherwise looks good
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RESEND PATCH 08/10] ide-floppy: mv idefloppy_{should_,}report_error

2008-01-05 Thread Bartlomiej Zolnierkiewicz
On Thursday 03 January 2008, Borislav Petkov wrote:
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
 ---
  drivers/ide/ide-floppy.c |6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)
 
 diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
 index 2c139e7..fd5fe7b 100644
 --- a/drivers/ide/ide-floppy.c
 +++ b/drivers/ide/ide-floppy.c
 @@ -544,7 +544,7 @@ static ide_startstop_t idefloppy_transfer_pc1(ide_drive_t 
 *drive)
  }
  
  /* Supresses error messages resulting from Medium not present */
 -static inline int idefloppy_should_report_error(idefloppy_t *floppy)
 +static inline int idefloppy_report_error(idefloppy_t *floppy)

wait, this function does indeed check if it _should_ report the error
(it doesn't report it itself)... however...

  {
   if (floppy-sense_key == 0x02 
   floppy-asc   == 0x3a 
 @@ -587,7 +587,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t 
 *drive, idefloppy_pc_t *pc
*/
   if (!test_bit(PC_ABORT, pc-flags)) {
   if (!test_bit(PC_SUPPRESS_ERROR, pc-flags)) {
 - if (idefloppy_should_report_error(floppy))
 + if (idefloppy_report_error(floppy))
   printk(KERN_ERR ide-floppy: %s: I/O 
 error, 
  pc = %2x, key = %2x, 
  asc = %2x, ascq = %2x\n,
 @@ -809,7 +809,7 @@ static ide_startstop_t idefloppy_do_request(ide_drive_t 
 *drive,
  
   if (rq-errors = ERROR_MAX) {
   if (floppy-failed_pc != NULL) {
 - if (idefloppy_should_report_error(floppy))
 + if (idefloppy_report_error(floppy))
   printk(KERN_ERR ide-floppy: %s: I/O error,
pc = %2x, key = %2x, asc = %2x,
ascq = %2x\n,

if you move the printk() into the function the new name would suddenly
make sense! :)

it may be also worth to remove 'inline' from idefloppy_report_error()
while at it (this function is not performance critical and this should
cut some bytes from the driver binary)
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RESEND PATCH 09/10] ide-floppy: use test_bit wrappers for testing flags

2008-01-05 Thread Bartlomiej Zolnierkiewicz

There are two issues here:

* set_bit()/test_bit() are atomic operations and they don't see to be
  necessary in case of ide-floppy.c (standard '|'/'' should be enough)

* using wrappers for these operations is not a bad idea but doing it _now_
  just makes it harder for us to figure out how to introduced common ATA
  Packet command interface for all ATAPI device drivers (the other drivers
  are using very similar flag handling and flag names currently)

so I would say that we should defer introducting these wrappers for now
(patch converting set_bit()/test_bit() to '|'/'' would still be welcomed).

On Thursday 03 January 2008, Borislav Petkov wrote:
 also, fix header comments and remove superfluous ones. There should be no
 functionality change resulting from this patch.

fixes for comments look fine but they should be merged with the other
patch (the one containing checkpatch.pl/comments fixes)

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] ide: don't include linux/hdsmart.h

2008-01-04 Thread Bartlomiej Zolnierkiewicz

IDE doesn't need it.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 include/linux/ide.h |1 -
 1 file changed, 1 deletion(-)

Index: b/include/linux/ide.h
===
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -9,7 +9,6 @@
 #include linux/init.h
 #include linux/ioport.h
 #include linux/hdreg.h
-#include linux/hdsmart.h
 #include linux/blkdev.h
 #include linux/proc_fs.h
 #include linux/interrupt.h
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] linux/hdsmart.h is not used by kernel code

2008-01-04 Thread Bartlomiej Zolnierkiewicz

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 include/linux/hdsmart.h |2 ++
 1 file changed, 2 insertions(+)

Index: b/include/linux/hdsmart.h
===
--- a/include/linux/hdsmart.h
+++ b/include/linux/hdsmart.h
@@ -17,6 +17,7 @@
 #ifndef _LINUX_HDSMART_H
 #define _LINUX_HDSMART_H
 
+#ifndef __KERNEL
 #define OFFLINE_FULL_SCAN  0
 #define SHORT_SELF_TEST1
 #define EXTEND_SELF_TEST   2
@@ -120,5 +121,6 @@ typedef struct ata_smart_selftestlog_s {
unsigned char   resevered[2];
unsigned char   chksum;
 } __attribute__ ((packed)) ata_smart_selftestlog_t;
+#endif /* __KERNEL__ *
 
 #endif /* _LINUX_HDSMART_H */
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 13/15] ide: move handling of I/O resources out of ide_probe_port()

2008-01-04 Thread Bartlomiej Zolnierkiewicz
Reserve/release I/O resources in ide_device_add_all() instead of
ide_probe_port().

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-probe.c |   23 ---
 1 file changed, 12 insertions(+), 11 deletions(-)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -747,13 +747,6 @@ static int ide_probe_port(ide_hwif_t *hw
if (hwif-noprobe)
return -EACCES;
 
-   if ((hwif-chipset != ide_4drives || !hwif-mate || 
!hwif-mate-present) 
-   (ide_hwif_request_regions(hwif))) {
-   printk(KERN_ERR %s: ports already in use, skipping probe\n,
-   hwif-name);
-   return -EBUSY;
-   }
-
/*
 * We must always disable IRQ, as probe_for_drive will assert IRQ, but
 * we'll install our IRQ driver much later...
@@ -798,10 +791,8 @@ static int ide_probe_port(ide_hwif_t *hw
if (irqd)
enable_irq(irqd);
 
-   if (!hwif-present) {
-   ide_hwif_release_regions(hwif);
+   if (!hwif-present)
return -ENODEV;
-   }
 
for (unit = 0; unit  MAX_DRIVES; unit++) {
ide_drive_t *drive = hwif-drives[unit];
@@ -1309,7 +1300,17 @@ int ide_device_add_all(u8 *idx)
if (idx[i] == 0xff)
continue;
 
-   (void)ide_probe_port(ide_hwifs[idx[i]]);
+   hwif = ide_hwifs[idx[i]];
+
+   if ((hwif-chipset != ide_4drives || !hwif-mate ||
+!hwif-mate-present)  ide_hwif_request_regions(hwif)) {
+   printk(KERN_ERR %s: ports already in use, 
+   skipping probe\n, hwif-name);
+   continue;
+   }
+
+   if (ide_probe_port(hwif)  0)
+   ide_hwif_release_regions(hwif);
}
 
for (i = 0; i  MAX_HWIFS; i++) {
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/15] ide: prepare init_irq() for using ide_remove_port_from_hwgroup()

2008-01-04 Thread Bartlomiej Zolnierkiewicz
* BUG_ON() early if 'hwif-next == hwif' and there is a 'match' hwgroup.

* Remove printk() for impossible condition and add a BUG_ON(hwgroup-drive)
  to match code in ide_unregister().

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
-52 bytes
 drivers/ide/ide-probe.c |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -996,6 +996,7 @@ static int init_irq (ide_hwif_t *hwif)
spin_lock_irq(ide_lock);
hwif-next = hwgroup-hwif-next;
hwgroup-hwif-next = hwif;
+   BUG_ON(hwif-next == hwif);
spin_unlock_irq(ide_lock);
} else {
hwgroup = kmalloc_node(sizeof(*hwgroup), GFP_KERNEL|__GFP_ZERO,
@@ -1075,7 +1076,6 @@ static int init_irq (ide_hwif_t *hwif)
 out_unlink:
spin_lock_irq(ide_lock);
if (hwif-next == hwif) {
-   BUG_ON(match);
BUG_ON(hwgroup-hwif != hwif);
kfree(hwgroup);
} else {
@@ -1085,8 +1085,7 @@ out_unlink:
g = g-next;
g-next = hwif-next;
if (hwgroup-hwif == hwif) {
-   /* Impossible. */
-   printk(KERN_ERR Duh. Uninitialized hwif listed as 
active hwif.\n);
+   BUG_ON(hwgroup-drive);
hwgroup-hwif = g;
}
BUG_ON(hwgroup-hwif == hwif);
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


<    1   2   3   4   5   6   7   8   9   10   >