From patchwork Tue Aug 27 07:04:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shen Lichuan X-Patchwork-Id: 13778991 Received: from HK2PR02CU002.outbound.protection.outlook.com (mail-eastasiaazon11010065.outbound.protection.outlook.com [52.101.128.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 85CBA8F58; Tue, 27 Aug 2024 07:05:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.128.65 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724742303; cv=fail; b=HSTwz01lZu6Z759bYfgTQsBjinatVk5x90J7WrXcIMQbKuYG37rnqkqVxfQB7iQIVW6FWY91FJ3XCnCEThK0A2al2DrZ20zZ0otZShS94CI6StX3b8W2jW5aO1f4+ydLNs1ln0D9FXW3jk+nm2erKkCnFeObFrsjiucdO14EYZ0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724742303; c=relaxed/simple; bh=JkoA0bEAF/3xPXpYVx/KeKC150LTAio+2bkekBMF5Us=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=uRtMFdcZ44BharmaqqyE87Tfn64ZL8KC10omD3wGG+HaMbsXglTNSE+A+w0uKeDaT/sC+IXAjXdOI3T1rh/dQE0WmI4yVlVias2NNIs/R2RO4T5Qx+1FPdrcRmR5RKLRHjyXhlGbnwC33LZCdlrG3EAw9JTA7keZshoszgGS1jk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=ThqmIOqw; arc=fail smtp.client-ip=52.101.128.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="ThqmIOqw" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=y+qOy5T3QfSval5gtFeAScppSPM5BUw1kAH+/BGiRfLlKIMXdlg7PimpwiZXDPR0bFMn0LInJhmy9HtsEFkvZCO7Qy9FcabsFe+3Ar7rX2u2N4A6+OeYCzmQDxEBvsROnHQ10FaJEsr246hdirmlwxUZFMcN6wTRTCIKIn/dEw5Ce32aiB63BD3DDoFZu77AWPxT8JOO8SF1vFnXvioFOslri7DVu2OC6KWL+3svoZ4RKep4qjFZrzBrekjUBcfdwPNwceV+gSSlod3tTTOLZljmvZ8cE+2pMwWXN2QpkdvpeeZIhuXd/aErw2Pt9U26YDh4K+xW6FddWP4S0C3/7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=FmVDVWLCTpXHPeiMC/CIIBMIj0AnhLI63KeBOqjWimk=; b=svZVU1Mau/iOJp4FBTD8vZA+E0xIZ2GYV9itGnWvISQRTWmTnwGoToENvz/bkY/chBOQIi59+3p6mqkBahlkwScqvU2rGTS+kSdZuOrCfqDYq6lXvbMZlOIjYYNk7zyXQacwxkUZkxOmVxN89v0szfFOcP1QoVoIxyiwmUgY7KDeH9mYhsJ8kJSmPCt38DqVrdM+8rEhb+UvUCM1y3WMKksReCgx35g26rroPX/trzgA9K/JkYwqRERpnflH8fj/1MRJfZYxG7lgZpqyLH2DnpaE5svW3K215c8PIwM8NlSy40cDhfvbxpSSPq8BfLN4L63kIw7YGDeTOACgAuK4qw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FmVDVWLCTpXHPeiMC/CIIBMIj0AnhLI63KeBOqjWimk=; b=ThqmIOqwaeUn3Fp27LG3eEWl2BgMd+yKfURraVJAchUzqCRscqNZ/z1z5BJuVO0Umez49PF2zometUQJCpLSYqAXcKxUqYSUHkErASw/0liq+5q4gN1v99CQukHjJ3m4Ri2A8HDU3ZIOqVRswHd+NZN6wY1bOlEGTJ4BZzAIX5AS1fY5eWogN1Y0j6RuEuXETca+lS8qIvDPTCZNzPC5UOD6Un6qxZXdJSnQTc6skpqJFmS8wYtDQI1eo97x6W3u1rbdTBCYr5sVOBxKzuDQawsEv2tEKNIaIUMUt4yMPQ5v8QqYgGIPTBTfMlfaekUPE8sQAGTix/3MNEgaoAlFGw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5899.apcprd06.prod.outlook.com (2603:1096:101:e3::16) by SEYPR06MB6753.apcprd06.prod.outlook.com (2603:1096:101:174::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.24; Tue, 27 Aug 2024 07:04:57 +0000 Received: from SEZPR06MB5899.apcprd06.prod.outlook.com ([fe80::8bfc:f1ee:8923:77ce]) by SEZPR06MB5899.apcprd06.prod.outlook.com ([fe80::8bfc:f1ee:8923:77ce%3]) with mapi id 15.20.7897.021; Tue, 27 Aug 2024 07:04:57 +0000 From: Shen Lichuan To: jim.cromie@gmail.com, jdelvare@suse.com, linux@roeck-us.net Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, opensource.kernel@vivo.com, Shen Lichuan Subject: [PATCH v1] hwmon: (pc87360) Use min() macro Date: Tue, 27 Aug 2024 15:04:42 +0800 Message-Id: <20240827070442.40667-1-shenlichuan@vivo.com> X-Mailer: git-send-email 2.17.1 X-ClientProxiedBy: SG2PR02CA0069.apcprd02.prod.outlook.com (2603:1096:4:54::33) To SEZPR06MB5899.apcprd06.prod.outlook.com (2603:1096:101:e3::16) Precedence: bulk X-Mailing-List: linux-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5899:EE_|SEYPR06MB6753:EE_ X-MS-Office365-Filtering-Correlation-Id: bcc57dd2-7125-42d1-0555-08dcc6668f7e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: 5MeuyZabhAy+He/bBpBaT3OhI26IfDx87Fv0gxaph0z+MuIPxztx8AdZeXj2Jj4UiVXC5EldcTfQSZ7IfWwDu8Xy0UIONbMyP/CsPaDM4ymYrV+J4fNlQRfFG4DNGwdb8A7T7cMBfzrco42I3MnUYitEknNfEfAFeD/tIvox+WqEKefi5GQVcWto6KPbqcqgZFLN8am/6SHZXSg+LOMDTyPcOyotYkJKW1a8DBFZ9ZfIzVbiLAWrwzhJx8YncoiLNXLTKak+iWOhLnnIqFYKklDrmoKWnISf83PJLjxF3SSHobxgdcjMzXMDbJungtj9RdkYPpxylekX6/UTQXQvi2zAY9OZuNxqiSTUhAavA/KfYGDce2tMca68y2lT/uMKJ4THSNNUbR3ObJxxuMDG8uax1rHAde/hiiZ21hQJWhq+fEa4k5HN6l/Gt7VAGB0KHZk8BEsq156yLhiY6/ZncEs+5xbYHOUqZj3TXla8vKgGJ27A1+41QkWo9rZZIDjA7xyZeaH7xkQfXyMFg26n/Vy621rMZl43wB88dWHzaFf7WJUoF7xvc7/LjIJi79G77F+eWejYt6+1NydfQFHfbQ7TCJsh9BFCyLC8fZCzd9HEuipX4uWIZclWQJ+wP2VzSOQvHPnwWu/KXKZkyacjHYz5f9aPGsxvl2mLEgsEmLLdOBn1Hj205hYlv1xB8GWS+TrsaIaPl9J0en32SH531kqeYOu70TUcP6mchTNTE3PgJzElU7fT1MrQHt9cLNtgRdlV8XeXKJf+wc9XDlbD7kgSKCO9kWxqqgaXcjCywTlCroXojeauPg26xu+lnH9nvXs/qOGfvHNdOHjt77/auJ54ndQYYjSC/w1bXUsETTwuMfpEpd/5FUyl94XG8IdP0+i4OQseTdx87SQtgSxvpArcOBrfQxlXbqX/8vNibUH1lVIcLmLw0h3RNSaNRACeq1f82+uGQiCNkUcFv5g80qykXkNwKFK58jrqt7m+82kO/4rc7C8jQF7QAyPXDZN70m8GgyTCcGmCCnKfE4czOapKhi8IyazPrxjBIPfx9spONQM3qS43KRkSH9enSsSvqK7FA8zBbGPrv5L/ey40ezoL5gmBVpNLcso7J9sPXEdvoMpWVSJvv4TNOkGSlf+IgBVfrb6rUi0XjOsg2uVkfsmZcTrBfzqIxqGm1nchL29QS+ng8CSDf12j6r6SAMldYFoNGfE95dYxRirDfuS0+0G4fugA6yAwY7rfIfHsIY8HOXlGNawbBb/QvQ9XkNC8eTWdcuLOjMWaRmPMHLl+JxaCtbkz+aiG614R9mzFKt0AmzFXjVnuPxnfMnTrqswzNhYudMa3QIwLVyLsCw7QHjYOtJ43sJ+wQWw7emzgjFd/PvNr6JWQ2zsta24+fbnutJf/hJuKUSiyw1ruVmmzOg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5899.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(376014)(52116014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-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9zV1hqT+xSi5dvJviB8CI137miTAmwokJ7ti7p/ifUfxhxyoccG+IB+R9hbrBNRys044lg+EWMfKk3AQU304INHB5w5N+XUMQ8k7+vNVy6JgjyfchHdPvLiOK4DFIrU1frbC3vO26tmR1HRIohYD2ybWvNlU/mJ4qE4Z6fTKzL0ZTa1e7ZdtbD767WU8FRNheFeqslXXuBxryUxeqDOXPuvhpVG1uOAb399cuP2nPajBTnbLUIdJb/3UyWqNmibf0MJYhpKK2KzssUff49u8Ls+HTUz8SinWUV2dd8FcNUECf3XXFvlKW6w0up5NlumtHaHnuin3sKnfcSgcj6AKIapGfgss+HzxkpeZfHAXZ6Jvg0bxEGqfBsHksMkC3sj0OwYgJuiPHgzvGgGtZV2pi0RF7ruAuwFZlID53Kro6WgXeevwVI6qR2RX1Ogm8WYQj3sSNWuzZuoEsjk/hV3P3qzcmuNFNaa+s2X++uY4bvJwdlS7XAk2+OlhQKj9Z4DlnDLvOiXHShSja4GZ0s+pB4XZu2sTXXv7Ah4k X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: bcc57dd2-7125-42d1-0555-08dcc6668f7e X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5899.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2024 07:04:57.8537 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: BmSFkHEzFqgPSoU4x0STW4pwe2cE8y1ILH5ymq/xQjHoioQ62x3Mp5Agw4AfXCcOOI6lqkyu4lVVg6Ixyw6SKg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB6753 Use the min() macro to simplify the pc87360_init_device() function and improve its readability. Signed-off-by: Shen Lichuan --- drivers/hwmon/pc87360.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwmon/pc87360.c b/drivers/hwmon/pc87360.c index 9e9681b2e8c5..788b5d58f77e 100644 --- a/drivers/hwmon/pc87360.c +++ b/drivers/hwmon/pc87360.c @@ -1315,7 +1315,7 @@ static void pc87360_init_device(struct platform_device *pdev, (reg & 0xC0) | 0x11); } - nr = data->innr < 11 ? data->innr : 11; + nr = min(data->innr, 11); for (i = 0; i < nr; i++) { reg = pc87360_read_value(data, LD_IN, i, PC87365_REG_IN_STATUS);