From patchwork Tue Sep 30 13:48:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 38144 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 223AC20549 for ; Tue, 30 Sep 2014 13:48:52 +0000 (UTC) Received: by mail-wi0-f198.google.com with SMTP id n3sf3699100wiv.1 for ; Tue, 30 Sep 2014 06:48:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=BYetCz2Id9AgVE9MXyM8jKE7mQ9ZJ6T2Jep9CVyJC4Y=; b=ZcuYkGtpFQdrJ+SyK1e/PmgpxpcRqJwH7ashZm0TZEtTWapJtyKFTrAGegb+BUXbgv oNboS3KbIc09C/CSCFyVPyeVTHj7iReWPnbKyp7Dnj8U2Q3M8+c5s2DZ0i2bPpc0ddc9 7ySKfnoyffvB3h96e/+PQCfq1BHqcrKB3qy7g3crvRhpL4McvYkn56dpShbyfZFDYhf8 qUQhzUCJyCXz/IqhrPf+DFjH2niS7WJywCLHmfUBVsFyhpMk9iI/kFRmhCcJmFlL3i5I x2MAh3+73EOf3i1j93pD6cQi/9f2lEZM33/vqM8Su4D3nqO5FkbbfU1XenacjorJLkXg q5lg== X-Gm-Message-State: ALoCoQkLCLJtGtXpWJDHt+6VimMjHpZUPXbUxgyT7sNXRJ78nKssfW2Drz6g9UB7nsIhC8v+FD3M X-Received: by 10.180.38.11 with SMTP id c11mr880407wik.5.1412084931328; Tue, 30 Sep 2014 06:48:51 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.9 with SMTP id o9ls40136lao.97.gmail; Tue, 30 Sep 2014 06:48:51 -0700 (PDT) X-Received: by 10.112.134.101 with SMTP id pj5mr44494431lbb.47.1412084931129; Tue, 30 Sep 2014 06:48:51 -0700 (PDT) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com [209.85.217.177]) by mx.google.com with ESMTPS id vs9si22758135lbb.138.2014.09.30.06.48.51 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 30 Sep 2014 06:48:51 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by mail-lb0-f177.google.com with SMTP id w7so3254273lbi.36 for ; Tue, 30 Sep 2014 06:48:51 -0700 (PDT) X-Received: by 10.112.75.233 with SMTP id f9mr10453483lbw.102.1412084931003; Tue, 30 Sep 2014 06:48:51 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.130.169 with SMTP id of9csp349626lbb; Tue, 30 Sep 2014 06:48:50 -0700 (PDT) X-Received: by 10.67.30.200 with SMTP id kg8mr69643286pad.35.1412084929519; Tue, 30 Sep 2014 06:48:49 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v9si27033221pdp.136.2014.09.30.06.48.47 for ; Tue, 30 Sep 2014 06:48:49 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752029AbaI3Nsc (ORCPT + 27 others); Tue, 30 Sep 2014 09:48:32 -0400 Received: from fw-tnat.cambridge.arm.com ([217.140.96.21]:50971 "EHLO cam-smtp0.cambridge.arm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750972AbaI3Ns3 (ORCPT ); Tue, 30 Sep 2014 09:48:29 -0400 Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.207.153]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id s8UDmMqG025876; Tue, 30 Sep 2014 14:48:22 +0100 From: Sudeep Holla To: LKML Cc: Sudeep Holla , Heiko Carstens , Lorenzo Pieralisi , Greg Kroah-Hartman Subject: [PATCH v5 02/11] topology: replace custom attribute macros with standard DEVICE_ATTR* Date: Tue, 30 Sep 2014 14:48:23 +0100 Message-Id: <1412084912-2767-3-git-send-email-sudeep.holla@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1412084912-2767-1-git-send-email-sudeep.holla@arm.com> References: <1412084912-2767-1-git-send-email-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: sudeep.holla@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Currently couple of custom macros are defined to declare the device attributes. However there are already standard macros defined in device.h that suffice the need and these custom macros can be removed. This patch replaces custom attribute macros with standard DEVICE_ATTR_RO attribute Signed-off-by: Sudeep Holla Cc: Greg Kroah-Hartman --- drivers/base/topology.c | 53 ++++++++++++++++++++++--------------------------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/drivers/base/topology.c b/drivers/base/topology.c index f7c353843ddf..6491f45200a7 100644 --- a/drivers/base/topology.c +++ b/drivers/base/topology.c @@ -29,57 +29,52 @@ #include #include -#define define_one_ro_named(_name, _func) \ - static DEVICE_ATTR(_name, 0444, _func, NULL) - -#define define_one_ro(_name) \ - static DEVICE_ATTR(_name, 0444, show_##_name, NULL) - #define define_id_show_func(name) \ -static ssize_t show_##name(struct device *dev, \ +static ssize_t name##_show(struct device *dev, \ struct device_attribute *attr, char *buf) \ { \ return sprintf(buf, "%d\n", topology_##name(dev->id)); \ } -#define define_siblings_show_map(name) \ -static ssize_t show_##name(struct device *dev, \ +#define define_siblings_show_map(name, mask) \ +static ssize_t name##_show(struct device *dev, \ struct device_attribute *attr, char *buf) \ { \ - return cpumap_print_to_pagebuf(false, buf, topology_##name(dev->id));\ + return cpumap_print_to_pagebuf(false, buf, topology_##mask(dev->id));\ } -#define define_siblings_show_list(name) \ -static ssize_t show_##name##_list(struct device *dev, \ - struct device_attribute *attr, \ - char *buf) \ +#define define_siblings_show_list(name, mask) \ +static ssize_t name##_list_show(struct device *dev, \ + struct device_attribute *attr, \ + char *buf) \ { \ - return cpumap_print_to_pagebuf(true, buf, topology_##name(dev->id));\ + return cpumap_print_to_pagebuf(true, buf, topology_##mask(dev->id));\ } -#define define_siblings_show_func(name) \ - define_siblings_show_map(name); define_siblings_show_list(name) +#define define_siblings_show_func(name, mask) \ + define_siblings_show_map(name, mask); \ + define_siblings_show_list(name, mask) define_id_show_func(physical_package_id); -define_one_ro(physical_package_id); +static DEVICE_ATTR_RO(physical_package_id); define_id_show_func(core_id); -define_one_ro(core_id); +static DEVICE_ATTR_RO(core_id); -define_siblings_show_func(thread_cpumask); -define_one_ro_named(thread_siblings, show_thread_cpumask); -define_one_ro_named(thread_siblings_list, show_thread_cpumask_list); +define_siblings_show_func(thread_siblings, thread_cpumask); +static DEVICE_ATTR_RO(thread_siblings); +static DEVICE_ATTR_RO(thread_siblings_list); -define_siblings_show_func(core_cpumask); -define_one_ro_named(core_siblings, show_core_cpumask); -define_one_ro_named(core_siblings_list, show_core_cpumask_list); +define_siblings_show_func(core_siblings, core_cpumask); +static DEVICE_ATTR_RO(core_siblings); +static DEVICE_ATTR_RO(core_siblings_list); #ifdef CONFIG_SCHED_BOOK define_id_show_func(book_id); -define_one_ro(book_id); -define_siblings_show_func(book_cpumask); -define_one_ro_named(book_siblings, show_book_cpumask); -define_one_ro_named(book_siblings_list, show_book_cpumask_list); +static DEVICE_ATTR_RO(book_id); +define_siblings_show_func(book_siblings, book_cpumask); +static DEVICE_ATTR_RO(book_siblings); +static DEVICE_ATTR_RO(book_siblings_list); #endif static struct attribute *default_attrs[] = {