public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Martin Dalecki <dalecki@evision-ventures.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: kernel list <linux-kernel@vger.kernel.org>
Subject: Re: Suspend support for IDE
Date: Sat, 09 Mar 2002 14:02:23 +0100	[thread overview]
Message-ID: <3C8A07DF.8040406@evision-ventures.com> (raw)
In-Reply-To: <20020308180204.GA7035@elf.ucw.cz>

Pavel Machek wrote:
> Hi!
> 
> This adds driver support to ide-disk.c. Does it look good to you? [If
> so, applying it will not hurt, altrough it might change in near
> future.]

Since I'm open for change anyway and it apprently doesn't hurt my
eyes ;-). I'm gald to include it. (God would I love to
delete the silly suspen partition on my noebook and suspend to
file instead!).

(I will just replace the panic check by a BUG_ON check...)

Tank you very much for your efforts to implement this!

> --- clean.pre/drivers/ide/ide-disk.c	Fri Mar  8 18:40:34 2002
> +++ linux-dm.pre/drivers/ide/ide-disk.c	Fri Mar  8 18:40:07 2002
> @@ -123,6 +123,8 @@
>   */
>  static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, unsigned long block)
>  {
> +	if (drive->blocked)
> +		panic("ide: Request while drive blocked? You don't like your data intact?");
>  	if (!(rq->flags & REQ_CMD)) {
>  		blk_dump_rq_flags(rq, "do_rw_disk, bad command");
>  		ide_end_request(drive, 0);
> @@ -910,13 +912,36 @@
>  	ide_add_setting(drive,	"max_failures",		SETTING_RW,					-1,			-1,			TYPE_INT,	0,	65535,				1,	1,	&drive->max_failures,		NULL);
>  }
>  
> +static int idedisk_suspend(struct device *dev, u32 state, u32 level)
> +{
> +	int i;
> +	ide_drive_t *drive = dev->driver_data;
> +
> +	printk("ide_disk_suspend()\n");
> +	while (HWGROUP(drive)->handler)
> +		schedule();
> +	drive->blocked = 1;
> +}
> +
> +static int idedisk_resume(struct device *dev, u32 level)
> +{
> +	ide_drive_t *drive = dev->driver_data;
> +	if (!drive->blocked)
> +		panic("ide: Resume but not suspended?\n");
> +	drive->blocked = 0;
> +}
> +
> +
>  /* This is just a hook for the overall driver tree.
>   *
>   * FIXME: This is soon goig to replace the custom linked list games played up
>   * to great extend between the different components of the IDE drivers.
>   */
>  
> -static struct device_driver idedisk_devdrv = {};
> +static struct device_driver idedisk_devdrv = {
> +	suspend: idedisk_suspend,
> +	resume: idedisk_resume,
> +};
>  
>  static void idedisk_setup(ide_drive_t *drive)
>  {
> @@ -963,6 +988,7 @@
>  	    sprintf(drive->device.name, "ide-disk");
>  	    drive->device.driver = &idedisk_devdrv;
>  	    drive->device.parent = &HWIF(drive)->device;
> +	    drive->device.driver_data = drive;
>  	    device_register(&drive->device);
>  	}
>  
> --- clean.pre/include/linux/ide.h	Fri Mar  8 18:40:38 2002
> +++ linux-dm.pre/include/linux/ide.h	Fri Mar  8 18:37:44 2002
> @@ -410,6 +410,7 @@
>  	unsigned autotune	: 2;	/* 1=autotune, 2=noautotune, 0=default */
>  	unsigned remap_0_to_1	: 2;	/* 0=remap if ezdrive, 1=remap, 2=noremap */
>  	unsigned ata_flash	: 1;	/* 1=present, 0=default */
> +	unsigned blocked        : 1;	/* 1=powermanagment told us not to do anything, so sleep nicely */
>  	unsigned	addressing;	/* : 2; 0=28-bit, 1=48-bit, 2=64-bit */
>  	byte		scsi;		/* 0=default, 1=skip current ide-subdriver for ide-scsi emulation */
>  	select_t	select;		/* basic drive/head select reg value */
> 
> 



-- 
- phone: +49 214 8656 283
- job:   eVision-Ventures AG, LEV .de (MY OPINIONS ARE MY OWN!)
- langs: de_DE.ISO8859-1, en_US, pl_PL.ISO8859-2, last ressort: ru_RU.KOI8-R


  parent reply	other threads:[~2002-03-09 13:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-08 18:02 Suspend support for IDE Pavel Machek
2002-03-08 18:37 ` Alan Cox
2002-03-08 18:33   ` benh
2002-03-09 21:03   ` Pavel Machek
2002-03-09 22:05     ` Alan Cox
2002-03-10  0:52       ` Barry K. Nathan
2002-03-11  0:10         ` Reid Hekman
2002-03-11  5:47           ` Andre Hedrick
2002-03-10  8:23       ` Rogier Wolff
2002-03-10 22:16         ` Derek J Witt
2002-03-10 22:37           ` Alan Cox
2002-03-11 12:15       ` Pavel Machek
2002-03-09 22:08     ` Martin Dalecki
2002-03-09 13:02 ` Martin Dalecki [this message]
     [not found] <Pine.LNX.4.33.0203101801150.30628-100000@coffee.psychology.mcmaster.ca>
2002-03-11  0:44 ` Derek J Witt
2002-03-11  1:01   ` Mark Hahn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3C8A07DF.8040406@evision-ventures.com \
    --to=dalecki@evision-ventures.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox