From patchwork Thu Apr 4 21:25:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janakarajan Natarajan X-Patchwork-Id: 10886359 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2CE4C17E1 for ; Thu, 4 Apr 2019 21:26:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16BC028AF6 for ; Thu, 4 Apr 2019 21:26:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B07F28AFB; Thu, 4 Apr 2019 21:26:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 967CD28AF8 for ; Thu, 4 Apr 2019 21:26:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730754AbfDDVZ6 (ORCPT ); Thu, 4 Apr 2019 17:25:58 -0400 Received: from mail-eopbgr740047.outbound.protection.outlook.com ([40.107.74.47]:6544 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730720AbfDDVZ5 (ORCPT ); Thu, 4 Apr 2019 17:25:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JFFa75NoUBhFlV+yqE//c6N02FdJVCEv38LUuxoZ02Q=; b=5uUvU63DQf/qtzrCbPYSD6dNZhiSciv7hbIxWePAw3NkWlrko0M/k2T6n5ZGpLk0Y7bnCG+XQ9hefNKOo9DJB4qjqafbjq0Qo13c/nDgHgRC0pUWn5jSGgLXG0+Uo0mXGv0rOwSc0azUTe4riHODQ6C9ohV8aHvMn0s8X9Koup0= Received: from SN6PR12MB2736.namprd12.prod.outlook.com (52.135.107.27) by SN6PR12MB2845.namprd12.prod.outlook.com (52.135.102.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.17; Thu, 4 Apr 2019 21:25:52 +0000 Received: from SN6PR12MB2736.namprd12.prod.outlook.com ([fe80::65cb:af55:6bd4:55a]) by SN6PR12MB2736.namprd12.prod.outlook.com ([fe80::65cb:af55:6bd4:55a%4]) with mapi id 15.20.1750.017; Thu, 4 Apr 2019 21:25:52 +0000 From: "Natarajan, Janakarajan" To: "linux-acpi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-pm@vger.kernel.org" , "devel@acpica.org" CC: "Rafael J . Wysocki" , Len Brown , Viresh Kumar , Robert Moore , Erik Schmauss , "Ghannam, Yazen" , "Natarajan, Janakarajan" Subject: [PATCH v2 3/7] acpi/cppc: Modify show_cppc_data macro Thread-Topic: [PATCH v2 3/7] acpi/cppc: Modify show_cppc_data macro Thread-Index: AQHU6yz6JJqmaPEOAkm3pVU0VSvCPw== Date: Thu, 4 Apr 2019 21:25:50 +0000 Message-ID: <4ccf8a16e59b500946b3bdd13419a4956692528b.1554410643.git.Janakarajan.Natarajan@amd.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SN4PR0201CA0052.namprd02.prod.outlook.com (2603:10b6:803:20::14) To SN6PR12MB2736.namprd12.prod.outlook.com (2603:10b6:805:77::27) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Janakarajan.Natarajan@amd.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [165.204.78.2] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5bf66619-d84d-4a20-57db-08d6b9441c6f x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600139)(711020)(4605104)(4618075)(2017052603328)(7193020);SRVR:SN6PR12MB2845; x-ms-traffictypediagnostic: SN6PR12MB2845: x-microsoft-antispam-prvs: x-forefront-prvs: 0997523C40 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39860400002)(136003)(376002)(396003)(366004)(346002)(199004)(189003)(305945005)(5660300002)(26005)(102836004)(105586002)(66066001)(118296001)(8676002)(106356001)(6116002)(3846002)(81156014)(97736004)(68736007)(53936002)(81166006)(316002)(7736002)(2201001)(50226002)(71190400001)(71200400001)(86362001)(14444005)(6512007)(2501003)(8936002)(99286004)(25786009)(36756003)(256004)(4326008)(6486002)(478600001)(186003)(110136005)(486006)(14454004)(54906003)(446003)(72206003)(11346002)(2906002)(52116002)(2616005)(476003)(6506007)(386003)(76176011)(6436002);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR12MB2845;H:SN6PR12MB2736.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: B0YbOAYG+6khKLDSUsyI7qVsvTpgHpbtweWwKPt4ZxVsGHoLSG2Nfeqe5cOR5mb2qayH95VL6fY9LSbSycxfHTb0J5pgaYOaviYETBLgiEpDfciKrlB4RX+ezkTQTTmbWRhedNw219iVhyHFFtdC1mU7GVsVcEhgM7xa4Ls1NDHlaTrH6OgMkXrOgeHAFyz2PkHqL+fs9A17ViXsx796fQcIj4SRAZjCmRFYlVoEq7/hYSZIAhs/EQ8pTDrvOg2525l2bzdM+UTewuICoQ+7HVzav8Yx57EWf6oxefHivbAxG93J7Zn7763+h0/xEjQtbe25nCdDhvFXmO80VyWrGPQftoaeW1RHfbulh6zbJRj3bqVbsp7NpAUOpXF2ZBMWFCR8y26JTfcyUFzTgBO7RbWqlCYBRwu6byK0f+H8LPk= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5bf66619-d84d-4a20-57db-08d6b9441c6f X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Apr 2019 21:25:50.9300 (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-Transport-CrossTenantHeadersStamped: SN6PR12MB2845 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Yazen Ghannam The show_cppc_data macro implicity uses define_one_cppc_ro. This will prevent the creation of an attribute with read and write permissions. Create a separate macro that defines a show attribute and creates a read-only sysfs entry. This is in preparation for adding a macro to create sysfs entries with read+write permission. Signed-off-by: Yazen Ghannam [ carved out into a patch, cleaned up, productized ] Signed-off-by: Janakarajan Natarajan --- drivers/acpi/cppc_acpi.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c index 37157d19d2df..10ae5a5818e6 100644 --- a/drivers/acpi/cppc_acpi.c +++ b/drivers/acpi/cppc_acpi.c @@ -159,17 +159,20 @@ __ATTR(_name, 0444, show_##_name, NULL) return scnprintf(buf, PAGE_SIZE, "%llu\n", \ (u64)st_name.member_name); \ } \ + +#define show_cppc_data_ro(access_fn, struct_name, member_name) \ + show_cppc_data(access_fn, struct_name, member_name) \ define_one_cppc_ro(member_name) -show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, highest_perf); -show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, lowest_perf); -show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, nominal_perf); -show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, lowest_nonlinear_perf); -show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, lowest_freq); -show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, nominal_freq); +show_cppc_data_ro(cppc_get_perf_caps, cppc_perf_caps, highest_perf); +show_cppc_data_ro(cppc_get_perf_caps, cppc_perf_caps, lowest_perf); +show_cppc_data_ro(cppc_get_perf_caps, cppc_perf_caps, nominal_perf); +show_cppc_data_ro(cppc_get_perf_caps, cppc_perf_caps, lowest_nonlinear_perf); +show_cppc_data_ro(cppc_get_perf_caps, cppc_perf_caps, lowest_freq); +show_cppc_data_ro(cppc_get_perf_caps, cppc_perf_caps, nominal_freq); -show_cppc_data(cppc_get_perf_ctrs, cppc_perf_fb_ctrs, reference_perf); -show_cppc_data(cppc_get_perf_ctrs, cppc_perf_fb_ctrs, wraparound_time); +show_cppc_data_ro(cppc_get_perf_ctrs, cppc_perf_fb_ctrs, reference_perf); +show_cppc_data_ro(cppc_get_perf_ctrs, cppc_perf_fb_ctrs, wraparound_time); static ssize_t show_feedback_ctrs(struct kobject *kobj, struct attribute *attr, char *buf)