From patchwork Thu Dec 12 23:25:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 3335011 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5F8749F243 for ; Thu, 12 Dec 2013 23:28:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 85D1E207BF for ; Thu, 12 Dec 2013 23:28:33 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id A1E71207B8 for ; Thu, 12 Dec 2013 23:28:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 37FCFFA662; Thu, 12 Dec 2013 15:28:30 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-la0-f48.google.com (mail-la0-f48.google.com [209.85.215.48]) by gabe.freedesktop.org (Postfix) with ESMTP id 4A0BFFA662 for ; Thu, 12 Dec 2013 15:28:27 -0800 (PST) Received: by mail-la0-f48.google.com with SMTP id n7so845539lam.35 for ; Thu, 12 Dec 2013 15:28:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=zMUcDXr/rtMrGtB3P3XVjPf4J8N/DXi6YEJuiheU6TU=; b=hImLWBVBH6iHbuulKLZZ15phm/nKx6PaJkuPZC3uUsiiDnkxkCzDxlJVM37wyjEkhX g/3t5AuH7s/tWziGqM11AG3jwjWyDmeywbItv+LtE22FfWChxDkp7iS0FELMwF+9uw1E 5EonHzDhsb4VaGG91zFmy9OHAYaQPB5iifmNSGcsxA5gqOEg8vfpfRPSB+Stg9koYtfd kbOG1EnPp3QtvJypy/O7yhMSPC50n2lQTIDIyEeZpz52siO+bQElnM7rlawXvG78GTYR dS522rBAB/H/0UtWbqrXpgYzdz5Vuw/VNvXAxAuXQhj2Bf7VKwZfTyBsgHUUurxk7FO/ MHFQ== X-Received: by 10.152.121.105 with SMTP id lj9mr5149255lab.6.1386890905879; Thu, 12 Dec 2013 15:28:25 -0800 (PST) Received: from localhost ([212.98.188.75]) by mx.google.com with ESMTPSA id m5sm58426laj.4.2013.12.12.15.28.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Dec 2013 15:28:25 -0800 (PST) Date: Fri, 13 Dec 2013 02:25:57 +0300 From: Sergey Senozhatsky To: Alex Deucher Subject: [PATCH] radeon_pm: fix oops in hwmon_attributes_visible() and radeon_hwmon_show_temp_thresh() Message-ID: <20131212232557.GA2203@swordfish> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.22 (2013-10-16) Cc: Jerome Glisse , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since ec39f64bba radeon_hwmon_init() is using hwmon_device_register_with_groups(), which sets `rdev' as a device private driver_data, while hwmon_attributes_visible() and radeon_hwmon_show_temp_thresh() are still waiting for `drm_device'. fix them by using dev_get_drvdata(): BUG: unable to handle kernel paging request at 0000000000001e28 IP: [] hwmon_attributes_visible+0x18/0x3d [radeon] PGD 15057e067 PUD 151a8e067 PMD 0 Oops: 0000 [#1] PREEMPT SMP Call Trace: [] internal_create_group+0x114/0x1d9 [] sysfs_create_group+0xe/0x10 [] sysfs_create_groups+0x22/0x5f [] device_add+0x34f/0x501 [] device_register+0x15/0x18 [] hwmon_device_register_with_groups+0xb5/0xed [] radeon_hwmon_init+0x56/0x7c [radeon] [] radeon_pm_init+0x134/0x7e5 [radeon] [] ? kmem_cache_alloc+0x63/0xe3 [] radeon_modeset_init+0x75f/0x8ed [radeon] [] radeon_driver_load_kms+0xc6/0x187 [radeon] [] drm_dev_register+0xf9/0x1b4 [drm] [] drm_get_pci_dev+0x98/0x129 [drm] [] ? kfree+0x10a/0x166 [] ? radeon_pci_probe+0x91/0xac [radeon] [] radeon_pci_probe+0xa3/0xac [radeon] [] pci_device_probe+0x6e/0xcf [] driver_probe_device+0x98/0x1c4 [] __driver_attach+0x5c/0x7e [] ? __device_attach+0x38/0x38 [] bus_for_each_dev+0x7b/0x85 [] driver_attach+0x19/0x1b [] bus_add_driver+0x104/0x1ce [] driver_register+0x89/0xc5 [] __pci_register_driver+0x58/0x5b [] ? 0xffffffffa037efff [] drm_pci_init+0x86/0xea [drm] [] ? 0xffffffffa037efff [] radeon_init+0x97/0x1000 [radeon] [] do_one_initcall+0x7f/0x117 [] ? set_memory_nx+0x3b/0x3d [] load_module+0x1583/0x1bb4 [] ? store_uevent+0x35/0x35 [] ? finish_task_switch+0x3b/0x10c [] ? preempt_schedule_irq+0x5d/0x99 [] ? retint_restore_args+0x13/0x13 [] SyS_init_module+0xa0/0xaf [] tracesys+0xd4/0xd9 Signed-off-by: Sergey Senozhatsky --- drivers/gpu/drm/radeon/radeon_pm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index dc75bb6..984097b 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c @@ -552,8 +552,7 @@ static ssize_t radeon_hwmon_show_temp_thresh(struct device *dev, struct device_attribute *attr, char *buf) { - struct drm_device *ddev = dev_get_drvdata(dev); - struct radeon_device *rdev = ddev->dev_private; + struct radeon_device *rdev = dev_get_drvdata(dev); int hyst = to_sensor_dev_attr(attr)->index; int temp; @@ -580,8 +579,7 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj, struct attribute *attr, int index) { struct device *dev = container_of(kobj, struct device, kobj); - struct drm_device *ddev = dev_get_drvdata(dev); - struct radeon_device *rdev = ddev->dev_private; + struct radeon_device *rdev = dev_get_drvdata(dev); /* Skip limit attributes if DPM is not enabled */ if (rdev->pm.pm_method != PM_METHOD_DPM &&