From patchwork Tue Apr 3 09:49:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 132706 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp3586171ljb; Tue, 3 Apr 2018 02:49:15 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+tetTRO9n9/taN+pGhxoU5yB0DqfwXXzTm5uK5BZxARCwLMyY9oV24JL/jD2bD0IvIad+M X-Received: by 2002:a17:902:6184:: with SMTP id u4-v6mr13747104plj.390.1522748955204; Tue, 03 Apr 2018 02:49:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522748955; cv=none; d=google.com; s=arc-20160816; b=jhnfhlgtnUuKg92NJBVOkIqGHMPE8ew+olyd8uhrQFgQSXAnUVjqo2+ycjlBqK3NYT RhLh/zby4EWMrbSfrk70h7Tekb/OTB3+8QM8k74hPAG8yCJ31DAgDOAk9u/GQM65iGWj jg6880N8b0ncbtYFgMQsgmvRj4ZFjR14HqX9AZU7MklUYXXqYUdqwh7od+BSh4qqT8IH fjMCSmDL4Y3aOEHFcESPSELDA3VkfLHXLeIvtOwHYhY/7XfDiWFj/FSsl3hsINKphHFE /75AQUh20c2/Ehr4hxozgeALPOrsg/L92jNXVVKB/lGadqormACPzgu6ruxiilMbKrVb BSWg== 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=71D7VE1Y0zgwP1JTzNpD4jsJzzeFtf0pYGX8G1iFXHg=; b=VGZDSFwMgpzqXR0YCT5xGVO4hiTYVFRaemiacu+n4u8SoiKZGGynU9x8csCEdQ49Sg gesCUtvmq67F1fw4ekBuFhLfOgWg7EQ1F563HHJ5kUdYz+yTF32NhTnWS5vYH8bCfpdf QTsdAj0UL9ufoyAYlryT4kAZVf09/tGFiFHJnH7Z+3xO22K0E0pTR00hI1Not0RBggxj 6zwys8pEzRSwxuuORNCBPk1EAd5mJ9RexMIfFSSMeGVhmrj2wD6OlATjti2nl+mdibKJ mgzfJRNNs6tRcwVK4TXunym+Kmn6MPh38ynPt1D4CMWPh9RhDrgAUPrpXjQkqaKVfHXo YGwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K+eQ7vov; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 f3si1670219pgq.625.2018.04.03.02.49.14; Tue, 03 Apr 2018 02:49:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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=K+eQ7vov; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1754355AbeDCJtO (ORCPT + 11 others); Tue, 3 Apr 2018 05:49:14 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:38352 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751413AbeDCJtN (ORCPT ); Tue, 3 Apr 2018 05:49:13 -0400 Received: by mail-pl0-f66.google.com with SMTP id k6-v6so2970802pls.5 for ; Tue, 03 Apr 2018 02:49:13 -0700 (PDT) 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=71D7VE1Y0zgwP1JTzNpD4jsJzzeFtf0pYGX8G1iFXHg=; b=K+eQ7vov8ryA/tMo/SFsX9HK8AxPhHwh4kryyVRqUc8EdeETwqTi/7qzjX6bebUMsK i4CkjujOtJqts3whzVzi99K8/+zpIljqqWoI1LgXSarqeVBVwkJuW0MRhXAbLuXPqEYV 9fbGFwhzsS1rtEssielIqeSqCMmQWVKb7PbxQ= 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=71D7VE1Y0zgwP1JTzNpD4jsJzzeFtf0pYGX8G1iFXHg=; b=sNIlZ3/SdorHUVgu7co2ZExYJchE+v6HSp8e+phqMN9exanGgtPD6EquPUniID5oCZ WeyRxdJYpag/rHpSgTfDPmsC75qqSpXFc7AHhQA6UHONfDe4e6xsf8Id2GJwZKg1OrMx C/zmvkK3I5r3NacQSBQkNqBTu7nNs+1y/Q25uXNVH71Cu0dUVxWd/8lZwpkXA/HaW7SD 2TCi7pIdmfxOCxXmRig8+buIQGTKGSvHDYg3fMD2QD+J6lIq5x/qnhF0t9+afvBXKi8f i4GXdLzyWrZhA9MQMSwqJI9/RMkEyFDWYt88UiM5uoDW/z6DfEYoh+T1CJVQIgxiz1Zt goMA== X-Gm-Message-State: AElRT7GyJg9V++WE4jB7l1Pe0AuPza8iiOJTiUpS8Hc0rL+dxRRx7Fsx 8xOTyE234WJFsshjeWlPolpPyONkN4Q= X-Received: by 10.99.127.92 with SMTP id p28mr8792360pgn.305.1522748953023; Tue, 03 Apr 2018 02:49:13 -0700 (PDT) Received: from localhost ([122.171.228.188]) by smtp.gmail.com with ESMTPSA id 5sm5443613pfh.133.2018.04.03.02.49.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Apr 2018 02:49:12 -0700 (PDT) From: Viresh Kumar To: Zhang Rui , Eduardo Valentin Cc: Viresh Kumar , Vincent Guittot , linux-pm@vger.kernel.org Subject: [PATCH 1/2] thermal: Shorten name of sysfs callbacks Date: Tue, 3 Apr 2018 15:19:03 +0530 Message-Id: <6ff16be439d88dc5392c8c0c88ac5931724d970c.1522748815.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The naming isn't consistent across all sysfs callbacks in the thermal core, some have a short name like type_show() and others have long names like thermal_cooling_device_weight_show(). This patch tries to make it consistent by shortening the name of sysfs callbacks. Some of the sysfs files are named similarly for both thermal zone and cooling device (like: type) and to avoid name clash between their show/store routines, the cooling device specific sysfs callbacks are prefixed with "cdev_". Signed-off-by: Viresh Kumar --- drivers/thermal/thermal_core.c | 6 ++-- drivers/thermal/thermal_core.h | 13 +++----- drivers/thermal/thermal_sysfs.c | 74 +++++++++++++++-------------------------- 3 files changed, 34 insertions(+), 59 deletions(-) -- 2.15.0.194.g9af6a3dea062 diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index d64325e078db..649fd2a04823 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -736,7 +736,7 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, sysfs_attr_init(&dev->attr.attr); dev->attr.attr.name = dev->attr_name; dev->attr.attr.mode = 0444; - dev->attr.show = thermal_cooling_device_trip_point_show; + dev->attr.show = trip_point_show; result = device_create_file(&tz->device, &dev->attr); if (result) goto remove_symbol_link; @@ -745,8 +745,8 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, sysfs_attr_init(&dev->weight_attr.attr); dev->weight_attr.attr.name = dev->weight_attr_name; dev->weight_attr.attr.mode = S_IWUSR | S_IRUGO; - dev->weight_attr.show = thermal_cooling_device_weight_show; - dev->weight_attr.store = thermal_cooling_device_weight_store; + dev->weight_attr.show = weight_show; + dev->weight_attr.store = weight_store; result = device_create_file(&tz->device, &dev->weight_attr); if (result) goto remove_trip_file; diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h index 5e4150261500..eddee27c1d06 100644 --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h @@ -75,15 +75,10 @@ void thermal_zone_destroy_device_groups(struct thermal_zone_device *); void thermal_cooling_device_setup_sysfs(struct thermal_cooling_device *); void thermal_cooling_device_destroy_sysfs(struct thermal_cooling_device *cdev); /* used only at binding time */ -ssize_t -thermal_cooling_device_trip_point_show(struct device *, - struct device_attribute *, char *); -ssize_t thermal_cooling_device_weight_show(struct device *, - struct device_attribute *, char *); - -ssize_t thermal_cooling_device_weight_store(struct device *, - struct device_attribute *, - const char *, size_t); +ssize_t trip_point_show(struct device *, struct device_attribute *, char *); +ssize_t weight_show(struct device *, struct device_attribute *, char *); +ssize_t weight_store(struct device *, struct device_attribute *, const char *, + size_t); #ifdef CONFIG_THERMAL_STATISTICS void thermal_cooling_device_stats_update(struct thermal_cooling_device *cdev, diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c index 23b5e0a709b0..ba1df6953da6 100644 --- a/drivers/thermal/thermal_sysfs.c +++ b/drivers/thermal/thermal_sysfs.c @@ -668,17 +668,15 @@ void thermal_zone_destroy_device_groups(struct thermal_zone_device *tz) /* sys I/F for cooling device */ static ssize_t -thermal_cooling_device_type_show(struct device *dev, - struct device_attribute *attr, char *buf) +cdev_type_show(struct device *dev, struct device_attribute *attr, char *buf) { struct thermal_cooling_device *cdev = to_cooling_device(dev); return sprintf(buf, "%s\n", cdev->type); } -static ssize_t -thermal_cooling_device_max_state_show(struct device *dev, - struct device_attribute *attr, char *buf) +static ssize_t max_state_show(struct device *dev, struct device_attribute *attr, + char *buf) { struct thermal_cooling_device *cdev = to_cooling_device(dev); unsigned long state; @@ -690,9 +688,8 @@ thermal_cooling_device_max_state_show(struct device *dev, return sprintf(buf, "%ld\n", state); } -static ssize_t -thermal_cooling_device_cur_state_show(struct device *dev, - struct device_attribute *attr, char *buf) +static ssize_t cur_state_show(struct device *dev, struct device_attribute *attr, + char *buf) { struct thermal_cooling_device *cdev = to_cooling_device(dev); unsigned long state; @@ -705,9 +702,8 @@ thermal_cooling_device_cur_state_show(struct device *dev, } static ssize_t -thermal_cooling_device_cur_state_store(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) +cur_state_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) { struct thermal_cooling_device *cdev = to_cooling_device(dev); unsigned long state; @@ -726,13 +722,10 @@ thermal_cooling_device_cur_state_store(struct device *dev, return count; } -static struct device_attribute dev_attr_cdev_type = -__ATTR(type, 0444, thermal_cooling_device_type_show, NULL); -static DEVICE_ATTR(max_state, 0444, - thermal_cooling_device_max_state_show, NULL); -static DEVICE_ATTR(cur_state, 0644, - thermal_cooling_device_cur_state_show, - thermal_cooling_device_cur_state_store); +static struct device_attribute +dev_attr_cdev_type = __ATTR(type, 0444, cdev_type_show, NULL); +static DEVICE_ATTR(max_state, 0444, max_state_show, NULL); +static DEVICE_ATTR(cur_state, 0644, cur_state_show, cur_state_store); static struct attribute *cooling_device_attrs[] = { &dev_attr_cdev_type.attr, @@ -791,10 +784,8 @@ void thermal_cooling_device_stats_update(struct thermal_cooling_device *cdev, spin_unlock(&stats->lock); } -static ssize_t -thermal_cooling_device_total_trans_show(struct device *dev, - struct device_attribute *attr, - char *buf) +static ssize_t total_trans_show(struct device *dev, + struct device_attribute *attr, char *buf) { struct thermal_cooling_device *cdev = to_cooling_device(dev); struct cooling_dev_stats *stats = cdev->stats; @@ -808,9 +799,8 @@ thermal_cooling_device_total_trans_show(struct device *dev, } static ssize_t -thermal_cooling_device_time_in_state_show(struct device *dev, - struct device_attribute *attr, - char *buf) +time_in_state_ms_show(struct device *dev, struct device_attribute *attr, + char *buf) { struct thermal_cooling_device *cdev = to_cooling_device(dev); struct cooling_dev_stats *stats = cdev->stats; @@ -830,9 +820,8 @@ thermal_cooling_device_time_in_state_show(struct device *dev, } static ssize_t -thermal_cooling_device_reset_store(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) +reset_store(struct device *dev, struct device_attribute *attr, const char *buf, + size_t count) { struct thermal_cooling_device *cdev = to_cooling_device(dev); struct cooling_dev_stats *stats = cdev->stats; @@ -853,10 +842,8 @@ thermal_cooling_device_reset_store(struct device *dev, return count; } -static ssize_t -thermal_cooling_device_trans_table_show(struct device *dev, - struct device_attribute *attr, - char *buf) +static ssize_t trans_table_show(struct device *dev, + struct device_attribute *attr, char *buf) { struct thermal_cooling_device *cdev = to_cooling_device(dev); struct cooling_dev_stats *stats = cdev->stats; @@ -899,13 +886,10 @@ thermal_cooling_device_trans_table_show(struct device *dev, return len; } -static DEVICE_ATTR(total_trans, 0444, thermal_cooling_device_total_trans_show, - NULL); -static DEVICE_ATTR(time_in_state_ms, 0444, - thermal_cooling_device_time_in_state_show, NULL); -static DEVICE_ATTR(reset, 0200, NULL, thermal_cooling_device_reset_store); -static DEVICE_ATTR(trans_table, 0444, - thermal_cooling_device_trans_table_show, NULL); +static DEVICE_ATTR(total_trans, 0444, total_trans_show, NULL); +static DEVICE_ATTR(time_in_state_ms, 0444, time_in_state_ms_show, NULL); +static DEVICE_ATTR(reset, 0200, NULL, reset_store); +static DEVICE_ATTR(trans_table, 0444, trans_table_show, NULL); static struct attribute *cooling_device_stats_attrs[] = { &dev_attr_total_trans.attr, @@ -980,8 +964,7 @@ void thermal_cooling_device_destroy_sysfs(struct thermal_cooling_device *cdev) /* these helper will be used only at the time of bindig */ ssize_t -thermal_cooling_device_trip_point_show(struct device *dev, - struct device_attribute *attr, char *buf) +trip_point_show(struct device *dev, struct device_attribute *attr, char *buf) { struct thermal_instance *instance; @@ -995,8 +978,7 @@ thermal_cooling_device_trip_point_show(struct device *dev, } ssize_t -thermal_cooling_device_weight_show(struct device *dev, - struct device_attribute *attr, char *buf) +weight_show(struct device *dev, struct device_attribute *attr, char *buf) { struct thermal_instance *instance; @@ -1005,10 +987,8 @@ thermal_cooling_device_weight_show(struct device *dev, return sprintf(buf, "%d\n", instance->weight); } -ssize_t -thermal_cooling_device_weight_store(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) +ssize_t weight_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) { struct thermal_instance *instance; int ret, weight;