From patchwork Wed Dec 12 15:45:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pandruvada, Srinivas" X-Patchwork-Id: 205568 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-da0-f61.google.com (mail-da0-f61.google.com [209.85.210.61]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id C83AD2C0094 for ; Thu, 13 Dec 2012 02:45:39 +1100 (EST) Received: by mail-da0-f61.google.com with SMTP id z8sf542270dad.26 for ; Wed, 12 Dec 2012 07:45:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=x-beenthere:received-spf:x-extloop1:x-ironport-av:from:to:cc :subject:thread-topic:thread-index:date:message-id:references :in-reply-to:accept-language:x-ms-has-attach:x-ms-tnef-correlator :x-originating-ip:mime-version:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-google-group-id:list-post:list-help:list-archive:sender :list-subscribe:list-unsubscribe:content-language:content-type; bh=PlMU5YEPUATGWbZoMocfqpjRmb6BgnF7Oxk08YOF4Zs=; b=AhikIxYNwFZFJ4SGCHDAdWQA0SrGF9qF5v0GcWunIBO7K5hwK4gHje2IjWcuKHZkKb 2PQpuvUIfqT2qCAFApIaSIwjZhP/zJsn4oxa3SzEwvUoedA4PGC2vIuZITJUnvzZZIBi /x0lUAGCGn6N+1PWg9eIq2+DQ8zcwO3th6d11nbsbcPHhrqNIG9FFAEqtXoKKxwNNa5B a8pZQ02kJewDWWcVDxRzDYM5Irh5SwKG4l7cdfge6mX9V2nvsp5td2Jcv78U32w5WKW9 C4lqIe1gH9FJpGtQa7UtTg/3IBGaZJgzPNQvXcPd4cfcLKnc3Kv5WRszxEbYpUKY5rK9 gPxg== Received: by 10.50.169.103 with SMTP id ad7mr5523900igc.2.1355327137458; Wed, 12 Dec 2012 07:45:37 -0800 (PST) X-BeenThere: rtc-linux@googlegroups.com Received: by 10.50.202.97 with SMTP id kh1ls3503258igc.11.canary; Wed, 12 Dec 2012 07:45:36 -0800 (PST) Received: by 10.66.88.131 with SMTP id bg3mr569756pab.39.1355327136196; Wed, 12 Dec 2012 07:45:36 -0800 (PST) Received: by 10.66.88.131 with SMTP id bg3mr569754pab.39.1355327136181; Wed, 12 Dec 2012 07:45:36 -0800 (PST) Received: from mga01.intel.com (mga01.intel.com. [192.55.52.88]) by gmr-mx.google.com with ESMTP id uz6si5675177pbc.0.2012.12.12.07.45.35; Wed, 12 Dec 2012 07:45:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of srinivas.pandruvada@intel.com designates 192.55.52.88 as permitted sender) client-ip=192.55.52.88; Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 12 Dec 2012 07:45:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,267,1355126400"; d="scan'208";a="263013547" Received: from orsmsx106.amr.corp.intel.com ([10.22.225.133]) by fmsmga002.fm.intel.com with ESMTP; 12 Dec 2012 07:45:34 -0800 Received: from orsmsx151.amr.corp.intel.com (10.22.226.38) by ORSMSX106.amr.corp.intel.com (10.22.225.133) with Microsoft SMTP Server (TLS) id 14.1.355.2; Wed, 12 Dec 2012 07:45:34 -0800 Received: from orsmsx108.amr.corp.intel.com ([169.254.9.188]) by ORSMSX151.amr.corp.intel.com ([169.254.7.43]) with mapi id 14.01.0355.002; Wed, 12 Dec 2012 07:45:34 -0800 From: "Pandruvada, Srinivas" To: Alexander Holler , "linux-kernel@vger.kernel.org" CC: "linux-iio@vger.kernel.org" , Jonathan Cameron , Lars-Peter Clausen , "rtc-linux@googlegroups.com" , Alessandro Zummo , Andrew Morton Subject: [rtc-linux] RE: [PATCH 3/4] iio: merge hid-sensor-attributes.h into hid-sensor-hub.h Thread-Topic: [PATCH 3/4] iio: merge hid-sensor-attributes.h into hid-sensor-hub.h Thread-Index: AQHN18yW3WojzOxek0eBnfNmcOS+7JgVTu/g Date: Wed, 12 Dec 2012 15:45:33 +0000 Message-ID: <4FA419E87744DF4DAECD5BCE1214B7A91C960BAB@ORSMSX108.amr.corp.intel.com> References: <50C73AFC.1050904@jic23.retrosnub.co.uk> <1355250106-3114-1-git-send-email-holler@ahsoftware.de> <1355250106-3114-3-git-send-email-holler@ahsoftware.de> In-Reply-To: <1355250106-3114-3-git-send-email-holler@ahsoftware.de> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.22.254.138] MIME-Version: 1.0 X-Original-Sender: srinivas.pandruvada@intel.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: best guess record for domain of srinivas.pandruvada@intel.com designates 192.55.52.88 as permitted sender) smtp.mail=srinivas.pandruvada@intel.com Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: X-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , Content-Language: en-US One minor comment. -----Original Message----- From: Alexander Holler [mailto:holler@ahsoftware.de] Sent: Tuesday, December 11, 2012 10:22 AM To: linux-kernel@vger.kernel.org Cc: linux-iio@vger.kernel.org; Jonathan Cameron; Lars-Peter Clausen; rtc-linux@googlegroups.com; Alessandro Zummo; Pandruvada, Srinivas; Andrew Morton; Alexander Holler Subject: [PATCH 3/4] iio: merge hid-sensor-attributes.h into hid-sensor-hub.h The stuff in hid-sensor-attributes.h is needed by every piece which uses hid-sensor-hub and merging it into hid-sensor-hub.h makes it accessible from outside the iio subdirectory. Signed-off-by: Alexander Holler --- drivers/iio/accel/hid-sensor-accel-3d.c | 1 - .../iio/common/hid-sensors/hid-sensor-attributes.c | 1 - .../iio/common/hid-sensors/hid-sensor-attributes.h | 57 -------------------- .../iio/common/hid-sensors/hid-sensor-trigger.c | 1 - drivers/iio/gyro/hid-sensor-gyro-3d.c | 1 - drivers/iio/light/hid-sensor-als.c | 1 - drivers/iio/magnetometer/hid-sensor-magn-3d.c | 1 - include/linux/hid-sensor-hub.h | 38 +++++++++++++ 8 files changed, 38 insertions(+), 63 deletions(-) delete mode 100644 drivers/iio/common/hid-sensors/hid-sensor-attributes.h +++ b/include/linux/hid-sensor-hub.h @@ -157,4 +157,42 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, */ int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, u32 field_index, s32 *value); + +/* hid-sensor-attributes */ + +/* Common hid sensor iio structure */ +struct hid_sensor_iio_common { + struct hid_sensor_hub_device *hsdev; + struct platform_device *pdev; + unsigned usage_id; + bool data_ready; + struct hid_sensor_hub_attribute_info poll; + struct hid_sensor_hub_attribute_info report_state; + struct hid_sensor_hub_attribute_info power_state; + struct hid_sensor_hub_attribute_info sensitivity; }; +/*Convert from hid unit expo to regular exponent*/ static inline int +hid_sensor_convert_exponent(int unit_expo) { + if (unit_expo < 0x08) + return unit_expo; + else if (unit_expo <= 0x0f) + return -(0x0f-unit_expo+1); + else + return 0; +} + +int hid_sensor_parse_common_attributes(struct hid_sensor_hub_device *hsdev, + u32 usage_id, + struct hid_sensor_iio_common *st); int +hid_sensor_write_raw_hyst_value(struct hid_sensor_iio_common *st, + int val1, int val2); +int hid_sensor_read_raw_hyst_value(struct hid_sensor_iio_common *st, + int *val1, int *val2); +int hid_sensor_write_samp_freq_value(struct hid_sensor_iio_common *st, + int val1, int val2); +int hid_sensor_read_samp_freq_value(struct hid_sensor_iio_common *st, + int *val1, int *val2); + #endif -- 1.7.8.6 diff --git a/drivers/iio/accel/hid-sensor-accel-3d.c b/drivers/iio/accel/hid-sensor-accel-3d.c index 314a405..72371aa 100644 --- a/drivers/iio/accel/hid-sensor-accel-3d.c +++ b/drivers/iio/accel/hid-sensor-accel-3d.c @@ -28,7 +28,6 @@ #include #include #include -#include "../common/hid-sensors/hid-sensor-attributes.h" #include "../common/hid-sensors/hid-sensor-trigger.h" /*Format: HID-SENSOR-usage_id_in_hex*/ diff --git a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c index 7537495..5873f16 100644 --- a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c +++ b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c @@ -25,7 +25,6 @@ #include #include #include -#include "hid-sensor-attributes.h" static int pow_10(unsigned power) { diff --git a/drivers/iio/common/hid-sensors/hid-sensor-attributes.h b/drivers/iio/common/hid-sensors/hid-sensor-attributes.h deleted file mode 100644 index a4676a0..0000000 --- a/drivers/iio/common/hid-sensors/hid-sensor-attributes.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * HID Sensors Driver - * Copyright (c) 2012, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * - */ -#ifndef _HID_SENSORS_ATTRIBUTES_H -#define _HID_SENSORS_ATTRIBUTES_H - -/* Common hid sensor iio structure */ -struct hid_sensor_iio_common { - struct hid_sensor_hub_device *hsdev; - struct platform_device *pdev; - unsigned usage_id; - bool data_ready; - struct hid_sensor_hub_attribute_info poll; - struct hid_sensor_hub_attribute_info report_state; - struct hid_sensor_hub_attribute_info power_state; - struct hid_sensor_hub_attribute_info sensitivity; -}; -/*Convert from hid unit expo to regular exponent*/ -static inline int hid_sensor_convert_exponent(int unit_expo) -{ - if (unit_expo < 0x08) - return unit_expo; - else if (unit_expo <= 0x0f) - return -(0x0f-unit_expo+1); - else - return 0; -} - -int hid_sensor_parse_common_attributes(struct hid_sensor_hub_device *hsdev, - u32 usage_id, - struct hid_sensor_iio_common *st); -int hid_sensor_write_raw_hyst_value(struct hid_sensor_iio_common *st, - int val1, int val2); -int hid_sensor_read_raw_hyst_value(struct hid_sensor_iio_common *st, - int *val1, int *val2); -int hid_sensor_write_samp_freq_value(struct hid_sensor_iio_common *st, - int val1, int val2); -int hid_sensor_read_samp_freq_value(struct hid_sensor_iio_common *st, - int *val1, int *val2); - -#endif diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c index d4b790d..b097b68 100644 --- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c +++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c @@ -26,7 +26,6 @@ #include #include #include -#include "hid-sensor-attributes.h" #include "hid-sensor-trigger.h" static int hid_sensor_data_rdy_trigger_set_state(struct iio_trigger *trig, diff --git a/drivers/iio/gyro/hid-sensor-gyro-3d.c b/drivers/iio/gyro/hid-sensor-gyro-3d.c index 4c56ada..b98cd70 100644 --- a/drivers/iio/gyro/hid-sensor-gyro-3d.c +++ b/drivers/iio/gyro/hid-sensor-gyro-3d.c @@ -28,7 +28,6 @@ #include #include #include -#include "../common/hid-sensors/hid-sensor-attributes.h" #include "../common/hid-sensors/hid-sensor-trigger.h" /*Format: HID-SENSOR-usage_id_in_hex*/ diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c index 96e3691..9610989 100644 --- a/drivers/iio/light/hid-sensor-als.c +++ b/drivers/iio/light/hid-sensor-als.c @@ -28,7 +28,6 @@ #include #include #include -#include "../common/hid-sensors/hid-sensor-attributes.h" #include "../common/hid-sensors/hid-sensor-trigger.h" /*Format: HID-SENSOR-usage_id_in_hex*/ diff --git a/drivers/iio/magnetometer/hid-sensor-magn-3d.c b/drivers/iio/magnetometer/hid-sensor-magn-3d.c index c4f0d27..4957430 100644 --- a/drivers/iio/magnetometer/hid-sensor-magn-3d.c +++ b/drivers/iio/magnetometer/hid-sensor-magn-3d.c @@ -28,7 +28,6 @@ #include #include #include -#include "../common/hid-sensors/hid-sensor-attributes.h" #include "../common/hid-sensors/hid-sensor-trigger.h" /*Format: HID-SENSOR-usage_id_in_hex*/ diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h index 0aa5f4c..e6265f9 100644 --- a/include/linux/hid-sensor-hub.h