Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758801AbcCVLdU (ORCPT ); Tue, 22 Mar 2016 07:33:20 -0400 Received: from mail-pf0-f180.google.com ([209.85.192.180]:35041 "EHLO mail-pf0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754170AbcCVLdM (ORCPT ); Tue, 22 Mar 2016 07:33:12 -0400 Date: Tue, 22 Mar 2016 17:03:07 +0530 From: Viresh Kumar To: Shilpasri G Bhat Cc: linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org, ego@linux.vnet.ibm.com, linux-pm@vger.kernel.org, rjw@rjwysocki.net, shreyas@linux.vnet.ibm.com, linux-api@vger.kernel.org Subject: Re: [PATCH v12] cpufreq: powernv: Add sysfs attributes to show throttle stats Message-ID: <20160322113307.GI5272@vireshk-i7> References: <1458643717-2847-1-git-send-email-shilpa.bhat@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1458643717-2847-1-git-send-email-shilpa.bhat@linux.vnet.ibm.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 995 Lines: 34 I really wanted to Ack this time, but you know I am nitpicking again :( On 22-03-16, 16:18, Shilpasri G Bhat wrote: > static int powernv_cpufreq_cpu_init(struct cpufreq_policy *policy) > { > - int base, i; > + int base, i, ret; > > base = cpu_first_thread_sibling(policy->cpu); > > for (i = 0; i < threads_per_core; i++) > cpumask_set_cpu(base + i, policy->cpus); > > + if (!policy->driver_data) { Declare ret here, as it is going to be used only within the if block. > + ret = sysfs_create_group(&policy->kobj, &throttle_attr_grp); > + if (ret) { > + pr_info("Failed to create throttle stats directory for cpu %d\n", > + policy->cpu); > + return ret; > + } > + /* > + * policy->driver_data is used as a flag for one-time > + * creation of throttle sysfs files. > + */ > + policy->driver_data = (void *)policy; This is far better then the ugly solution I suggested on our private chat :), but you should drop (void *) typecast. Its not required. -- viresh