linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Hans de Goede <hdegoede@redhat.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
	Miklos Szeredi <miklos@szeredi.hu>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Tejun Heo <tj@kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-pm@vger.kernel.org>
Subject: Re: [REGRESION] Suspend hangs with 3.6-rc1 on Lenovo T60 notebook
Date: Thu, 16 Aug 2012 11:13:33 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.44L0.1208161106350.24305-100000@netrider.rowland.org> (raw)
In-Reply-To: <502CDADA.2070507@redhat.com>

On Thu, 16 Aug 2012, Hans de Goede wrote:

> Ah right, these are bus_driver operations. That explains some things, so I've
> done some more research asking myself: "Why does generic_ide_suspend(), which
> is a *bus* op, call dev_get_drvdata?", the answer to that seems to be that
> the ide subsystem is abusing (IMHO) drvdata to store per device bus_driver
> data. Which I believe is not how drvdata is intended to be used.
> 
> With that said, the above knowledge has allowed me to write an (ugly) fix for
> the regression Miklos is seeing. Miklos can you give the attached patch a
> try please?
> 
> > It clearly should check if drive is not NULL before using that pointer.
> 
> I assume you mean drive*r*, yes I agree that generic_ide_remove should
> check for that. So who is going to write a patch for that?

The existing code could certainly be improved.  Your patch does:

> +               /*
> +                * device_register() will have cleared drvdata on
> +                * device_attach failure, but we use drvdata to store per
> +                * device bus info, rather then for driver info, so restore it.
> +                */
> +               dev_set_drvdata(dev, drive);

But at this point, dev is defined by:

		struct device *dev = &drive->gendev;

So why bother setting anything?  It seems to me that 
generic_ide_suspend() and generic_ide_resume() could easily replace

	ide_drive_t *drive = dev_get_drvdata(dev);

with

	ide_drive_t *drive = dev_to_ide_drive(dev);

where dev_to_ide_drive is defined as "container_of(dev, ide_drive_t,
gendev)" (if this isn't defined already).

Alan Stern


  reply	other threads:[~2012-08-16 15:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87a9xwivqb.fsf@tucsk.pomaz.szeredi.hu>
2012-08-15  6:41 ` [REGRESION] Suspend hangs with 3.6-rc1 on Lenovo T60 notebook Hans de Goede
2012-08-15 19:59   ` Rafael J. Wysocki
2012-08-16 11:34     ` Hans de Goede
2012-08-16 15:13       ` Alan Stern [this message]
2012-08-16 16:29         ` Miklos Szeredi
2012-08-16 16:32           ` Alan Stern
2012-08-16 20:02             ` Rafael J. Wysocki
2012-08-17  9:23               ` Hans de Goede
2012-08-17 14:22                 ` Alan Stern
2012-08-17 14:27                   ` Alan Stern
2012-08-17 15:32                     ` Hans de Goede

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=Pine.LNX.4.44L0.1208161106350.24305-100000@netrider.rowland.org \
    --to=stern@rowland.harvard.edu \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=rjw@sisk.pl \
    --cc=tj@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).