From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753336AbbKWGoN (ORCPT ); Mon, 23 Nov 2015 01:44:13 -0500 Received: from mailout4.samsung.com ([203.254.224.34]:35272 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752504AbbKWGoL (ORCPT ); Mon, 23 Nov 2015 01:44:11 -0500 X-AuditID: cbfee68e-f79f56d000004437-b3-5652b5b8323b Date: Mon, 23 Nov 2015 06:44:08 +0000 (GMT) From: MyungJoo Ham Subject: Re: [PATCH 4/6] PM / devfreq: Set the freq_table of devfreq device To: =?utf-8?Q?=EC=B5=9C=EC=B0=AC=EC=9A=B0?= , =?utf-8?Q?=EB=B0=95=EA=B2=BD=EB=AF=BC?= Cc: "linux-kernel@vger.kernel.org" , "linux-pm@vger.kernel.org" Reply-to: myungjoo.ham@samsung.com MIME-version: 1.0 X-MTR: 20151123063406008@myungjoo.ham Msgkey: 20151123063406008@myungjoo.ham X-EPLocale: ko_KR.utf-8 X-Priority: 3 X-EPWebmail-Msg-Type: personal X-EPWebmail-Reply-Demand: 0 X-EPApproval-Locale: X-EPHeader: ML X-MLAttribute: X-RootMTR: 20151123063406008@myungjoo.ham X-ParentMTR: X-ArchiveUser: X-CPGSPASS: N X-ConfirmMail: N,general Content-type: text/plain; charset=utf-8 MIME-version: 1.0 Message-id: <693585704.122261448261048874.JavaMail.weblogic@epmlwas06a> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrIIsWRmVeSWpSXmKPExsWyRsSkWHfH1qAwgyd3bSwu75rD5sDo8XmT XABjFJdNSmpOZllqkb5dAlfGrg6PghsiFYs6/RsYJ4h0MXJyCAmoSyxacpINxJYQMJG4f/ci E4QtJnHh3no2iJqljBJrmmNgak7++8zaxcgFFJ/DKLGy+zEjSIJFQFVi06qXLF2MHBxsAnoS Mz8ng4SFBbwlFsxrZgapFxHoY5Q4/Hs2O0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xftYGRpijF39/DBXnlzh2ewcThC0gMfXMQagaLYlPN7qhnuSTWLPwLQtM/a5T y5lhdt3fMheqV0Jia8sTVohfFCWmdD9kB/mdWUBTYv0ufXSv8Aq4S/z4dZJ1AqPsLCSpWUi6 ZyF0IytZwMiyilE0tSC5oDgpvcJYrzgxt7g0L10vOT93EyM4AT1bvIPx/3nrQ4wCHIxKPLwa +kFhQqyJZcWVuYcYJTiYlUR4HRcBhXhTEiurUovy44tKc1KLDzGaAuNsIrOUaHI+MDnmlcQb GhubmJmYWppYGJiaK4nz3t7nFyYkkJ5YkpqdmlqQWgTTx8TBKdXA2J72LLJ513Oh2o+prrfF An3vTAt4+MZRMbfoI/Nyp7I4h/r979RrL5TFdU/h33H6rodw1AGep12/lLKrFdRq+RrbFVep XczelVZTESixnXtj3jy/BUk/Zs+5omL88g9jaNqBjuxb1Y+8uubZXT7ctbzC4ew7pRkPDVeu 0l88+3X/hOpVF6pZlViKMxINtZiLihMBpMpcdlYDAAA= DLP-Filter: Pass X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id tAN6iuTw010452 > This patch initialize the freq_table array of each devfreq device by using > the devfreq_set_freq_table(). If freq_table is NULL, the devfreq framework > is not able to support the frequency transtion information through sysfs. > > The OPP core uses the integer type for the number of opps in the opp list > and uses the 'unsigned long' type for each frequency. So, this patch modifies > the type of some variable as following: > - the type of freq_table : unsigned int -> unsigned long > - the type of max_state : unsigned int -> int I have some comments on this patch described below. I've created an 'updated' patch based on this at: https://git.kernel.org/cgit/linux/kernel/git/mzx/devfreq.git/commit/?h=for-rafael&id=9e35a6caf143cd77f14d5e62269ed00ea1775854 It will be applied as suggested on the link above unless you have strong reason to make max_state signed. [] > +static void devfreq_set_freq_table(struct devfreq *devfreq) > +{ > + struct devfreq_dev_profile *profile = devfreq->profile; > + struct dev_pm_opp *opp; > + unsigned long freq; # - int i; + int i, count; > + > + /* Initialize the freq_table from OPP table */ # - profile->max_state = dev_pm_opp_get_opp_count(devfreq->dev.parent); # - if (profile->max_state <= 0) # - return; + count = dev_pm_opp_get_opp_count(devfreq->dev.parent); + if (count < 0) + return; If dev_pm_opp_get_opp_count() gives us an error (probably, this device does not support OPP and does not give freq_table for the statistics support), we do not need to store that error in profile->max_state. We just need to return. (no need to be signed.) [] > - len += sprintf(buf + len, "%8u", > + len += sprintf(buf + len, "%8ld", > devfreq->profile->freq_table[i]); [] > - len += sprintf(buf + len, "%8u:", > + len += sprintf(buf + len, "%8ld:", > devfreq->profile->freq_table[i]); freq_table is unsigned. {.n++%ݶw{.n+{G{ayʇڙ,jfhz_(階ݢj"mG?&~iOzv^m ?I