From patchwork Wed Jan 17 06:01:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 124779 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp1268118lje; Tue, 16 Jan 2018 22:03:23 -0800 (PST) X-Google-Smtp-Source: ACJfBoulEGzgKbt9AEm1+IBKPkt6/ZaBh79uqm8g06iYIRh88EAYZGGTi7bdmMr7sOD3OV7JYwsY X-Received: by 10.98.103.83 with SMTP id b80mr27610808pfc.223.1516169003769; Tue, 16 Jan 2018 22:03:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516169003; cv=none; d=google.com; s=arc-20160816; b=VSsUXALlr0IOAAZSz2ElXIR7zQ84r4rZ2KFghfRyKVsq9A0s+Bsl9UnR2xkdYQ7O// xjAvPjFcdg3w3tITrpcMZQi3gEQJDYx1+G7MWXz/J/IlknOQu46LAjSAMmWXDuksF19b 5scPybk1v4EUcODloiE4aOyHq9njMq1WKFqT4RK0vDF+m75ZQyQRdTpkMh5dGEe/nXzp dNepSFmfXuJU6KY6F5qpTrqspJgxrSuZZlQZoBtGnTaelno6rOIiBQ4Apb0uEgtHC/3z AYiwuDyngsJXwoDJ+ogioScOlQhIx1vZwG97nVYr4q3+lB8wd822YesPNTvFak33HXv2 T8WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=vbvDOgGhg5rLg9YU57Czp6AVkkQiMHqma7Y1G6xTlmg=; b=RxgD+RujKErEJQvt7i4zcaK9keIT+IcwVAa7udkhwbtygugmqD4PzTk73jo8cSbaoi xz9A7z568xY9aPQVgi9Cdn4TSoe0hUdBY/gBEI9mIWGB82AmHsKT9bmDNxF9FpPZEPZ2 LZrlcvqsljFOxk6HxPpSXHfke7BxX17zvR9oGAXt5ueJ6uv6HhR6fBxIWEeMlW03ttjz LyXiAsq5pfMb+rYr+YRc3Mn1PtGnhf+pFSgxP1ZbYmcTGnaFc7kweKW3Ost5ZZiTaLx1 EeNQXqqLtum8dcBrJ5m4t8kfaDHdlD6DwS5gW4gYz0I3YWqPUNf0P/69EGUQf3qLN0w3 zzmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Lbwz50Ku; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w2si11513pgp.680.2018.01.16.22.03.23; Tue, 16 Jan 2018 22:03:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Lbwz50Ku; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752164AbeAQGDV (ORCPT + 28 others); Wed, 17 Jan 2018 01:03:21 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:41424 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750888AbeAQGDU (ORCPT ); Wed, 17 Jan 2018 01:03:20 -0500 Received: by mail-pg0-f65.google.com with SMTP id 136so10188599pgd.8 for ; Tue, 16 Jan 2018 22:03:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=vbvDOgGhg5rLg9YU57Czp6AVkkQiMHqma7Y1G6xTlmg=; b=Lbwz50KuJPMFfyJYAew2PbNTpdD1YXqr+ZDZexAg5nOaKiyB5x4AVuET9JG7GJ+JON 5I7Up2UW6fajkEqfFWAk8yfLAbjBBk60n7QTBhKMrhIWn8Xj6FLocPj/xdAITMQGTLuM qiXEoLGpf6WBQXi2GhFx8K5/cjVqLIFM56IUs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=vbvDOgGhg5rLg9YU57Czp6AVkkQiMHqma7Y1G6xTlmg=; b=IjfMLsP7/pSs0y9ALSVS05u/4vJqQIve3R47hiV1q+P80FV/yDAVPvWIQvx4b6KUlb EvuwERNiZyUB0XCdQLeUvxk+yZXPBIUYtMrTGrtfxAxdkJPGvjzzP0NJM8Wlrt+rplVx U2Yvkm7wj22MQk8CXpVPcqjZAsycNVJ1EoxVmFE2KlFFijEr4dzk/iNBgj+efbv8hh/E qC+pVwH7/xgvV3YZEeqlzpI8+p5qvGBxNbI0O0vGyrWRC3o9he3Lf/j5Ho+4uTsX/MAr /GOvKR05t6m2jwP8nKRocFCXQps3SUCNOBAhzCQ+DrVKQv2H1RnrV//h/vxY91p9D6ob z4DQ== X-Gm-Message-State: AKwxytctTn39QVUVS9safg4hJ2ddC8Vpt/HoI35t75WRXkL7/WQ5Ig/j SQ+MJfMT2Y+/+4xWnk6jMP61sQ== X-Received: by 10.98.189.10 with SMTP id a10mr15825809pff.125.1516169000147; Tue, 16 Jan 2018 22:03:20 -0800 (PST) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id n66sm5987418pfn.64.2018.01.16.22.02.21 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Jan 2018 22:03:19 -0800 (PST) From: Baolin Wang To: john.stultz@linaro.org, tglx@linutronix.de, sboyd@codeaurora.org Cc: broonie@kernel.org, arnd@arndb.de, baolin.wang@linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] clocksource: Skip to check the override clocksource if override name is empty Date: Wed, 17 Jan 2018 14:01:28 +0800 Message-Id: <069ce2a605546bcad6552968cff755f0a03f9f10.1516167691.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some platforms will not set the override clocksource name to select, so we can skip to check the override clocksource when selecting one clocksource. Signed-off-by: Baolin Wang --- kernel/time/clocksource.c | 4 ++++ 1 file changed, 4 insertions(+) -- 1.7.9.5 diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index 65f9e3f..c5fdcb1 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c @@ -594,6 +594,9 @@ static void __clocksource_select(bool skipcur) if (!best) return; + if (!strlen(override_name)) + goto found; + /* Check for the override clocksource. */ list_for_each_entry(cs, &clocksource_list, list) { if (skipcur && cs == curr_clocksource) @@ -625,6 +628,7 @@ static void __clocksource_select(bool skipcur) break; } +found: if (curr_clocksource != best && !timekeeping_notify(best)) { pr_info("Switched to clocksource %s\n", best->name); curr_clocksource = best; From patchwork Wed Jan 17 06:01:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 124780 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp1268613lje; Tue, 16 Jan 2018 22:05:28 -0800 (PST) X-Google-Smtp-Source: ACJfBouey5d+jvQuteuEcNNeKDFfYRQf4igKQ4/SRrUQkqCbxC9CJNjTqgPj4dOmH2fPfWynhDy6 X-Received: by 10.159.253.8 with SMTP id p8mr41452283pls.44.1516169128799; Tue, 16 Jan 2018 22:05:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516169128; cv=none; d=google.com; s=arc-20160816; b=b5cDcl3PwLcX85jdc7ttGJdG8JyLwg4YjHCFsAMuK0SNpZtSq4gohPwqt+XfdjAyCv yZvBcH8+p9k9duIIB8eBXbUkndjB0mxaXUyh8jhfCOcna0/yo0PW6rtpzmxW/4teU4EI ok+w1qDQKvI8aosxftejX6Rs4e3MB/Q4g1h+WnxkR+EYcKjNNiBp/Dx6YVrbhgjcurBI TurgyVZtQHQT+yBPa4gXnSomlOJtjkvfKqHVe8gflStvJj4BlDDTTz8L8sGIuaW6Vqr5 nvcnudMcZZ+dQpflINyaV4zaf1g+WlildZuO4UJLMCeolPRVdxEaXeoP97rCHGFxbzTi h8aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=EUoj80eDdxYnt/DPWo44yjlYW/VJrR/nsZ/wVjN7e6I=; b=JXWUmIJX6En7d0m3vNWm9xSOEi8npnnPdx8Z365EfeCxn2aA6xHSkm1abTuGi62TAw rmFCzktpF0Dme7vaqyCjEreoELiJeGJmv66eEK/XKbJbWZZVAxdvpH/B8nBKyjPhyIUl 0GQ2u1oRdRQKI6u5GuoS0B86jr1v0gKHEHXEyX7bk157YtifIhpVY7AUrFcDcQXaXf3a fGWBSe5XXfpBUt4KiHrFASTvnIzeWwyaGOdV0gH2QJh100En8EfSBE/FE3PLvESegm5s THLawv6zyYFyI3RIP3sVoUcS+GbLfJuIBhCdKQNalOOipQctPGkTXmCoKMZ80b8y6ZdO l+6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NCp+UMiJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u23si3764083plk.516.2018.01.16.22.05.28; Tue, 16 Jan 2018 22:05:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NCp+UMiJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750908AbeAQGF0 (ORCPT + 28 others); Wed, 17 Jan 2018 01:05:26 -0500 Received: from mail-pl0-f67.google.com ([209.85.160.67]:34381 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750794AbeAQGFY (ORCPT ); Wed, 17 Jan 2018 01:05:24 -0500 Received: by mail-pl0-f67.google.com with SMTP id d21so8038332pll.1 for ; Tue, 16 Jan 2018 22:05:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=EUoj80eDdxYnt/DPWo44yjlYW/VJrR/nsZ/wVjN7e6I=; b=NCp+UMiJ78qHD9YBxAlF/yUK+BjEORSnhVKo0XjNG57S4HHxe29YgGaGwT+a2GSa/2 TX9OJ78WEKBrF2/P8l6jBJyGTwCavwS/LgefYGSpfjTL1/IdDY1jnMWrWrkdLm++ul8A 0Jx59YyactNwDqdJIbosZtaP3hfhB6fXZLFyE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=EUoj80eDdxYnt/DPWo44yjlYW/VJrR/nsZ/wVjN7e6I=; b=NJ+7Y3FSVU/lF3kc9ONm2ScQKhWpPLEfOQdsBw6FnM7yKYqrdO9Z5FKyo3lxaBzRLe qWQJhe7HU4oroCuSdXel2rqSkl/Vcecet5siWX1SpdlsvrLmUKSQZj0KOQhnezobl6l5 C06yDHaKf8hWgIe8qZ67LAcHuugMRYKy+gvWPjCWeqxE4WnsoUoC/IPQNR1KSXIxmeRo kcIPxKaeJFFTGElmB0dzjAEPUJuz669uOEneLp6AHe7lTnhD1Ldr+D3MiDG+XGRzU9c8 cRAKSCR4p/OVYpNJZIVxrvvK3bNxiQogyNLttgD7T+AM8gfKO+NinUtQVCvHJlht8mb1 Ug4w== X-Gm-Message-State: AKwxyteFckAGGIFjjEWX/hOQkbTHVYLYgN05w/cpgmm9na7o/qvj4CM+ QcEAdWrE4AiblyhWZRMBtrIWjg== X-Received: by 10.159.235.143 with SMTP id f15mr10258933plr.214.1516169124357; Tue, 16 Jan 2018 22:05:24 -0800 (PST) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id n66sm5987418pfn.64.2018.01.16.22.03.43 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Jan 2018 22:05:23 -0800 (PST) From: Baolin Wang To: john.stultz@linaro.org, tglx@linutronix.de, sboyd@codeaurora.org Cc: broonie@kernel.org, arnd@arndb.de, baolin.wang@linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] clocksource: Use DEVICE_ATTR_RW/RO/WO to define device attributes Date: Wed, 17 Jan 2018 14:01:29 +0800 Message-Id: <8f35c77e753e957b61187e8e7b2e4a3d61e4a72b.1516167691.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <069ce2a605546bcad6552968cff755f0a03f9f10.1516167691.git.baolin.wang@linaro.org> References: <069ce2a605546bcad6552968cff755f0a03f9f10.1516167691.git.baolin.wang@linaro.org> In-Reply-To: <069ce2a605546bcad6552968cff755f0a03f9f10.1516167691.git.baolin.wang@linaro.org> References: <069ce2a605546bcad6552968cff755f0a03f9f10.1516167691.git.baolin.wang@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert DEVICE_ATTR to DEVICE_ATTR_RW/RO/WO to make attributes' definition more clear. Signed-off-by: Baolin Wang --- kernel/time/clocksource.c | 43 +++++++++++++++++-------------------------- 1 file changed, 17 insertions(+), 26 deletions(-) -- 1.7.9.5 diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index c5fdcb1..7ce5346 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c @@ -857,16 +857,16 @@ int clocksource_unregister(struct clocksource *cs) #ifdef CONFIG_SYSFS /** - * sysfs_show_current_clocksources - sysfs interface for current clocksource + * current_clocksource_show - sysfs interface for current clocksource * @dev: unused * @attr: unused * @buf: char buffer to be filled with clocksource list * * Provides sysfs interface for listing current clocksource. */ -static ssize_t -sysfs_show_current_clocksources(struct device *dev, - struct device_attribute *attr, char *buf) +static ssize_t current_clocksource_show(struct device *dev, + struct device_attribute *attr, + char *buf) { ssize_t count = 0; @@ -895,7 +895,7 @@ ssize_t sysfs_get_uname(const char *buf, char *dst, size_t cnt) } /** - * sysfs_override_clocksource - interface for manually overriding clocksource + * current_clocksource_store - interface for manually overriding clocksource * @dev: unused * @attr: unused * @buf: name of override clocksource @@ -904,9 +904,9 @@ ssize_t sysfs_get_uname(const char *buf, char *dst, size_t cnt) * Takes input from sysfs interface for manually overriding the default * clocksource selection. */ -static ssize_t sysfs_override_clocksource(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) +static ssize_t current_clocksource_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) { ssize_t ret; @@ -920,9 +920,10 @@ static ssize_t sysfs_override_clocksource(struct device *dev, return ret; } +static DEVICE_ATTR_RW(current_clocksource); /** - * sysfs_unbind_current_clocksource - interface for manually unbinding clocksource + * unbind_clocksource_store - interface for manually unbinding clocksource * @dev: unused * @attr: unused * @buf: unused @@ -930,7 +931,7 @@ static ssize_t sysfs_override_clocksource(struct device *dev, * * Takes input from sysfs interface for manually unbinding a clocksource. */ -static ssize_t sysfs_unbind_clocksource(struct device *dev, +static ssize_t unbind_clocksource_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { @@ -954,19 +955,19 @@ static ssize_t sysfs_unbind_clocksource(struct device *dev, return ret ? ret : count; } +static DEVICE_ATTR_WO(unbind_clocksource); /** - * sysfs_show_available_clocksources - sysfs interface for listing clocksource + * available_clocksource_show - sysfs interface for listing clocksource * @dev: unused * @attr: unused * @buf: char buffer to be filled with clocksource list * * Provides sysfs interface for listing registered clocksources */ -static ssize_t -sysfs_show_available_clocksources(struct device *dev, - struct device_attribute *attr, - char *buf) +static ssize_t available_clocksource_show(struct device *dev, + struct device_attribute *attr, + char *buf) { struct clocksource *src; ssize_t count = 0; @@ -990,17 +991,7 @@ static ssize_t sysfs_unbind_clocksource(struct device *dev, return count; } - -/* - * Sysfs setup bits: - */ -static DEVICE_ATTR(current_clocksource, 0644, sysfs_show_current_clocksources, - sysfs_override_clocksource); - -static DEVICE_ATTR(unbind_clocksource, 0200, NULL, sysfs_unbind_clocksource); - -static DEVICE_ATTR(available_clocksource, 0444, - sysfs_show_available_clocksources, NULL); +static DEVICE_ATTR_RO(available_clocksource); static struct bus_type clocksource_subsys = { .name = "clocksource", From patchwork Wed Jan 17 06:01:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 124781 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp1269250lje; Tue, 16 Jan 2018 22:07:55 -0800 (PST) X-Google-Smtp-Source: ACJfBovqMz86VGcrhGXllV/Uxf7BPx22N55uaBx6R/N641TrTrnHIBMSYxnWNkMP36xMtf4FBmtR X-Received: by 10.101.74.129 with SMTP id b1mr10125711pgu.317.1516169275409; Tue, 16 Jan 2018 22:07:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516169275; cv=none; d=google.com; s=arc-20160816; b=nclJB0kzpT50puwk4vfkOUNMioGaJ4ritUomtK1ic3i+2brxHWdowf9uG1QymwSFIG gi09gMWbA5f1L+zcL90VXUbVVcvZYBPmVvuJKbPYMuw4BX6lVFbgXki2GZ5FZ19sPB48 m+vcVF3SvYKKddCZqlvIH7KG/z5GggJ6Y5/kBOPhrHAqc1PedxtwDrYXlMSmSObVeeML ELE3MPiWh+hPOS4OX1oiWnSeJcuVrWj1JbxoEfOM7PJhGDgMGJDscTAn2I4CuIcaDygZ QN5M45xfDlgov8w+voKnSW5TLQNtHgepiGvT3TX+vdJ9NROSClIjPVhIJ/oNQgGSveJd tsAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=oYNd3JSJl4w5Bm5bnNm1RPeQFkLJJmutNWPQIw1IUoA=; b=OQo7zVn94bZwGoOQtvOWPUv4hE1ivwC/on2elHBkDCgnkNP+LihR9igwZ54ewjblp6 3Qa6ioNDNU6gjB9rIfGALqAUIYvu63p7L7baebSB9zDaytI/WPgK8meR3tXF1U0mO0xQ zC87sg2mpNN4m4aiqU7tgIDCKg5mVqAl8K0qUM1xm+NmvR+RevtK3Rsb7mgh7jDPmzSv AmCkwrfKN5AgYsBY72qwe9ijbnLWralM818p0WpqCKD0ujgwtHaGyTwxcs2LqxMJSOn0 frR41GoqjdCwLCBZabbkeCorpfA+gmeg5SOZIf8q1DmDtAPBQJtaKF+alSTIdv41YzaJ s4yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qp80TGBh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x3si3643956plo.2.2018.01.16.22.07.55; Tue, 16 Jan 2018 22:07:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qp80TGBh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752195AbeAQGHx (ORCPT + 28 others); Wed, 17 Jan 2018 01:07:53 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:43017 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751559AbeAQGHp (ORCPT ); Wed, 17 Jan 2018 01:07:45 -0500 Received: by mail-pg0-f67.google.com with SMTP id n17so3170629pgf.10 for ; Tue, 16 Jan 2018 22:07:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=oYNd3JSJl4w5Bm5bnNm1RPeQFkLJJmutNWPQIw1IUoA=; b=Qp80TGBhoSY2jH83uwUeMmbLhZSJXXviWeSCXPxmPMtd2jAPpxltIdJaPAJ3jvel7M W7DNgRDcC6AiDmSM8ITKDcTdo3PfFb2FOaeeypvkkfC97jcS6J/ksJWRBlqkkv9AQeqy Uw22MxtrqiqtnY4h1+au9L4Chjnd8iXrM9t3E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=oYNd3JSJl4w5Bm5bnNm1RPeQFkLJJmutNWPQIw1IUoA=; b=mq+ygszm2kzfvPyMQGf9ga6MWRtsGsHLtxfxkmN0RmG7FrY4Nd+OhhOkTHg15vkps2 DU7drOUla/p0zfoNqsyWnlOtkW/Xm9tT4uufvYnl0JihdVKwTHgclgeOFVfaKU2zi7OO +5t2STLx8kBGpYsBdQ2EwINJU2itq2n3es8lPbf6Te5LeZ4G05NW442T4lIKHVq9D2ps TQEWW94+evPIJdZYCQqfZMn0OL5GqdKvq8gS1qWTuex3g5i2JVcvBiecUPWjT+3dmitt p/SPcaseoGJhF3XaBs+8lkkCjWh9BI33hmi88wXdbz4BZz/PblEGctKhIswAXojq5FHE vBYg== X-Gm-Message-State: AKGB3mIDK0Gs0KyFBud1Pm9gPeeEXMKT8O48ZWueyShu8z1iJp/n56PF +l7+a3yMr93myQpj/iabXybAyw== X-Received: by 10.99.116.88 with SMTP id e24mr24100235pgn.279.1516169264633; Tue, 16 Jan 2018 22:07:44 -0800 (PST) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id n66sm5987418pfn.64.2018.01.16.22.06.16 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Jan 2018 22:07:44 -0800 (PST) From: Baolin Wang To: john.stultz@linaro.org, tglx@linutronix.de, sboyd@codeaurora.org Cc: broonie@kernel.org, arnd@arndb.de, baolin.wang@linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] clocksource: Use ATTRIBUTE_GROUPS macro Date: Wed, 17 Jan 2018 14:01:30 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <069ce2a605546bcad6552968cff755f0a03f9f10.1516167691.git.baolin.wang@linaro.org> References: <069ce2a605546bcad6552968cff755f0a03f9f10.1516167691.git.baolin.wang@linaro.org> In-Reply-To: <069ce2a605546bcad6552968cff755f0a03f9f10.1516167691.git.baolin.wang@linaro.org> References: <069ce2a605546bcad6552968cff755f0a03f9f10.1516167691.git.baolin.wang@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert to use ATTRIBUTE_GROUPS to define one attribute group pointed by 'groups' of the device, which can avoid issuing device_create_file() many times. Signed-off-by: Baolin Wang --- kernel/time/clocksource.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) -- 1.7.9.5 diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index 7ce5346..0e974cf 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c @@ -993,6 +993,14 @@ static ssize_t available_clocksource_show(struct device *dev, } static DEVICE_ATTR_RO(available_clocksource); +static struct attribute *clocksource_attrs[] = { + &dev_attr_current_clocksource.attr, + &dev_attr_unbind_clocksource.attr, + &dev_attr_available_clocksource.attr, + NULL +}; +ATTRIBUTE_GROUPS(clocksource); + static struct bus_type clocksource_subsys = { .name = "clocksource", .dev_name = "clocksource", @@ -1001,6 +1009,7 @@ static ssize_t available_clocksource_show(struct device *dev, static struct device device_clocksource = { .id = 0, .bus = &clocksource_subsys, + .groups = clocksource_groups, }; static int __init init_clocksource_sysfs(void) @@ -1009,17 +1018,7 @@ static int __init init_clocksource_sysfs(void) if (!error) error = device_register(&device_clocksource); - if (!error) - error = device_create_file( - &device_clocksource, - &dev_attr_current_clocksource); - if (!error) - error = device_create_file(&device_clocksource, - &dev_attr_unbind_clocksource); - if (!error) - error = device_create_file( - &device_clocksource, - &dev_attr_available_clocksource); + return error; }