From patchwork Thu Aug 21 10:59:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 35739 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oi0-f70.google.com (mail-oi0-f70.google.com [209.85.218.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BF6DB2055D for ; Thu, 21 Aug 2014 11:00:25 +0000 (UTC) Received: by mail-oi0-f70.google.com with SMTP id u20sf48174743oif.5 for ; Thu, 21 Aug 2014 04:00:25 -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=X7J/HLv2F9VYzlfHmcqIBX0dyUasZ64nfY67tDVWFJ8PFT07TTxUDfSlGhafqJl2+V z+1/B0lpzXjqHtiLWsKE3jr80rqo8KXknTtvL81xkmdnWk1U2ocrM+Kb+dhHx5SsCYsb ZZyUWYmhw6XTmm0K5hnBb+dBCKrpQVl9p5hBbFlPQPjDTn7JK/FjucNn6x6tzDvXN/ek TAxWB+6/6DiVRrerv/CfZnQusVeSJyRLaNLE+S/WzSvb8NiQfzQFtaqqU4CnPOPe1S8G /kBualWPUEQDiU533l5IG8LNQQTYkJhIziflb9RfSa8GO17hm6zc53/guhEaeH2JCi80 UBCQ== X-Gm-Message-State: ALoCoQkbqUe7EAVD+8br+CmZVWXsZr7PPrFThsO77Lu2+bL4n/Ogyk6EX0UX3dB5tN3xYwQ4qkfy X-Received: by 10.42.207.146 with SMTP id fy18mr2146706icb.12.1408618825339; Thu, 21 Aug 2014 04:00:25 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.19.108 with SMTP id 99ls645837qgg.29.gmail; Thu, 21 Aug 2014 04:00:25 -0700 (PDT) X-Received: by 10.52.190.71 with SMTP id go7mr11940006vdc.28.1408618825248; Thu, 21 Aug 2014 04:00:25 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id z17si12200818vct.60.2014.08.21.04.00.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 21 Aug 2014 04:00:25 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id ij19so10280198vcb.25 for ; Thu, 21 Aug 2014 04:00:25 -0700 (PDT) X-Received: by 10.220.172.8 with SMTP id j8mr385113vcz.32.1408618825169; Thu, 21 Aug 2014 04:00:25 -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 uj3csp125492vcb; Thu, 21 Aug 2014 04:00:24 -0700 (PDT) X-Received: by 10.70.137.98 with SMTP id qh2mr55451563pdb.61.1408618824222; Thu, 21 Aug 2014 04:00:24 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ra3si18231679pab.60.2014.08.21.04.00.23 for ; Thu, 21 Aug 2014 04:00:24 -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 S1754475AbaHULAW (ORCPT + 26 others); Thu, 21 Aug 2014 07:00:22 -0400 Received: from fw-tnat.cambridge.arm.com ([217.140.96.21]:53551 "EHLO cam-smtp0.cambridge.arm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753849AbaHULAS (ORCPT ); Thu, 21 Aug 2014 07:00:18 -0400 Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.207.61]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id s7LB08RN024643; Thu, 21 Aug 2014 12:00:10 +0100 From: Sudeep Holla To: LKML Cc: sudeep.holla@arm.com, Heiko Carstens , Lorenzo Pieralisi , Stephen Boyd , Greg Kroah-Hartman Subject: [PATCH v3 02/11] topology: replace custom attribute macros with standard DEVICE_ATTR* Date: Thu, 21 Aug 2014 11:59:45 +0100 Message-Id: <1408618794-28497-3-git-send-email-sudeep.holla@arm.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1408618794-28497-1-git-send-email-sudeep.holla@arm.com> References: <1406306692-7135-1-git-send-email-sudeep.holla@arm.com> <1408618794-28497-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.180 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[] = {