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=-12.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,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 1815BC433E0 for ; Sun, 28 Mar 2021 16:09:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E46C161981 for ; Sun, 28 Mar 2021 16:09:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230385AbhC1QHm (ORCPT ); Sun, 28 Mar 2021 12:07:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229538AbhC1QHQ (ORCPT ); Sun, 28 Mar 2021 12:07:16 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4322C061756 for ; Sun, 28 Mar 2021 09:07:15 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id j4-20020a05600c4104b029010c62bc1e20so5428987wmi.3 for ; Sun, 28 Mar 2021 09:07:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=gg1H/cycQVGjnxB5BUbRFDV5crvEsOoV1N9QyN86gMY=; b=taCQkPo8S23c++n4vqFLEkfJTN87PC2iLxCGhl+xi5OrUtglM1GvA6pVdiDX8NMxMJ PsiREcxmhjIQE0QQgXPjlOy/YLN0LZPj97TDVMr+k4erhXn6KeSVZrUC3piL25DrsTih RolM4/MqIZvhZX6uVACZ3XPpcO99G9Oz2bfdZ6opJvhpYNeERRWK/ibB/M8pbDNkATAA +lZBKDjqaC2FHAAwwebL0rAXDWwzycyRDJ7EmuSUNhU/U6miDPuKf24tkYNSJPurmRr9 F+SGA4HgN7KJO193Eza46o4UhcJNM5X6hGfQzGDka28TB9qyxOjHaisVGlbsuuvgf7RS /EKA== 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-language :content-transfer-encoding; bh=gg1H/cycQVGjnxB5BUbRFDV5crvEsOoV1N9QyN86gMY=; b=YJF/W9tp0LyrkonBhCSZpIEhO7TxC0COYE7puRJdVjV+j1Vq1qfKtw0Nzc/N8x9LlS sWwFy1fCK49j99jbRzgFCiIBi/lORIIKpu6BT19dOxOT8k0kjVfFXqqWTy6Kj8eeEqBQ B0EuW1WIJQAH6gjokxbnRX9OO/aycBYYO7i06pqoWY9hSciNnJ27OLqF3lhZL3CP248h tpiP6LWvmL2crwDGMfrjUJJpuyiv++pxJYz7t6RmyUSKegbqqRSeTOSlBjmjquow/QOT WZvpq6+oyx53tyMdf4wQSaGBNXuK6XQqbRJcm8uI3sDnTFB5TKiuEHVrJd2RfvSGFzAa 5okQ== X-Gm-Message-State: AOAM530Z/iPXURvGNKuowhPH+LnWBTBEfKPquU+av2mBo47xaW9jVfGu S8lgJzzMM4FqA6DWj2uLFRCHHA== X-Google-Smtp-Source: ABdhPJwequDklrmlqZYb6yDLOIlqHW0cBuqfyat1xLSQIpbUmMKdLbkxfqeo6SlN9DxxGe1k/O70xA== X-Received: by 2002:a1c:ddc6:: with SMTP id u189mr21794497wmg.171.1616947633940; Sun, 28 Mar 2021 09:07:13 -0700 (PDT) Received: from ?IPv6:2a01:e34:ed2f:f020:1945:696f:a453:cac9? ([2a01:e34:ed2f:f020:1945:696f:a453:cac9]) by smtp.googlemail.com with ESMTPSA id j9sm20505235wmi.24.2021.03.28.09.07.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 28 Mar 2021 09:07:13 -0700 (PDT) Subject: Re: [PATCH v4 2/5] powercap/drivers/dtpm: Create a registering system To: Greg KH Cc: rafael@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, lukasz.luba@arm.com References: <20210312130411.29833-1-daniel.lezcano@linaro.org> <20210312130411.29833-2-daniel.lezcano@linaro.org> <433ec4ac-a7a9-ecf9-f1c1-f658d279a2df@linaro.org> <7df276d1-abea-622c-2c7e-2c5e412aa4a9@linaro.org> From: Daniel Lezcano Message-ID: <7ba5094b-7fac-72ff-0e52-6f60eb86f253@linaro.org> Date: Sun, 28 Mar 2021 18:07:10 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 28/03/2021 13:24, Greg KH wrote: > On Sun, Mar 28, 2021 at 01:11:30PM +0200, Daniel Lezcano wrote: >> >> Hi Greg, >> >> On 28/03/2021 08:50, Greg KH wrote: >> >> [ ... ] >> >>>>> And any reason why you are not using "real" struct devices in this >>>>> subsystem? You seem to be rolling your own infrastructure for no good >>>>> reason. I imagine you want sysfs support next, right? >>>> >>>> Actually, the framework is on top of powercap, so it has de facto the >>>> sysfs support. On the other side, the dtpm backends are tied with the >>>> device they manage. >>> >>> So why are they not a "real" device in the driver model? It looks like >>> you almost are wanting all of that functionality and are having to >>> implement it "by hand" instead. >> >> I'm sorry I misunderstanding your point. dtpm is the backend for the >> powercap subsystem which is the generic subsystem to do power limitation. >> >> We have: >> >> struct dtpm_cpu { >> struct dtpm dtmp; >> ... >> } >> >> struct dtpm { >> struct powercap powecap; >> }; >> >> struct powercap { >> struct device dev; >> }; > > Oh nice. So you can not use a kref here at all as you already have a > reference counted device controling your structure. You can not have 2 > references trying to control the same structure, that way lies madness > and bugs :( > > So why are you trying to add a kref here as the structure already has > support for proper lifetimes? Right, I'll revisit that part. Thanks for the review. I've a branch which is pulled by Rafael [1]. These parts are already merged in the dtpm/next branch but not yet in Rafael's tree. I think a rebase is possible but I would like to avoid that. Would be a patch on top of the dtpm/next acceptable given your flow with Android ? -- Daniel [1] https://git.kernel.org/pub/scm/linux/kernel/git/daniel.lezcano/linux.git/log/?h=dtpm/next -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog