From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755136AbcHBLWF (ORCPT ); Tue, 2 Aug 2016 07:22:05 -0400 Received: from mga14.intel.com ([192.55.52.115]:17403 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753994AbcHBLTm (ORCPT ); Tue, 2 Aug 2016 07:19:42 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,459,1464678000"; d="scan'208";a="743064860" From: Baole Ni To: gregkh@linuxfoundation.org, lenb@kernel.org, x86@kernel.org, hpa@zytor.com Cc: linux-kernel@vger.kernel.org, chuansheng.liu@intel.com, baolex.ni@intel.com Subject: [PATCH 0076/1285] Replace numeric parameter like 0444 with macro Date: Tue, 2 Aug 2016 18:38:51 +0800 Message-Id: <20160802103851.18817-1-baolex.ni@intel.com> X-Mailer: git-send-email 2.9.2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I find that the developers often just specified the numeric value when calling a macro which is defined with a parameter for access permission. As we know, these numeric value for access permission have had the corresponding macro, and that using macro can improve the robustness and readability of the code, thus, I suggest replacing the numeric parameter with the macro. Signed-off-by: Chuansheng Liu Signed-off-by: Baole Ni --- drivers/base/memory.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/base/memory.c b/drivers/base/memory.c index f46dba8..10e7689 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -418,13 +418,13 @@ static ssize_t show_valid_zones(struct device *dev, return sprintf(buf, "%s\n", zone->name); } -static DEVICE_ATTR(valid_zones, 0444, show_valid_zones, NULL); +static DEVICE_ATTR(valid_zones, S_IRUSR | S_IRGRP | S_IROTH, show_valid_zones, NULL); #endif -static DEVICE_ATTR(phys_index, 0444, show_mem_start_phys_index, NULL); -static DEVICE_ATTR(state, 0644, show_mem_state, store_mem_state); -static DEVICE_ATTR(phys_device, 0444, show_phys_device, NULL); -static DEVICE_ATTR(removable, 0444, show_mem_removable, NULL); +static DEVICE_ATTR(phys_index, S_IRUSR | S_IRGRP | S_IROTH, show_mem_start_phys_index, NULL); +static DEVICE_ATTR(state, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, show_mem_state, store_mem_state); +static DEVICE_ATTR(phys_device, S_IRUSR | S_IRGRP | S_IROTH, show_phys_device, NULL); +static DEVICE_ATTR(removable, S_IRUSR | S_IRGRP | S_IROTH, show_mem_removable, NULL); /* * Block size attribute stuff @@ -436,7 +436,7 @@ print_block_size(struct device *dev, struct device_attribute *attr, return sprintf(buf, "%lx\n", get_memory_block_size()); } -static DEVICE_ATTR(block_size_bytes, 0444, print_block_size, NULL); +static DEVICE_ATTR(block_size_bytes, S_IRUSR | S_IRGRP | S_IROTH, print_block_size, NULL); /* * Memory auto online policy. @@ -466,7 +466,7 @@ store_auto_online_blocks(struct device *dev, struct device_attribute *attr, return count; } -static DEVICE_ATTR(auto_online_blocks, 0644, show_auto_online_blocks, +static DEVICE_ATTR(auto_online_blocks, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, show_auto_online_blocks, store_auto_online_blocks); /* -- 2.9.2