From patchwork Tue Aug 21 15:20:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 1355761 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 4450CDFB34 for ; Tue, 21 Aug 2012 15:19:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751272Ab2HUPTL (ORCPT ); Tue, 21 Aug 2012 11:19:11 -0400 Received: from mail-we0-f174.google.com ([74.125.82.174]:38064 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751521Ab2HUPTG (ORCPT ); Tue, 21 Aug 2012 11:19:06 -0400 Received: by weyx8 with SMTP id x8so4636537wey.19 for ; Tue, 21 Aug 2012 08:19:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=from:to:subject:cc:date:message-id:user-agent:mime-version :content-type; bh=eiA3DOJ9VtRRMkQQxdwi03QXHX/kjeZxqiMYuebodOg=; b=fsdzAF6Nlk9Erh1lqrQwB//M4Eib5s3qhT4AbrAJ+RRYAAhSuZqRdTIbRoIKpfcZT9 9I+Ia1zE2dPDUVtn5vLxWp5LPCkJWvJmldp5f3+tsuQHSgY1LpuEGmaVO/b/8NaTqmVd mq1SsGRLvvTvkx0VdDoYEGFz7Ys+NWgUc6GPg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:subject:cc:date:message-id:user-agent:mime-version :content-type:x-gm-message-state; bh=eiA3DOJ9VtRRMkQQxdwi03QXHX/kjeZxqiMYuebodOg=; b=kgncfin1/477pVxrjbqdGaILv6byH8wydumMBFGO+mDFZcHT5TDprCowh29GS5lYkc IEKHwkvMHufH84EA3mw3ajtp0z+h0/+PUHK1GWj3Gx+PTjkdTxlrpTEO1IqSrFf0bIqw UezyjmILnQlIggrFoMeKpAa0wrnzdFq8y+/8lxcpEfZT8t/gBwckmq7GTZhFWESWNWaE fmvfJNeu6PLVVfx5rJCHB1MOwC66YqSQ6dlWzHfqjuqmZDr84wspNLyJuGWjCDEaZyii s5uePFNx678h0z/0np6mtlOtwT4aakqYi8vg3SaChUol9xgqCDoYuiF/U87ubMc5FEMY 6OJw== Received: by 10.180.104.200 with SMTP id gg8mr39778006wib.14.1345562345133; Tue, 21 Aug 2012 08:19:05 -0700 (PDT) Received: from tucsk.pomaz.szeredi.hu (62-165-251-20.pool.digikabel.hu. [62.165.251.20]) by mx.google.com with ESMTPS id fb20sm4851551wid.1.2012.08.21.08.19.02 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 21 Aug 2012 08:19:03 -0700 (PDT) From: Miklos Szeredi To: davem@davemloft.net Subject: [PATCH] ide: fix generic_ide_suspend/resume Oops CC: rjw@sisk.pl, stern@rowland.harvard.edu, hdegoede@redhat.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-ide@vger.kernel.org Date: Tue, 21 Aug 2012 17:20:30 +0200 Message-ID: <87txvwgtkx.fsf@tucsk.pomaz.szeredi.hu> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 X-Gm-Message-State: ALoCoQkzABe9oeboGbcbq048wMNRs0tonz837JKU9Lc7TWAZi0GEgP7rTnkJSI/KoyaBSD2H9Era Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Miklos Szeredi This patch fixes a regresion introduced by commit 0998d063 (device-core: Ensure drvdata = NULL when no driver is bound). Suspend oopses in generic_ide_suspend() because dev_get_drvdata() returns NULL (dev->p->driver_data == NULL) and this function is not prepared for this. Fix is based on Alan Stern's suggestion. Signed-off-by: Miklos Szeredi Acked-by: Rafael J. Wysocki --- drivers/ide/ide-pm.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ide/ide-pm.c b/drivers/ide/ide-pm.c index 9240609..8d1e32d 100644 --- a/drivers/ide/ide-pm.c +++ b/drivers/ide/ide-pm.c @@ -4,7 +4,7 @@ int generic_ide_suspend(struct device *dev, pm_message_t mesg) { - ide_drive_t *drive = dev_get_drvdata(dev); + ide_drive_t *drive = to_ide_device(dev); ide_drive_t *pair = ide_get_pair_dev(drive); ide_hwif_t *hwif = drive->hwif; struct request *rq; @@ -40,7 +40,7 @@ int generic_ide_suspend(struct device *dev, pm_message_t mesg) int generic_ide_resume(struct device *dev) { - ide_drive_t *drive = dev_get_drvdata(dev); + ide_drive_t *drive = to_ide_device(dev); ide_drive_t *pair = ide_get_pair_dev(drive); ide_hwif_t *hwif = drive->hwif; struct request *rq;