From patchwork Tue Aug 2 11:49:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "baolex.ni" X-Patchwork-Id: 9258255 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4D17D60754 for ; Tue, 2 Aug 2016 15:35:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F22028527 for ; Tue, 2 Aug 2016 15:35:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 335E228510; Tue, 2 Aug 2016 15:35: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=-6.9 required=2.0 tests=BAYES_00,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 CD52728510 for ; Tue, 2 Aug 2016 15:35:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934265AbcHBPfO (ORCPT ); Tue, 2 Aug 2016 11:35:14 -0400 Received: from mga14.intel.com ([192.55.52.115]:11915 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934885AbcHBM0p (ORCPT ); Tue, 2 Aug 2016 08:26:45 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 02 Aug 2016 05:26:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,460,1464678000"; d="scan'208";a="1018220103" Received: from shsibuild003.sh.intel.com ([10.239.146.225]) by fmsmga001.fm.intel.com with ESMTP; 02 Aug 2016 05:26:42 -0700 From: Baole Ni To: jejb@parisc-linux.org, deller@gmx.de, Allen.Hubbe@emc.com, rjui@broadcom.com, sbranden@broadcom.com, m.chehab@samsung.com, pawel@osciak.com, m.szyprowski@samsung.com, kyungmin.park@samsung.com, k.kozlowski@samsung.com Cc: linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org, chuansheng.liu@intel.com, baolex.ni@intel.com, arnd@arndb.de Subject: [PATCH 0814/1285] Replace numeric parameter like 0444 with macro Date: Tue, 2 Aug 2016 19:49:03 +0800 Message-Id: <20160802114904.4233-1-baolex.ni@intel.com> X-Mailer: git-send-email 2.9.2 Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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/parisc/pdc_stable.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c index 3651c38..0cb008f 100644 --- a/drivers/parisc/pdc_stable.c +++ b/drivers/parisc/pdc_stable.c @@ -487,8 +487,8 @@ static const struct sysfs_ops pdcspath_attr_ops = { }; /* These are the two attributes of any PDC path. */ -static PATHS_ATTR(hwpath, 0644, pdcspath_hwpath_read, pdcspath_hwpath_write); -static PATHS_ATTR(layer, 0644, pdcspath_layer_read, pdcspath_layer_write); +static PATHS_ATTR(hwpath, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, pdcspath_hwpath_read, pdcspath_hwpath_write); +static PATHS_ATTR(layer, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, pdcspath_layer_read, pdcspath_layer_write); static struct attribute *paths_subsys_attrs[] = { &paths_attr_hwpath.attr, @@ -931,15 +931,15 @@ static ssize_t pdcs_osdep2_write(struct kobject *kobj, } /* The remaining attributes. */ -static PDCS_ATTR(size, 0444, pdcs_size_read, NULL); -static PDCS_ATTR(autoboot, 0644, pdcs_autoboot_read, pdcs_autoboot_write); -static PDCS_ATTR(autosearch, 0644, pdcs_autosearch_read, pdcs_autosearch_write); -static PDCS_ATTR(timer, 0444, pdcs_timer_read, NULL); -static PDCS_ATTR(osid, 0444, pdcs_osid_read, NULL); -static PDCS_ATTR(osdep1, 0600, pdcs_osdep1_read, pdcs_osdep1_write); -static PDCS_ATTR(diagnostic, 0400, pdcs_diagnostic_read, NULL); -static PDCS_ATTR(fastsize, 0400, pdcs_fastsize_read, NULL); -static PDCS_ATTR(osdep2, 0600, pdcs_osdep2_read, pdcs_osdep2_write); +static PDCS_ATTR(size, S_IRUSR | S_IRGRP | S_IROTH, pdcs_size_read, NULL); +static PDCS_ATTR(autoboot, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, pdcs_autoboot_read, pdcs_autoboot_write); +static PDCS_ATTR(autosearch, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, pdcs_autosearch_read, pdcs_autosearch_write); +static PDCS_ATTR(timer, S_IRUSR | S_IRGRP | S_IROTH, pdcs_timer_read, NULL); +static PDCS_ATTR(osid, S_IRUSR | S_IRGRP | S_IROTH, pdcs_osid_read, NULL); +static PDCS_ATTR(osdep1, S_IRUSR | S_IWUSR, pdcs_osdep1_read, pdcs_osdep1_write); +static PDCS_ATTR(diagnostic, S_IRUSR, pdcs_diagnostic_read, NULL); +static PDCS_ATTR(fastsize, S_IRUSR, pdcs_fastsize_read, NULL); +static PDCS_ATTR(osdep2, S_IRUSR | S_IWUSR, pdcs_osdep2_read, pdcs_osdep2_write); static struct attribute *pdcs_subsys_attrs[] = { &pdcs_attr_size.attr,