From patchwork Wed Sep 3 17:00:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 36615 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f200.google.com (mail-ob0-f200.google.com [209.85.214.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F28222039B for ; Wed, 3 Sep 2014 17:01:24 +0000 (UTC) Received: by mail-ob0-f200.google.com with SMTP id va2sf46509251obc.3 for ; Wed, 03 Sep 2014 10:01:24 -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=8MhPscful9RO5FTBdD9mKxZrffn24VSqkzfKExusnxY=; b=CO3gOKSQJDCK4Si00VwNraxUdLb78MNIr7lwGEBgoLjJ4oEHTyMpUPQQZ9ejHh6xoS gdIi1N8o4S36/I8WeHYDmdOzkXb67lIQkCG668CCLRw3zlOYf/Oo6tDKT/oGgPDCaeal r4qoGghDVxR5TzH1ztrbVNnBKk11uN+do6mSqbBF+bXddXsPuhjIeGHhv28ds3WMYQ6a nIMr7VLvcGwXTDLnpeSMvMdyqLe82+MWWUy8lF/D9Tr2WwhmxmwxGATP6QO2PpHK9Esg 911Lc/mqf7THsSCUaczVcEgbwsmHo2qudrtRWbw8J9Refe52uP0jzQGHiCIw+YPGS/p9 +m4A== X-Gm-Message-State: ALoCoQkJXZ0+XMk9K8cmU/iVMFZqYDAntgUM7HdJ91RXwukBUVUsLg8EUQz7DqVHFXj3HP5uBlJS X-Received: by 10.42.58.138 with SMTP id i10mr15282094ich.18.1409763684354; Wed, 03 Sep 2014 10:01:24 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.22.229 with SMTP id 92ls2682687qgn.98.gmail; Wed, 03 Sep 2014 10:01:24 -0700 (PDT) X-Received: by 10.221.24.135 with SMTP id re7mr1553983vcb.53.1409763684134; Wed, 03 Sep 2014 10:01:24 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id pu11si1240968vdb.55.2014.09.03.10.01.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Sep 2014 10:01:24 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id hy4so9263754vcb.10 for ; Wed, 03 Sep 2014 10:01:24 -0700 (PDT) X-Received: by 10.220.187.134 with SMTP id cw6mr1544265vcb.71.1409763684043; Wed, 03 Sep 2014 10:01:24 -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.221.45.67 with SMTP id uj3csp710699vcb; Wed, 3 Sep 2014 10:01:23 -0700 (PDT) X-Received: by 10.50.50.198 with SMTP id e6mr38495756igo.1.1409763683145; Wed, 03 Sep 2014 10:01:23 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ic5si12219877pbc.128.2014.09.03.10.01.10 for ; Wed, 03 Sep 2014 10:01:11 -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 S932925AbaICRAn (ORCPT + 26 others); Wed, 3 Sep 2014 13:00:43 -0400 Received: from fw-tnat.cambridge.arm.com ([217.140.96.21]:53452 "EHLO cam-smtp0.cambridge.arm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753538AbaICRAk (ORCPT ); Wed, 3 Sep 2014 13:00:40 -0400 Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.207.142]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id s83H0SkB032633; Wed, 3 Sep 2014 18:00:29 +0100 From: Sudeep Holla To: LKML Cc: Sudeep Holla , Heiko Carstens , Lorenzo Pieralisi , Greg Kroah-Hartman Subject: [PATCH v4 02/11] topology: replace custom attribute macros with standard DEVICE_ATTR* Date: Wed, 3 Sep 2014 18:00:08 +0100 Message-Id: <1409763617-17074-3-git-send-email-sudeep.holla@arm.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1409763617-17074-1-git-send-email-sudeep.holla@arm.com> References: <1409763617-17074-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.220.179 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: , From: Sudeep Holla 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 39b294bd769b..71251ef96e0a 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_copy_to_buf(false, topology_##name(dev->id), buf);\ + return cpumap_copy_to_buf(false, topology_##mask(dev->id), buf);\ } -#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_copy_to_buf(true, topology_##name(dev->id), buf); \ + return cpumap_copy_to_buf(true, topology_##mask(dev->id), buf); \ } -#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[] = {