Received: by 2002:ac0:8c8e:0:0:0:0:0 with SMTP id r14csp729461ima; Wed, 6 Feb 2019 07:27:00 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ84bWMvTN23j5RZwsJA2MUxpj3lclsmynl6qopEGf4tPqBISgAHh7RbD8TNrj6d9BYZZss X-Received: by 2002:a62:6e07:: with SMTP id j7mr11313314pfc.135.1549466819930; Wed, 06 Feb 2019 07:26:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549466819; cv=none; d=google.com; s=arc-20160816; b=nb5PMpZqxUkVV+syFgc7khUBu4ZcOezSBqKgCxf9hnjiZ92hRnCQAwEaRiqL/VTVmc 86hKpKS8MHBPH39PuZzyCG09xVTHROHBE0bE6MSrdwvS24ryyo5v6ZK59Ec+mru/lpqc 8afEzJ6SHjGXTYmjH5INsneRKFDb3VDrEWXiuOhWeDt+/bGM7c+8uwfuco2OApS8u0Z9 RLO6kKf19F82WrVgWOmFa49aVdQulkWKopmDeUztuYOIQ5ERJuMtk6q72WsibrI/x/xa 73/sWkFoKcnpBT/agVdcylDohPPrkSsqNgOc7/p0b7GI7yxjXC/WyV2bpO0jw0wHbuNc 5Tbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=pxFtNMi8ZNdWvkNnHd6/QoYTob9gIGvXPJjdBG2hXts=; b=vrfVC6/415C5riDh4I6DxcZbV0iABb1Ic3kaOP1gnVIDg6s1G2GGTJaioPq3QA4YIn EDmxpWrOohoA6UwZql+72Hgy601YmA6S6FsUdvPRssJTgmfTRxOxoClqf0RQsoYqAhgn Df3c/5QFMpJi8uwFfNcF7Ad4pPEVUDQRp64fK3ScjcD9u7ZiUe04rkEBX+EZG18WD5/C zXqL1ieL0okbM7toNNhiLQ/PjAB2doCur5oz0uLQCNHFhWnfCI30eLn3jMkivL9I2oLJ hJNxVhFgSRGulCDCXFwv15gB1jrbTpdJEpc4eKzN/ZKsqPCoXmj4DLiC/sMY+OvEVMMC ecqA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j39si6318124plb.272.2019.02.06.07.26.43; Wed, 06 Feb 2019 07:26:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730919AbfBFOzP (ORCPT + 99 others); Wed, 6 Feb 2019 09:55:15 -0500 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:46938 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726767AbfBFOzP (ORCPT ); Wed, 6 Feb 2019 09:55:15 -0500 Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x16EpNMb001272; Wed, 6 Feb 2019 15:54:53 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2qfv9j9k5a-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 06 Feb 2019 15:54:53 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 786D034; Wed, 6 Feb 2019 14:54:52 +0000 (GMT) Received: from Webmail-eu.st.com (sfhdag5node3.st.com [10.75.127.15]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 488F52C3C; Wed, 6 Feb 2019 14:54:52 +0000 (GMT) Received: from [10.48.0.167] (10.75.127.45) by SFHDAG5NODE3.st.com (10.75.127.15) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Wed, 6 Feb 2019 15:54:51 +0100 Subject: Re: [PATCH 2/4] pwm: stm32-lp: Add power management support To: Thierry Reding , =?UTF-8?Q?Uwe_Kleine-K=c3=b6nig?= CC: , , , , , , , , , , , , Tomasz Duszynski References: <1549370429-19116-1-git-send-email-fabrice.gasnier@st.com> <1549370429-19116-3-git-send-email-fabrice.gasnier@st.com> <20190205204732.zrbhgyxnvjbwfyw4@pengutronix.de> <20190205222522.GB1372@mithrandir> <6584a59b-657d-adc9-fab2-eb1a9baba05d@st.com> <20190206085405.pdiwd3c6wjog5hl7@pengutronix.de> <20190206125545.GI21676@ulmo> From: Fabrice Gasnier Message-ID: Date: Wed, 6 Feb 2019 15:54:50 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190206125545.GI21676@ulmo> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.75.127.45] X-ClientProxiedBy: SFHDAG7NODE3.st.com (10.75.127.21) To SFHDAG5NODE3.st.com (10.75.127.15) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-02-06_09:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/6/19 1:55 PM, Thierry Reding wrote: > On Wed, Feb 06, 2019 at 09:54:05AM +0100, Uwe Kleine-König wrote: >> On Wed, Feb 06, 2019 at 09:42:48AM +0100, Fabrice Gasnier wrote: >>> If you agree with the current approach, I can send a V2 with Tomasz's >>> suggestion to remove the ifdefs and use __maybe_unused instead. >> >> I think the suspend callback should have something like: >> >> if (is_still_enabled) { >> /* >> * The consumer didn't stop us, so refuse to suspend. >> */ >> dev_err(dev, "The consumer didn't stop us, so refuse to suspend.\n"); >> return -EBUSY; >> } >> >> This way there are no bad surprises if the pwm is suspended before its >> consumer and it's obvious what is missing. Thierry, Uwe, When the pwm is suspended before its consumer, the bad surprise is the suspend request will fail... I'm not sure a new attempt may be better. So, it looks like the only way to have this clean is by implementing the device link e.g. via pwm_get() ? > > Something that just occurred to me: perhaps as part of pwm_get() we > should track where we were being requested from so that we could give > hints in situations like this as to where the consumer is that forgot > to suspend the PWM. The current approach handles the situation where the consumer forgot to suspend the PWM... I can add some warning about that in the suspend routine, incl the label. What do you think? What's the best approach ? Please advise, BR, Fabrice > > I suppose we already have pwm_device.label to help with this, but > perhaps we could improve things if we stored __builtin_return_address > during pwm_get() to help users pinpoint where they need to look. > > Thierry >