Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1530945ybt; Thu, 2 Jul 2020 07:45:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWW6dxnV7if0GcRjsooefTSXWmLrN8bZbrfDiZRYOf7sMHYPvyNC8YAlU2wcIQXJJpPMqy X-Received: by 2002:a17:907:2654:: with SMTP id ar20mr26437582ejc.62.1593701123973; Thu, 02 Jul 2020 07:45:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1593701123; cv=pass; d=google.com; s=arc-20160816; b=bcXS1j5yGCOWut7vFofXqO/n1jvBEafdG+CLaYU/qY8ph7tupy0rsTv61qa60kZQ70 S80INCauNuPpoKgE/0VL38hiNgoQoNCqaHkjdQQfqyGmh/OPht1ZGov/RS1vlxGF3LWV JL7sEFeZoJScEuVgH1hp3CcGD7GzGSBwcGvUufqWI/Z1R0Ego+G9cAKeuojgIbCnI8oe kNU5f4JbBuJlqviMI4HtTVScXU3ZTwNbK3q2J7kDQHDYdsvFIfqWPwWEaSj+JmWQRKWC 2GcmqU53RrKti/DPH/BRkgBAXFGqI9W1u0XXL6jKi4U87BZLNKwX/DIGIqNvH3826I4a OEFg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-language :content-transfer-encoding:in-reply-to:user-agent:date:message-id :from:references:cc:to:subject:dkim-signature; bh=A2A31+P0kpH/RIG4uYaz8DliMzp4g5Ncqx7wadAnp/U=; b=RS9/qyOgjIpN7ge6DaMSk9NWIwUzVnqzB79wb5dDfyCrNr70d0WnZH1D7+wt0Nn5Dz vMfDvHRSt7k/BCwri1r0kPZjOjS04quv07LoO2YejhN1sM4pMmmyRyO625qd+A9d6mKT aMAe0JagqcTkTKcXa1CUvNuLlslzZcAsPZfXBv6Wxb2fCJn+huQyjqZLIcWOvUa4vM15 6nXu/acl95zfDodIOzqqHq2k1L7YRWX8Qdq5PivMGqzwYlwV+ox4wgsPR6vhqyhFw+gb bFRtSz+0IV+NJSXoKC+NjBk2DpJGsQwVFWjLRyq5OU2nKnNKNC9a2qEIQpNL/YxLBBcj jT0g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=OZgTYbKu; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ok24si5935545ejb.491.2020.07.02.07.45.00; Thu, 02 Jul 2020 07:45:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=OZgTYbKu; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729518AbgGBOmu (ORCPT + 99 others); Thu, 2 Jul 2020 10:42:50 -0400 Received: from mail-co1nam11on2086.outbound.protection.outlook.com ([40.107.220.86]:42080 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728179AbgGBOmt (ORCPT ); Thu, 2 Jul 2020 10:42:49 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=myPl7zHwUKoiP0jr84JF/X2VIvPjAxanhLWr3UaUG8feiwPxRsNB2DZoNbzGIfhJwDGhMOOD/ICWHp+A+jTIisCSaoYlmXWOSrfk8i/7nVe76zjPfvaqtK4NEcGIAh0IdPBd7ga2xMWuJVRyK2SgMjUTiybuxTeGbaBfuP1TqTiCKn63KWKXmWlOui80CTcu+gwxlZrBApaxN/SWb4b+khGMHjyVVyU7hmQQLy4Fca6W26yeYDCFoMOqtT8u6pHfDNa7pVA3LVZYHShuKJERznHbT/S/hnszirTwVTlHaayrkEk+2N7XRTRcX2C75NFvkYRqeQh57Qpqd/L9O5p/gA== 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-SenderADCheck; bh=A2A31+P0kpH/RIG4uYaz8DliMzp4g5Ncqx7wadAnp/U=; b=l8Vcbdu9Xob4GHamKu32HI/Fyo0MMgWSsH/3N6T0b0dJ7AxoLd+NluJNA8WR7BLNyNxU3UW6YwlAK7y7PBFQ4BPXjELjuSGdWYtIJaB6difiB9jUaT9uLOw4HPZT2HluoR+Um3BVTdu0KT3y9gv9Ep8NISo4gkuNYkZ9JURo5Ikh+WrbQmAAMCpbkT8oytsP06B56zKBGByLQvWNt+a45JajzR8uqCjThn+utBnbwhdP+MRSqnqw1bwWhh02IUgdkp82gOlL2WyhgU1sMii3larnpt9PI13eQabrtFfHNiuCH1jY0tXdsELotTTHA48nxNNa1+K4aXYd+usCzPGYHg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=A2A31+P0kpH/RIG4uYaz8DliMzp4g5Ncqx7wadAnp/U=; b=OZgTYbKu/ZADJf5xABMVnAfb5jt8MOGkpTF2ZGKOSbkdDWuWWWj+C5jQmjUWH5goktj1WcQ5VZnn+GM+7EEU88L6A8asAQV4l70lYvTFAPSXuFyCW4MazMUcqdsTmU8x9c71sZpBhMjGaoGvQjgV4bs31mk5BNaD54YuQhnK85E= Authentication-Results: lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=none action=none header.from=amd.com; Received: from MN2PR12MB3775.namprd12.prod.outlook.com (2603:10b6:208:159::19) by MN2PR12MB4518.namprd12.prod.outlook.com (2603:10b6:208:266::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.21; Thu, 2 Jul 2020 14:42:45 +0000 Received: from MN2PR12MB3775.namprd12.prod.outlook.com ([fe80::a16e:8812:b4c0:918d]) by MN2PR12MB3775.namprd12.prod.outlook.com ([fe80::a16e:8812:b4c0:918d%6]) with mapi id 15.20.3153.021; Thu, 2 Jul 2020 14:42:45 +0000 Subject: Re: [PATCH 1/2] moduleparams: Add hex type parameter To: Paul Menzel , Linus Torvalds , Alex Deucher Cc: linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org References: <20200702140102.26129-1-pmenzel@molgen.mpg.de> From: =?UTF-8?Q?Christian_K=c3=b6nig?= Message-ID: <7c31d918-c967-5ebb-970e-7f6e913237e8@amd.com> Date: Thu, 2 Jul 2020 16:42:38 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 In-Reply-To: <20200702140102.26129-1-pmenzel@molgen.mpg.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-ClientProxiedBy: AM4PR0202CA0010.eurprd02.prod.outlook.com (2603:10a6:200:89::20) To MN2PR12MB3775.namprd12.prod.outlook.com (2603:10b6:208:159::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [IPv6:2a02:908:1252:fb60:be8a:bd56:1f94:86e7] (2a02:908:1252:fb60:be8a:bd56:1f94:86e7) by AM4PR0202CA0010.eurprd02.prod.outlook.com (2603:10a6:200:89::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.22 via Frontend Transport; Thu, 2 Jul 2020 14:42:43 +0000 X-Originating-IP: [2a02:908:1252:fb60:be8a:bd56:1f94:86e7] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 7dc3fe78-084a-4a0e-eba9-08d81e962ec6 X-MS-TrafficTypeDiagnostic: MN2PR12MB4518: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3044; X-Forefront-PRVS: 0452022BE1 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yyMTpAPYa8bvk4ecoO/UpsmhPhC+nfuO+ju0SMjlkD8hI7apji/QgOSYLOXSP4RQawh3F32X0IlwZA+d2BpglLLwm9nW+63Nt5J4peE6d5WyfrR3+kaRvAwfGPpnasdvVibM/pxkcYSm5MXqmfNwnLvF4CTHKe7yigf5KZDISgJ6qDteoLhQ5T4Uj9CsrwHggmjCTWaD1WwpPdIVfwx9rLTQ+ZMsnncyVEBEHWuyyMQKSV79zo58wXU+WH5mU1e09W5MWZUZtACy5DGsNSv+1DT8I2uIcGLkLi9yLu5+SHeW6scsHff5EOKSRexcVZIMkTwto+YDx5OBCkpGOVC7YbncBM91iBIkeoSfVq1uPlriUmbjMUnevc7UaTOxo4Iv X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB3775.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(366004)(66476007)(36756003)(498600001)(2616005)(86362001)(16526019)(31696002)(5660300002)(110136005)(66946007)(2906002)(83380400001)(8676002)(8936002)(186003)(31686004)(66556008)(6666004)(6636002)(52116002)(6486002)(4326008)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: ZjWWeFP3LMm4ZraaqiN6g6EKxXTRU7Zn+mDBndEZmlvMBbX9arO7A4ZfQyWuBs1++7UT2jxFzedUxUZ2s5MxN8Y2TPaSQQyYIylHan84lvzucQeDAIMiT1T3QDYCG5cqlGKdKIX9tspy4adT1WMSI8+4v852Peb3PwV2EEYY/EZbqm9DEX8HYwIHM4yExq4s3ITNXUcXEEm+k1qdrAcRic73hJuD1Mj2mGvlqr65b0v0wb6FtonChq50hjE+yGLDQzMDRE37M25gJ5WNaS67GL/8tkMYga4kcHiqNm9TSLZMyyOj+aiaoyMXOk+m2cCkWfbAezTQZQL+AjTfbeo1OnrU3HIhzwMULaldxdyQGTYia+hMzjC/V0LmV1cx3PENDeaUfC7yqK2TiUQ32uOROuzOXOCpxybTvz83v8PRUfawZY2DJanZb4+SSnyIon89X22ZeD0BE3Y65yk0JvFK1ZCqNx9TZwPZo7YhZ2l64f2B1LhRPHNNxg7QNG3zPdB3ecYMgw1RvTigjo3jpVK2gK1NyyHp2prTPJf4wkOznu3D3gfW0ydvG9JUuHArSWa0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7dc3fe78-084a-4a0e-eba9-08d81e962ec6 X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB3775.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jul 2020 14:42:45.5459 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: iw1xgdk3eGDYiyw087ShViCSxfAy31tuvzQVvzv5KdD0pePsxZxPdxDE7gze8qK2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4518 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 02.07.20 um 16:01 schrieb Paul Menzel: > For bitmasks printing values in hex is more convenient. > > Prefix with 0x (#) to make it clear, that it’s a hex value. > > Using the helper for `amdgpu.ppfeaturemask`, it will look like below. > > Before: > > $ more /sys/module/amdgpu/parameters/ppfeaturemask > 4294950911 > > After: > > $ more /sys/module/amdgpu/parameters/ppfeaturemask > 0xffffbfff > > Cc: linux-kernel@vger.kernel.org > Cc: amd-gfx@lists.freedesktop.org > Signed-off-by: Paul Menzel Good idea. I'm just not sure how well this is received upstream because it only covers u32 On the other hand that is probably also the most used. Christian. > --- > include/linux/moduleparam.h | 7 ++++++- > kernel/params.c | 1 + > 2 files changed, 7 insertions(+), 1 deletion(-) > > diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h > index 3ef917ff0964..408978fcfe27 100644 > --- a/include/linux/moduleparam.h > +++ b/include/linux/moduleparam.h > @@ -118,7 +118,7 @@ struct kparam_array > * you can create your own by defining those variables. > * > * Standard types are: > - * byte, short, ushort, int, uint, long, ulong > + * byte, hex, short, ushort, int, uint, long, ulong > * charp: a character pointer > * bool: a bool, values 0/1, y/n, Y/N. > * invbool: the above, only sense-reversed (N = true). > @@ -448,6 +448,11 @@ extern int param_set_ullong(const char *val, const struct kernel_param *kp); > extern int param_get_ullong(char *buffer, const struct kernel_param *kp); > #define param_check_ullong(name, p) __param_check(name, p, unsigned long long) > > +extern const struct kernel_param_ops param_ops_hex; > +extern int param_set_hex(const char *val, const struct kernel_param *kp); > +extern int param_get_hex(char *buffer, const struct kernel_param *kp); > +#define param_check_hex(name, p) param_check_uint(name, p) > + > extern const struct kernel_param_ops param_ops_charp; > extern int param_set_charp(const char *val, const struct kernel_param *kp); > extern int param_get_charp(char *buffer, const struct kernel_param *kp); > diff --git a/kernel/params.c b/kernel/params.c > index 8e56f8b12d8f..ceca8394dac5 100644 > --- a/kernel/params.c > +++ b/kernel/params.c > @@ -241,6 +241,7 @@ STANDARD_PARAM_DEF(uint, unsigned int, "%u", kstrtouint); > STANDARD_PARAM_DEF(long, long, "%li", kstrtol); > STANDARD_PARAM_DEF(ulong, unsigned long, "%lu", kstrtoul); > STANDARD_PARAM_DEF(ullong, unsigned long long, "%llu", kstrtoull); > +STANDARD_PARAM_DEF(hex, unsigned int, "%#x", kstrtouint); > > int param_set_charp(const char *val, const struct kernel_param *kp) > {