From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2BC2C47083 for ; Wed, 2 Jun 2021 06:42:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9892460C40 for ; Wed, 2 Jun 2021 06:42:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231607AbhFBGnv (ORCPT ); Wed, 2 Jun 2021 02:43:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231565AbhFBGnc (ORCPT ); Wed, 2 Jun 2021 02:43:32 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50CE3C061760 for ; Tue, 1 Jun 2021 23:41:48 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id a5so1748700lfm.0 for ; Tue, 01 Jun 2021 23:41:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=JuA6X6SLX6jIYFhYDQ4PSI4qy/mD4F92gXt5+pzqhiw=; b=KCV/BGdWMOqxiMziTgxJG87UDnnpW8xslLWy99uLb7VpB0RQjUpAWx3hwYAp9Kx5Dl IjTIIwlQYDW5T7AXT2g3YaWicvlr0QoZq8pSc/suf79ln6bq3X8planLEx+zhml1LRDt Mun9Yaawf9AiZbfMNOTlrFcP8dbphUV94K0FW0FoGk+JaHCkKpr5nEsWTE46qHOgssXF dhsOdlXifGmZQnIFGM+g2cIN585b68PiWEuCsFf0hMVvWeV2dYsBNs4tCNYIhxqAJ/b8 K0oNCfR+mBnCAgtWDyanW4oLNUX9ZWtxwZBpN3Ks13wNdZ57GC5dswRWQGLYavDjHvS5 cwmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=JuA6X6SLX6jIYFhYDQ4PSI4qy/mD4F92gXt5+pzqhiw=; b=giSOtMUpUzerSH4x18iNxlR4BxJJxzhpVMLJ+4gsjUyANyXPq7oUNLBFpqUn5Xo4wE qmMhj/h6aRmNMDTmqvpUKtApDqhQUrSbMNfAN/78ALBbX1OskS9+Q50gN+2xQahKa2UZ EacauIYq8ag/538FNRPnCFg9y/UcbkQoP+8tZSk1OjQGGoYQCT6isSXZ1oGAOquFNAbM d/0XbdkR5+AiXh0bIVf4LEUGVjRI7HGGqcusi7vTPE42JBPX1i7vadnvjGTpp85uCpZo SxtmhRFiLS8xDCPORNbDfB+SU62nVwYXjUMLNK/fNeDrl1FiaA8gjfR1sTDJM6btVO40 bCzw== X-Gm-Message-State: AOAM533GbiXhe5rEo47DS0UhbXqPAdn15dceWdl9nFyT+eW5WZvhh156 PoH8vzXC7YdnTlq84z+gT+k= X-Google-Smtp-Source: ABdhPJyISRYTRVb7ufM2hmPTe5uCl/aVs5YEhYnXhErkpU6mZCC8AlR8jCTkc4ir85CpRK9jN25aVg== X-Received: by 2002:a05:6512:1188:: with SMTP id g8mr21596868lfr.410.1622616106489; Tue, 01 Jun 2021 23:41:46 -0700 (PDT) Received: from ?IPv6:2a02:908:1252:fb60:cd07:2759:3eec:1d00? ([2a02:908:1252:fb60:cd07:2759:3eec:1d00]) by smtp.gmail.com with ESMTPSA id y8sm146731lfj.192.2021.06.01.23.41.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Jun 2021 23:41:45 -0700 (PDT) Subject: Re: [PATCH -next] drm/radeon/radeon_pm: use DEVICE_ATTR_RW macro To: Alex Deucher , YueHaibing Cc: Dave Airlie , xinhui pan , LKML , Maling list - DRI developers , amd-gfx list , Daniel Vetter , "Deucher, Alexander" , Christian Koenig References: <20210528070217.9204-1-yuehaibing@huawei.com> From: =?UTF-8?Q?Christian_K=c3=b6nig?= Message-ID: <2920ae60-0064-a972-94fd-57b0caa0c01d@gmail.com> Date: Wed, 2 Jun 2021 08:41:43 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 02.06.21 um 03:53 schrieb Alex Deucher: > On Fri, May 28, 2021 at 3:18 AM YueHaibing wrote: >> Use DEVICE_ATTR_RW() helper instead of plain DEVICE_ATTR(), >> which makes the code a bit shorter and easier to read. >> >> Signed-off-by: YueHaibing > I'm not convinced this really buys us anything other than code churn, > but I don't have a particularly strong opinion of others feel > differently. I agree, especially dropping the amdgpu/radeon prefix from the functions doesn't sound like something we want. Christian. > > Alex > > >> --- >> drivers/gpu/drm/radeon/radeon_pm.c | 56 ++++++++++++------------------ >> 1 file changed, 23 insertions(+), 33 deletions(-) >> >> diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c >> index 3861c0b98fcf..edf10cc3947e 100644 >> --- a/drivers/gpu/drm/radeon/radeon_pm.c >> +++ b/drivers/gpu/drm/radeon/radeon_pm.c >> @@ -352,9 +352,8 @@ static void radeon_pm_print_states(struct radeon_device *rdev) >> } >> } >> >> -static ssize_t radeon_get_pm_profile(struct device *dev, >> - struct device_attribute *attr, >> - char *buf) >> +static ssize_t power_profile_show(struct device *dev, >> + struct device_attribute *attr, char *buf) >> { >> struct drm_device *ddev = dev_get_drvdata(dev); >> struct radeon_device *rdev = ddev->dev_private; >> @@ -366,10 +365,8 @@ static ssize_t radeon_get_pm_profile(struct device *dev, >> (cp == PM_PROFILE_HIGH) ? "high" : "default"); >> } >> >> -static ssize_t radeon_set_pm_profile(struct device *dev, >> - struct device_attribute *attr, >> - const char *buf, >> - size_t count) >> +static ssize_t power_profile_store(struct device *dev, struct device_attribute *attr, >> + const char *buf, size_t count) >> { >> struct drm_device *ddev = dev_get_drvdata(dev); >> struct radeon_device *rdev = ddev->dev_private; >> @@ -406,9 +403,8 @@ static ssize_t radeon_set_pm_profile(struct device *dev, >> return count; >> } >> >> -static ssize_t radeon_get_pm_method(struct device *dev, >> - struct device_attribute *attr, >> - char *buf) >> +static ssize_t power_method_show(struct device *dev, >> + struct device_attribute *attr, char *buf) >> { >> struct drm_device *ddev = dev_get_drvdata(dev); >> struct radeon_device *rdev = ddev->dev_private; >> @@ -418,10 +414,9 @@ static ssize_t radeon_get_pm_method(struct device *dev, >> (pm == PM_METHOD_PROFILE) ? "profile" : "dpm"); >> } >> >> -static ssize_t radeon_set_pm_method(struct device *dev, >> - struct device_attribute *attr, >> - const char *buf, >> - size_t count) >> +static ssize_t power_method_store(struct device *dev, >> + struct device_attribute *attr, >> + const char *buf, size_t count) >> { >> struct drm_device *ddev = dev_get_drvdata(dev); >> struct radeon_device *rdev = ddev->dev_private; >> @@ -462,9 +457,8 @@ static ssize_t radeon_set_pm_method(struct device *dev, >> return count; >> } >> >> -static ssize_t radeon_get_dpm_state(struct device *dev, >> - struct device_attribute *attr, >> - char *buf) >> +static ssize_t power_dpm_state_show(struct device *dev, >> + struct device_attribute *attr, char *buf) >> { >> struct drm_device *ddev = dev_get_drvdata(dev); >> struct radeon_device *rdev = ddev->dev_private; >> @@ -475,10 +469,9 @@ static ssize_t radeon_get_dpm_state(struct device *dev, >> (pm == POWER_STATE_TYPE_BALANCED) ? "balanced" : "performance"); >> } >> >> -static ssize_t radeon_set_dpm_state(struct device *dev, >> - struct device_attribute *attr, >> - const char *buf, >> - size_t count) >> +static ssize_t power_dpm_state_store(struct device *dev, >> + struct device_attribute *attr, >> + const char *buf, size_t count) >> { >> struct drm_device *ddev = dev_get_drvdata(dev); >> struct radeon_device *rdev = ddev->dev_private; >> @@ -506,9 +499,9 @@ static ssize_t radeon_set_dpm_state(struct device *dev, >> return count; >> } >> >> -static ssize_t radeon_get_dpm_forced_performance_level(struct device *dev, >> - struct device_attribute *attr, >> - char *buf) >> +static ssize_t power_dpm_force_performance_level_show(struct device *dev, >> + struct device_attribute *attr, >> + char *buf) >> { >> struct drm_device *ddev = dev_get_drvdata(dev); >> struct radeon_device *rdev = ddev->dev_private; >> @@ -523,10 +516,9 @@ static ssize_t radeon_get_dpm_forced_performance_level(struct device *dev, >> (level == RADEON_DPM_FORCED_LEVEL_LOW) ? "low" : "high"); >> } >> >> -static ssize_t radeon_set_dpm_forced_performance_level(struct device *dev, >> +static ssize_t power_dpm_force_performance_level_store(struct device *dev, >> struct device_attribute *attr, >> - const char *buf, >> - size_t count) >> + const char *buf, size_t count) >> { >> struct drm_device *ddev = dev_get_drvdata(dev); >> struct radeon_device *rdev = ddev->dev_private; >> @@ -658,12 +650,10 @@ static ssize_t radeon_hwmon_get_pwm1(struct device *dev, >> return sprintf(buf, "%i\n", speed); >> } >> >> -static DEVICE_ATTR(power_profile, S_IRUGO | S_IWUSR, radeon_get_pm_profile, radeon_set_pm_profile); >> -static DEVICE_ATTR(power_method, S_IRUGO | S_IWUSR, radeon_get_pm_method, radeon_set_pm_method); >> -static DEVICE_ATTR(power_dpm_state, S_IRUGO | S_IWUSR, radeon_get_dpm_state, radeon_set_dpm_state); >> -static DEVICE_ATTR(power_dpm_force_performance_level, S_IRUGO | S_IWUSR, >> - radeon_get_dpm_forced_performance_level, >> - radeon_set_dpm_forced_performance_level); >> +static DEVICE_ATTR_RW(power_profile); >> +static DEVICE_ATTR_RW(power_method); >> +static DEVICE_ATTR_RW(power_dpm_state); >> +static DEVICE_ATTR_RW(power_dpm_force_performance_level); >> >> static ssize_t radeon_hwmon_show_temp(struct device *dev, >> struct device_attribute *attr, >> -- >> 2.17.1 >> > _______________________________________________ > amd-gfx mailing list > amd-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/amd-gfx