Received: by 10.192.165.156 with SMTP id m28csp770769imm; Thu, 19 Apr 2018 07:18:44 -0700 (PDT) X-Google-Smtp-Source: AIpwx49R8cIiSveehcrLyVnup4bh2ogbjTFplCt8U2hM0MQopfRt6mEXBIDbfCKEDGwu7aYXwKa+ X-Received: by 10.98.19.72 with SMTP id b69mr5058544pfj.206.1524147524426; Thu, 19 Apr 2018 07:18:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524147524; cv=none; d=google.com; s=arc-20160816; b=BtWAfmzQZUkqzKyXv5ArnUNjwO3a02/RXGHf8YjIpMMlQDbTMq+EilkDzvPr8MCPHa zcQAucMVX5mb8jXFChMBUV1CwBsTDxZtkVUGWkf6S1AY5Qj7gyK1J6hG3ASmQn433x5+ lhEb9ZNM8/LSL99bK4H34O4P4Te0abE+yrRSdYm6Ocbw5MGOhT6HM0FYjDPEm7tcXxhB kwJqqKm0cX4Qxi8OELLfFwNEPp5WRxXoHYFNQeGHSR9eBkXvCkiBi2mXBGbYy11Oq0vH mZ0x1oWxC8PXN9xs0abNM1ylPCFjxf3N4j5QLgCJU4pR4GwE9QRrJy7gAqEkWZ8JiBsd iJ9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=0xLvIqAV8tgOFSAhJtU6cR3bGrMXwrMR6kFHgki+emk=; b=F1tG8iOZW7suq+wq7rF3grhrG5SwLvL17PyWKe2ZNOsin+hpvXSiZqcUAl/Pdlr5mD 91QJE7tIEAhG0eYdG4R9oa/ClYm1rxIGhbxoqJ3iE0Wew1+Lt9mdf6ysGtz5LZ5f6xlR nCqLz20OA6T6QU6HaqJ8414PQCKY/JbeDxEoaLSMEdJ91smkdALT93LS4jdLZDLFZ6im eEt+XmYJXm0EkFZ50lXHNmtdhV8Z9NAiXlt1YgrC3+ziXnjJLlVZOesqaU5A13STVA5y ov+5a+vQZz8/Cjj20k/cUh88mg9xaZAoTNN5m22WvhRfs25YO5kId4+QZ4BuLfwjrkJf BTVA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r14si2963669pgt.292.2018.04.19.07.18.30; Thu, 19 Apr 2018 07:18:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752848AbeDSOHE (ORCPT + 99 others); Thu, 19 Apr 2018 10:07:04 -0400 Received: from sauhun.de ([88.99.104.3]:45294 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752765AbeDSOG5 (ORCPT ); Thu, 19 Apr 2018 10:06:57 -0400 Received: from localhost (unknown [145.253.130.2]) by pokefinder.org (Postfix) with ESMTPSA id 143D83139BD; Thu, 19 Apr 2018 16:06:55 +0200 (CEST) From: Wolfram Sang To: linux-kernel@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, kernel-janitors@vger.kernel.org, Wolfram Sang , Jiri Kosina , Jonathan Cameron , Srinivas Pandruvada , Benjamin Tissoires , linux-input@vger.kernel.org, linux-iio@vger.kernel.org Subject: [PATCH 17/61] hid: simplify getting .drvdata Date: Thu, 19 Apr 2018 16:05:47 +0200 Message-Id: <20180419140641.27926-18-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180419140641.27926-1-wsa+renesas@sang-engineering.com> References: <20180419140641.27926-1-wsa+renesas@sang-engineering.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We should get drvdata from struct device directly. Going via platform_device is an unneeded step back and forth. Signed-off-by: Wolfram Sang --- Build tested only. buildbot is happy. Please apply individually. drivers/hid/hid-sensor-custom.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c index e8a114157f87..cd0c2a7c8003 100644 --- a/drivers/hid/hid-sensor-custom.c +++ b/drivers/hid/hid-sensor-custom.c @@ -157,8 +157,7 @@ static int usage_id_cmp(const void *p1, const void *p2) static ssize_t enable_sensor_show(struct device *dev, struct device_attribute *attr, char *buf) { - struct platform_device *pdev = to_platform_device(dev); - struct hid_sensor_custom *sensor_inst = platform_get_drvdata(pdev); + struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev); return sprintf(buf, "%d\n", sensor_inst->enable); } @@ -237,8 +236,7 @@ static ssize_t enable_sensor_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - struct platform_device *pdev = to_platform_device(dev); - struct hid_sensor_custom *sensor_inst = platform_get_drvdata(pdev); + struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev); int value; int ret = -EINVAL; @@ -283,8 +281,7 @@ static const struct attribute_group enable_sensor_attr_group = { static ssize_t show_value(struct device *dev, struct device_attribute *attr, char *buf) { - struct platform_device *pdev = to_platform_device(dev); - struct hid_sensor_custom *sensor_inst = platform_get_drvdata(pdev); + struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev); struct hid_sensor_hub_attribute_info *attribute; int index, usage, field_index; char name[HID_CUSTOM_NAME_LENGTH]; @@ -392,8 +389,7 @@ static ssize_t show_value(struct device *dev, struct device_attribute *attr, static ssize_t store_value(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - struct platform_device *pdev = to_platform_device(dev); - struct hid_sensor_custom *sensor_inst = platform_get_drvdata(pdev); + struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev); int index, field_index, usage; char name[HID_CUSTOM_NAME_LENGTH]; int value; -- 2.11.0