From patchwork Wed Jan 13 14:48:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 8026331 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BFA589F2F4 for ; Wed, 13 Jan 2016 15:04:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 43A0C204EC for ; Wed, 13 Jan 2016 15:04:44 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 5A3BC20256 for ; Wed, 13 Jan 2016 15:04:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D1F946E7BA; Wed, 13 Jan 2016 07:04:42 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org X-Greylist: delayed 908 seconds by postgrey-1.34 at gabe; Wed, 13 Jan 2016 07:04:40 PST Received: from m50-135.163.com (m50-135.163.com [123.125.50.135]) by gabe.freedesktop.org (Postfix) with ESMTP id C78156E7BA; Wed, 13 Jan 2016 07:04:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=JxfuxPF+AFxqg0aUdb 3q0zqFWV80itmAvOSsCq6XMCU=; b=oe4fZI6U5KBcwIp+UQJ0q2Ihz1FUnAxHcG Y3KIK3DB0zxy0OtPPct+bFbs+fIYw+jQyXxQgPt8hZ8QemsjOtl4kcTbEa1y7k3l v4iWzu4QHuVnstMAfmdl7oW76BKx8vPMMsTIgA75UNDSor0SpL4W6Rluh2pD73Bt hfLc9NfZ8= Received: from localhost (unknown [116.77.137.250]) by smtp5 (Coremail) with SMTP id D9GowAAHe0zYY5ZWofF1AA--.24365S3; Wed, 13 Jan 2016 22:48:58 +0800 (CST) From: Geliang Tang To: Daniel Vetter , Jani Nikula , David Airlie Date: Wed, 13 Jan 2016 22:48:40 +0800 Message-Id: X-Mailer: git-send-email 2.5.0 In-Reply-To: <60dcf3fb69ec74bd57026ae434bd06514d699044.1452696179.git.geliangtang@163.com> References: <60dcf3fb69ec74bd57026ae434bd06514d699044.1452696179.git.geliangtang@163.com> In-Reply-To: <60dcf3fb69ec74bd57026ae434bd06514d699044.1452696179.git.geliangtang@163.com> References: <60dcf3fb69ec74bd57026ae434bd06514d699044.1452696179.git.geliangtang@163.com> X-CM-TRANSID: D9GowAAHe0zYY5ZWofF1AA--.24365S3 X-Coremail-Antispam: 1Uf129KBjvJXoW7KFWxJrW7XF13Wr15uryxGrg_yoW8Zw4xpF W5Jay5KrWxWrsrWw4UZF4kuF13twn5K34fWw4vkw1fKF1vyr90gF98AryUAF4rArWDCrn7 X3WDKFy2yay0kr7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07UeE_NUUUUU= X-Originating-IP: [116.77.137.250] X-CM-SenderInfo: 5jhoxtpqjwt0rj6rljoofrz/1tbiMBvumVWBTt-3wgAAss Cc: Geliang Tang , intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [Intel-gfx] [PATCH 2/5] drm/i915: use kobj_to_dev() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,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 Use kobj_to_dev() instead of open-coding it. Signed-off-by: Geliang Tang --- drivers/gpu/drm/i915/i915_sysfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c index 37e3f0d..c6188dd 100644 --- a/drivers/gpu/drm/i915/i915_sysfs.c +++ b/drivers/gpu/drm/i915/i915_sysfs.c @@ -164,7 +164,7 @@ i915_l3_read(struct file *filp, struct kobject *kobj, struct bin_attribute *attr, char *buf, loff_t offset, size_t count) { - struct device *dev = container_of(kobj, struct device, kobj); + struct device *dev = kobj_to_dev(kobj); struct drm_minor *dminor = dev_to_drm_minor(dev); struct drm_device *drm_dev = dminor->dev; struct drm_i915_private *dev_priv = drm_dev->dev_private; @@ -200,7 +200,7 @@ i915_l3_write(struct file *filp, struct kobject *kobj, struct bin_attribute *attr, char *buf, loff_t offset, size_t count) { - struct device *dev = container_of(kobj, struct device, kobj); + struct device *dev = kobj_to_dev(kobj); struct drm_minor *dminor = dev_to_drm_minor(dev); struct drm_device *drm_dev = dminor->dev; struct drm_i915_private *dev_priv = drm_dev->dev_private; @@ -521,7 +521,7 @@ static ssize_t error_state_read(struct file *filp, struct kobject *kobj, loff_t off, size_t count) { - struct device *kdev = container_of(kobj, struct device, kobj); + struct device *kdev = kobj_to_dev(kobj); struct drm_minor *minor = dev_to_drm_minor(kdev); struct drm_device *dev = minor->dev; struct i915_error_state_file_priv error_priv; @@ -556,7 +556,7 @@ static ssize_t error_state_write(struct file *file, struct kobject *kobj, struct bin_attribute *attr, char *buf, loff_t off, size_t count) { - struct device *kdev = container_of(kobj, struct device, kobj); + struct device *kdev = kobj_to_dev(kobj); struct drm_minor *minor = dev_to_drm_minor(kdev); struct drm_device *dev = minor->dev; int ret;