From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1162791AbdAJE0r (ORCPT ); Mon, 9 Jan 2017 23:26:47 -0500 Received: from mail-pf0-f181.google.com ([209.85.192.181]:35089 "EHLO mail-pf0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1764570AbdAJE0g (ORCPT ); Mon, 9 Jan 2017 23:26:36 -0500 Date: Tue, 10 Jan 2017 09:56:32 +0530 From: Viresh Kumar To: Stephen Boyd Cc: Rafael Wysocki , Viresh Kumar , Nishanth Menon , linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Vincent Guittot Subject: Re: [PATCH 06/12] PM / OPP: Add 'struct kref' to struct dev_pm_opp Message-ID: <20170110042632.GC6332@vireshk-i7> References: <1d5f61440dbfb640c330f77c9090e2ac23482ebc.1481106919.git.viresh.kumar@linaro.org> <20170109234427.GY17126@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170109234427.GY17126@codeaurora.org> 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 On 09-01-17, 15:44, Stephen Boyd wrote: > On 12/07, Viresh Kumar wrote: > > Add kref to struct dev_pm_opp for easier accounting of the OPPs. > > > > Note that the OPPs are freed under the opp_table->lock mutex only. > > I'm lost. Why add another level of krefs? Heh. The earlier krefs were for the OPP table itself, so that it gets freed once there are no more users of it. The kref introduced now is for individual OPPs, so that they don't disappear while being used and gets freed once all are done. Also note that the OPP table will get freed only after all the OPPs are freed, plus there are no more users left, like platform code which might have set suppoerted-hw property. -- viresh