From patchwork Tue Oct 10 12:59:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Sundar S K X-Patchwork-Id: 733024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C926CD80CA for ; Tue, 10 Oct 2023 13:02:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232431AbjJJNCM (ORCPT ); Tue, 10 Oct 2023 09:02:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232453AbjJJNBg (ORCPT ); Tue, 10 Oct 2023 09:01:36 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2043.outbound.protection.outlook.com [40.107.93.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EA6813D; Tue, 10 Oct 2023 06:01:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fVIJvAdR8N8vj699qOSweE/3/3O6zE73DMbKfIDEZ2zwPbQDnp8VDOp4zWbVomM+H4aEG1LgBhdM/Akcd74CtVgN90RGC0O61KW7dPUkhfibLikXiim2Xe6dKOPvwgtFwi74gt0rIqmQ/LfhQGtSHUeHA2XvspLbusqVturXEcYII/MQMK2CtXO4f0xgkjJRMHOPjxWMwYilM2bM2FzxpPNMdnxacEGTivZ0KikUAtWPGy+XBU9t5x7EI/5EJtgKzGNR5dfRj9vo/aK8YMW84PAxNEIdNyB+qr2Go0yZwgdqBjCDhJpgwzqcBwTklyjPGRZuDhoHBQ5kEwkn8u+SHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=X+jTmfNoVkIqiYQ+hCrelFeX2PgBxIli578HUrRTH+8=; b=eFW96PiS684W9+3oWP8Z+z89RRnF560VdPP25D3++71MyossUfgY2PqXg/1ZfbiGD5M8BOW4lkdu9Y2onlC4tTr6jVfYfy+CRf6aUGBhw9yAzy3HkgepaaM+qlnIhwPq3p9U3GcSQrSYUF8qgK9U/625JvzcfTJB6aY2+OplkvZMUjAQK76ee/CtJ+1TF5/VQNMygHEtPRRJxyNMznkrpmB+3+gaAG6U8dymu7Y2qGDT+VvtdJJTJIwNW8mr3YbbduKbepaqW1WFmk5npTeqYkebK0eKiej3LZisnOTLWgJxgPLwJGJuE89tAkydWJT0Ig9dvx08OgYJmGrY/QBuyA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=X+jTmfNoVkIqiYQ+hCrelFeX2PgBxIli578HUrRTH+8=; b=Zhc2dVZpTVfWPqpxGG8L5NESUbGBeklIlEApbz1yUL05jrfQ2dZaVuaMtBozvyCQmP+3BzqdnWLdU0/R2GEd0nrAywC/1j3nG0R+LTBPiBvD6/8ZPWHyV0m9qVuc6oTFYKEZU2TIFniTf9bAovGxbWDhSPLFAk1y1GoqurcUTjs= Received: from CH2PR02CA0006.namprd02.prod.outlook.com (2603:10b6:610:4e::16) by CH3PR12MB8581.namprd12.prod.outlook.com (2603:10b6:610:15d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38; Tue, 10 Oct 2023 13:01:24 +0000 Received: from DS2PEPF0000343C.namprd02.prod.outlook.com (2603:10b6:610:4e:cafe::8f) by CH2PR02CA0006.outlook.office365.com (2603:10b6:610:4e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.36 via Frontend Transport; Tue, 10 Oct 2023 13:01:24 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS2PEPF0000343C.mail.protection.outlook.com (10.167.18.39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Tue, 10 Oct 2023 13:01:23 +0000 Received: from jatayu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 10 Oct 2023 08:00:57 -0500 From: Shyam Sundar S K To: , , , , , , , , , , CC: , , , , , , "Basavaraj Natikar" , Shyam Sundar S K Subject: [PATCH v3 14/16] HID: amd_sfh: rename float_to_int() to amd_sfh_float_to_int() Date: Tue, 10 Oct 2023 18:29:15 +0530 Message-ID: <20231010125917.138225-15-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231010125917.138225-1-Shyam-sundar.S-k@amd.com> References: <20231010125917.138225-1-Shyam-sundar.S-k@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS2PEPF0000343C:EE_|CH3PR12MB8581:EE_ X-MS-Office365-Filtering-Correlation-Id: 50270da6-eff4-49ab-2900-08dbc99101cc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zoOZFqYXL3sEac9X1cpH5QEsbe0WFaj8B4ZdjlACdONeceqK1sJb51L2AnccPGNINfJ7kvEvH7R87/muhANyT/EtdF+Ry1AoWWBxOttkjoto5oADE0S9yxzpSQHlJA0B2Sy8ufvrzNc798HXhzGiCjAIizv2jg4ZyXbgcH+6l1yJc4w8ZS1O2OrsQQbSa/JfiWULytPBU23NhtgbB7MYt/l/eMvdxOqifKBjNH44XSF6atKwQLzo+AvAAGWSqdo1kG96OEHL8+5CWdKyV60DRtvmhtTghZK9PPcnyuJQAl1VOzcf9jgkB+A2QbuTnocUCsbUv1PUn7XWHC/3LOSC3EB2uk7jDyiRSRpQflVClO+szoz9xG7IQDXsJ6QyPlmXhIv2TyOzW0KKuT2CNEQLgiiJVFkFw49i4McgepP7BoXVBHIctMQoiEdxExWrG9+sDLHDutcK48mDI7Arv0RNRWaJvTZEp1KjWuDGySHUYwZfupOcpq0v0GfddqVpBfHuAgVuAEHBHhIgG+uYavrLu/67taieShD1die5MEAfcG83aQR5nviniKoWJhNIDWFystxw1XHjf4eetrx6zoqZ28BaggN8J3gEgStbatDo+Uq2zIp+dt3zhR4/KMPipRvPA8UKFgjqC0/FnYVRam5r0WIa1DKpWFhMzdJCJ2gBN0dXpkciyVjMzbLPTbv5/1Vu1uQ/smtZGGMgCwGHyqm09bULIxJfADzjq3QhWBmjj6vF9HE5Pz7mNMo1aQ+R6KEg8XWHAVC8RHF07700aqdy9tGTGk6ZI4JeRKQIUmEBxuk= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(39860400002)(376002)(346002)(396003)(136003)(230922051799003)(1800799009)(186009)(82310400011)(64100799003)(451199024)(36840700001)(40470700004)(46966006)(40480700001)(41300700001)(16526019)(47076005)(26005)(336012)(426003)(921005)(82740400003)(356005)(83380400001)(81166007)(36860700001)(8936002)(4326008)(8676002)(1076003)(110136005)(316002)(70586007)(478600001)(40460700003)(70206006)(2616005)(54906003)(5660300002)(2906002)(7416002)(7696005)(6666004)(36756003)(86362001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2023 13:01:23.8936 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 50270da6-eff4-49ab-2900-08dbc99101cc X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS2PEPF0000343C.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8581 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Basavaraj Natikar Current amd_sfh driver has float_to_int() to convert units from float to int. This is fine until this function gets called outside of the current scope of file. Add a prefix "amd_sfh" to float_to_int() so that function represents the driver name. This function will be called by multiple callers in the next patch. Co-developed-by: Shyam Sundar S K Signed-off-by: Shyam Sundar S K Signed-off-by: Basavaraj Natikar --- drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c index 06bdcf072d10..47a87b28e00e 100644 --- a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c +++ b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c @@ -132,7 +132,7 @@ static void get_common_inputs(struct common_input_property *common, int report_i common->event_type = HID_USAGE_SENSOR_EVENT_DATA_UPDATED_ENUM; } -static int float_to_int(u32 flt32_val) +static int amd_sfh_float_to_int(u32 flt32_val) { int fraction, shift, mantissa, sign, exp, zeropre; @@ -200,9 +200,9 @@ static u8 get_input_rep(u8 current_index, int sensor_idx, int report_id, OFFSET_SENSOR_DATA_DEFAULT; memcpy_fromio(&accel_data, sensoraddr, sizeof(struct sfh_accel_data)); get_common_inputs(&acc_input.common_property, report_id); - acc_input.in_accel_x_value = float_to_int(accel_data.acceldata.x) / 100; - acc_input.in_accel_y_value = float_to_int(accel_data.acceldata.y) / 100; - acc_input.in_accel_z_value = float_to_int(accel_data.acceldata.z) / 100; + acc_input.in_accel_x_value = amd_sfh_float_to_int(accel_data.acceldata.x) / 100; + acc_input.in_accel_y_value = amd_sfh_float_to_int(accel_data.acceldata.y) / 100; + acc_input.in_accel_z_value = amd_sfh_float_to_int(accel_data.acceldata.z) / 100; memcpy(input_report, &acc_input, sizeof(acc_input)); report_size = sizeof(acc_input); break; @@ -211,9 +211,9 @@ static u8 get_input_rep(u8 current_index, int sensor_idx, int report_id, OFFSET_SENSOR_DATA_DEFAULT; memcpy_fromio(&gyro_data, sensoraddr, sizeof(struct sfh_gyro_data)); get_common_inputs(&gyro_input.common_property, report_id); - gyro_input.in_angel_x_value = float_to_int(gyro_data.gyrodata.x) / 1000; - gyro_input.in_angel_y_value = float_to_int(gyro_data.gyrodata.y) / 1000; - gyro_input.in_angel_z_value = float_to_int(gyro_data.gyrodata.z) / 1000; + gyro_input.in_angel_x_value = amd_sfh_float_to_int(gyro_data.gyrodata.x) / 1000; + gyro_input.in_angel_y_value = amd_sfh_float_to_int(gyro_data.gyrodata.y) / 1000; + gyro_input.in_angel_z_value = amd_sfh_float_to_int(gyro_data.gyrodata.z) / 1000; memcpy(input_report, &gyro_input, sizeof(gyro_input)); report_size = sizeof(gyro_input); break; @@ -222,9 +222,9 @@ static u8 get_input_rep(u8 current_index, int sensor_idx, int report_id, OFFSET_SENSOR_DATA_DEFAULT; memcpy_fromio(&mag_data, sensoraddr, sizeof(struct sfh_mag_data)); get_common_inputs(&magno_input.common_property, report_id); - magno_input.in_magno_x = float_to_int(mag_data.magdata.x) / 100; - magno_input.in_magno_y = float_to_int(mag_data.magdata.y) / 100; - magno_input.in_magno_z = float_to_int(mag_data.magdata.z) / 100; + magno_input.in_magno_x = amd_sfh_float_to_int(mag_data.magdata.x) / 100; + magno_input.in_magno_y = amd_sfh_float_to_int(mag_data.magdata.y) / 100; + magno_input.in_magno_z = amd_sfh_float_to_int(mag_data.magdata.z) / 100; magno_input.in_magno_accuracy = mag_data.accuracy / 100; memcpy(input_report, &magno_input, sizeof(magno_input)); report_size = sizeof(magno_input); @@ -234,7 +234,7 @@ static u8 get_input_rep(u8 current_index, int sensor_idx, int report_id, OFFSET_SENSOR_DATA_DEFAULT; memcpy_fromio(&als_data, sensoraddr, sizeof(struct sfh_als_data)); get_common_inputs(&als_input.common_property, report_id); - als_input.illuminance_value = float_to_int(als_data.lux); + als_input.illuminance_value = amd_sfh_float_to_int(als_data.lux); report_size = sizeof(als_input); memcpy(input_report, &als_input, sizeof(als_input)); break;